@kommo-crm/crm-react-ui-kit 1.1.1-beta.0 → 1.1.1-beta.1

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 (42) hide show
  1. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  2. package/dist/components/ContextMenu/ContextMenu.js +75 -72
  3. package/dist/components/ContextMenu/ContextMenu.props.d.ts +4 -0
  4. package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
  5. package/dist/components/ContextMenu/ContextMenu.types.d.ts +4 -0
  6. package/dist/components/ContextMenu/ContextMenu.types.d.ts.map +1 -1
  7. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +1 -1
  8. package/dist/components/ContextMenu/components/Content/Content.js +1 -1
  9. package/dist/components/ContextMenu/components/Content/index.js +1 -1
  10. package/dist/components/ContextMenu/components/Item/Item.d.ts.map +1 -1
  11. package/dist/components/ContextMenu/components/Item/Item.js +64 -56
  12. package/dist/components/ContextMenu/components/Item/Item.props.d.ts +8 -2
  13. package/dist/components/ContextMenu/components/Item/Item.props.d.ts.map +1 -1
  14. package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
  15. package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
  16. package/dist/components/ContextMenu/components/Sub/Sub.js +18 -16
  17. package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts +4 -0
  18. package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts.map +1 -1
  19. package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
  20. package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +56 -53
  21. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +1 -1
  22. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +1 -1
  23. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.d.ts.map +1 -1
  24. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +53 -50
  25. package/dist/components/ContextMenu/components/Trigger/Trigger.d.ts.map +1 -1
  26. package/dist/components/ContextMenu/components/Trigger/Trigger.js +24 -24
  27. package/dist/components/ContextMenu/hooks/index.js +1 -1
  28. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.d.ts.map +1 -1
  29. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
  30. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts +1 -0
  31. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
  32. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +56 -46
  33. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts +4 -3
  34. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
  35. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +55 -87
  36. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts +1 -0
  37. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map +1 -1
  38. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +57 -54
  39. package/dist/components/ContextMenu/index.js +1 -1
  40. package/dist/useContentPositioning-27D32n5u.mjs +185 -0
  41. package/package.json +1 -1
  42. package/dist/useContentPositioning-BIVWgixU.mjs +0 -174
@@ -1,98 +1,66 @@
1
- import { useId as A, useState as I, useRef as x, useCallback as l, useEffect as v } from "react";
2
- import { useContextMenuContext as E } from "../../ContextMenu.context.js";
3
- import { useLevelContext as S } from "../../providers/LevelProvider/LevelProvider.js";
1
+ import { useId as L, useState as a, useRef as v, useEffect as x } from "react";
4
2
  import { ContextMenuMode as s } from "../../ContextMenu.enums.js";
5
- import "../../../../useContentPositioning-BIVWgixU.mjs";
3
+ import { useLevelContext as g } from "../../providers/LevelProvider/LevelProvider.js";
4
+ import "../../../../useContentPositioning-27D32n5u.mjs";
6
5
  import "../../components/Content/Content.utils.js";
7
- import { useIsTouchDevice as k } from "../useIsTouchDevice/useIsTouchDevice.js";
8
- function H({
9
- displayName: L,
10
- mode: D,
11
- defaultOpen: e
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
12
12
  }) {
13
- const T = A(), [t, r] = I(e || !1), [w, c] = I(!1), [K, o] = I(!1), p = x(null), u = x(null), P = k(), {
14
- hoverCloseDelay: g,
15
- animationDuration: h,
16
- animatedOpen: f,
17
- mode: m
18
- } = E(L), { activeItemId: M } = S(L), a = P ? s.CLICK : D, i = l(() => {
19
- p.current && (clearTimeout(p.current), p.current = null), u.current && (clearTimeout(u.current), u.current = null);
20
- }, []), C = l(() => {
21
- if (c(!1), a === s.CLICK) {
22
- r(!1), o(!1);
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) => {
22
+ if (c !== void 0) {
23
+ t(c), n(c), u(!1);
23
24
  return;
24
25
  }
25
- u.current && clearTimeout(u.current), u.current = window.setTimeout(
26
- () => r(!1),
27
- h
28
- );
29
- }, [h]), R = l(
30
- (n) => {
31
- if (a === s.CLICK || e !== void 0) {
32
- n.preventDefault(), n.stopPropagation();
33
- return;
34
- }
35
- if (i(), t) {
36
- c(!0);
37
- return;
38
- }
39
- if (m !== s.CLICK && !f) {
40
- o(!0);
41
- return;
42
- }
43
- r(!0);
44
- },
45
- [e, m, f, t, i]
46
- ), b = l(
47
- (n) => {
48
- if (a === s.CLICK || e !== void 0) {
49
- n.preventDefault(), n.stopPropagation();
50
- return;
51
- }
52
- i(), o(!1), t && (u.current = window.setTimeout(
53
- C,
54
- g
55
- ));
56
- },
57
- [e, t, g, i, C]
58
- ), d = l(
59
- (n) => {
60
- if (e !== void 0) {
61
- r(e), c(e), o(!1);
62
- return;
63
- }
64
- if (a === s.CLICK) {
65
- r(n), c(n), o(!1);
26
+ if (o === s.CLICK) {
27
+ t(f), n(f);
28
+ return;
29
+ }
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));
37
+ };
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);
66
44
  return;
67
45
  }
68
- if (n) {
69
- if (i(), m !== s.CLICK && !f) {
70
- o(!0);
71
- return;
72
- }
73
- r(!0);
74
- } else
75
- C();
76
- },
77
- [e, m, f, i, C]
78
- );
79
- return v(() => {
80
- M !== T && t && e === void 0 && (i(), c(!1), r(!1), o(!1));
81
- }, [M, t, i]), v(() => {
82
- K && f && (r(!0), o(!1));
83
- }, [K, f]), v(() => {
84
- a === s.CLICK && d(t);
85
- }, [t, d]), {
86
- open: t,
87
- setOpen: r,
88
- animatedOpen: w,
89
- startAnimation: () => c(!0),
90
- handleMouseEnter: R,
91
- handleMouseLeave: b,
92
- handleOpenChange: d,
93
- triggerId: T
46
+ return e.current || (e.current = setTimeout(() => {
47
+ R();
48
+ }, I)), () => {
49
+ e.current && (clearTimeout(e.current), e.current = null);
50
+ };
51
+ }
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
94
62
  };
95
63
  }
96
64
  export {
97
- H as useContextMenuSub
65
+ G as useContextMenuSub
98
66
  };
@@ -4,6 +4,7 @@ export declare const useContextMenuSubMenu: ({ displayName, mode: rootMode, defa
4
4
  open: boolean;
5
5
  mode: "click" | "hover" | ContextMenuMode;
6
6
  onOpenChange: (value: boolean) => void;
7
+ onOpenByKeyboard: (value: boolean) => void;
7
8
  inheritedArrowColor: string | null;
8
9
  triggerRef: import('react').RefObject<HTMLButtonElement>;
9
10
  contentRef: import('react').RefObject<HTMLDivElement>;
@@ -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;;;0BAsFI,OAAO;;;;;;;;2CAfK,OAAO;;;;;CAmJrD,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;AAI1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,eAAO,MAAM,qBAAqB,qJAU/B,4BAA4B;;;0BAuFI,OAAO;8BAyBP,OAAO;;;;;;;;2CAxCK,OAAO;;;;;CA0KrD,CAAC"}
@@ -1,69 +1,72 @@
1
- import { useId as N, useState as C, useRef as T, useLayoutEffect as P, useEffect as q } from "react";
2
- import { ContextMenuMode as i } from "../../ContextMenu.enums.js";
3
- import { useInheritedArrowColor as Q } from "../useInheritedArrowColor/useInheritedArrowColor.js";
4
- import "../../../../useContentPositioning-BIVWgixU.mjs";
1
+ import { useId as Q, useState as T, useRef as C, useLayoutEffect as U, useEffect as R } from "react";
2
+ import { ContextMenuMode as l } from "../../ContextMenu.enums.js";
3
+ import { useInheritedArrowColor as W } from "../useInheritedArrowColor/useInheritedArrowColor.js";
4
+ import "../../../../useContentPositioning-27D32n5u.mjs";
5
5
  import "../../components/Content/Content.utils.js";
6
6
  import "../../ContextMenu.context.js";
7
- import { useLevelContext as U } from "../../providers/LevelProvider/LevelProvider.js";
8
- import { useIsTouchDevice as W } from "../useIsTouchDevice/useIsTouchDevice.js";
9
- const b = ({
10
- displayName: R,
11
- mode: j,
12
- defaultOpen: E,
13
- animationDuration: H,
14
- subMenuOpen: a,
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: L,
13
+ animationDuration: K,
14
+ subMenuOpen: u,
15
15
  setSubMenuOpen: t,
16
- hoverCloseDelay: m,
17
- closeRootMenuImmediately: s,
16
+ hoverCloseDelay: d,
17
+ closeRootMenuImmediately: n,
18
18
  onOpen: v
19
19
  }) => {
20
- const h = N(), [c, k] = C(a || E || !1), [g, l] = C(!1), [L, n] = C(!1), [o, d] = C(!1), { activeItemId: V } = U(R), z = T(null), x = T(null), r = T(null), f = T(null), e = W() ? i.CLICK : j, A = () => {
21
- r.current && (clearTimeout(r.current), r.current = null), f.current && (clearTimeout(f.current), f.current = null);
22
- }, I = (u = !1) => {
23
- t == null || t(!1), k(!1), n(!1), d(!1), u && (s == null || s());
20
+ const E = Q(), [f, y] = T(u || L || !1), [V, i] = T(!1), [g, a] = T(!1), [z, H] = T(!1), [s, h] = T(!1), { activeItemId: x } = X(j), D = C(null), A = C(null), r = C(null), e = C(null), c = Y() ? l.CLICK : k, B = () => {
21
+ r.current && (clearTimeout(r.current), r.current = null), e.current && (clearTimeout(e.current), e.current = null);
22
+ }, I = (o = !1) => {
23
+ t == null || t(!1), y(!1), a(!1), h(!1), o && (n == null || n());
24
24
  }, w = () => {
25
- A(), e === i.HOVER || o ? (l(!1), f.current = setTimeout(() => {
25
+ B(), c === l.HOVER || s ? (i(!1), e.current = setTimeout(() => {
26
26
  I();
27
- }, H)) : I();
28
- }, K = (u = !1) => {
29
- A(), l(!1), t == null || t(!1), n(!1), d(!1), u && (s == null || s());
30
- }, B = (u) => {
31
- e === i.CLICK && E !== void 0 || (u ? (f.current && (clearTimeout(f.current), f.current = null), (e === i.HOVER || o) && l(!0), t == null || t(!0), v == null || v(!0)) : w());
32
- }, D = () => {
33
- e !== i.HOVER && !o || (c || (r.current && (clearTimeout(r.current), r.current = null), l(!0), t == null || t(!0)), n(!0));
34
- }, F = () => {
35
- e !== i.HOVER && !o || (r.current && (clearTimeout(r.current), r.current = null), n(!1));
27
+ }, K)) : I();
28
+ }, q = (o = !1) => {
29
+ B(), i(!1), t == null || t(!1), a(!1), h(!1), o && (n == null || n());
30
+ }, m = (o) => {
31
+ c === l.CLICK && L !== void 0 || (o ? (e.current && (clearTimeout(e.current), e.current = null), (c === l.HOVER || s) && i(!0), t == null || t(!0), v == null || v(!0)) : w());
32
+ }, F = (o) => {
33
+ H(o), m == null || m(o);
36
34
  }, G = () => {
37
- l(!0), n(!0), d(!0);
35
+ H(!1), !(c !== l.HOVER && !s) && (e.current && (clearTimeout(e.current), e.current = null, i(!0)), f || (r.current && (clearTimeout(r.current), r.current = null), i(!0), t == null || t(!0)), a(!0));
36
+ }, J = () => {
37
+ H(!1), !(c !== l.HOVER && !s) && (r.current && (clearTimeout(r.current), r.current = null), a(!1));
38
+ }, N = () => {
39
+ i(!0), a(!0), h(!0);
38
40
  };
39
- P(() => {
40
- a !== void 0 && l(a);
41
- }, [a]), q(() => {
42
- V !== h && (c || a) && K();
43
- }, [V, c, h]), q(() => {
44
- !c && !g || e !== i.HOVER && !o || (L ? r.current && (clearTimeout(r.current), r.current = null) : r.current || (r.current = setTimeout(() => {
41
+ U(() => {
42
+ u !== void 0 && i(u);
43
+ }, [u]), R(() => {
44
+ x !== E && (f || u) && q();
45
+ }, [x, f, E]), R(() => {
46
+ !f && !V || c !== l.HOVER && !s || z || (g ? r.current && (clearTimeout(r.current), r.current = null) : r.current || (r.current = setTimeout(() => {
45
47
  w();
46
- }, m)));
47
- }, [e, c, L, o, m]);
48
- const J = Q(c, x);
48
+ }, d)));
49
+ }, [c, f, g, s, d]);
50
+ const P = W(f, A);
49
51
  return {
50
- open: c,
51
- mode: e,
52
- onOpenChange: B,
53
- inheritedArrowColor: J,
54
- triggerRef: z,
55
- contentRef: x,
56
- animatedOpen: g,
57
- animationDuration: H,
58
- hoverCloseDelay: m,
59
- temporaryHoverClose: o,
60
- closeMenuImmediately: K,
61
- onMouseEnter: D,
62
- onMouseLeave: F,
63
- enableTemporaryHoverClose: G,
64
- triggerId: h
52
+ open: f,
53
+ mode: c,
54
+ onOpenChange: m,
55
+ onOpenByKeyboard: F,
56
+ inheritedArrowColor: P,
57
+ triggerRef: D,
58
+ contentRef: A,
59
+ animatedOpen: V,
60
+ animationDuration: K,
61
+ hoverCloseDelay: d,
62
+ temporaryHoverClose: s,
63
+ closeMenuImmediately: q,
64
+ onMouseEnter: G,
65
+ onMouseLeave: J,
66
+ enableTemporaryHoverClose: N,
67
+ triggerId: E
65
68
  };
66
69
  };
67
70
  export {
68
- b as useContextMenuSubMenu
71
+ tr as useContextMenuSubMenu
69
72
  };
@@ -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-BIVWgixU.mjs";
3
+ import "../../useContentPositioning-27D32n5u.mjs";
4
4
  import { Direction as p } from "./components/Content/Content.enums.js";
5
5
  import "./components/Content/Content.utils.js";
6
6
  export {
@@ -0,0 +1,185 @@
1
+ import { forwardRef as W, useState as _, useLayoutEffect as D } from "react";
2
+ import { jsx as N } from "react/jsx-runtime";
3
+ import { C as x } from "./index-BA3njR2k.mjs";
4
+ import { c as A } from "./index-L8X2o7IH.mjs";
5
+ import { u as M, a as w, e as y } from "./react-spring_web.modern-Dnq1lqN5.mjs";
6
+ import { mergeRefs as F } from "./lib/utils.js";
7
+ import { LevelProvider as U } from "./components/ContextMenu/providers/LevelProvider/LevelProvider.js";
8
+ import { useContextMenuContext as k } from "./components/ContextMenu/ContextMenu.context.js";
9
+ import { ContextMenuMode as G } from "./components/ContextMenu/ContextMenu.enums.js";
10
+ import { Direction as e } from "./components/ContextMenu/components/Content/Content.enums.js";
11
+ import { directionToSide as S } from "./components/ContextMenu/components/Content/Content.utils.js";
12
+ import './assets/useContentPositioning.css';const z = "_content_k9opk_1", B = {
13
+ content: z
14
+ }, v = "ContextMenu.Content", j = W(
15
+ ({
16
+ style: s,
17
+ className: C,
18
+ children: f,
19
+ alignOffset: a,
20
+ arrowPadding: c = 5,
21
+ collisionBoundary: h,
22
+ direction: b = e.DOWN_RIGHT,
23
+ disableAutoPositioning: m = !1,
24
+ ...T
25
+ }, H) => {
26
+ const [E, O] = _(!1), [L, t] = _(null), {
27
+ triggerRef: u,
28
+ contentRef: r,
29
+ animatedOpen: d,
30
+ animationDuration: g,
31
+ mode: p,
32
+ temporaryHoverClose: o,
33
+ onMouseEnter: l,
34
+ onMouseLeave: I
35
+ } = k(v), { align: i, labelOffset: n, isPositioned: R } = K({
36
+ direction: b,
37
+ alignOffset: a,
38
+ disableAutoPositioning: m,
39
+ triggerRef: u,
40
+ contentRef: r,
41
+ collisionBoundary: h,
42
+ children: f
43
+ }), P = M({
44
+ opacity: R && (p === G.CLICK && !o || d) ? 1 : 0,
45
+ config: p === G.CLICK && !o ? { duration: 0 } : { duration: g, easing: y.easeInOutCubic }
46
+ });
47
+ return /* @__PURE__ */ N(
48
+ U,
49
+ {
50
+ hasItemWithIcon: E,
51
+ setHasItemWithIcon: O,
52
+ activeItemId: L,
53
+ setActiveItemId: t,
54
+ children: /* @__PURE__ */ N(
55
+ w.div,
56
+ {
57
+ style: {
58
+ zIndex: Number.MAX_SAFE_INTEGER,
59
+ position: "fixed",
60
+ ...P
61
+ },
62
+ "data-content-wrapper": !0,
63
+ children: /* @__PURE__ */ N(
64
+ x,
65
+ {
66
+ ref: F(r, H),
67
+ className: A(B.content, C),
68
+ style: {
69
+ ...s || {},
70
+ pointerEvents: m || R ? "auto" : "none"
71
+ },
72
+ collisionBoundary: h,
73
+ side: S[b],
74
+ align: i,
75
+ arrowPadding: c,
76
+ alignOffset: n,
77
+ onMouseEnter: l,
78
+ onMouseLeave: I,
79
+ ...T,
80
+ children: f
81
+ }
82
+ )
83
+ }
84
+ )
85
+ }
86
+ );
87
+ }
88
+ );
89
+ j.displayName = v;
90
+ function K({
91
+ direction: s,
92
+ alignOffset: C = 0,
93
+ disableAutoPositioning: f,
94
+ triggerRef: a,
95
+ contentRef: c,
96
+ collisionBoundary: h,
97
+ children: b
98
+ }) {
99
+ const [m, T] = _(
100
+ s === e.UP_RIGHT || s === e.DOWN_RIGHT || s === e.RIGHT_UP || s === e.RIGHT_DOWN ? "start" : "end"
101
+ ), [H, E] = _(C), [O, L] = _(!1);
102
+ return D(() => {
103
+ if (!c.current || f || [
104
+ e.DOWN_LEFT,
105
+ e.DOWN_RIGHT,
106
+ e.UP_LEFT,
107
+ e.UP_RIGHT
108
+ ].includes(s))
109
+ return;
110
+ const t = c.current, u = t.firstElementChild;
111
+ let r;
112
+ m === "start" ? t.children[1].hasAttribute("data-separator") ? r = t.children[2] : r = t.children[1] : t.children[t.children.length - 1].hasAttribute(
113
+ "data-arrow"
114
+ ) ? r = t.children[t.children.length - 2] : r = t.children[t.children.length - 1];
115
+ const d = a.current;
116
+ if (d) {
117
+ const g = r.getBoundingClientRect().height, o = (d.getBoundingClientRect().height - g) / 2;
118
+ if (m === "start") {
119
+ if (u instanceof HTMLElement && u.hasAttribute("data-label")) {
120
+ const l = u.getBoundingClientRect().height;
121
+ E(C - l + o);
122
+ }
123
+ } else
124
+ E(C + o - 1);
125
+ }
126
+ }, [b, s, c, a, m]), D(() => {
127
+ if (f || !(a != null && a.current))
128
+ return;
129
+ let t = null, u = !0;
130
+ const r = h instanceof Element && h || document.documentElement, d = () => {
131
+ if (!u)
132
+ return;
133
+ const g = a.current, p = c.current;
134
+ if (!g || !p)
135
+ return;
136
+ const o = g.getBoundingClientRect(), l = p.getBoundingClientRect();
137
+ if (l.width <= 0)
138
+ return;
139
+ const I = r.getBoundingClientRect(), i = {
140
+ right: I.right - o.right >= l.width,
141
+ left: o.left - I.left >= l.width,
142
+ bottom: I.bottom - o.bottom >= l.height,
143
+ top: o.top - I.top >= l.height
144
+ };
145
+ let n = "start";
146
+ switch (s) {
147
+ case e.UP_RIGHT:
148
+ case e.DOWN_RIGHT: {
149
+ i.right ? n = "start" : i.left ? n = "end" : n = "start";
150
+ break;
151
+ }
152
+ case e.UP_LEFT:
153
+ case e.DOWN_LEFT: {
154
+ i.left ? n = "end" : i.right ? n = "start" : n = "end";
155
+ break;
156
+ }
157
+ case e.RIGHT_DOWN:
158
+ case e.LEFT_DOWN: {
159
+ i.bottom ? n = "start" : i.top ? n = "end" : n = "start";
160
+ break;
161
+ }
162
+ case e.RIGHT_UP:
163
+ case e.LEFT_UP: {
164
+ i.top ? n = "end" : i.bottom ? n = "start" : n = "end";
165
+ break;
166
+ }
167
+ }
168
+ T(n), L(!0);
169
+ };
170
+ return requestAnimationFrame(d), c.current && typeof ResizeObserver < "u" && (t = new ResizeObserver(d), t.observe(c.current)), () => {
171
+ u = !1, t == null || t.disconnect();
172
+ };
173
+ }, [
174
+ s,
175
+ f,
176
+ a,
177
+ c,
178
+ h
179
+ ]), { align: m, labelOffset: H, isPositioned: O };
180
+ }
181
+ export {
182
+ j as C,
183
+ B as s,
184
+ K as u
185
+ };
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.0",
4
+ "version": "1.1.1-beta.1",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "engines": {