@kommo-crm/crm-react-ui-kit 1.1.1-beta.6 → 1.1.1-beta.8
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 +102 -90
- package/dist/components/ContextMenu/ContextMenu.props.d.ts +22 -0
- package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Arrow/Arrow.js +1 -1
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.d.ts +1 -0
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +45 -40
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.props.d.ts +4 -0
- package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Content/Content.js +2 -2
- package/dist/components/ContextMenu/components/Content/index.js +1 -1
- package/dist/components/ContextMenu/components/Group/Group.js +1 -1
- package/dist/components/ContextMenu/components/Item/Item.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Item/Item.js +80 -75
- package/dist/components/ContextMenu/components/Item/Item.props.d.ts +6 -0
- package/dist/components/ContextMenu/components/Item/Item.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/ItemIndicator/ItemIndicator.js +1 -1
- package/dist/components/ContextMenu/components/Label/Label.js +1 -1
- package/dist/components/ContextMenu/components/Portal/Portal.js +1 -1
- package/dist/components/ContextMenu/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.d.ts +1 -0
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +50 -45
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.props.d.ts +4 -0
- package/dist/components/ContextMenu/components/RadioItem/RadioItem.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Separator/Separator.js +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.d.ts +5 -5
- package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/Sub/Sub.js +54 -55
- package/dist/components/ContextMenu/components/Sub/Sub.types.d.ts +7 -0
- package/dist/components/ContextMenu/components/Sub/Sub.types.d.ts.map +1 -0
- package/dist/components/ContextMenu/components/Sub/Sub.types.js +1 -0
- package/dist/components/ContextMenu/components/Sub/index.d.ts +1 -0
- package/dist/components/ContextMenu/components/Sub/index.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubContent/SubContent.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubContent/SubContent.js +26 -25
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +71 -66
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts +8 -0
- package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts.map +1 -1
- package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +2 -2
- 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 +3 -3
- package/dist/components/ContextMenu/components/Trigger/Trigger.js +1 -1
- 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.d.ts +1 -0
- package/dist/components/ContextMenu/index.d.ts.map +1 -1
- package/dist/components/ContextMenu/index.js +1 -1
- package/dist/{index-BA3njR2k.mjs → index-CYWNqEqR.mjs} +1 -1
- package/dist/{useContentPositioning-DO7ZotnD.mjs → useContentPositioning-BLEFxO0N.mjs} +66 -65
- package/package.json +1 -1
|
@@ -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-CYWNqEqR.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