@elcrm/components 0.2.1 → 0.2.3
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/{Dropdown-4yUB2tk1.js → Dropdown-C6qlqMLV.js} +1 -1
- package/dist/Dropdown.js +1 -1
- package/dist/Popover-5dFP4TXx.js +149 -0
- package/dist/Popover.js +1 -1
- package/dist/{Sidebar-CBYq1ad6.js → Sidebar-D7CTdu37.js} +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/index.es.js +3 -3
- package/package.json +1 -1
- package/dist/Popover-D0m5JWIt.js +0 -142
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "react";
|
|
2
2
|
import { C as f } from "./CheckIcon-FdB8fMEF.js";
|
|
3
3
|
import { c as m } from "./cx-CcykAxZN.js";
|
|
4
|
-
import { P as D } from "./Popover-
|
|
4
|
+
import { P as D } from "./Popover-5dFP4TXx.js";
|
|
5
5
|
import { u as j } from "./useControllableValue-CWqH1kpM.js";
|
|
6
6
|
import './Dropdown.css';const I = "crr", M = "crt", P = "crc", R = "crp", W = "crh", z = "crg", F = "crd", G = "cri", T = "crn", V = "crm", q = "crk", A = "crl", H = "cru", J = "crb", K = "cro", Q = "crf", U = "crx", X = "cry", Y = "crv", n = {
|
|
7
7
|
r: I,
|
package/dist/Dropdown.js
CHANGED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import l, { useRef as g, useId as j, useState as H, useLayoutEffect as S, useEffect as W } from "react";
|
|
2
|
+
import { createPortal as G } from "react-dom";
|
|
3
|
+
import { c as C } from "./cx-CcykAxZN.js";
|
|
4
|
+
import { u as J } from "./useControllableValue-CWqH1kpM.js";
|
|
5
|
+
import './Popover.css';const B = 1e3, Q = 10;
|
|
6
|
+
function L() {
|
|
7
|
+
const e = globalThis;
|
|
8
|
+
return e.elcrm || (e.elcrm = {}), e.elcrm.overlayZ || (e.elcrm.overlayZ = { seq: 0, active: /* @__PURE__ */ new Set() }), e.elcrm.overlayZ;
|
|
9
|
+
}
|
|
10
|
+
function U() {
|
|
11
|
+
const e = L();
|
|
12
|
+
e.seq += 1;
|
|
13
|
+
const n = B + e.seq * Q;
|
|
14
|
+
return e.active.add(n), n;
|
|
15
|
+
}
|
|
16
|
+
function T(e) {
|
|
17
|
+
const n = L();
|
|
18
|
+
n.active.delete(e), n.active.size === 0 && (n.seq = 0);
|
|
19
|
+
}
|
|
20
|
+
function re() {
|
|
21
|
+
const e = L();
|
|
22
|
+
return e.active.size === 0 ? B : Math.max(...e.active);
|
|
23
|
+
}
|
|
24
|
+
const X = "c3r", Y = "c3t", _ = "c3p", b = {
|
|
25
|
+
r: X,
|
|
26
|
+
t: Y,
|
|
27
|
+
p: _
|
|
28
|
+
};
|
|
29
|
+
function $(e, n, v, w) {
|
|
30
|
+
if (!l.isValidElement(e)) return e;
|
|
31
|
+
const u = e.props.onClick;
|
|
32
|
+
return l.cloneElement(e, {
|
|
33
|
+
"aria-haspopup": "menu",
|
|
34
|
+
"aria-expanded": n,
|
|
35
|
+
"aria-controls": n ? v : void 0,
|
|
36
|
+
onClick: (p) => {
|
|
37
|
+
u == null || u(p), w();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function se({
|
|
42
|
+
trigger: e,
|
|
43
|
+
children: n,
|
|
44
|
+
open: v,
|
|
45
|
+
defaultOpen: w = !1,
|
|
46
|
+
onOpenChange: u,
|
|
47
|
+
align: p = "end",
|
|
48
|
+
disabled: M = !1,
|
|
49
|
+
label: N,
|
|
50
|
+
role: V = "menu",
|
|
51
|
+
className: D,
|
|
52
|
+
panelClassName: A
|
|
53
|
+
}) {
|
|
54
|
+
const h = g(null), R = g(null), E = j(), [o = !1, F] = J(
|
|
55
|
+
v,
|
|
56
|
+
w,
|
|
57
|
+
u
|
|
58
|
+
), [i, z] = H(null), [a, P] = H(null), x = g(null);
|
|
59
|
+
x.current = a;
|
|
60
|
+
const y = (t) => {
|
|
61
|
+
M && t || F(t);
|
|
62
|
+
};
|
|
63
|
+
S(() => {
|
|
64
|
+
if (o) {
|
|
65
|
+
a == null && P(U());
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
a != null && (T(a), P(null));
|
|
69
|
+
}, [o, a]), W(() => () => {
|
|
70
|
+
x.current != null && T(x.current);
|
|
71
|
+
}, []);
|
|
72
|
+
const Z = () => {
|
|
73
|
+
const t = h.current;
|
|
74
|
+
if (!t) return;
|
|
75
|
+
const r = t.getBoundingClientRect(), s = 8, c = window.innerHeight - r.bottom - s - 8, d = r.top - s - 8, m = c >= 160 || c >= d, O = Math.min(420, Math.max(120, m ? c : d)), f = Math.max(200, r.width), q = p === "end" ? Math.max(8, Math.min(r.right - f, window.innerWidth - f - 8)) : Math.max(8, Math.min(r.left, window.innerWidth - f - 8));
|
|
76
|
+
z(
|
|
77
|
+
m ? { top: r.bottom + s, left: q, minWidth: f, maxHeight: O } : {
|
|
78
|
+
bottom: window.innerHeight - r.top + s,
|
|
79
|
+
left: q,
|
|
80
|
+
minWidth: f,
|
|
81
|
+
maxHeight: O
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
S(() => {
|
|
86
|
+
if (!o) {
|
|
87
|
+
z(null);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
Z();
|
|
91
|
+
const t = () => Z();
|
|
92
|
+
return window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), () => {
|
|
93
|
+
window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
|
|
94
|
+
};
|
|
95
|
+
}, [o, p]), W(() => {
|
|
96
|
+
if (!o) return;
|
|
97
|
+
const t = (s) => {
|
|
98
|
+
var d, m;
|
|
99
|
+
const c = s.target;
|
|
100
|
+
(d = h.current) != null && d.contains(c) || (m = R.current) != null && m.contains(c) || y(!1);
|
|
101
|
+
}, r = (s) => {
|
|
102
|
+
s.key === "Escape" && y(!1);
|
|
103
|
+
};
|
|
104
|
+
return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), () => {
|
|
105
|
+
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r);
|
|
106
|
+
};
|
|
107
|
+
}, [o]);
|
|
108
|
+
const K = {
|
|
109
|
+
position: "fixed",
|
|
110
|
+
zIndex: a ?? 1e3,
|
|
111
|
+
...i ? {
|
|
112
|
+
...i.top != null ? { top: i.top } : { bottom: i.bottom },
|
|
113
|
+
left: i.left,
|
|
114
|
+
minWidth: i.minWidth,
|
|
115
|
+
maxHeight: i.maxHeight
|
|
116
|
+
} : { visibility: "hidden", pointerEvents: "none" }
|
|
117
|
+
}, k = o ? /* @__PURE__ */ l.createElement(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
ref: R,
|
|
121
|
+
id: E,
|
|
122
|
+
role: V,
|
|
123
|
+
"aria-label": N,
|
|
124
|
+
className: C(b.p, A),
|
|
125
|
+
style: K,
|
|
126
|
+
onMouseDown: (t) => t.stopPropagation()
|
|
127
|
+
},
|
|
128
|
+
n
|
|
129
|
+
) : null, I = () => {
|
|
130
|
+
M || y(!o);
|
|
131
|
+
};
|
|
132
|
+
return /* @__PURE__ */ l.createElement("div", { ref: h, className: C(b.r, D) }, /* @__PURE__ */ l.createElement(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: b.t,
|
|
136
|
+
"aria-haspopup": "menu",
|
|
137
|
+
"aria-expanded": o,
|
|
138
|
+
"aria-controls": o ? E : void 0,
|
|
139
|
+
onClick: l.isValidElement(e) ? void 0 : I
|
|
140
|
+
},
|
|
141
|
+
$(e, o, E, I)
|
|
142
|
+
), k && typeof document < "u" ? G(k, document.body) : null);
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
se as P,
|
|
146
|
+
U as a,
|
|
147
|
+
re as p,
|
|
148
|
+
T as r
|
|
149
|
+
};
|
package/dist/Popover.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "react";
|
|
2
2
|
import { B as h } from "./Badge-jp-9iNNL.js";
|
|
3
|
-
import { D as w } from "./Dropdown-
|
|
3
|
+
import { D as w } from "./Dropdown-C6qlqMLV.js";
|
|
4
4
|
import { I as y } from "./Item-D4okhsfW.js";
|
|
5
5
|
import { b as C } from "./badgeText-CRzlIzi3.js";
|
|
6
6
|
import { c as u } from "./cx-CcykAxZN.js";
|
package/dist/Sidebar.js
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -13,7 +13,7 @@ import { R as g } from "./Row-DsQOVn18.js";
|
|
|
13
13
|
import { C as F } from "./Column-BiogBDf8.js";
|
|
14
14
|
import { S as H, s as M } from "./Stack-XkmPSswj.js";
|
|
15
15
|
import { M as Z } from "./Menu-DuXQv-zT.js";
|
|
16
|
-
import { D as z } from "./Dropdown-
|
|
16
|
+
import { D as z } from "./Dropdown-C6qlqMLV.js";
|
|
17
17
|
import { B as E } from "./Breadcrumb-CAM_e9LN.js";
|
|
18
18
|
import { L as j } from "./Loading-DkkG7RcE.js";
|
|
19
19
|
import { S as K } from "./Section-Crxk2J-E.js";
|
|
@@ -33,8 +33,8 @@ import { P as Pr } from "./PageShell-D9EZiO8o.js";
|
|
|
33
33
|
import { C as Ar, a as Br } from "./ChatSplit-DNnu3TNq.js";
|
|
34
34
|
import { C as Ir } from "./ChatFrame-BW2TmCkZ.js";
|
|
35
35
|
import { C as Rr } from "./ChatMessages-B8rdXiK-.js";
|
|
36
|
-
import { S as Gr } from "./Sidebar-
|
|
37
|
-
import { P as gr, a as kr, p as Fr, r as Nr } from "./Popover-
|
|
36
|
+
import { S as Gr } from "./Sidebar-D7CTdu37.js";
|
|
37
|
+
import { P as gr, a as kr, p as Fr, r as Nr } from "./Popover-5dFP4TXx.js";
|
|
38
38
|
import { lazy as e } from "react";
|
|
39
39
|
import { c as Mr } from "./cx-CcykAxZN.js";
|
|
40
40
|
function s(a) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elcrm/components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Shell UI elCRM: Layout, Header, Sidebar, Popover, PageHead, PageShell, Section, Stack, Stat, ActionGroup, TextGroup, ItemColumn и др.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MaSkal <dev@elcrm.online>",
|
package/dist/Popover-D0m5JWIt.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import c, { useRef as g, useId as G, useState as q, useLayoutEffect as S, useEffect as W } from "react";
|
|
2
|
-
import { createPortal as J } from "react-dom";
|
|
3
|
-
import { c as C } from "./cx-CcykAxZN.js";
|
|
4
|
-
import { u as Q } from "./useControllableValue-CWqH1kpM.js";
|
|
5
|
-
import './Popover.css';const T = 1e3, U = 10;
|
|
6
|
-
function M() {
|
|
7
|
-
const e = globalThis;
|
|
8
|
-
return e.elcrm || (e.elcrm = {}), e.elcrm.overlayZ || (e.elcrm.overlayZ = { seq: 0, active: /* @__PURE__ */ new Set() }), e.elcrm.overlayZ;
|
|
9
|
-
}
|
|
10
|
-
function X() {
|
|
11
|
-
const e = M();
|
|
12
|
-
e.seq += 1;
|
|
13
|
-
const n = T + e.seq * U;
|
|
14
|
-
return e.active.add(n), n;
|
|
15
|
-
}
|
|
16
|
-
function H(e) {
|
|
17
|
-
const n = M();
|
|
18
|
-
n.active.delete(e), n.active.size === 0 && (n.seq = 0);
|
|
19
|
-
}
|
|
20
|
-
function se() {
|
|
21
|
-
const e = M();
|
|
22
|
-
return e.active.size === 0 ? T : Math.max(...e.active);
|
|
23
|
-
}
|
|
24
|
-
const Y = "c3r", _ = "c3t", $ = "c3p", L = {
|
|
25
|
-
r: Y,
|
|
26
|
-
t: _,
|
|
27
|
-
p: $
|
|
28
|
-
};
|
|
29
|
-
function ee(e, n, v, h) {
|
|
30
|
-
if (!c.isValidElement(e)) return e;
|
|
31
|
-
const l = e.props.onClick;
|
|
32
|
-
return c.cloneElement(e, {
|
|
33
|
-
"aria-haspopup": "menu",
|
|
34
|
-
"aria-expanded": n,
|
|
35
|
-
"aria-controls": n ? v : void 0,
|
|
36
|
-
onClick: (f) => {
|
|
37
|
-
l == null || l(f), h();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function ie({
|
|
42
|
-
trigger: e,
|
|
43
|
-
children: n,
|
|
44
|
-
open: v,
|
|
45
|
-
defaultOpen: h = !1,
|
|
46
|
-
onOpenChange: l,
|
|
47
|
-
align: f = "end",
|
|
48
|
-
disabled: R = !1,
|
|
49
|
-
label: B,
|
|
50
|
-
role: N = "menu",
|
|
51
|
-
className: V,
|
|
52
|
-
panelClassName: D
|
|
53
|
-
}) {
|
|
54
|
-
const w = g(null), z = g(null), E = G(), [o = !1, A] = Q(
|
|
55
|
-
v,
|
|
56
|
-
h,
|
|
57
|
-
l
|
|
58
|
-
), [u, b] = q(null), [i, P] = q(null), x = g(null);
|
|
59
|
-
x.current = i;
|
|
60
|
-
const y = (t) => {
|
|
61
|
-
R && t || A(t);
|
|
62
|
-
};
|
|
63
|
-
S(() => {
|
|
64
|
-
if (o) {
|
|
65
|
-
i == null && P(X());
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
i != null && (H(i), P(null));
|
|
69
|
-
}, [o, i]), W(() => () => {
|
|
70
|
-
x.current != null && H(x.current);
|
|
71
|
-
}, []);
|
|
72
|
-
const Z = () => {
|
|
73
|
-
const t = w.current;
|
|
74
|
-
if (!t) return;
|
|
75
|
-
const r = t.getBoundingClientRect(), s = 8, a = window.innerHeight - r.bottom - s - 8, d = r.top - s - 8, m = a >= 160 || a >= d, O = Math.min(420, Math.max(120, m ? a : d)), p = Math.max(200, r.width), K = m ? r.bottom + s : Math.max(8, r.top - s - O), j = f === "end" ? Math.max(8, Math.min(r.right - p, window.innerWidth - p - 8)) : Math.max(8, Math.min(r.left, window.innerWidth - p - 8));
|
|
76
|
-
b({ top: K, left: j, minWidth: p, maxHeight: O });
|
|
77
|
-
};
|
|
78
|
-
S(() => {
|
|
79
|
-
if (!o) {
|
|
80
|
-
b(null);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
Z();
|
|
84
|
-
const t = () => Z();
|
|
85
|
-
return window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), () => {
|
|
86
|
-
window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
|
|
87
|
-
};
|
|
88
|
-
}, [o, f]), W(() => {
|
|
89
|
-
if (!o) return;
|
|
90
|
-
const t = (s) => {
|
|
91
|
-
var d, m;
|
|
92
|
-
const a = s.target;
|
|
93
|
-
(d = w.current) != null && d.contains(a) || (m = z.current) != null && m.contains(a) || y(!1);
|
|
94
|
-
}, r = (s) => {
|
|
95
|
-
s.key === "Escape" && y(!1);
|
|
96
|
-
};
|
|
97
|
-
return document.addEventListener("mousedown", t), document.addEventListener("keydown", r), () => {
|
|
98
|
-
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r);
|
|
99
|
-
};
|
|
100
|
-
}, [o]);
|
|
101
|
-
const F = {
|
|
102
|
-
position: "fixed",
|
|
103
|
-
zIndex: i ?? 1e3,
|
|
104
|
-
...u ? {
|
|
105
|
-
top: u.top,
|
|
106
|
-
left: u.left,
|
|
107
|
-
minWidth: u.minWidth,
|
|
108
|
-
maxHeight: u.maxHeight
|
|
109
|
-
} : { visibility: "hidden", pointerEvents: "none" }
|
|
110
|
-
}, k = o ? /* @__PURE__ */ c.createElement(
|
|
111
|
-
"div",
|
|
112
|
-
{
|
|
113
|
-
ref: z,
|
|
114
|
-
id: E,
|
|
115
|
-
role: N,
|
|
116
|
-
"aria-label": B,
|
|
117
|
-
className: C(L.p, D),
|
|
118
|
-
style: F,
|
|
119
|
-
onMouseDown: (t) => t.stopPropagation()
|
|
120
|
-
},
|
|
121
|
-
n
|
|
122
|
-
) : null, I = () => {
|
|
123
|
-
R || y(!o);
|
|
124
|
-
};
|
|
125
|
-
return /* @__PURE__ */ c.createElement("div", { ref: w, className: C(L.r, V) }, /* @__PURE__ */ c.createElement(
|
|
126
|
-
"div",
|
|
127
|
-
{
|
|
128
|
-
className: L.t,
|
|
129
|
-
"aria-haspopup": "menu",
|
|
130
|
-
"aria-expanded": o,
|
|
131
|
-
"aria-controls": o ? E : void 0,
|
|
132
|
-
onClick: c.isValidElement(e) ? void 0 : I
|
|
133
|
-
},
|
|
134
|
-
ee(e, o, E, I)
|
|
135
|
-
), k && typeof document < "u" ? J(k, document.body) : null);
|
|
136
|
-
}
|
|
137
|
-
export {
|
|
138
|
-
ie as P,
|
|
139
|
-
X as a,
|
|
140
|
-
se as p,
|
|
141
|
-
H as r
|
|
142
|
-
};
|