@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.
@@ -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;+CAKb,QAAQ;;CAuCV,CAAC"}
1
+ {"version":3,"file":"Sub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;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 b } from "../../../../index-BA3njR2k.mjs";
2
+ import { S as l } from "../../../../index-BA3njR2k.mjs";
3
3
  import "react";
4
- import { ContextMenuMode as l } from "../../ContextMenu.enums.js";
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 x } from "../../hooks/useContextMenuSub/useContextMenuSub.js";
9
- import { ContextMenuSubProvider as C, DISPLAY_NAME as t } from "./Sub.context.js";
10
- const O = ({
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 = l.HOVER,
12
+ mode: e = x.HOVER,
13
+ onOpen: m,
13
14
  defaultOpen: o,
14
- ...m
15
+ ...p
15
16
  }) => {
16
17
  const {
17
18
  open: n,
18
- setOpen: p,
19
- animatedOpen: a,
20
- startAnimation: s,
21
- handleMouseEnter: u,
22
- handleMouseLeave: d,
23
- handleOpenChange: M,
24
- triggerId: h,
25
- onOpenByKeyboard: S
26
- } = x({
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
- C,
34
+ O,
33
35
  {
34
36
  mode: e,
35
37
  open: n,
36
- setOpen: p,
37
- animatedOpen: a,
38
+ setOpen: a,
39
+ animatedOpen: s,
38
40
  defaultOpen: o,
39
- startAnimation: s,
40
- onMouseEnter: u,
41
- onMouseLeave: d,
42
- onOpenByKeyboard: S,
43
- triggerId: h,
41
+ startAnimation: u,
42
+ onMouseEnter: d,
43
+ onMouseLeave: M,
44
+ onOpenByKeyboard: b,
45
+ triggerId: S,
44
46
  children: /* @__PURE__ */ r(
45
- b,
47
+ l,
46
48
  {
47
49
  open: n,
48
- onOpenChange: M,
49
- ...m,
50
+ onOpenChange: h,
51
+ ...p,
50
52
  children: i
51
53
  }
52
54
  )
53
55
  }
54
56
  );
55
57
  };
56
- O.displayName = t;
58
+ f.displayName = t;
57
59
  export {
58
- O as Sub
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;IAC7E;;;;OAIG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B,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
+ {"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,GACZ,EAAE,wBAAwB;;;;;;;8BAyEQ,OAAO;8BAmCP,OAAO;;EA4GzC"}
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 L, useState as a, useRef as v, useEffect as x } from "react";
2
- import { ContextMenuMode as s } from "../../ContextMenu.enums.js";
3
- import { useLevelContext as g } from "../../providers/LevelProvider/LevelProvider.js";
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 B } from "../useIsTouchDevice/useIsTouchDevice.js";
7
- import { useContextMenuContext as A } from "../../ContextMenu.context.js";
8
- function G({
9
- displayName: m,
10
- mode: y,
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 d = L(), [i, t] = a(c || !1), [M, n] = a(!1), [C, l] = a(!1), [T, u] = a(!1), e = v(null), r = v(null), O = B(), { hoverCloseDelay: I, animationDuration: H } = A(m), { activeItemId: p } = g(m), o = O ? s.CLICK : y, h = () => {
14
- e.current && (clearTimeout(e.current), e.current = null), r.current && (clearTimeout(r.current), r.current = null);
15
- }, K = () => {
16
- h(), n(!1), t(!1), l(!1), u(!1);
17
- }, R = () => {
18
- h(), o === s.HOVER ? (n(!1), r.current = setTimeout(() => {
19
- t(!1), l(!1), u(!1);
20
- }, H)) : (t(!1), l(!1), u(!1));
21
- }, E = (f) => {
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
- t(c), n(c), u(!1);
24
+ u(c), e == null || e(c), s(c), i(!1);
24
25
  return;
25
26
  }
26
- if (o === s.CLICK) {
27
- t(f), n(f);
27
+ if (l === a.CLICK) {
28
+ u(f), e == null || e(f), s(f);
28
29
  return;
29
30
  }
30
- f ? (r.current && (clearTimeout(r.current), r.current = null), o === s.HOVER && n(!0), t(!0)) : R();
31
- }, V = (f) => {
32
- u(f), E(f);
33
- }, b = () => {
34
- o === s.HOVER && (u(!1), r.current && (clearTimeout(r.current), r.current = null, n(!0)), i || (e.current && (clearTimeout(e.current), e.current = null), n(!0), t(!0)), l(!0));
35
- }, D = () => {
36
- o === s.HOVER && (u(!1), e.current && (clearTimeout(e.current), e.current = null), l(!1));
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 x(() => {
39
- p !== d && i && c === void 0 && K();
40
- }, [p, i, c]), x(() => {
41
- if (!(!i || o !== s.HOVER) && !T) {
42
- if (C) {
43
- e.current && (clearTimeout(e.current), e.current = null);
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 e.current || (e.current = setTimeout(() => {
47
- R();
48
- }, I)), () => {
49
- e.current && (clearTimeout(e.current), e.current = null);
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, i, C, I, T]), {
53
- open: i,
54
- setOpen: t,
55
- animatedOpen: M,
56
- startAnimation: () => n(!0),
57
- handleMouseEnter: b,
58
- handleMouseLeave: D,
59
- handleOpenChange: E,
60
- onOpenByKeyboard: V,
61
- triggerId: d
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
- G as useContextMenuSub
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
@@ -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;CACvB"}
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kommo-crm/crm-react-ui-kit",
3
3
  "description": "Ready-to-use React components which implements Kommo design",
4
- "version": "1.1.1-beta.4",
4
+ "version": "1.1.1-beta.5",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "engines": {