@solostylist/ui-kit 1.0.142 → 1.0.144

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 _ } from "react";
3
- import { Box as l, Grid as c } from "@mui/material";
4
- import b from "../s-icon-button/s-icon-button.js";
5
- const T = 40, B = 16, R = ({
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: a = "center",
13
- backdropColor: x = "divider",
14
- backdropOpacity: m = 1,
15
- blurAmount: j = 10,
16
- borderRadius: v = 0,
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] = _(!1), h = o !== void 0 ? o : n && I, y = () => {
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 (a) {
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 (a) {
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
- }, k = () => {
52
+ }, T = () => {
53
53
  let t = d;
54
- return s && (t = s * T + (s - 1) * B + s * 16), t;
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(l, { display: "flex", children: /* @__PURE__ */ r.jsxs(l, { position: "relative", onMouseEnter: y, onMouseLeave: A, children: [
58
+ /* @__PURE__ */ r.jsx(a, { display: "flex", children: /* @__PURE__ */ r.jsxs(a, { position: "relative", onMouseEnter: h, onMouseLeave: A, children: [
59
59
  p,
60
- h && /* @__PURE__ */ r.jsx(
61
- l,
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(${j}px)`,
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: v,
80
- children: /* @__PURE__ */ r.jsx(c, { container: !0, spacing: 2, justifyContent: M(), maxWidth: k(), children: u.map((t, C) => {
81
- var f;
82
- return /* @__PURE__ */ r.jsx(c, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ r.jsx(
83
- b,
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.dark" : void 0
97
+ backgroundColor: t.isActive ? "primary.main" : void 0,
98
+ color: t.isActive ? "primary.contrastText" : void 0
97
99
  },
98
- ...(f = t.iconButtonProps) == null ? void 0 : f.sx
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}-${C}`);
105
+ ) }, `${t.tooltip}-${b}`);
104
106
  }) })
105
107
  }
106
108
  )
@@ -12,10 +12,12 @@ export interface SCommentMessageProps {
12
12
  totalReplies?: number;
13
13
  onLike?: (commentId: string | number) => void;
14
14
  onReply?: (commentId: string | number, parentId?: string | number) => void;
15
+ onToggleReplies?: (commentId: string | number) => void;
15
16
  showReplies?: boolean;
16
17
  avatarSize?: number;
17
18
  level?: number;
18
19
  maxLevel?: number;
20
+ loading?: boolean;
19
21
  children?: React.ReactNode;
20
22
  sx?: SxProps;
21
23
  }
@@ -1,140 +1,125 @@
1
- import { j as e } from "../jsx-runtime-OVHDjVDe.js";
2
- import { useState as I, useEffect as T } from "react";
3
- import { Box as m, Stack as M, Typography as x, IconButton as P, Button as $, Collapse as V } from "@mui/material";
4
- import Y from "../s-avatar/s-avatar.js";
5
- import { F as q } from "../Favorite-DmSF47XC.js";
6
- import { c as S } from "../createSvgIcon-Dq42_0tn.js";
7
- import { E as G } from "../ExpandMore-mZGpvXf6.js";
8
- const J = S(/* @__PURE__ */ e.jsx("path", {
1
+ import { j as t } from "../jsx-runtime-OVHDjVDe.js";
2
+ import { useState as S, useEffect as R } from "react";
3
+ import { Box as c, Stack as x, Typography as g, IconButton as q, Button as F, Collapse as G } from "@mui/material";
4
+ import J from "../s-avatar/s-avatar.js";
5
+ import e from "../s-skeleton/s-skeleton.js";
6
+ import { F as K } from "../Favorite-DmSF47XC.js";
7
+ import { c as L } from "../createSvgIcon-Dq42_0tn.js";
8
+ import { E as O } from "../ExpandMore-mZGpvXf6.js";
9
+ const Q = L(/* @__PURE__ */ t.jsx("path", {
9
10
  d: "m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
10
- }), "ExpandLess"), K = S(/* @__PURE__ */ e.jsx("path", {
11
+ }), "ExpandLess"), U = L(/* @__PURE__ */ t.jsx("path", {
11
12
  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__ */ e.jsx("path", {
13
+ }), "FavoriteBorder"), X = L(/* @__PURE__ */ t.jsx("path", {
13
14
  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 = (r) => {
15
- const c = /* @__PURE__ */ new Date(), d = typeof r == "string" ? new Date(r) : r, h = c.getTime() - d.getTime(), f = Math.floor(h / 1e3), o = Math.floor(f / 60), s = Math.floor(o / 60), t = Math.floor(s / 24), l = Math.floor(t / 7), n = Math.floor(t / 30), a = Math.floor(t / 365);
16
- return f < 60 ? "just now" : o < 60 ? o === 1 ? "1 minute ago" : `${o} minutes ago` : s < 24 ? s === 1 ? "1 hour ago" : `${s} hours ago` : t < 7 ? t === 1 ? "1 day ago" : `${t} days ago` : l < 4 ? l === 1 ? "1 week ago" : `${l} weeks ago` : n < 12 ? n === 1 ? "1 month ago" : `${n} months ago` : a === 1 ? "1 year ago" : `${a} years ago`;
17
- }, U = ({
18
- id: r = Date.now(),
19
- userName: c,
20
- userAvatar: d,
21
- commentContent: h,
15
+ }), "Reply"), Z = (i) => {
16
+ const d = /* @__PURE__ */ new Date(), j = typeof i == "string" ? new Date(i) : i, p = d.getTime() - j.getTime(), f = Math.floor(p / 1e3), n = Math.floor(f / 60), o = Math.floor(n / 60), s = Math.floor(o / 24), h = Math.floor(s / 7), r = Math.floor(s / 30), a = Math.floor(s / 365);
17
+ return f < 60 ? "just now" : n < 60 ? n === 1 ? "1 minute ago" : `${n} minutes ago` : o < 24 ? o === 1 ? "1 hour ago" : `${o} hours ago` : s < 7 ? s === 1 ? "1 day ago" : `${s} days ago` : h < 4 ? h === 1 ? "1 week ago" : `${h} weeks ago` : r < 12 ? r === 1 ? "1 month ago" : `${r} months ago` : a === 1 ? "1 year ago" : `${a} years ago`;
18
+ }, _ = ({
19
+ id: i = Date.now(),
20
+ userName: d,
21
+ userAvatar: j,
22
+ commentContent: p,
22
23
  datetime: f,
23
- likes: o = 0,
24
- isLiked: s = !1,
25
- replies: t = [],
26
- totalReplies: l,
27
- onLike: n,
24
+ likes: n = 0,
25
+ isLiked: o = !1,
26
+ replies: s = [],
27
+ totalReplies: h,
28
+ onLike: r,
28
29
  onReply: a,
29
- showReplies: p = !0,
30
- avatarSize: C = 48,
31
- level: z = 0,
32
- maxLevel: L = 3,
33
- children: w,
34
- sx: E = {}
30
+ onToggleReplies: C,
31
+ showReplies: u = !0,
32
+ avatarSize: m = 48,
33
+ level: b = 0,
34
+ maxLevel: z = 3,
35
+ loading: T = !1,
36
+ children: k,
37
+ sx: $ = {}
35
38
  }) => {
36
- const [k, g] = I(o), [j, u] = I(s), [v, R] = I(!1), B = () => {
37
- j ? (g((i) => Math.max(0, i - 1)), u(!1)) : (g((i) => i + 1), u(!0)), n && n(r);
38
- }, D = () => {
39
- a && a(r);
40
- }, F = () => {
41
- R(!v);
42
- }, W = Q(f), y = l ?? t.length, b = y > 0, H = Math.min(z, L) * 2;
43
- return T(() => {
44
- g(o);
45
- }, [o]), T(() => {
46
- u(s);
47
- }, [s]), /* @__PURE__ */ e.jsxs(m, { sx: { pl: H, py: 1, ...E }, children: [
48
- /* @__PURE__ */ e.jsxs(M, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
49
- /* @__PURE__ */ e.jsx(Y, { avatar: d, name: c, size: C }),
50
- /* @__PURE__ */ e.jsxs(m, { sx: { flex: 1 }, children: [
51
- /* @__PURE__ */ e.jsxs(M, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
52
- /* @__PURE__ */ e.jsx(x, { variant: "subtitle2", fontWeight: "600", children: c }),
53
- /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: W }) })
39
+ const [E, v] = S(n), [w, I] = S(o), [y, H] = S(!1), W = () => {
40
+ w ? (v((l) => Math.max(0, l - 1)), I(!1)) : (v((l) => l + 1), I(!0)), r && r(i);
41
+ }, A = () => {
42
+ a && a(i);
43
+ }, P = () => {
44
+ H(!y), C && C(i);
45
+ }, V = Z(f), M = h ?? s.length, B = M > 0, D = Math.min(b, z) * 2;
46
+ return R(() => {
47
+ v(n);
48
+ }, [n]), R(() => {
49
+ I(o);
50
+ }, [o]), T ? /* @__PURE__ */ t.jsx(c, { sx: { pl: D, py: 1, ...$ }, children: /* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
51
+ /* @__PURE__ */ t.jsx(e, { component: "rounded-avatar", width: m, height: m }),
52
+ /* @__PURE__ */ t.jsxs(c, { sx: { flex: 1 }, children: [
53
+ /* @__PURE__ */ t.jsxs(x, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
54
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: 120, height: 20 }),
55
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: 80, height: 16 })
56
+ ] }),
57
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: "100%", height: 16, sx: { mb: 0.5 } }),
58
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: "85%", height: 16, sx: { mb: 0.5 } }),
59
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: "70%", height: 16, sx: { mb: 2 } }),
60
+ /* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 1, alignItems: "center", children: [
61
+ /* @__PURE__ */ t.jsx(e, { component: "icon-button" }),
62
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: 20, height: 16 }),
63
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: 60, height: 32 }),
64
+ /* @__PURE__ */ t.jsx(e, { variant: "text", width: 80, height: 32 })
65
+ ] })
66
+ ] })
67
+ ] }) }) : /* @__PURE__ */ t.jsxs(c, { sx: { pl: D, py: 1, ...$ }, children: [
68
+ /* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
69
+ /* @__PURE__ */ t.jsx(J, { avatar: j, name: d, size: m }),
70
+ /* @__PURE__ */ t.jsxs(c, { sx: { flex: 1 }, children: [
71
+ /* @__PURE__ */ t.jsxs(x, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
72
+ /* @__PURE__ */ t.jsx(g, { variant: "subtitle2", fontWeight: "600", children: d }),
73
+ /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(g, { variant: "caption", color: "text.secondary", children: V }) })
54
74
  ] }),
55
- /* @__PURE__ */ e.jsx(x, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: h }),
56
- /* @__PURE__ */ e.jsxs(M, { direction: "row", spacing: 1, alignItems: "center", children: [
57
- /* @__PURE__ */ e.jsx(
58
- P,
59
- {
60
- size: "small",
61
- onClick: B,
62
- sx: {
63
- color: j ? "error.main" : "text.secondary",
64
- p: 0.5,
65
- "&:hover": {
66
- backgroundColor: "action.hover"
67
- }
68
- },
69
- children: j ? /* @__PURE__ */ e.jsx(q, { fontSize: "small" }) : /* @__PURE__ */ e.jsx(K, { fontSize: "small" })
70
- }
71
- ),
72
- k > 0 && /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: k }),
73
- /* @__PURE__ */ e.jsx(
74
- $,
75
+ /* @__PURE__ */ t.jsx(g, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: p }),
76
+ /* @__PURE__ */ t.jsxs(x, { direction: "row", spacing: 1, alignItems: "center", children: [
77
+ /* @__PURE__ */ t.jsx(
78
+ q,
75
79
  {
76
80
  size: "small",
77
- startIcon: /* @__PURE__ */ e.jsx(O, { fontSize: "small" }),
78
- onClick: D,
79
- variant: "text",
81
+ onClick: W,
80
82
  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
- }
83
+ color: w ? "error.main" : "text.secondary"
90
84
  },
91
- children: "Reply"
85
+ children: w ? /* @__PURE__ */ t.jsx(K, { fontSize: "small" }) : /* @__PURE__ */ t.jsx(U, { fontSize: "small" })
92
86
  }
93
87
  ),
94
- b && p && /* @__PURE__ */ e.jsxs(
95
- $,
88
+ E > 0 && /* @__PURE__ */ t.jsx(g, { variant: "caption", color: "text.secondary", children: E }),
89
+ /* @__PURE__ */ t.jsx(F, { size: "small", startIcon: /* @__PURE__ */ t.jsx(X, { fontSize: "small" }), onClick: A, variant: "text", children: "Reply" }),
90
+ B && u && /* @__PURE__ */ t.jsxs(
91
+ F,
96
92
  {
97
93
  size: "small",
98
- startIcon: v ? /* @__PURE__ */ e.jsx(J, { fontSize: "small" }) : /* @__PURE__ */ e.jsx(G, { fontSize: "small" }),
99
- onClick: F,
94
+ startIcon: y ? /* @__PURE__ */ t.jsx(Q, { fontSize: "small" }) : /* @__PURE__ */ t.jsx(O, { fontSize: "small" }),
95
+ onClick: P,
100
96
  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
97
  children: [
113
- y,
98
+ M,
114
99
  " ",
115
- y === 1 ? "reply" : "replies"
100
+ M === 1 ? "reply" : "replies"
116
101
  ]
117
102
  }
118
103
  )
119
104
  ] }),
120
- w && /* @__PURE__ */ e.jsx(m, { sx: { mt: 2 }, children: w })
105
+ k && /* @__PURE__ */ t.jsx(c, { sx: { mt: 2 }, children: k })
121
106
  ] })
122
107
  ] }),
123
- b && p && /* @__PURE__ */ e.jsx(V, { in: v, children: /* @__PURE__ */ e.jsx(m, { sx: { mt: 2 }, children: t.map((i, A) => /* @__PURE__ */ e.jsx(
124
- U,
108
+ B && u && /* @__PURE__ */ t.jsx(G, { in: y, children: /* @__PURE__ */ t.jsx(c, { sx: { mt: 2 }, children: s.map((l, Y) => /* @__PURE__ */ t.jsx(
109
+ _,
125
110
  {
126
- ...i,
127
- level: z + 1,
128
- maxLevel: L,
129
- onLike: n,
111
+ ...l,
112
+ level: b + 1,
113
+ maxLevel: z,
114
+ onLike: r,
130
115
  onReply: a,
131
- showReplies: p,
132
- avatarSize: Math.max(32, C - 8)
116
+ showReplies: u,
117
+ avatarSize: Math.max(32, m - 8)
133
118
  },
134
- i.id || `reply-${A}`
119
+ l.id || `reply-${Y}`
135
120
  )) }) })
136
121
  ] });
137
122
  };
138
123
  export {
139
- U as default
124
+ _ as default
140
125
  };
@@ -16,6 +16,8 @@ export interface SReviewProps {
16
16
  avatarSize?: number;
17
17
  maxRating?: number;
18
18
  readOnly?: boolean;
19
+ showDivider?: boolean;
20
+ loading?: boolean;
19
21
  sx?: SxProps;
20
22
  }
21
23
  declare const SReview: React.FC<SReviewProps>;
@@ -1,70 +1,93 @@
1
1
  import { j as e } from "../jsx-runtime-OVHDjVDe.js";
2
- import { useState as g, useEffect as A } from "react";
3
- import { Box as b, Stack as p, Typography as i, IconButton as T, Divider as F } from "@mui/material";
4
- import N from "../s-avatar/s-avatar.js";
5
- import q from "../s-image-modal/s-image-modal.js";
6
- import G from "../s-lazy-image/s-lazy-image.js";
7
- import J from "../s-rating/s-rating.js";
8
- import { c as $ } from "../createSvgIcon-Dq42_0tn.js";
9
- const K = $(/* @__PURE__ */ e.jsx("path", {
2
+ import { useState as j, useEffect as G } from "react";
3
+ import { Box as h, Stack as a, Divider as D, Typography as x, IconButton as H } from "@mui/material";
4
+ import J from "../s-avatar/s-avatar.js";
5
+ import K from "../s-image-modal/s-image-modal.js";
6
+ import P from "../s-lazy-image/s-lazy-image.js";
7
+ import Q from "../s-rating/s-rating.js";
8
+ import r from "../s-skeleton/s-skeleton.js";
9
+ import { c as L } from "../createSvgIcon-Dq42_0tn.js";
10
+ const X = L(/* @__PURE__ */ e.jsx("path", {
10
11
  d: "M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2m4 0v12h4V3z"
11
- }), "ThumbDown"), P = $(/* @__PURE__ */ e.jsx("path", {
12
+ }), "ThumbDown"), Z = L(/* @__PURE__ */ e.jsx("path", {
12
13
  d: "M1 21h4V9H1zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73z"
13
- }), "ThumbUp"), Q = (r) => {
14
- const c = /* @__PURE__ */ new Date(), y = typeof r == "string" ? new Date(r) : r, j = c.getTime() - y.getTime(), u = Math.floor(j / 1e3), l = Math.floor(u / 60), s = Math.floor(l / 60), a = Math.floor(s / 24), h = Math.floor(a / 7), m = Math.floor(a / 30), f = Math.floor(a / 365);
15
- return u < 60 ? "just now" : l < 60 ? l === 1 ? "1 minute ago" : `${l} minutes ago` : s < 24 ? s === 1 ? "1 hour ago" : `${s} hours ago` : a < 7 ? a === 1 ? "1 day ago" : `${a} days ago` : h < 4 ? h === 1 ? "1 week ago" : `${h} weeks ago` : m < 12 ? m === 1 ? "1 month ago" : `${m} months ago` : f === 1 ? "1 year ago" : `${f} years ago`;
16
- }, ae = ({
17
- id: r = Date.now(),
18
- userName: c,
19
- userAvatar: y,
20
- rating: j,
21
- reviewContent: u,
22
- datetime: l,
14
+ }), "ThumbUp"), _ = (l) => {
15
+ const m = /* @__PURE__ */ new Date(), v = typeof l == "string" ? new Date(l) : l, y = m.getTime() - v.getTime(), w = Math.floor(y / 1e3), c = Math.floor(w / 60), s = Math.floor(c / 60), i = Math.floor(s / 24), d = Math.floor(i / 7), f = Math.floor(i / 30), g = Math.floor(i / 365);
16
+ return w < 60 ? "just now" : c < 60 ? c === 1 ? "1 minute ago" : `${c} minutes ago` : s < 24 ? s === 1 ? "1 hour ago" : `${s} hours ago` : i < 7 ? i === 1 ? "1 day ago" : `${i} days ago` : d < 4 ? d === 1 ? "1 week ago" : `${d} weeks ago` : f < 12 ? f === 1 ? "1 month ago" : `${f} months ago` : g === 1 ? "1 year ago" : `${g} years ago`;
17
+ }, ce = ({
18
+ id: l = Date.now(),
19
+ userName: m,
20
+ userAvatar: v,
21
+ rating: y,
22
+ reviewContent: w,
23
+ datetime: c,
23
24
  images: s,
24
- userHelpfulVote: a = null,
25
- helpfulYes: h = 0,
26
- helpfulNo: m = 0,
27
- onHelpfulVote: f,
28
- showHelpfulSection: k = !0,
29
- avatarSize: z = 48,
30
- maxRating: D = 5,
31
- readOnly: H = !0,
32
- sx: L = {}
25
+ userHelpfulVote: i = null,
26
+ helpfulYes: d = 0,
27
+ helpfulNo: f = 0,
28
+ onHelpfulVote: g,
29
+ showHelpfulSection: R = !0,
30
+ avatarSize: I = 48,
31
+ maxRating: V = 5,
32
+ readOnly: W = !0,
33
+ showDivider: S = !0,
34
+ loading: E = !1,
35
+ sx: T = {}
33
36
  }) => {
34
- const [R, v] = g(h), [V, w] = g(m), [d, I] = g(a), [W, C] = g(!1), [E, M] = g(null), S = (t) => {
35
- let n = t;
36
- d === t ? (t === "yes" ? v((o) => Math.max(0, o - 1)) : w((o) => Math.max(0, o - 1)), I(null), n = null) : (d === "yes" ? v((o) => Math.max(0, o - 1)) : d === "no" && w((o) => Math.max(0, o - 1)), t === "yes" ? v((o) => o + 1) : w((o) => o + 1), I(t), n = t), f && f(r, n);
37
- }, x = (s == null ? void 0 : s.map((t, n) => ({
38
- id: `review-${r}-image-${n}`,
37
+ const [O, M] = j(d), [U, b] = j(f), [p, k] = j(i), [Y, $] = j(!1), [B, C] = j(null), z = (n) => {
38
+ let o = n;
39
+ p === n ? (n === "yes" ? M((t) => Math.max(0, t - 1)) : b((t) => Math.max(0, t - 1)), k(null), o = null) : (p === "yes" ? M((t) => Math.max(0, t - 1)) : p === "no" && b((t) => Math.max(0, t - 1)), n === "yes" ? M((t) => t + 1) : b((t) => t + 1), k(n), o = n), g && g(l, o);
40
+ }, u = (s == null ? void 0 : s.map((n, o) => ({
41
+ id: `review-${l}-image-${o}`,
39
42
  type: "image",
40
- url: t,
41
- title: `Review image ${n + 1}`,
42
- desc: `Image ${n + 1} from ${c}'s review`
43
- }))) || [], O = (t) => {
44
- const n = x[t];
45
- n && (M(n), C(!0));
46
- }, U = () => {
47
- C(!1), M(null);
48
- }, Y = (t) => {
49
- M(t);
50
- }, B = Q(l);
51
- return A(() => {
52
- I(a);
53
- }, [a]), /* @__PURE__ */ e.jsxs(b, { sx: { py: 2, ...L }, children: [
54
- /* @__PURE__ */ e.jsxs(p, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
55
- /* @__PURE__ */ e.jsx(N, { avatar: y, name: c, size: z }),
56
- /* @__PURE__ */ e.jsxs(b, { sx: { flex: 1 }, children: [
57
- /* @__PURE__ */ e.jsxs(p, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
58
- /* @__PURE__ */ e.jsx(i, { variant: "subtitle2", fontWeight: "600", children: c }),
59
- /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(i, { variant: "caption", color: "text.secondary", children: B }) })
43
+ url: n,
44
+ title: `Review image ${o + 1}`,
45
+ desc: `Image ${o + 1} from ${m}'s review`
46
+ }))) || [], A = (n) => {
47
+ const o = u[n];
48
+ o && (C(o), $(!0));
49
+ }, F = () => {
50
+ $(!1), C(null);
51
+ }, N = (n) => {
52
+ C(n);
53
+ }, q = _(c);
54
+ return G(() => {
55
+ k(i);
56
+ }, [i]), E ? /* @__PURE__ */ e.jsxs(h, { sx: { py: 2, ...T }, children: [
57
+ /* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
58
+ /* @__PURE__ */ e.jsx(r, { component: "rounded-avatar", width: I, height: I }),
59
+ /* @__PURE__ */ e.jsxs(h, { sx: { flex: 1 }, children: [
60
+ /* @__PURE__ */ e.jsxs(a, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
61
+ /* @__PURE__ */ e.jsx(r, { variant: "text", width: 120, height: 20 }),
62
+ /* @__PURE__ */ e.jsx(r, { variant: "text", width: 80, height: 16 })
60
63
  ] }),
61
- /* @__PURE__ */ e.jsx(b, { sx: { mb: 1 }, children: /* @__PURE__ */ e.jsx(J, { value: j, max: D, readOnly: H, size: "small" }) }),
62
- /* @__PURE__ */ e.jsx(i, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: u }),
63
- s && s.length > 0 && /* @__PURE__ */ e.jsx(p, { direction: "row", spacing: 1, sx: { mb: 2, flexWrap: "wrap", gap: 1 }, children: s.map((t, n) => /* @__PURE__ */ e.jsx(
64
- G,
64
+ /* @__PURE__ */ e.jsx(h, { sx: { mb: 1 }, children: /* @__PURE__ */ e.jsx(r, { variant: "text", width: 100, height: 20 }) }),
65
+ /* @__PURE__ */ e.jsx(r, { variant: "text", width: "100%", height: 16, sx: { mb: 0.5 } }),
66
+ /* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 1, sx: { display: "inline-flex", alignItems: "center" }, children: [
67
+ /* @__PURE__ */ e.jsx(r, { variant: "text", width: 140, height: 16, sx: { mr: 2 } }),
68
+ /* @__PURE__ */ e.jsx(r, { component: "icon-button" }),
69
+ /* @__PURE__ */ e.jsx(r, { variant: "text", width: 20, height: 16 }),
70
+ /* @__PURE__ */ e.jsx(r, { component: "icon-button" }),
71
+ /* @__PURE__ */ e.jsx(r, { variant: "text", width: 20, height: 16 })
72
+ ] })
73
+ ] })
74
+ ] }),
75
+ S && /* @__PURE__ */ e.jsx(D, { sx: { mt: 2 } })
76
+ ] }) : /* @__PURE__ */ e.jsxs(h, { sx: { py: 2, ...T }, children: [
77
+ /* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
78
+ /* @__PURE__ */ e.jsx(J, { avatar: v, name: m, size: I }),
79
+ /* @__PURE__ */ e.jsxs(h, { sx: { flex: 1 }, children: [
80
+ /* @__PURE__ */ e.jsxs(a, { direction: "row", alignItems: "center", spacing: 2, mb: 1, children: [
81
+ /* @__PURE__ */ e.jsx(x, { variant: "subtitle2", fontWeight: "600", children: m }),
82
+ /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: q }) })
83
+ ] }),
84
+ /* @__PURE__ */ e.jsx(h, { sx: { mb: 1 }, children: /* @__PURE__ */ e.jsx(Q, { value: y, max: V, readOnly: W, size: "small" }) }),
85
+ /* @__PURE__ */ e.jsx(x, { variant: "body2", sx: { mb: 2, lineHeight: 1.6 }, children: w }),
86
+ s && s.length > 0 && /* @__PURE__ */ e.jsx(a, { direction: "row", spacing: 1, sx: { mb: 2, flexWrap: "wrap", gap: 1 }, children: s.map((n, o) => /* @__PURE__ */ e.jsx(
87
+ P,
65
88
  {
66
- src: t,
67
- alt: `Review image ${n + 1}`,
89
+ src: n,
90
+ alt: `Review image ${o + 1}`,
68
91
  width: 80,
69
92
  height: 80,
70
93
  variant: "rounded",
@@ -72,68 +95,68 @@ const K = $(/* @__PURE__ */ e.jsx("path", {
72
95
  objectFit: "cover",
73
96
  cursor: "pointer"
74
97
  },
75
- onClick: () => O(n),
76
- onMouseEnter: (o) => {
77
- o.currentTarget.style.opacity = "0.8";
98
+ onClick: () => A(o),
99
+ onMouseEnter: (t) => {
100
+ t.currentTarget.style.opacity = "0.8";
78
101
  },
79
- onMouseLeave: (o) => {
80
- o.currentTarget.style.opacity = "1";
102
+ onMouseLeave: (t) => {
103
+ t.currentTarget.style.opacity = "1";
81
104
  }
82
105
  },
83
- n
106
+ o
84
107
  )) }),
85
- k && /* @__PURE__ */ e.jsxs(p, { direction: "row", spacing: 1, sx: { display: "inline-flex", alignItems: "center" }, children: [
86
- /* @__PURE__ */ e.jsx(i, { variant: "caption", color: "text.secondary", sx: { mr: 2 }, children: "Was this review helpful?" }),
108
+ R && /* @__PURE__ */ e.jsxs(a, { direction: "row", spacing: 1, sx: { display: "inline-flex", alignItems: "center" }, children: [
109
+ /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", sx: { mr: 2 }, children: "Was this review helpful?" }),
87
110
  /* @__PURE__ */ e.jsx(
88
- T,
111
+ H,
89
112
  {
90
113
  size: "small",
91
- onClick: () => S("yes"),
114
+ onClick: () => z("yes"),
92
115
  sx: {
93
- color: d === "yes" ? "primary.main" : "text.secondary",
116
+ color: p === "yes" ? "primary.main" : "text.secondary",
94
117
  "&:hover": {
95
118
  backgroundColor: "action.hover"
96
119
  }
97
120
  },
98
- children: /* @__PURE__ */ e.jsx(P, { fontSize: "small" })
121
+ children: /* @__PURE__ */ e.jsx(Z, { fontSize: "small" })
99
122
  }
100
123
  ),
101
- /* @__PURE__ */ e.jsx(i, { variant: "caption", color: "text.secondary", children: R }),
124
+ /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: O }),
102
125
  /* @__PURE__ */ e.jsx(
103
- T,
126
+ H,
104
127
  {
105
128
  size: "small",
106
- onClick: () => S("no"),
129
+ onClick: () => z("no"),
107
130
  sx: {
108
- color: d === "no" ? "error.main" : "text.secondary",
131
+ color: p === "no" ? "error.main" : "text.secondary",
109
132
  ml: 1,
110
133
  "&:hover": {
111
134
  backgroundColor: "action.hover"
112
135
  }
113
136
  },
114
- children: /* @__PURE__ */ e.jsx(K, { fontSize: "small" })
137
+ children: /* @__PURE__ */ e.jsx(X, { fontSize: "small" })
115
138
  }
116
139
  ),
117
- /* @__PURE__ */ e.jsx(i, { variant: "caption", color: "text.secondary", children: V })
140
+ /* @__PURE__ */ e.jsx(x, { variant: "caption", color: "text.secondary", children: U })
118
141
  ] })
119
142
  ] })
120
143
  ] }),
121
- /* @__PURE__ */ e.jsx(F, { sx: { mt: 2 } }),
144
+ S && /* @__PURE__ */ e.jsx(D, { sx: { mt: 2 } }),
122
145
  /* @__PURE__ */ e.jsx(
123
- q,
146
+ K,
124
147
  {
125
- isOpen: W,
126
- onClose: U,
127
- selectedItem: E,
128
- onItemChange: Y,
129
- mediaItems: x,
130
- showNavigation: x.length > 1,
131
- showThumbnailDock: x.length > 1,
132
- showCounter: x.length > 1
148
+ isOpen: Y,
149
+ onClose: F,
150
+ selectedItem: B,
151
+ onItemChange: N,
152
+ mediaItems: u,
153
+ showNavigation: u.length > 1,
154
+ showThumbnailDock: u.length > 1,
155
+ showCounter: u.length > 1
133
156
  }
134
157
  )
135
158
  ] });
136
159
  };
137
160
  export {
138
- ae as default
161
+ ce as default
139
162
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.142",
6
+ "version": "1.0.144",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "private": false,
9
9
  "type": "module",