@alxgrn/telefrag-ui 0.1.4 → 0.1.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.
package/dist/assets/MainMenu.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.MainMenu{margin-top:var(--alxgrn-unit);margin-right:var(--alxgrn-unit-half)}.Sidebar .MainMenu{margin-top:0}.MainMenu .MainMenuAlternative{padding:var(--alxgrn-unit-half);border-radius:var(--alxgrn-unit-half);-webkit-user-select:none;user-select:none}.MainMenu .MainMenuAlternative:hover{background-color:var(--alxgrn-bg-panel)}.MainMenu .MainMenuAlternative:hover *{color:var(--alxgrn-color-accent)}.MainMenu .MainMenuAlternative a{display:flex;align-items:center;gap:var(--alxgrn-unit-half);cursor:pointer;color:var(--alxgrn-color-text)
|
|
1
|
+
.MainMenu{margin-top:var(--alxgrn-unit);margin-right:var(--alxgrn-unit-half)}.Sidebar .MainMenu{margin-top:0}.MainMenu .MainMenuAlternative{padding:var(--alxgrn-unit-half);border-radius:var(--alxgrn-unit-half);-webkit-user-select:none;user-select:none}.MainMenu .MainMenuAlternative:hover{background-color:var(--alxgrn-bg-panel)}.MainMenu .MainMenuAlternative:hover *{color:var(--alxgrn-color-accent)}.MainMenu .MainMenuAlternative a{display:flex;align-items:center;gap:var(--alxgrn-unit-half);cursor:pointer;color:var(--alxgrn-color-text);text-decoration:none;border:none}.MainMenu .MainMenuAlternative svg{color:var(--alxgrn-color-accent);font-size:var(--alxgrn-font-size-big)}.MainMenu .MainMenuAlternative img{width:var(--alxgrn-font-size-big);height:var(--alxgrn-font-size-big);border-radius:50%;flex:0 0 auto}.MainMenu .MainMenuAlternative .MainMenuAlternativeText{font-size:var(--alxgrn-font-size);overflow-wrap:break-word;display:-webkit-box;line-clamp:1;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;flex:1 1 auto}.MainMenu .MainMenuAlternative .MainMenuAlternativeCheck{display:block;width:var(--alxgrn-unit-half);height:var(--alxgrn-unit-half);border-radius:50%;background-color:var(--alxgrn-color-accent);flex:0 0 auto}.MainMenu .MainMenuNode,.MainMenu .MainMenuTitle{padding:var(--alxgrn-unit-half)}.MainMenu .MainMenuTitle{text-transform:uppercase;font-size:var(--alxgrn-font-size-small);font-weight:600;color:var(--alxgrn-color-light);overflow-wrap:break-word;display:-webkit-box;line-clamp:1;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
-
type
|
|
2
|
+
type Props = {
|
|
3
3
|
maxHeight?: number;
|
|
4
|
-
aspectRatio?: never;
|
|
5
|
-
};
|
|
6
|
-
type PropsWithAspectRatio = {
|
|
7
|
-
maxHeight?: never;
|
|
8
4
|
aspectRatio?: '1x1' | '16x9';
|
|
9
|
-
};
|
|
10
|
-
type Props = (PropsWithAspectRatio | PropsWithMaxHeight) & {
|
|
11
5
|
expand?: string;
|
|
12
6
|
collapse?: string;
|
|
13
7
|
isCollapsable?: boolean;
|
|
@@ -1,72 +1,87 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as x, jsx as u, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useRef as d, useCallback as g, useLayoutEffect as T, useEffect as L } from "react";
|
|
3
3
|
import '../../../assets/Expandable.css';/* empty css */
|
|
4
|
-
const M = 50,
|
|
5
|
-
children:
|
|
6
|
-
maxHeight:
|
|
7
|
-
aspectRatio:
|
|
8
|
-
expand:
|
|
9
|
-
collapse:
|
|
10
|
-
isCollapsable:
|
|
11
|
-
noShadow:
|
|
4
|
+
const M = 50, S = 300, _ = 1e3, D = ({
|
|
5
|
+
children: I,
|
|
6
|
+
maxHeight: f,
|
|
7
|
+
aspectRatio: b = "1x1",
|
|
8
|
+
expand: k = "Показать целиком...",
|
|
9
|
+
collapse: w = "Свернуть...",
|
|
10
|
+
isCollapsable: N = !0,
|
|
11
|
+
noShadow: O
|
|
12
12
|
}) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
const [c, v] = E(!1), [h, R] = E(!1), [A, H] = E("none"), r = d(null), y = d(!1), o = d(null), i = d(null), a = g(() => {
|
|
14
|
+
if (f !== void 0) return Math.max(f, M);
|
|
15
|
+
const e = r.current;
|
|
16
|
+
if (!e) return S;
|
|
17
|
+
const t = e.offsetWidth;
|
|
18
|
+
if (t === 0) return S;
|
|
19
|
+
const n = b === "16x9" ? Math.ceil(t / 16 * 9) : t;
|
|
20
|
+
return Math.max(n, M);
|
|
21
|
+
}, [f, b]), m = g(() => {
|
|
22
|
+
const e = r.current;
|
|
23
|
+
if (!e) return;
|
|
24
|
+
const t = e.getBoundingClientRect(), n = getComputedStyle(e);
|
|
25
|
+
if (t.width === 0 || t.height === 0 || n.display === "none" || n.visibility === "hidden")
|
|
26
|
+
return;
|
|
27
|
+
e.offsetHeight;
|
|
28
|
+
const s = e.scrollHeight, p = a();
|
|
29
|
+
R(s > p);
|
|
30
|
+
}, [a]), l = g(() => {
|
|
31
|
+
const e = r.current;
|
|
32
|
+
if (!e) return;
|
|
33
|
+
const t = e.querySelectorAll("img"), n = Array.from(t).filter((s) => !s.complete);
|
|
34
|
+
if (n.length === 0) {
|
|
35
|
+
m();
|
|
36
|
+
return;
|
|
26
37
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
Promise.all(n.map((s) => new Promise((p) => {
|
|
39
|
+
s.onload = s.onerror = p;
|
|
40
|
+
}))).then(m);
|
|
41
|
+
}, [m]);
|
|
42
|
+
return T(() => {
|
|
43
|
+
if (y.current || !r.current) return;
|
|
44
|
+
y.current = !0;
|
|
45
|
+
const e = r.current, t = new MutationObserver(l);
|
|
46
|
+
t.observe(e, {
|
|
47
|
+
childList: !0,
|
|
48
|
+
subtree: !0
|
|
49
|
+
}), i.current && i.current.disconnect(), i.current = t;
|
|
50
|
+
const n = new ResizeObserver(l);
|
|
51
|
+
n.observe(e), o.current && o.current.disconnect(), o.current = n;
|
|
52
|
+
const s = setTimeout(l, _);
|
|
53
|
+
return l(), () => {
|
|
54
|
+
clearTimeout(s), o.current && o.current.disconnect(), i.current && i.current.disconnect();
|
|
38
55
|
};
|
|
39
|
-
}, [
|
|
40
|
-
|
|
56
|
+
}, [l]), L(() => {
|
|
57
|
+
H(c ? r.current ? `${r.current.scrollHeight}px` : "none" : `${a()}px`);
|
|
58
|
+
}, [c, a]), /* @__PURE__ */ x("div", { className: "Expandable", children: [
|
|
59
|
+
/* @__PURE__ */ u(
|
|
41
60
|
"div",
|
|
42
61
|
{
|
|
43
|
-
ref:
|
|
44
|
-
className:
|
|
45
|
-
style: { maxHeight:
|
|
46
|
-
children:
|
|
62
|
+
ref: r,
|
|
63
|
+
className: h ? c ? "ExpandableExpanded" : "ExpandableCollapsed" : void 0,
|
|
64
|
+
style: h ? { maxHeight: A } : void 0,
|
|
65
|
+
children: I
|
|
47
66
|
}
|
|
48
67
|
),
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
h && /* @__PURE__ */ x(C, { children: [
|
|
69
|
+
c && N && /* @__PURE__ */ u(
|
|
51
70
|
"span",
|
|
52
71
|
{
|
|
53
72
|
className: "ExpandableButton",
|
|
54
|
-
onClick: () =>
|
|
55
|
-
|
|
56
|
-
"aria-controls": "collapsible-content",
|
|
57
|
-
children: g
|
|
73
|
+
onClick: () => v(!1),
|
|
74
|
+
children: w
|
|
58
75
|
}
|
|
59
76
|
),
|
|
60
|
-
!
|
|
61
|
-
!
|
|
62
|
-
/* @__PURE__ */
|
|
77
|
+
!c && /* @__PURE__ */ x(C, { children: [
|
|
78
|
+
!O && /* @__PURE__ */ u("div", { className: "ExpandableShadow" }),
|
|
79
|
+
/* @__PURE__ */ u(
|
|
63
80
|
"span",
|
|
64
81
|
{
|
|
65
82
|
className: "ExpandableButton",
|
|
66
|
-
onClick: () =>
|
|
67
|
-
|
|
68
|
-
"aria-controls": "collapsible-content",
|
|
69
|
-
children: H
|
|
83
|
+
onClick: () => v(!0),
|
|
84
|
+
children: k
|
|
70
85
|
}
|
|
71
86
|
)
|
|
72
87
|
] })
|
|
@@ -74,5 +89,5 @@ const M = 50, b = 300, j = ({
|
|
|
74
89
|
] });
|
|
75
90
|
};
|
|
76
91
|
export {
|
|
77
|
-
|
|
92
|
+
D as default
|
|
78
93
|
};
|
package/package.json
CHANGED