elseware-ui 2.31.8 → 2.31.9
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/index.css +75 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +50 -33
- package/dist/index.d.ts +50 -33
- package/dist/index.js +115 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +115 -112
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -17483,7 +17483,7 @@ function CommentComposer({
|
|
|
17483
17483
|
}
|
|
17484
17484
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
17485
17485
|
/* @__PURE__ */ jsx(Avatar, { src: avatar, size: "md" }),
|
|
17486
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex
|
|
17486
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-3", children: [
|
|
17487
17487
|
/* @__PURE__ */ jsx(
|
|
17488
17488
|
"textarea",
|
|
17489
17489
|
{
|
|
@@ -17492,7 +17492,7 @@ function CommentComposer({
|
|
|
17492
17492
|
placeholder,
|
|
17493
17493
|
onFocus: () => setFocused(true),
|
|
17494
17494
|
onChange: (e) => setValue(e.target.value),
|
|
17495
|
-
className: "
|
|
17495
|
+
className: "min-h-[56px] w-full resize-none border-b border-gray-300 bg-transparent pb-2 text-sm outline-none dark:border-neutral-700"
|
|
17496
17496
|
}
|
|
17497
17497
|
),
|
|
17498
17498
|
(focused || value.length > 0) && /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
@@ -17532,56 +17532,44 @@ function CommentActions({
|
|
|
17532
17532
|
const liked = comment.liked ?? false;
|
|
17533
17533
|
const disliked = comment.disliked ?? false;
|
|
17534
17534
|
const canReply = comment.permissions?.canReply ?? true;
|
|
17535
|
-
return /* @__PURE__ */ jsxs(
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
{
|
|
17543
|
-
onClick: onLike,
|
|
17544
|
-
className: `
|
|
17545
|
-
inline-flex
|
|
17546
|
-
items-center
|
|
17547
|
-
gap-1
|
|
17548
|
-
transition-colors
|
|
17535
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-5 text-sm text-gray-500 dark:text-gray-400", children: [
|
|
17536
|
+
/* @__PURE__ */ jsxs(
|
|
17537
|
+
"button",
|
|
17538
|
+
{
|
|
17539
|
+
onClick: onLike,
|
|
17540
|
+
className: `
|
|
17541
|
+
inline-flex items-center gap-1 transition-colors
|
|
17549
17542
|
${liked ? "text-blue-500" : "hover:text-gray-900 dark:hover:text-gray-100"}
|
|
17550
17543
|
`,
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
inline-flex
|
|
17563
|
-
items-center
|
|
17564
|
-
gap-1
|
|
17565
|
-
transition-colors
|
|
17544
|
+
children: [
|
|
17545
|
+
liked ? /* @__PURE__ */ jsx(BiSolidLike, { size: 18 }) : /* @__PURE__ */ jsx(BiLike, { size: 18 }),
|
|
17546
|
+
/* @__PURE__ */ jsx("span", { children: likes })
|
|
17547
|
+
]
|
|
17548
|
+
}
|
|
17549
|
+
),
|
|
17550
|
+
/* @__PURE__ */ jsxs(
|
|
17551
|
+
"button",
|
|
17552
|
+
{
|
|
17553
|
+
onClick: onDislike,
|
|
17554
|
+
className: `
|
|
17555
|
+
inline-flex items-center gap-1 transition-colors
|
|
17566
17556
|
${disliked ? "text-red-500" : "hover:text-gray-900 dark:hover:text-gray-100"}
|
|
17567
17557
|
`,
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
|
|
17577
|
-
|
|
17578
|
-
|
|
17579
|
-
|
|
17580
|
-
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
}
|
|
17584
|
-
);
|
|
17558
|
+
children: [
|
|
17559
|
+
disliked ? /* @__PURE__ */ jsx(BiSolidDislike, { size: 18 }) : /* @__PURE__ */ jsx(BiDislike, { size: 18 }),
|
|
17560
|
+
/* @__PURE__ */ jsx("span", { children: dislikes })
|
|
17561
|
+
]
|
|
17562
|
+
}
|
|
17563
|
+
),
|
|
17564
|
+
canReply && /* @__PURE__ */ jsx(
|
|
17565
|
+
"button",
|
|
17566
|
+
{
|
|
17567
|
+
onClick: onReply,
|
|
17568
|
+
className: "font-medium transition-colors hover:text-gray-900 dark:hover:text-gray-100",
|
|
17569
|
+
children: "Reply"
|
|
17570
|
+
}
|
|
17571
|
+
)
|
|
17572
|
+
] });
|
|
17585
17573
|
}
|
|
17586
17574
|
var CommentActions_default = CommentActions;
|
|
17587
17575
|
function CommentContent({ comment }) {
|
|
@@ -17674,63 +17662,57 @@ function CommentMenu({
|
|
|
17674
17662
|
{
|
|
17675
17663
|
type: "button",
|
|
17676
17664
|
onClick: () => setOpen(!open),
|
|
17677
|
-
className: "
|
|
17665
|
+
className: "text-gray-500 transition-colors hover:text-gray-900 dark:hover:text-gray-100",
|
|
17678
17666
|
children: /* @__PURE__ */ jsx(BiDotsVerticalRounded, { size: 18 })
|
|
17679
17667
|
}
|
|
17680
17668
|
),
|
|
17681
|
-
open && /* @__PURE__ */ jsxs(
|
|
17682
|
-
|
|
17683
|
-
|
|
17684
|
-
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
]
|
|
17729
|
-
}
|
|
17730
|
-
)
|
|
17731
|
-
]
|
|
17732
|
-
}
|
|
17733
|
-
)
|
|
17669
|
+
open && /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-full z-50 mt-2 min-w-[180px] overflow-hidden rounded-xl border border-gray-200 bg-white shadow-xl dark:border-neutral-800 dark:bg-neutral-900", children: [
|
|
17670
|
+
canEdit && /* @__PURE__ */ jsxs(
|
|
17671
|
+
"button",
|
|
17672
|
+
{
|
|
17673
|
+
type: "button",
|
|
17674
|
+
onClick: () => {
|
|
17675
|
+
setOpen(false);
|
|
17676
|
+
onEdit?.();
|
|
17677
|
+
},
|
|
17678
|
+
className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800",
|
|
17679
|
+
children: [
|
|
17680
|
+
/* @__PURE__ */ jsx(BiEdit, {}),
|
|
17681
|
+
"Edit"
|
|
17682
|
+
]
|
|
17683
|
+
}
|
|
17684
|
+
),
|
|
17685
|
+
canDelete && /* @__PURE__ */ jsxs(
|
|
17686
|
+
"button",
|
|
17687
|
+
{
|
|
17688
|
+
type: "button",
|
|
17689
|
+
onClick: () => {
|
|
17690
|
+
setOpen(false);
|
|
17691
|
+
onDelete?.();
|
|
17692
|
+
},
|
|
17693
|
+
className: "flex w-full items-center gap-2 px-4 py-3 text-sm text-red-500 hover:bg-gray-100 dark:hover:bg-neutral-800",
|
|
17694
|
+
children: [
|
|
17695
|
+
/* @__PURE__ */ jsx(BiTrash, {}),
|
|
17696
|
+
"Delete"
|
|
17697
|
+
]
|
|
17698
|
+
}
|
|
17699
|
+
),
|
|
17700
|
+
canReport && /* @__PURE__ */ jsxs(
|
|
17701
|
+
"button",
|
|
17702
|
+
{
|
|
17703
|
+
type: "button",
|
|
17704
|
+
onClick: () => {
|
|
17705
|
+
setOpen(false);
|
|
17706
|
+
onReport?.();
|
|
17707
|
+
},
|
|
17708
|
+
className: "flex w-full items-center gap-2 px-4 py-3 text-sm hover:bg-gray-100 dark:hover:bg-neutral-800",
|
|
17709
|
+
children: [
|
|
17710
|
+
/* @__PURE__ */ jsx(BiFlag, {}),
|
|
17711
|
+
"Report"
|
|
17712
|
+
]
|
|
17713
|
+
}
|
|
17714
|
+
)
|
|
17715
|
+
] })
|
|
17734
17716
|
] });
|
|
17735
17717
|
}
|
|
17736
17718
|
var CommentMenu_default = CommentMenu;
|
|
@@ -17748,7 +17730,7 @@ function CommentRepliesToggle({
|
|
|
17748
17730
|
{
|
|
17749
17731
|
type: "button",
|
|
17750
17732
|
onClick: onToggle,
|
|
17751
|
-
className: "
|
|
17733
|
+
className: "inline-flex w-fit items-center gap-1 text-sm font-medium text-blue-500 transition-colors hover:text-blue-400",
|
|
17752
17734
|
children: [
|
|
17753
17735
|
collapsed ? /* @__PURE__ */ jsx(BiChevronDown, { size: 18 }) : /* @__PURE__ */ jsx(BiChevronUp, { size: 18 }),
|
|
17754
17736
|
/* @__PURE__ */ jsx("span", { children: label })
|
|
@@ -17760,7 +17742,10 @@ var CommentRepliesToggle_default = CommentRepliesToggle;
|
|
|
17760
17742
|
function ReplyComposer({
|
|
17761
17743
|
avatar,
|
|
17762
17744
|
username,
|
|
17745
|
+
placeholder,
|
|
17746
|
+
submitLabel = "Reply",
|
|
17763
17747
|
loading,
|
|
17748
|
+
disabled,
|
|
17764
17749
|
onSubmit
|
|
17765
17750
|
}) {
|
|
17766
17751
|
return /* @__PURE__ */ jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsx(
|
|
@@ -17768,20 +17753,18 @@ function ReplyComposer({
|
|
|
17768
17753
|
{
|
|
17769
17754
|
avatar,
|
|
17770
17755
|
loading,
|
|
17771
|
-
|
|
17772
|
-
|
|
17756
|
+
disabled,
|
|
17757
|
+
submitLabel,
|
|
17758
|
+
placeholder: placeholder ?? `Reply to @${username}`,
|
|
17773
17759
|
onSubmit
|
|
17774
17760
|
}
|
|
17775
17761
|
) });
|
|
17776
17762
|
}
|
|
17777
17763
|
var ReplyComposer_default = ReplyComposer;
|
|
17778
|
-
|
|
17779
|
-
// src/compositions/comment-thread/constants/comment.constants.ts
|
|
17780
|
-
var MAX_COMMENT_DEPTH = 5;
|
|
17781
|
-
var COMMENT_INDENTATION = 24;
|
|
17782
17764
|
function CommentItem({
|
|
17783
17765
|
comment,
|
|
17784
17766
|
depth = 0,
|
|
17767
|
+
config,
|
|
17785
17768
|
components,
|
|
17786
17769
|
onLike,
|
|
17787
17770
|
onDislike,
|
|
@@ -17792,7 +17775,7 @@ function CommentItem({
|
|
|
17792
17775
|
}) {
|
|
17793
17776
|
const [collapsed, setCollapsed] = useState(false);
|
|
17794
17777
|
const [isReplying, setIsReplying] = useState(false);
|
|
17795
|
-
const resolvedDepth = Math.min(depth,
|
|
17778
|
+
const resolvedDepth = Math.min(depth, config.maxDepth);
|
|
17796
17779
|
const {
|
|
17797
17780
|
Header: HeaderComponent = CommentHeader_default,
|
|
17798
17781
|
Content: ContentComponent = CommentContent_default,
|
|
@@ -17811,7 +17794,7 @@ function CommentItem({
|
|
|
17811
17794
|
{
|
|
17812
17795
|
className: "flex flex-col gap-4",
|
|
17813
17796
|
style: {
|
|
17814
|
-
paddingLeft: resolvedDepth *
|
|
17797
|
+
paddingLeft: resolvedDepth * config.indentation
|
|
17815
17798
|
},
|
|
17816
17799
|
children: [
|
|
17817
17800
|
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-3 min-w-0", children: [
|
|
@@ -17847,6 +17830,8 @@ function CommentItem({
|
|
|
17847
17830
|
{
|
|
17848
17831
|
avatar: comment.author?.avatar,
|
|
17849
17832
|
username: comment.author?.username,
|
|
17833
|
+
placeholder: `Reply to @${comment.author?.username}`,
|
|
17834
|
+
submitLabel: "Reply",
|
|
17850
17835
|
onSubmit: handleReply
|
|
17851
17836
|
}
|
|
17852
17837
|
),
|
|
@@ -17871,6 +17856,7 @@ function CommentItem({
|
|
|
17871
17856
|
{
|
|
17872
17857
|
comments: comment.replies,
|
|
17873
17858
|
depth: depth + 1,
|
|
17859
|
+
config,
|
|
17874
17860
|
components,
|
|
17875
17861
|
onLike,
|
|
17876
17862
|
onDislike,
|
|
@@ -17890,6 +17876,7 @@ var CommentItem_default = CommentItem;
|
|
|
17890
17876
|
function CommentList({
|
|
17891
17877
|
comments,
|
|
17892
17878
|
depth = 0,
|
|
17879
|
+
config,
|
|
17893
17880
|
components,
|
|
17894
17881
|
onLike,
|
|
17895
17882
|
onDislike,
|
|
@@ -17906,6 +17893,7 @@ function CommentList({
|
|
|
17906
17893
|
{
|
|
17907
17894
|
comment,
|
|
17908
17895
|
depth,
|
|
17896
|
+
config,
|
|
17909
17897
|
components,
|
|
17910
17898
|
onLike,
|
|
17911
17899
|
onDislike,
|
|
@@ -17971,18 +17959,30 @@ function insertReply(comments, parentId, reply) {
|
|
|
17971
17959
|
};
|
|
17972
17960
|
});
|
|
17973
17961
|
}
|
|
17962
|
+
|
|
17963
|
+
// src/compositions/comment-thread/constants/comment.constants.ts
|
|
17964
|
+
var DEFAULT_COMMENT_THREAD_CONFIG = {
|
|
17965
|
+
maxDepth: 5,
|
|
17966
|
+
indentation: 24,
|
|
17967
|
+
dateFormat: "relative"
|
|
17968
|
+
};
|
|
17974
17969
|
function CommentThread({
|
|
17975
17970
|
currentUser,
|
|
17976
17971
|
dataSource,
|
|
17977
17972
|
loading = false,
|
|
17978
17973
|
components,
|
|
17974
|
+
config,
|
|
17979
17975
|
onEdit,
|
|
17980
17976
|
onDelete,
|
|
17981
17977
|
onReport
|
|
17982
17978
|
}) {
|
|
17983
17979
|
const [comments, setComments] = useState([]);
|
|
17984
17980
|
const [isLoadingComments, setIsLoadingComments] = useState(true);
|
|
17985
|
-
const ComposerComponent = components?.
|
|
17981
|
+
const ComposerComponent = components?.Composer ?? CommentComposer_default;
|
|
17982
|
+
const resolvedConfig = {
|
|
17983
|
+
...DEFAULT_COMMENT_THREAD_CONFIG,
|
|
17984
|
+
...config
|
|
17985
|
+
};
|
|
17986
17986
|
useEffect(() => {
|
|
17987
17987
|
async function loadComments() {
|
|
17988
17988
|
try {
|
|
@@ -18060,6 +18060,8 @@ function CommentThread({
|
|
|
18060
18060
|
ComposerComponent,
|
|
18061
18061
|
{
|
|
18062
18062
|
avatar: currentUser.avatar,
|
|
18063
|
+
placeholder: "Add a comment...",
|
|
18064
|
+
submitLabel: "Comment",
|
|
18063
18065
|
onSubmit: handleCreateComment
|
|
18064
18066
|
}
|
|
18065
18067
|
),
|
|
@@ -18068,6 +18070,7 @@ function CommentThread({
|
|
|
18068
18070
|
{
|
|
18069
18071
|
comments,
|
|
18070
18072
|
components,
|
|
18073
|
+
config: resolvedConfig,
|
|
18071
18074
|
onLike: handleLike,
|
|
18072
18075
|
onDislike: handleDislike,
|
|
18073
18076
|
onReply: handleReply,
|