@nexface/chat 0.1.21-alpha.0 → 0.1.21-alpha.2

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.
@@ -6,6 +6,7 @@ import { ThreadListItemPrimitive, ThreadListPrimitive, useAui, useAuiState, } fr
6
6
  import { Loader2Icon, MoreHorizontalIcon, PlusIcon, SearchIcon } from "lucide-react";
7
7
  import { Input } from "./input.js";
8
8
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent } from "./dropdown-menu.js";
9
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
9
10
  import { cn } from "./utils.js";
10
11
  export function ThreadListRoot({ className, ...props }) {
11
12
  return (_jsx(ThreadListPrimitive.Root, { "data-slot": "aui_thread-list-root", className: cn("flex flex-col gap-0.5", className), ...props }));
@@ -16,7 +17,7 @@ export function ThreadListNew(props) {
16
17
  export function ThreadListSearch({ value, onValueChange, }) {
17
18
  return (_jsxs("div", { "data-slot": "aui_thread-list-search", className: cn("relative px-0.5 py-1"), children: [_jsx(SearchIcon, { "data-slot": "aui_thread-list-search-icon", className: cn("text-muted-foreground pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2") }), _jsx(Input, { type: "search", value: value, onChange: (event) => onValueChange(event.target.value), "aria-label": "\u641C\u7D22\u4F1A\u8BDD", placeholder: "\u641C\u7D22\u4F1A\u8BDD", className: cn("border-foreground/10 bg-background h-8 ps-8 text-[13px] md:text-[13px]") })] }));
18
19
  }
19
- export function ThreadListItem({ disabled, menu, }) {
20
+ export function ThreadListItem({ disabled, menu, disabledReason, }) {
20
21
  const isRunning = useAuiState((s) => s.threadListItem.isRunning);
21
22
  const title = useAuiState((s) => s.threadListItem.title);
22
23
  const [isRenaming, setIsRenaming] = useState(false);
@@ -28,10 +29,13 @@ export function ThreadListItem({ disabled, menu, }) {
28
29
  triggerRef.current?.focus();
29
30
  }
30
31
  }, [isRenaming]);
31
- return (_jsxs(ThreadListItemPrimitive.Root, { "data-slot": "aui_thread-list-item", className: cn("group data-active:bg-foreground/[0.06] hover:bg-foreground/[0.04] has-data-[state=open]:bg-foreground/[0.04] rounded-control relative flex h-8 shrink-0 items-center transition-colors"), children: [isRenaming ? (_jsx(ThreadListItemRename, { onDone: (focus) => {
32
+ const item = (_jsxs(ThreadListItemPrimitive.Root, { "data-slot": "aui_thread-list-item", "data-disabled": disabled || undefined, className: cn("data-[disabled=true]:opacity-50 group data-active:bg-foreground/[0.06] hover:bg-foreground/[0.04] has-data-[state=open]:bg-foreground/[0.04] rounded-control relative flex h-8 shrink-0 items-center transition-colors"), children: [isRenaming ? (_jsx(ThreadListItemRename, { onDone: (focus) => {
32
33
  restoreFocus.current = focus;
33
34
  setIsRenaming(false);
34
35
  } })) : (_jsxs(ThreadListItemPrimitive.Trigger, { ref: triggerRef, disabled: disabled, "data-slot": "aui_thread-list-item-trigger", className: cn("text-muted-foreground group-data-active:text-foreground hover:text-foreground flex h-full min-w-0 flex-1 items-center px-2 text-left text-[13px] transition-colors outline-none group-hover:pe-8 group-has-focus-visible:pe-8 group-has-data-[state=open]:pe-8 group-data-active:pe-8"), children: [isRunning && (_jsx(Loader2Icon, { "aria-hidden": true, className: cn("text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin") })), _jsx("span", { className: cn("min-w-0 flex-1 truncate"), children: _jsx(ThreadListItemPrimitive.Title, { fallback: "\u65B0\u4F1A\u8BDD" }) })] })), _jsxs(DropdownMenu, { modal: false, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": `管理 ${title}`, className: cn("text-muted-foreground hover:text-foreground absolute end-1 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-sm opacity-0 transition-colors group-hover:opacity-100 group-has-focus-visible:opacity-100 group-data-active:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"), children: _jsx(MoreHorizontalIcon, { className: cn("size-3.5") }) }) }), _jsx(DropdownMenuContent, { side: "right", align: "start", sideOffset: 6, children: menu(() => setIsRenaming(true)) })] })] }));
36
+ if (!disabledReason)
37
+ return item;
38
+ return (_jsx(TooltipProvider, { delayDuration: 300, skipDelayDuration: 0, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: item }), _jsx(TooltipContent, { side: "right", sideOffset: 8, className: cn("max-w-[min(20rem,var(--radix-tooltip-content-available-width))] break-words"), children: disabledReason })] }) }));
35
39
  }
36
40
  function ThreadListItemRename({ onDone }) {
37
41
  const aui = useAui();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexface/chat",
3
- "version": "0.1.21-alpha.0",
3
+ "version": "0.1.21-alpha.2",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "sideEffects": [
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@ag-ui/core": "0.0.59",
22
- "@nexface/agent": "0.1.21-alpha.0",
22
+ "@nexface/agent": "0.1.21-alpha.2",
23
23
  "class-variance-authority": "0.7.1",
24
24
  "clsx": "2.1.1",
25
25
  "fast-json-patch": "3.1.1",
@@ -28,7 +28,7 @@
28
28
  "use-sync-external-store": "1.7.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@nexface/tools": "0.1.21-alpha.0",
31
+ "@nexface/tools": "0.1.21-alpha.2",
32
32
  "react": ">=17",
33
33
  "react-dom": ">=17"
34
34
  },