@copilotz/chat-ui 0.9.9 → 0.9.11
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.cjs +78 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +78 -70
- package/dist/index.js.map +1 -1
- package/dist/styles.css +29 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2701,25 +2701,32 @@ var Sidebar2 = ({
|
|
|
2701
2701
|
inputRef.current.select();
|
|
2702
2702
|
}
|
|
2703
2703
|
}, [editingThreadId]);
|
|
2704
|
+
const normalizedSearchQuery = searchQuery.trim().toLowerCase();
|
|
2705
|
+
const threadMatchesTitle = (thread) => !normalizedSearchQuery || (thread.title ?? "").toString().toLowerCase().includes(
|
|
2706
|
+
normalizedSearchQuery
|
|
2707
|
+
);
|
|
2708
|
+
const tagMatchesSearch = (tag) => !normalizedSearchQuery || tag.name.toLowerCase().includes(normalizedSearchQuery) || tag.id.toLowerCase().includes(normalizedSearchQuery);
|
|
2709
|
+
const threadMatchesSearch = (thread) => threadMatchesTitle(thread) || (thread.tags ?? []).some(tagMatchesSearch);
|
|
2704
2710
|
const filteredThreads = threads.filter((thread) => {
|
|
2705
|
-
const title = (thread.title ?? "").toString();
|
|
2706
|
-
const matchesSearch = title.toLowerCase().includes(searchQuery.toLowerCase());
|
|
2707
2711
|
const matchesArchiveFilter = showArchived || !thread.isArchived;
|
|
2708
|
-
return
|
|
2712
|
+
return threadMatchesSearch(thread) && matchesArchiveFilter;
|
|
2709
2713
|
});
|
|
2710
2714
|
const allTags = useMemo3(() => collectThreadTags(threads), [threads]);
|
|
2711
2715
|
const threadGroups = useMemo3(() => {
|
|
2712
2716
|
if (tagsEnabled && groupBy === "tag") {
|
|
2713
|
-
const groups2 = allTags.map((tag) =>
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2717
|
+
const groups2 = allTags.map((tag) => {
|
|
2718
|
+
const tagMatches = tagMatchesSearch(tag);
|
|
2719
|
+
return {
|
|
2720
|
+
key: tag.id,
|
|
2721
|
+
label: tag.name,
|
|
2722
|
+
tag,
|
|
2723
|
+
threads: filteredThreads.filter(
|
|
2724
|
+
(thread) => (thread.tags ?? []).some((threadTag) => threadTag.id === tag.id) && (tagMatches || threadMatchesTitle(thread))
|
|
2725
|
+
)
|
|
2726
|
+
};
|
|
2727
|
+
}).filter((group) => group.threads.length > 0);
|
|
2721
2728
|
const untagged = filteredThreads.filter(
|
|
2722
|
-
(thread) => (thread.tags ?? []).length === 0
|
|
2729
|
+
(thread) => (thread.tags ?? []).length === 0 && threadMatchesTitle(thread)
|
|
2723
2730
|
);
|
|
2724
2731
|
if (untagged.length > 0) {
|
|
2725
2732
|
groups2.push({
|
|
@@ -2766,6 +2773,7 @@ var Sidebar2 = ({
|
|
|
2766
2773
|
config.labels?.yesterday,
|
|
2767
2774
|
filteredThreads,
|
|
2768
2775
|
groupBy,
|
|
2776
|
+
normalizedSearchQuery,
|
|
2769
2777
|
tagsEnabled
|
|
2770
2778
|
]);
|
|
2771
2779
|
const tagDialogThread = tagDialogThreadId ? threads.find((thread) => thread.id === tagDialogThreadId) ?? null : null;
|
|
@@ -2816,7 +2824,7 @@ var Sidebar2 = ({
|
|
|
2816
2824
|
setEditingThreadId(null);
|
|
2817
2825
|
};
|
|
2818
2826
|
return /* @__PURE__ */ jsxs11(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2819
|
-
/* @__PURE__ */ jsxs11(SidebarHeader, { children: [
|
|
2827
|
+
/* @__PURE__ */ jsxs11(SidebarHeader, { className: "gap-3 p-3", children: [
|
|
2820
2828
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2821
2829
|
/* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ jsx18(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsx18(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx18(Bot, { className: "h-4 w-4" }) }) }) }),
|
|
2822
2830
|
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
@@ -2824,56 +2832,78 @@ var Sidebar2 = ({
|
|
|
2824
2832
|
config.branding?.subtitle && /* @__PURE__ */ jsx18("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2825
2833
|
] })
|
|
2826
2834
|
] }),
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
/* @__PURE__ */ jsxs11("div", { className: "relative
|
|
2835
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-3 px-1 group-data-[collapsible=icon]:hidden", children: [
|
|
2836
|
+
onCreateThread && /* @__PURE__ */ jsx18(
|
|
2837
|
+
CreateThreadDialog,
|
|
2838
|
+
{
|
|
2839
|
+
config,
|
|
2840
|
+
onCreateThread,
|
|
2841
|
+
trigger: /* @__PURE__ */ jsx18(SidebarMenu, { children: /* @__PURE__ */ jsx18(SidebarMenuItem, { children: /* @__PURE__ */ jsxs11(
|
|
2842
|
+
SidebarMenuButton,
|
|
2843
|
+
{
|
|
2844
|
+
size: "lg",
|
|
2845
|
+
className: "h-11 w-full justify-start gap-2 rounded-xl border border-sidebar-border/80 bg-sidebar text-sidebar-foreground shadow-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:justify-center",
|
|
2846
|
+
tooltip: config.labels?.newChat || "New Chat",
|
|
2847
|
+
children: [
|
|
2848
|
+
/* @__PURE__ */ jsx18(Plus, { className: "size-4" }),
|
|
2849
|
+
/* @__PURE__ */ jsx18("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
|
|
2850
|
+
]
|
|
2851
|
+
}
|
|
2852
|
+
) }) })
|
|
2853
|
+
}
|
|
2854
|
+
),
|
|
2855
|
+
/* @__PURE__ */ jsxs11("div", { className: "relative", children: [
|
|
2848
2856
|
/* @__PURE__ */ jsx18(
|
|
2849
2857
|
Search,
|
|
2850
2858
|
{
|
|
2851
2859
|
"aria-hidden": "true",
|
|
2852
|
-
className: "pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 select-none
|
|
2860
|
+
className: "pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 select-none text-sidebar-foreground/45"
|
|
2853
2861
|
}
|
|
2854
2862
|
),
|
|
2855
2863
|
/* @__PURE__ */ jsx18(
|
|
2856
2864
|
Input,
|
|
2857
2865
|
{
|
|
2858
|
-
className: "h-
|
|
2866
|
+
className: "h-9 rounded-xl border-sidebar-border/80 bg-sidebar pl-3 pr-10 text-sidebar-foreground shadow-sm placeholder:text-sidebar-foreground/50 focus-visible:ring-1 focus-visible:ring-sidebar-ring",
|
|
2859
2867
|
placeholder: config.labels?.search || "Search...",
|
|
2860
2868
|
value: searchQuery,
|
|
2861
2869
|
onChange: (e) => setSearchQuery(e.target.value)
|
|
2862
2870
|
}
|
|
2863
2871
|
)
|
|
2864
2872
|
] }),
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2873
|
+
tagsEnabled && threadTagsConfig?.groupingEnabled !== false && /* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-2 gap-1 rounded-xl border border-sidebar-border/60 bg-sidebar-accent/70 p-1", children: [
|
|
2874
|
+
/* @__PURE__ */ jsx18(
|
|
2875
|
+
Button,
|
|
2876
|
+
{
|
|
2877
|
+
variant: "ghost",
|
|
2878
|
+
size: "sm",
|
|
2879
|
+
onClick: () => setGroupBy("date"),
|
|
2880
|
+
className: `h-8 rounded-lg px-2 text-xs font-semibold transition-colors ${groupBy === "date" ? "border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-sm hover:bg-sidebar" : "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"}`,
|
|
2881
|
+
children: config.labels?.groupByDate || "Date"
|
|
2882
|
+
}
|
|
2883
|
+
),
|
|
2884
|
+
/* @__PURE__ */ jsx18(
|
|
2885
|
+
Button,
|
|
2886
|
+
{
|
|
2887
|
+
variant: "ghost",
|
|
2888
|
+
size: "sm",
|
|
2889
|
+
onClick: () => setGroupBy("tag"),
|
|
2890
|
+
className: `h-8 rounded-lg px-2 text-xs font-semibold transition-colors ${groupBy === "tag" ? "border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-sm hover:bg-sidebar" : "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"}`,
|
|
2891
|
+
children: config.labels?.groupByTag || "Tag"
|
|
2892
|
+
}
|
|
2893
|
+
)
|
|
2894
|
+
] })
|
|
2895
|
+
] }),
|
|
2896
|
+
/* @__PURE__ */ jsx18("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx18(
|
|
2897
|
+
Button,
|
|
2898
|
+
{
|
|
2899
|
+
variant: "ghost",
|
|
2900
|
+
size: "icon",
|
|
2901
|
+
className: "h-8 w-8",
|
|
2902
|
+
onClick: () => setOpen(true),
|
|
2903
|
+
title: config.labels?.search || "Search",
|
|
2904
|
+
children: /* @__PURE__ */ jsx18(Search, { className: "h-4 w-4" })
|
|
2905
|
+
}
|
|
2906
|
+
) })
|
|
2877
2907
|
] }),
|
|
2878
2908
|
/* @__PURE__ */ jsxs11(SidebarContent, { children: [
|
|
2879
2909
|
threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx18("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs11(
|
|
@@ -2889,28 +2919,6 @@ var Sidebar2 = ({
|
|
|
2889
2919
|
]
|
|
2890
2920
|
}
|
|
2891
2921
|
) }),
|
|
2892
|
-
tagsEnabled && threadTagsConfig?.groupingEnabled !== false && /* @__PURE__ */ jsx18("div", { className: "px-2 py-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-2 gap-1 rounded-lg border border-sidebar-border/70 bg-sidebar-accent/70 p-1", children: [
|
|
2893
|
-
/* @__PURE__ */ jsx18(
|
|
2894
|
-
Button,
|
|
2895
|
-
{
|
|
2896
|
-
variant: "ghost",
|
|
2897
|
-
size: "sm",
|
|
2898
|
-
onClick: () => setGroupBy("date"),
|
|
2899
|
-
className: `h-7 rounded-md px-2 text-xs font-semibold transition-colors ${groupBy === "date" ? "border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-sm hover:bg-sidebar" : "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"}`,
|
|
2900
|
-
children: config.labels?.groupByDate || "Date"
|
|
2901
|
-
}
|
|
2902
|
-
),
|
|
2903
|
-
/* @__PURE__ */ jsx18(
|
|
2904
|
-
Button,
|
|
2905
|
-
{
|
|
2906
|
-
variant: "ghost",
|
|
2907
|
-
size: "sm",
|
|
2908
|
-
onClick: () => setGroupBy("tag"),
|
|
2909
|
-
className: `h-7 rounded-md px-2 text-xs font-semibold transition-colors ${groupBy === "tag" ? "border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-sm hover:bg-sidebar" : "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"}`,
|
|
2910
|
-
children: config.labels?.groupByTag || "Tag"
|
|
2911
|
-
}
|
|
2912
|
-
)
|
|
2913
|
-
] }) }),
|
|
2914
2922
|
threadGroups.length === 0 ? /* @__PURE__ */ jsxs11("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2915
2923
|
/* @__PURE__ */ jsx18("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ jsx18(Plus, { className: "h-4 w-4 opacity-50" }) }),
|
|
2916
2924
|
/* @__PURE__ */ jsx18("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|