@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.
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +75 -72
- package/dist/components/ContextMenu/ContextMenu.props.d.ts +4 -0
- package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +4 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +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 +64 -56
- package/dist/components/ContextMenu/components/Item/Item.props.d.ts +8 -2
- package/dist/components/ContextMenu/components/Item/Item.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.js +18 -16
- package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts +4 -0
- package/dist/components/ContextMenu/components/Sub/Sub.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +56 -53
- package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +1 -1
- package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +53 -50
- package/dist/components/ContextMenu/components/Trigger/Trigger.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Trigger/Trigger.js +24 -24
- package/dist/components/ContextMenu/hooks/index.js +1 -1
- package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts +1 -0
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +56 -46
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts +4 -3
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +55 -87
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts +1 -0
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +57 -54
- package/dist/components/ContextMenu/index.js +1 -1
- package/dist/useContentPositioning-27D32n5u.mjs +185 -0
- package/package.json +1 -1
- package/dist/useContentPositioning-BIVWgixU.mjs +0 -174
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { forwardRef as v, useState as _, useLayoutEffect as D } from "react";
|
|
2
|
-
import { jsx as L } from "react/jsx-runtime";
|
|
3
|
-
import { C as F } from "./index-BA3njR2k.mjs";
|
|
4
|
-
import { c as U } from "./index-L8X2o7IH.mjs";
|
|
5
|
-
import { u as x, a as y, e as A } from "./react-spring_web.modern-Dnq1lqN5.mjs";
|
|
6
|
-
import { mergeRefs as M } from "./lib/utils.js";
|
|
7
|
-
import { LevelProvider as w } 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 t } 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
|
-
}, P = "ContextMenu.Content", j = v(
|
|
15
|
-
({
|
|
16
|
-
style: n,
|
|
17
|
-
className: I,
|
|
18
|
-
children: f,
|
|
19
|
-
alignOffset: i,
|
|
20
|
-
arrowPadding: a = 5,
|
|
21
|
-
collisionBoundary: d,
|
|
22
|
-
direction: C = t.DOWN_RIGHT,
|
|
23
|
-
disableAutoPositioning: T = !1,
|
|
24
|
-
...E
|
|
25
|
-
}, H) => {
|
|
26
|
-
const [b, O] = _(!1), [N, s] = _(null), {
|
|
27
|
-
triggerRef: c,
|
|
28
|
-
contentRef: h,
|
|
29
|
-
animatedOpen: u,
|
|
30
|
-
animationDuration: p,
|
|
31
|
-
mode: m,
|
|
32
|
-
temporaryHoverClose: l,
|
|
33
|
-
onMouseEnter: o,
|
|
34
|
-
onMouseLeave: g
|
|
35
|
-
} = k(P), { align: r, labelOffset: e, isPositioned: R } = K({
|
|
36
|
-
direction: C,
|
|
37
|
-
alignOffset: i,
|
|
38
|
-
disableAutoPositioning: T,
|
|
39
|
-
triggerRef: c,
|
|
40
|
-
contentRef: h,
|
|
41
|
-
collisionBoundary: d,
|
|
42
|
-
children: f
|
|
43
|
-
}), W = x({
|
|
44
|
-
opacity: R && (m === G.CLICK && !l || u) ? 1 : 0,
|
|
45
|
-
config: m === G.CLICK && !l ? { duration: 0 } : { duration: p, easing: A.easeInOutCubic }
|
|
46
|
-
});
|
|
47
|
-
return /* @__PURE__ */ L(
|
|
48
|
-
w,
|
|
49
|
-
{
|
|
50
|
-
hasItemWithIcon: b,
|
|
51
|
-
setHasItemWithIcon: O,
|
|
52
|
-
activeItemId: N,
|
|
53
|
-
setActiveItemId: s,
|
|
54
|
-
children: /* @__PURE__ */ L(
|
|
55
|
-
y.div,
|
|
56
|
-
{
|
|
57
|
-
style: {
|
|
58
|
-
zIndex: Number.MAX_SAFE_INTEGER,
|
|
59
|
-
position: "fixed",
|
|
60
|
-
...W
|
|
61
|
-
},
|
|
62
|
-
"data-content-wrapper": !0,
|
|
63
|
-
children: /* @__PURE__ */ L(
|
|
64
|
-
F,
|
|
65
|
-
{
|
|
66
|
-
ref: M(h, H),
|
|
67
|
-
className: U(B.content, I),
|
|
68
|
-
style: {
|
|
69
|
-
...n || {},
|
|
70
|
-
pointerEvents: T || R ? "auto" : "none"
|
|
71
|
-
},
|
|
72
|
-
collisionBoundary: d,
|
|
73
|
-
side: S[C],
|
|
74
|
-
align: r,
|
|
75
|
-
arrowPadding: a,
|
|
76
|
-
alignOffset: e,
|
|
77
|
-
onMouseEnter: o,
|
|
78
|
-
onMouseLeave: g,
|
|
79
|
-
...E,
|
|
80
|
-
children: f
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
j.displayName = P;
|
|
90
|
-
function K({
|
|
91
|
-
direction: n,
|
|
92
|
-
alignOffset: I = 0,
|
|
93
|
-
disableAutoPositioning: f,
|
|
94
|
-
triggerRef: i,
|
|
95
|
-
contentRef: a,
|
|
96
|
-
collisionBoundary: d,
|
|
97
|
-
children: C
|
|
98
|
-
}) {
|
|
99
|
-
const [T, E] = _(
|
|
100
|
-
n === t.UP_RIGHT || n === t.DOWN_RIGHT || n === t.RIGHT_UP || n === t.RIGHT_DOWN ? "start" : "end"
|
|
101
|
-
), [H, b] = _(I), [O, N] = _(!1);
|
|
102
|
-
return D(() => {
|
|
103
|
-
if (!a.current || f || [
|
|
104
|
-
t.DOWN_LEFT,
|
|
105
|
-
t.DOWN_RIGHT,
|
|
106
|
-
t.UP_LEFT,
|
|
107
|
-
t.UP_RIGHT
|
|
108
|
-
].includes(n))
|
|
109
|
-
return;
|
|
110
|
-
const s = a.current, c = s.firstElementChild, h = s.children[1].hasAttribute("data-separator") ? s.children[2] : s.children[1], u = i.current;
|
|
111
|
-
if (c && c.hasAttribute("data-label") && u) {
|
|
112
|
-
const p = c.getBoundingClientRect().height, m = h.getBoundingClientRect().height, o = (u.getBoundingClientRect().height - m) / 2;
|
|
113
|
-
n === t.LEFT_UP || n === t.RIGHT_UP ? b(I + o - 2) : (n === t.LEFT_DOWN || n === t.RIGHT_DOWN) && b(I - p + o);
|
|
114
|
-
}
|
|
115
|
-
}, [C, n, a, i]), D(() => {
|
|
116
|
-
if (f || !(i != null && i.current))
|
|
117
|
-
return;
|
|
118
|
-
let s = null, c = !0;
|
|
119
|
-
const h = d instanceof Element && d || document.documentElement, u = () => {
|
|
120
|
-
if (!c)
|
|
121
|
-
return;
|
|
122
|
-
const p = i.current, m = a.current;
|
|
123
|
-
if (!p || !m)
|
|
124
|
-
return;
|
|
125
|
-
const l = p.getBoundingClientRect(), o = m.getBoundingClientRect();
|
|
126
|
-
if (o.width <= 0)
|
|
127
|
-
return;
|
|
128
|
-
const g = h.getBoundingClientRect(), r = {
|
|
129
|
-
right: g.right - l.right >= o.width,
|
|
130
|
-
left: l.left - g.left >= o.width,
|
|
131
|
-
bottom: g.bottom - l.bottom >= o.height,
|
|
132
|
-
top: l.top - g.top >= o.height
|
|
133
|
-
};
|
|
134
|
-
let e = "start";
|
|
135
|
-
switch (n) {
|
|
136
|
-
case t.UP_RIGHT:
|
|
137
|
-
case t.DOWN_RIGHT: {
|
|
138
|
-
r.right ? e = "start" : r.left ? e = "end" : e = "start";
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
case t.UP_LEFT:
|
|
142
|
-
case t.DOWN_LEFT: {
|
|
143
|
-
r.left ? e = "end" : r.right ? e = "start" : e = "end";
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
case t.RIGHT_DOWN:
|
|
147
|
-
case t.LEFT_DOWN: {
|
|
148
|
-
r.bottom ? e = "start" : r.top ? e = "end" : e = "start";
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
case t.RIGHT_UP:
|
|
152
|
-
case t.LEFT_UP: {
|
|
153
|
-
r.top ? e = "end" : r.bottom ? e = "start" : e = "end";
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
E(e), N(!0);
|
|
158
|
-
};
|
|
159
|
-
return requestAnimationFrame(u), a.current && typeof ResizeObserver < "u" && (s = new ResizeObserver(u), s.observe(a.current)), () => {
|
|
160
|
-
c = !1, s == null || s.disconnect();
|
|
161
|
-
};
|
|
162
|
-
}, [
|
|
163
|
-
n,
|
|
164
|
-
f,
|
|
165
|
-
i,
|
|
166
|
-
a,
|
|
167
|
-
d
|
|
168
|
-
]), { align: T, labelOffset: H, isPositioned: O };
|
|
169
|
-
}
|
|
170
|
-
export {
|
|
171
|
-
j as C,
|
|
172
|
-
B as s,
|
|
173
|
-
K as u
|
|
174
|
-
};
|