@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.
- package/dist/components/ContextMenu/ContextMenu.context.d.ts +4 -2
- package/dist/components/ContextMenu/ContextMenu.context.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.context.js +7 -4
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +83 -80
- package/dist/components/ContextMenu/ContextMenu.props.d.ts +14 -0
- package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +1 -1
- package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Content/Content.js +1 -1
- package/dist/components/ContextMenu/components/Content/index.js +1 -1
- package/dist/components/ContextMenu/components/Item/Item.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Item/Item.js +75 -71
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.js +2 -1
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +67 -64
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts +4 -0
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +38 -40
- package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +2 -2
- package/dist/components/ContextMenu/hooks/index.js +1 -1
- package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts +2 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +72 -61
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts +4 -0
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +51 -49
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +71 -63
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts +4 -0
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts.map +1 -1
- package/dist/components/ContextMenu/index.js +1 -1
- package/dist/{useContentPositioning-DO7ZotnD.mjs → useContentPositioning-DAKfbddS.mjs} +66 -65
- package/package.json +1 -1
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { ContextMenuMode as
|
|
3
|
-
import { useLevelContext as
|
|
4
|
-
import "
|
|
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-DAKfbddS.mjs";
|
|
5
6
|
import "../../components/Content/Content.utils.js";
|
|
6
|
-
import { useIsTouchDevice as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, b)) : (
|
|
22
|
-
},
|
|
23
|
-
if (
|
|
24
|
-
|
|
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 (
|
|
28
|
-
|
|
27
|
+
if (u === c.CLICK) {
|
|
28
|
+
i(a), e == null || e(a), f(a);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
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
|
-
|
|
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
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
-
if (!(!
|
|
43
|
-
if (
|
|
44
|
-
|
|
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
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
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
|
-
}, [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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;
|
package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
|
2
|
-
import { ContextMenuMode as
|
|
3
|
-
import { useInheritedArrowColor as
|
|
4
|
-
import "../../../../useContentPositioning-
|
|
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-DAKfbddS.mjs";
|
|
5
5
|
import "../../components/Content/Content.utils.js";
|
|
6
|
-
import "../../ContextMenu.context.js";
|
|
7
|
-
import { useLevelContext as
|
|
8
|
-
import { useIsTouchDevice as
|
|
9
|
-
const
|
|
10
|
-
displayName:
|
|
11
|
-
mode:
|
|
12
|
-
defaultOpen:
|
|
13
|
-
animationDuration:
|
|
14
|
-
subMenuOpen:
|
|
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:
|
|
17
|
-
closeRootMenuImmediately:
|
|
18
|
-
onOpen:
|
|
16
|
+
hoverCloseDelay: d,
|
|
17
|
+
closeRootMenuImmediately: a,
|
|
18
|
+
onOpen: c,
|
|
19
|
+
onAnimatedOpen: x
|
|
19
20
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
r.current && (clearTimeout(r.current), r.current = null),
|
|
22
|
-
},
|
|
23
|
-
t == null || t(!1),
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
!
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
}, [
|
|
50
|
-
|
|
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:
|
|
53
|
-
mode:
|
|
54
|
-
onOpenChange:
|
|
55
|
-
onOpenByKeyboard:
|
|
56
|
-
inheritedArrowColor:
|
|
57
|
-
triggerRef:
|
|
58
|
-
contentRef:
|
|
59
|
-
animatedOpen:
|
|
60
|
-
animationDuration:
|
|
61
|
-
hoverCloseDelay:
|
|
62
|
-
temporaryHoverClose:
|
|
63
|
-
closeMenuImmediately:
|
|
64
|
-
onMouseEnter:
|
|
65
|
-
onMouseLeave:
|
|
66
|
-
enableTemporaryHoverClose:
|
|
67
|
-
triggerId:
|
|
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
|
-
|
|
79
|
+
er as useContextMenuSubMenu
|
|
72
80
|
};
|
package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts
CHANGED
|
@@ -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
|
*/
|
package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts.map
CHANGED
|
@@ -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"}
|
|
@@ -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-
|
|
3
|
+
import "../../useContentPositioning-DAKfbddS.mjs";
|
|
4
4
|
import { Direction as p } from "./components/Content/Content.enums.js";
|
|
5
5
|
import "./components/Content/Content.utils.js";
|
|
6
6
|
export {
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { forwardRef as
|
|
1
|
+
import { forwardRef as F, useState as H, useLayoutEffect as v } from "react";
|
|
2
2
|
import { jsx as P } from "react/jsx-runtime";
|
|
3
|
-
import { C as
|
|
4
|
-
import { c as
|
|
5
|
-
import { u as
|
|
6
|
-
import { mergeRefs as
|
|
7
|
-
import { LevelProvider as
|
|
8
|
-
import { useContextMenuContext as
|
|
3
|
+
import { C as R } from "./index-BA3njR2k.mjs";
|
|
4
|
+
import { c as U } from "./index-L8X2o7IH.mjs";
|
|
5
|
+
import { u as k, a as S, e as z } from "./react-spring_web.modern-Dnq1lqN5.mjs";
|
|
6
|
+
import { mergeRefs as B } from "./lib/utils.js";
|
|
7
|
+
import { LevelProvider as j } from "./components/ContextMenu/providers/LevelProvider/LevelProvider.js";
|
|
8
|
+
import { useContextMenuContext as K } from "./components/ContextMenu/ContextMenu.context.js";
|
|
9
9
|
import { ContextMenuMode as w } from "./components/ContextMenu/ContextMenu.enums.js";
|
|
10
10
|
import { Direction as e } from "./components/ContextMenu/components/Content/Content.enums.js";
|
|
11
|
-
import { directionToSide as
|
|
12
|
-
import './assets/useContentPositioning.css';const
|
|
13
|
-
content:
|
|
14
|
-
}, x = "ContextMenu.Content",
|
|
11
|
+
import { directionToSide as q } from "./components/ContextMenu/components/Content/Content.utils.js";
|
|
12
|
+
import './assets/useContentPositioning.css';const X = "_content_k9opk_1", Y = {
|
|
13
|
+
content: X
|
|
14
|
+
}, x = "ContextMenu.Content", J = F(
|
|
15
15
|
({
|
|
16
|
-
style:
|
|
16
|
+
style: c,
|
|
17
17
|
className: g,
|
|
18
18
|
children: h,
|
|
19
19
|
alignOffset: o,
|
|
20
|
-
arrowPadding:
|
|
20
|
+
arrowPadding: l = 5,
|
|
21
21
|
collisionBoundary: C,
|
|
22
22
|
direction: O = e.DOWN_RIGHT,
|
|
23
23
|
disableAutoPositioning: p = !1,
|
|
@@ -28,13 +28,14 @@ import './assets/useContentPositioning.css';const q = "_content_k9opk_1", X = {
|
|
|
28
28
|
const [W, r] = H(!1), [i, I] = H(null), {
|
|
29
29
|
triggerRef: s,
|
|
30
30
|
contentRef: f,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
isOpen: _,
|
|
32
|
+
animatedOpen: u,
|
|
33
|
+
animationDuration: m,
|
|
34
|
+
mode: d,
|
|
35
|
+
temporaryHoverClose: n,
|
|
36
|
+
onMouseEnter: t,
|
|
37
|
+
onMouseLeave: a
|
|
38
|
+
} = K(x), { align: D, labelOffset: y, isPositioned: L } = M({
|
|
38
39
|
direction: O,
|
|
39
40
|
alignOffset: o,
|
|
40
41
|
disableAutoPositioning: p,
|
|
@@ -42,45 +43,45 @@ import './assets/useContentPositioning.css';const q = "_content_k9opk_1", X = {
|
|
|
42
43
|
contentRef: f,
|
|
43
44
|
collisionBoundary: C,
|
|
44
45
|
children: h
|
|
45
|
-
}),
|
|
46
|
-
opacity: L && (
|
|
47
|
-
config:
|
|
46
|
+
}), A = k({
|
|
47
|
+
opacity: L && (d === w.CLICK && !n || u) ? 1 : 0,
|
|
48
|
+
config: d === w.CLICK && !n ? { duration: 0 } : { duration: m, easing: z.easeInOutCubic }
|
|
48
49
|
});
|
|
49
50
|
return /* @__PURE__ */ P(
|
|
50
|
-
|
|
51
|
+
j,
|
|
51
52
|
{
|
|
52
53
|
hasItemWithIcon: W,
|
|
53
54
|
setHasItemWithIcon: r,
|
|
54
55
|
activeItemId: i,
|
|
55
56
|
setActiveItemId: I,
|
|
56
|
-
children: /* @__PURE__ */ P(
|
|
57
|
-
|
|
57
|
+
children: _ && /* @__PURE__ */ P(
|
|
58
|
+
S.div,
|
|
58
59
|
{
|
|
59
60
|
style: {
|
|
60
61
|
zIndex: Number.MAX_SAFE_INTEGER - 10,
|
|
61
62
|
position: "fixed",
|
|
62
|
-
...
|
|
63
|
+
...A
|
|
63
64
|
},
|
|
64
65
|
"data-content-wrapper": !0,
|
|
65
66
|
children: /* @__PURE__ */ P(
|
|
66
|
-
|
|
67
|
+
R,
|
|
67
68
|
{
|
|
68
|
-
ref:
|
|
69
|
-
className:
|
|
69
|
+
ref: B(f, G),
|
|
70
|
+
className: U(Y.content, g),
|
|
70
71
|
style: {
|
|
71
|
-
...
|
|
72
|
+
...c || {},
|
|
72
73
|
pointerEvents: p || L ? "auto" : "none"
|
|
73
74
|
},
|
|
74
75
|
collisionBoundary: C,
|
|
75
|
-
side:
|
|
76
|
-
align:
|
|
77
|
-
arrowPadding:
|
|
78
|
-
alignOffset:
|
|
76
|
+
side: q[O],
|
|
77
|
+
align: D,
|
|
78
|
+
arrowPadding: l,
|
|
79
|
+
alignOffset: y,
|
|
79
80
|
onMouseEnter: (T) => {
|
|
80
|
-
|
|
81
|
+
t == null || t(T), E == null || E(T);
|
|
81
82
|
},
|
|
82
83
|
onMouseLeave: (T) => {
|
|
83
|
-
|
|
84
|
+
a == null || a(T), b == null || b(T);
|
|
84
85
|
},
|
|
85
86
|
...N,
|
|
86
87
|
children: h
|
|
@@ -92,27 +93,27 @@ import './assets/useContentPositioning.css';const q = "_content_k9opk_1", X = {
|
|
|
92
93
|
);
|
|
93
94
|
}
|
|
94
95
|
);
|
|
95
|
-
|
|
96
|
-
function
|
|
97
|
-
direction:
|
|
96
|
+
J.displayName = x;
|
|
97
|
+
function M({
|
|
98
|
+
direction: c,
|
|
98
99
|
alignOffset: g = 0,
|
|
99
100
|
disableAutoPositioning: h,
|
|
100
101
|
triggerRef: o,
|
|
101
|
-
contentRef:
|
|
102
|
+
contentRef: l,
|
|
102
103
|
collisionBoundary: C,
|
|
103
104
|
children: O
|
|
104
105
|
}) {
|
|
105
106
|
const [p, E] = H(
|
|
106
|
-
|
|
107
|
+
c === e.UP_RIGHT || c === e.DOWN_RIGHT || c === e.RIGHT_UP || c === e.RIGHT_DOWN ? "start" : "end"
|
|
107
108
|
), [b, N] = H(g), [G, W] = H(!1);
|
|
108
109
|
return v(() => {
|
|
109
|
-
const r =
|
|
110
|
+
const r = l == null ? void 0 : l.current;
|
|
110
111
|
if (!r || h || [
|
|
111
112
|
e.DOWN_LEFT,
|
|
112
113
|
e.DOWN_RIGHT,
|
|
113
114
|
e.UP_LEFT,
|
|
114
115
|
e.UP_RIGHT
|
|
115
|
-
].includes(
|
|
116
|
+
].includes(c))
|
|
116
117
|
return;
|
|
117
118
|
const i = r.children;
|
|
118
119
|
if (!i || i.length === 0)
|
|
@@ -122,20 +123,20 @@ function J({
|
|
|
122
123
|
if (p === "start") {
|
|
123
124
|
const t = i.item(1);
|
|
124
125
|
if (t instanceof Element && t.hasAttribute("data-separator")) {
|
|
125
|
-
const
|
|
126
|
-
|
|
126
|
+
const a = i.item(2);
|
|
127
|
+
a instanceof Element ? s = a : s = null;
|
|
127
128
|
} else t instanceof Element && (s = t);
|
|
128
129
|
} else {
|
|
129
|
-
const t = i.length - 1,
|
|
130
|
-
if (
|
|
130
|
+
const t = i.length - 1, a = i.item(t);
|
|
131
|
+
if (a instanceof Element && a.hasAttribute("data-arrow")) {
|
|
131
132
|
const D = i.item(t - 1);
|
|
132
133
|
D instanceof Element ? s = D : s = null;
|
|
133
|
-
} else
|
|
134
|
+
} else a instanceof Element && (s = a);
|
|
134
135
|
}
|
|
135
136
|
const f = o == null ? void 0 : o.current;
|
|
136
137
|
if (!f || !s)
|
|
137
138
|
return;
|
|
138
|
-
const _ = s.getBoundingClientRect(), u = f.getBoundingClientRect(),
|
|
139
|
+
const _ = s.getBoundingClientRect(), u = f.getBoundingClientRect(), m = _.height, n = (u.height - m) / 2;
|
|
139
140
|
if (p === "start") {
|
|
140
141
|
if (I instanceof Element && I.hasAttribute("data-label")) {
|
|
141
142
|
const t = I.getBoundingClientRect().height;
|
|
@@ -145,8 +146,8 @@ function J({
|
|
|
145
146
|
N(g + n - 1);
|
|
146
147
|
}, [
|
|
147
148
|
O,
|
|
148
|
-
a,
|
|
149
149
|
c,
|
|
150
|
+
l,
|
|
150
151
|
o,
|
|
151
152
|
p,
|
|
152
153
|
g,
|
|
@@ -158,20 +159,20 @@ function J({
|
|
|
158
159
|
const I = C instanceof Element && C || document.documentElement, s = () => {
|
|
159
160
|
if (!i)
|
|
160
161
|
return;
|
|
161
|
-
const f = o.current, _ =
|
|
162
|
+
const f = o.current, _ = l.current;
|
|
162
163
|
if (!f || !_)
|
|
163
164
|
return;
|
|
164
|
-
const u = f.getBoundingClientRect(),
|
|
165
|
-
if (
|
|
165
|
+
const u = f.getBoundingClientRect(), m = _.getBoundingClientRect();
|
|
166
|
+
if (m.width <= 0)
|
|
166
167
|
return;
|
|
167
168
|
const d = I.getBoundingClientRect(), n = {
|
|
168
|
-
right: d.right - u.right >=
|
|
169
|
-
left: u.left - d.left >=
|
|
170
|
-
bottom: d.bottom - u.bottom >=
|
|
171
|
-
top: u.top - d.top >=
|
|
169
|
+
right: d.right - u.right >= m.width,
|
|
170
|
+
left: u.left - d.left >= m.width,
|
|
171
|
+
bottom: d.bottom - u.bottom >= m.height,
|
|
172
|
+
top: u.top - d.top >= m.height
|
|
172
173
|
};
|
|
173
174
|
let t = "start";
|
|
174
|
-
switch (
|
|
175
|
+
switch (c) {
|
|
175
176
|
case e.UP_RIGHT:
|
|
176
177
|
case e.DOWN_RIGHT: {
|
|
177
178
|
n.right ? t = "start" : n.left ? t = "end" : t = "start";
|
|
@@ -195,19 +196,19 @@ function J({
|
|
|
195
196
|
}
|
|
196
197
|
E(t), W(!0);
|
|
197
198
|
};
|
|
198
|
-
return requestAnimationFrame(s),
|
|
199
|
+
return requestAnimationFrame(s), l.current && typeof ResizeObserver < "u" && (r = new ResizeObserver(s), r.observe(l.current)), () => {
|
|
199
200
|
i = !1, r == null || r.disconnect();
|
|
200
201
|
};
|
|
201
202
|
}, [
|
|
202
|
-
|
|
203
|
+
c,
|
|
203
204
|
h,
|
|
204
205
|
o,
|
|
205
|
-
|
|
206
|
+
l,
|
|
206
207
|
C
|
|
207
208
|
]), { align: p, labelOffset: b, isPositioned: G };
|
|
208
209
|
}
|
|
209
210
|
export {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
J as C,
|
|
212
|
+
Y as s,
|
|
213
|
+
M as u
|
|
213
214
|
};
|
package/package.json
CHANGED