@solostylist/ui-kit 1.0.142 → 1.0.143
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.
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { j as r } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
2
|
+
import { useState as k } from "react";
|
|
3
|
+
import { Box as a, Grid as f } from "@mui/material";
|
|
4
|
+
import C from "../s-icon-button/s-icon-button.js";
|
|
5
|
+
const _ = 40, B = 16, R = ({
|
|
6
6
|
actions: u,
|
|
7
7
|
maxWidth: d,
|
|
8
8
|
columns: s = 3,
|
|
9
9
|
children: p,
|
|
10
10
|
showOnHover: n = !0,
|
|
11
11
|
visible: o,
|
|
12
|
-
position:
|
|
13
|
-
backdropColor: x = "
|
|
14
|
-
backdropOpacity: m =
|
|
15
|
-
blurAmount:
|
|
16
|
-
borderRadius:
|
|
12
|
+
position: l = "center",
|
|
13
|
+
backdropColor: x = "background.paper",
|
|
14
|
+
backdropOpacity: m = 0.9,
|
|
15
|
+
blurAmount: v = 10,
|
|
16
|
+
borderRadius: j = 0,
|
|
17
17
|
overlaySx: g,
|
|
18
18
|
onVisibilityChange: e
|
|
19
19
|
}) => {
|
|
20
|
-
const [I, i] =
|
|
20
|
+
const [I, i] = k(!1), y = o !== void 0 ? o : n && I, h = () => {
|
|
21
21
|
n && o === void 0 && (i(!0), e == null || e(!0));
|
|
22
22
|
}, A = () => {
|
|
23
23
|
n && o === void 0 && (i(!1), e == null || e(!1));
|
|
24
24
|
}, E = () => {
|
|
25
|
-
switch (
|
|
25
|
+
switch (l) {
|
|
26
26
|
case "top-left":
|
|
27
27
|
return { justifyContent: "flex-start", alignItems: "flex-start" };
|
|
28
28
|
case "top-right":
|
|
@@ -36,7 +36,7 @@ const T = 40, B = 16, R = ({
|
|
|
36
36
|
return { justifyContent: "center", alignItems: "center" };
|
|
37
37
|
}
|
|
38
38
|
}, M = () => {
|
|
39
|
-
switch (
|
|
39
|
+
switch (l) {
|
|
40
40
|
case "top-left":
|
|
41
41
|
return "flex-start";
|
|
42
42
|
case "top-right":
|
|
@@ -49,16 +49,16 @@ const T = 40, B = 16, R = ({
|
|
|
49
49
|
default:
|
|
50
50
|
return "center";
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, T = () => {
|
|
53
53
|
let t = d;
|
|
54
|
-
return s && (t = s *
|
|
54
|
+
return s && (t = s * _ + (s - 1) * B + s * 16), t;
|
|
55
55
|
};
|
|
56
56
|
return (
|
|
57
57
|
// Main container with flex to center the children
|
|
58
|
-
/* @__PURE__ */ r.jsx(
|
|
58
|
+
/* @__PURE__ */ r.jsx(a, { display: "flex", children: /* @__PURE__ */ r.jsxs(a, { position: "relative", onMouseEnter: h, onMouseLeave: A, children: [
|
|
59
59
|
p,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
y && /* @__PURE__ */ r.jsx(
|
|
61
|
+
a,
|
|
62
62
|
{
|
|
63
63
|
position: "absolute",
|
|
64
64
|
top: 0,
|
|
@@ -69,18 +69,18 @@ const T = 40, B = 16, R = ({
|
|
|
69
69
|
bgcolor: x,
|
|
70
70
|
sx: {
|
|
71
71
|
opacity: m,
|
|
72
|
-
backdropFilter: `blur(${
|
|
72
|
+
backdropFilter: `blur(${v}px)`,
|
|
73
73
|
transform: "translateZ(0)",
|
|
74
74
|
willChange: "transform",
|
|
75
75
|
transition: "opacity 0.2s ease-in-out",
|
|
76
76
|
...E(),
|
|
77
77
|
...g
|
|
78
78
|
},
|
|
79
|
-
borderRadius:
|
|
80
|
-
children: /* @__PURE__ */ r.jsx(
|
|
81
|
-
var
|
|
82
|
-
return /* @__PURE__ */ r.jsx(
|
|
83
|
-
|
|
79
|
+
borderRadius: j,
|
|
80
|
+
children: /* @__PURE__ */ r.jsx(f, { container: !0, spacing: 2, justifyContent: M(), maxWidth: T(), children: u.map((t, b) => {
|
|
81
|
+
var c;
|
|
82
|
+
return /* @__PURE__ */ r.jsx(f, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ r.jsx(
|
|
83
|
+
C,
|
|
84
84
|
{
|
|
85
85
|
tooltipOptions: { title: t.tooltip, placement: "top" },
|
|
86
86
|
onClick: t.onClick,
|
|
@@ -90,17 +90,19 @@ const T = 40, B = 16, R = ({
|
|
|
90
90
|
sx: {
|
|
91
91
|
margin: 1,
|
|
92
92
|
backgroundColor: t.isActive ? "primary.main" : void 0,
|
|
93
|
+
color: t.isActive ? "primary.contrastText" : void 0,
|
|
93
94
|
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
94
95
|
opacity: t.disabled ? 0.5 : 1,
|
|
95
96
|
"&:hover": {
|
|
96
|
-
backgroundColor: t.isActive ? "primary.
|
|
97
|
+
backgroundColor: t.isActive ? "primary.main" : void 0,
|
|
98
|
+
color: t.isActive ? "primary.contrastText" : void 0
|
|
97
99
|
},
|
|
98
|
-
...(
|
|
100
|
+
...(c = t.iconButtonProps) == null ? void 0 : c.sx
|
|
99
101
|
},
|
|
100
102
|
...t.iconButtonProps,
|
|
101
103
|
children: t.icon
|
|
102
104
|
}
|
|
103
|
-
) }, `${t.tooltip}-${
|
|
105
|
+
) }, `${t.tooltip}-${b}`);
|
|
104
106
|
}) })
|
|
105
107
|
}
|
|
106
108
|
)
|
|
@@ -1,135 +1,100 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Box as m, Stack as M, Typography as
|
|
1
|
+
import { j as t } from "../jsx-runtime-OVHDjVDe.js";
|
|
2
|
+
import { useState as y, useEffect as E } from "react";
|
|
3
|
+
import { Box as m, Stack as M, Typography as d, IconButton as P, Button as R, Collapse as V } from "@mui/material";
|
|
4
4
|
import Y from "../s-avatar/s-avatar.js";
|
|
5
5
|
import { F as q } from "../Favorite-DmSF47XC.js";
|
|
6
6
|
import { c as S } from "../createSvgIcon-Dq42_0tn.js";
|
|
7
7
|
import { E as G } from "../ExpandMore-mZGpvXf6.js";
|
|
8
|
-
const J = S(/* @__PURE__ */
|
|
8
|
+
const J = S(/* @__PURE__ */ t.jsx("path", {
|
|
9
9
|
d: "m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
10
|
-
}), "ExpandLess"), K = S(/* @__PURE__ */
|
|
10
|
+
}), "ExpandLess"), K = S(/* @__PURE__ */ t.jsx("path", {
|
|
11
11
|
d: "M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3m-4.4 15.55-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05"
|
|
12
|
-
}), "FavoriteBorder"), O = S(/* @__PURE__ */
|
|
12
|
+
}), "FavoriteBorder"), O = S(/* @__PURE__ */ t.jsx("path", {
|
|
13
13
|
d: "M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11"
|
|
14
|
-
}), "Reply"), Q = (
|
|
15
|
-
const c = /* @__PURE__ */ new Date(),
|
|
16
|
-
return f < 60 ? "just now" :
|
|
14
|
+
}), "Reply"), Q = (a) => {
|
|
15
|
+
const c = /* @__PURE__ */ new Date(), x = typeof a == "string" ? new Date(a) : a, h = c.getTime() - x.getTime(), f = Math.floor(h / 1e3), s = Math.floor(f / 60), o = Math.floor(s / 60), e = Math.floor(o / 24), l = Math.floor(e / 7), n = Math.floor(e / 30), r = Math.floor(e / 365);
|
|
16
|
+
return f < 60 ? "just now" : s < 60 ? s === 1 ? "1 minute ago" : `${s} minutes ago` : o < 24 ? o === 1 ? "1 hour ago" : `${o} hours ago` : e < 7 ? e === 1 ? "1 day ago" : `${e} days ago` : l < 4 ? l === 1 ? "1 week ago" : `${l} weeks ago` : n < 12 ? n === 1 ? "1 month ago" : `${n} months ago` : r === 1 ? "1 year ago" : `${r} years ago`;
|
|
17
17
|
}, U = ({
|
|
18
|
-
id:
|
|
18
|
+
id: a = Date.now(),
|
|
19
19
|
userName: c,
|
|
20
|
-
userAvatar:
|
|
20
|
+
userAvatar: x,
|
|
21
21
|
commentContent: h,
|
|
22
22
|
datetime: f,
|
|
23
|
-
likes:
|
|
24
|
-
isLiked:
|
|
25
|
-
replies:
|
|
23
|
+
likes: s = 0,
|
|
24
|
+
isLiked: o = !1,
|
|
25
|
+
replies: e = [],
|
|
26
26
|
totalReplies: l,
|
|
27
27
|
onLike: n,
|
|
28
|
-
onReply:
|
|
28
|
+
onReply: r,
|
|
29
29
|
showReplies: p = !0,
|
|
30
|
-
avatarSize:
|
|
31
|
-
level:
|
|
32
|
-
maxLevel:
|
|
33
|
-
children:
|
|
34
|
-
sx:
|
|
30
|
+
avatarSize: L = 48,
|
|
31
|
+
level: w = 0,
|
|
32
|
+
maxLevel: z = 3,
|
|
33
|
+
children: C,
|
|
34
|
+
sx: B = {}
|
|
35
35
|
}) => {
|
|
36
|
-
const [
|
|
37
|
-
j ? (g((i) => Math.max(0, i - 1)), u(!1)) : (g((i) => i + 1), u(!0)), n && n(
|
|
38
|
-
},
|
|
39
|
-
|
|
36
|
+
const [$, g] = y(s), [j, u] = y(o), [I, D] = y(!1), T = () => {
|
|
37
|
+
j ? (g((i) => Math.max(0, i - 1)), u(!1)) : (g((i) => i + 1), u(!0)), n && n(a);
|
|
38
|
+
}, b = () => {
|
|
39
|
+
r && r(a);
|
|
40
40
|
}, F = () => {
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
return
|
|
44
|
-
g(
|
|
45
|
-
}, [
|
|
46
|
-
u(
|
|
47
|
-
}, [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
41
|
+
D(!I);
|
|
42
|
+
}, H = Q(f), v = l ?? e.length, k = v > 0, W = Math.min(w, z) * 2;
|
|
43
|
+
return E(() => {
|
|
44
|
+
g(s);
|
|
45
|
+
}, [s]), E(() => {
|
|
46
|
+
u(o);
|
|
47
|
+
}, [o]), /* @__PURE__ */ t.jsxs(m, { sx: { pl: W, py: 1, ...B }, children: [
|
|
48
|
+
/* @__PURE__ */ t.jsxs(M, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
|
|
49
|
+
/* @__PURE__ */ t.jsx(Y, { avatar: x, name: c, size: L }),
|
|
50
|
+
/* @__PURE__ */ t.jsxs(m, { sx: { flex: 1 }, children: [
|
|
51
|
+
/* @__PURE__ */ t.jsxs(M, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
|
|
52
|
+
/* @__PURE__ */ t.jsx(d, { variant: "subtitle2", fontWeight: "600", children: c }),
|
|
53
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(d, { variant: "caption", color: "text.secondary", children: H }) })
|
|
54
54
|
] }),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ t.jsx(d, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: h }),
|
|
56
|
+
/* @__PURE__ */ t.jsxs(M, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
57
|
+
/* @__PURE__ */ t.jsx(
|
|
58
58
|
P,
|
|
59
59
|
{
|
|
60
60
|
size: "small",
|
|
61
|
-
onClick:
|
|
61
|
+
onClick: T,
|
|
62
62
|
sx: {
|
|
63
|
-
color: j ? "error.main" : "text.secondary"
|
|
64
|
-
p: 0.5,
|
|
65
|
-
"&:hover": {
|
|
66
|
-
backgroundColor: "action.hover"
|
|
67
|
-
}
|
|
63
|
+
color: j ? "error.main" : "text.secondary"
|
|
68
64
|
},
|
|
69
|
-
children: j ? /* @__PURE__ */
|
|
65
|
+
children: j ? /* @__PURE__ */ t.jsx(q, { fontSize: "small" }) : /* @__PURE__ */ t.jsx(K, { fontSize: "small" })
|
|
70
66
|
}
|
|
71
67
|
),
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
68
|
+
$ > 0 && /* @__PURE__ */ t.jsx(d, { variant: "caption", color: "text.secondary", children: $ }),
|
|
69
|
+
/* @__PURE__ */ t.jsx(R, { size: "small", startIcon: /* @__PURE__ */ t.jsx(O, { fontSize: "small" }), onClick: b, variant: "text", children: "Reply" }),
|
|
70
|
+
k && p && /* @__PURE__ */ t.jsxs(
|
|
71
|
+
R,
|
|
75
72
|
{
|
|
76
73
|
size: "small",
|
|
77
|
-
startIcon: /* @__PURE__ */
|
|
78
|
-
onClick: D,
|
|
79
|
-
variant: "text",
|
|
80
|
-
sx: {
|
|
81
|
-
color: "text.secondary",
|
|
82
|
-
textTransform: "none",
|
|
83
|
-
minWidth: "auto",
|
|
84
|
-
px: 1,
|
|
85
|
-
py: 0.5,
|
|
86
|
-
fontSize: "0.75rem",
|
|
87
|
-
"&:hover": {
|
|
88
|
-
backgroundColor: "action.hover"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
children: "Reply"
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
b && p && /* @__PURE__ */ e.jsxs(
|
|
95
|
-
$,
|
|
96
|
-
{
|
|
97
|
-
size: "small",
|
|
98
|
-
startIcon: v ? /* @__PURE__ */ e.jsx(J, { fontSize: "small" }) : /* @__PURE__ */ e.jsx(G, { fontSize: "small" }),
|
|
74
|
+
startIcon: I ? /* @__PURE__ */ t.jsx(J, { fontSize: "small" }) : /* @__PURE__ */ t.jsx(G, { fontSize: "small" }),
|
|
99
75
|
onClick: F,
|
|
100
76
|
variant: "text",
|
|
101
|
-
sx: {
|
|
102
|
-
color: "primary.main",
|
|
103
|
-
textTransform: "none",
|
|
104
|
-
minWidth: "auto",
|
|
105
|
-
px: 1,
|
|
106
|
-
py: 0.5,
|
|
107
|
-
fontSize: "0.75rem",
|
|
108
|
-
"&:hover": {
|
|
109
|
-
backgroundColor: "action.hover"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
77
|
children: [
|
|
113
|
-
|
|
78
|
+
v,
|
|
114
79
|
" ",
|
|
115
|
-
|
|
80
|
+
v === 1 ? "reply" : "replies"
|
|
116
81
|
]
|
|
117
82
|
}
|
|
118
83
|
)
|
|
119
84
|
] }),
|
|
120
|
-
|
|
85
|
+
C && /* @__PURE__ */ t.jsx(m, { sx: { mt: 2 }, children: C })
|
|
121
86
|
] })
|
|
122
87
|
] }),
|
|
123
|
-
|
|
88
|
+
k && p && /* @__PURE__ */ t.jsx(V, { in: I, children: /* @__PURE__ */ t.jsx(m, { sx: { mt: 2 }, children: e.map((i, A) => /* @__PURE__ */ t.jsx(
|
|
124
89
|
U,
|
|
125
90
|
{
|
|
126
91
|
...i,
|
|
127
|
-
level:
|
|
128
|
-
maxLevel:
|
|
92
|
+
level: w + 1,
|
|
93
|
+
maxLevel: z,
|
|
129
94
|
onLike: n,
|
|
130
|
-
onReply:
|
|
95
|
+
onReply: r,
|
|
131
96
|
showReplies: p,
|
|
132
|
-
avatarSize: Math.max(32,
|
|
97
|
+
avatarSize: Math.max(32, L - 8)
|
|
133
98
|
},
|
|
134
99
|
i.id || `reply-${A}`
|
|
135
100
|
)) }) })
|