@kommo-crm/crm-react-ui-kit 1.1.1-beta.4 → 1.1.1-beta.5
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/components/Sub/Sub.d.ts +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.js +32 -30
- package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts +5 -1
- package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +50 -49
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.types.d.ts +4 -0
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SubProps } from './Sub.props';
|
|
3
3
|
export declare const Sub: {
|
|
4
|
-
({ children, mode, defaultOpen, ...rest }: SubProps): React.JSX.Element;
|
|
4
|
+
({ children, mode, onOpen, defaultOpen, ...rest }: SubProps): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=Sub.d.ts.map
|
|
@@ -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;AAO1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,eAAO,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"Sub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,eAAO,MAAM,GAAG;uDAOb,QAAQ;;CAwCV,CAAC"}
|
|
@@ -1,59 +1,61 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { S as
|
|
2
|
+
import { S as l } from "../../../../index-BA3njR2k.mjs";
|
|
3
3
|
import "react";
|
|
4
|
-
import { ContextMenuMode as
|
|
4
|
+
import { ContextMenuMode as x } from "../../ContextMenu.enums.js";
|
|
5
5
|
import "../../providers/LevelProvider/LevelProvider.js";
|
|
6
6
|
import "../../../../useContentPositioning-BLCC-Xty.mjs";
|
|
7
7
|
import "../Content/Content.utils.js";
|
|
8
|
-
import { useContextMenuSub as
|
|
9
|
-
import { ContextMenuSubProvider as
|
|
10
|
-
const
|
|
8
|
+
import { useContextMenuSub as C } from "../../hooks/useContextMenuSub/useContextMenuSub.js";
|
|
9
|
+
import { ContextMenuSubProvider as O, DISPLAY_NAME as t } from "./Sub.context.js";
|
|
10
|
+
const f = ({
|
|
11
11
|
children: i,
|
|
12
|
-
mode: e =
|
|
12
|
+
mode: e = x.HOVER,
|
|
13
|
+
onOpen: m,
|
|
13
14
|
defaultOpen: o,
|
|
14
|
-
...
|
|
15
|
+
...p
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
17
18
|
open: n,
|
|
18
|
-
setOpen:
|
|
19
|
-
animatedOpen:
|
|
20
|
-
startAnimation:
|
|
21
|
-
handleMouseEnter:
|
|
22
|
-
handleMouseLeave:
|
|
23
|
-
handleOpenChange:
|
|
24
|
-
triggerId:
|
|
25
|
-
onOpenByKeyboard:
|
|
26
|
-
} =
|
|
19
|
+
setOpen: a,
|
|
20
|
+
animatedOpen: s,
|
|
21
|
+
startAnimation: u,
|
|
22
|
+
handleMouseEnter: d,
|
|
23
|
+
handleMouseLeave: M,
|
|
24
|
+
handleOpenChange: h,
|
|
25
|
+
triggerId: S,
|
|
26
|
+
onOpenByKeyboard: b
|
|
27
|
+
} = C({
|
|
27
28
|
displayName: t,
|
|
28
29
|
mode: e,
|
|
29
|
-
defaultOpen: o
|
|
30
|
+
defaultOpen: o,
|
|
31
|
+
onOpen: m
|
|
30
32
|
});
|
|
31
33
|
return /* @__PURE__ */ r(
|
|
32
|
-
|
|
34
|
+
O,
|
|
33
35
|
{
|
|
34
36
|
mode: e,
|
|
35
37
|
open: n,
|
|
36
|
-
setOpen:
|
|
37
|
-
animatedOpen:
|
|
38
|
+
setOpen: a,
|
|
39
|
+
animatedOpen: s,
|
|
38
40
|
defaultOpen: o,
|
|
39
|
-
startAnimation:
|
|
40
|
-
onMouseEnter:
|
|
41
|
-
onMouseLeave:
|
|
42
|
-
onOpenByKeyboard:
|
|
43
|
-
triggerId:
|
|
41
|
+
startAnimation: u,
|
|
42
|
+
onMouseEnter: d,
|
|
43
|
+
onMouseLeave: M,
|
|
44
|
+
onOpenByKeyboard: b,
|
|
45
|
+
triggerId: S,
|
|
44
46
|
children: /* @__PURE__ */ r(
|
|
45
|
-
|
|
47
|
+
l,
|
|
46
48
|
{
|
|
47
49
|
open: n,
|
|
48
|
-
onOpenChange:
|
|
49
|
-
...
|
|
50
|
+
onOpenChange: h,
|
|
51
|
+
...p,
|
|
50
52
|
children: i
|
|
51
53
|
}
|
|
52
54
|
)
|
|
53
55
|
}
|
|
54
56
|
);
|
|
55
57
|
};
|
|
56
|
-
|
|
58
|
+
f.displayName = t;
|
|
57
59
|
export {
|
|
58
|
-
|
|
60
|
+
f as Sub
|
|
59
61
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { Sub as RadixDropdownMenuSub } from '@radix-ui/react-dropdown-menu';
|
|
3
3
|
import { ContextMenuModeType } from '../../ContextMenu.types';
|
|
4
|
-
export type SubProps = ComponentPropsWithoutRef<typeof RadixDropdownMenuSub> & {
|
|
4
|
+
export type SubProps = Omit<ComponentPropsWithoutRef<typeof RadixDropdownMenuSub>, 'onOpenChange'> & {
|
|
5
5
|
/**
|
|
6
6
|
* Defines how the submenu is triggered.
|
|
7
7
|
*
|
|
8
8
|
* @default "hover"
|
|
9
9
|
*/
|
|
10
10
|
mode?: ContextMenuModeType;
|
|
11
|
+
/**
|
|
12
|
+
* Called when submenu open state changes.
|
|
13
|
+
*/
|
|
14
|
+
onOpen?: (open: boolean) => void;
|
|
11
15
|
};
|
|
12
16
|
export interface ContextMenuSubContextProps {
|
|
13
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sub.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,IAAI,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,wBAAwB,CAAC,OAAO,oBAAoB,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"Sub.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,IAAI,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,IAAI,CACzB,wBAAwB,CAAC,OAAO,oBAAoB,CAAC,EACrD,cAAc,CACf,GAAG;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseContextMenuSubOptions } from './useContextMenuSub.types';
|
|
2
|
-
export declare function useContextMenuSub({ displayName, mode: initialMode, defaultOpen, }: UseContextMenuSubOptions): {
|
|
2
|
+
export declare function useContextMenuSub({ displayName, mode: initialMode, defaultOpen, onOpen, }: UseContextMenuSubOptions): {
|
|
3
3
|
open: boolean;
|
|
4
4
|
setOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
5
5
|
animatedOpen: boolean;
|
|
@@ -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,
|
|
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,66 +1,67 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { ContextMenuMode as
|
|
3
|
-
import { useLevelContext as
|
|
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
4
|
import "../../../../useContentPositioning-BLCC-Xty.mjs";
|
|
5
5
|
import "../../components/Content/Content.utils.js";
|
|
6
|
-
import { useIsTouchDevice as
|
|
7
|
-
import { useContextMenuContext as
|
|
8
|
-
function
|
|
9
|
-
displayName:
|
|
10
|
-
mode:
|
|
11
|
-
defaultOpen: c
|
|
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,
|
|
12
|
+
onOpen: e
|
|
12
13
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
},
|
|
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);
|
|
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) => {
|
|
22
23
|
if (c !== void 0) {
|
|
23
|
-
|
|
24
|
+
u(c), e == null || e(c), s(c), i(!1);
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
if (
|
|
27
|
-
|
|
27
|
+
if (l === a.CLICK) {
|
|
28
|
+
u(f), e == null || e(f), s(f);
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
f ? (
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
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));
|
|
36
|
+
}, B = () => {
|
|
37
|
+
l === a.HOVER && (i(!1), r.current && (clearTimeout(r.current), r.current = null), m(!1));
|
|
37
38
|
};
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
if (!(!
|
|
42
|
-
if (
|
|
43
|
-
|
|
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);
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
47
|
+
return r.current || (r.current = setTimeout(() => {
|
|
48
|
+
x();
|
|
49
|
+
}, h)), () => {
|
|
50
|
+
r.current && (clearTimeout(r.current), r.current = null);
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
}, [o,
|
|
53
|
-
open:
|
|
54
|
-
setOpen:
|
|
55
|
-
animatedOpen:
|
|
56
|
-
startAnimation: () =>
|
|
57
|
-
handleMouseEnter:
|
|
58
|
-
handleMouseLeave:
|
|
59
|
-
handleOpenChange:
|
|
60
|
-
onOpenByKeyboard:
|
|
61
|
-
triggerId:
|
|
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
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
Q as useContextMenuSub
|
|
66
67
|
};
|
|
@@ -12,5 +12,9 @@ export interface UseContextMenuSubOptions {
|
|
|
12
12
|
* The open state of the dropdown menu when it is initially rendered.
|
|
13
13
|
*/
|
|
14
14
|
defaultOpen?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Called when submenu open state changes.
|
|
17
|
+
*/
|
|
18
|
+
onOpen?: (open: boolean) => void;
|
|
15
19
|
}
|
|
16
20
|
//# sourceMappingURL=useContextMenuSub.types.d.ts.map
|
package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContextMenuSub.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,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;
|
|
1
|
+
{"version":3,"file":"useContextMenuSub.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,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,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC"}
|
package/package.json
CHANGED