devnonla-ui 0.19.2 → 0.20.0
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/README.md +11 -0
- package/package.json +1 -1
- package/src/alert/Alert.tsx +7 -7
- package/src/app/App.tsx +11 -7
- package/src/breadcrumb/Breadcrumb.tsx +80 -0
- package/src/button/Button.tsx +48 -33
- package/src/button/ButtonCopy.tsx +2 -2
- package/src/calendar/Calendar.tsx +12 -12
- package/src/card/Card.tsx +15 -10
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/index.ts +1 -5
- package/src/chat/message-ui/ChatError.tsx +1 -1
- package/src/chat/message-ui/ChatInput.tsx +4 -4
- package/src/chat/message-ui/ChatThinking.tsx +1 -1
- package/src/chat/message-ui/ChatUserMessage.tsx +3 -3
- package/src/chat/message-ui/ChatWelcome.tsx +2 -2
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +6 -6
- package/src/chat/tool-ui/ChatToolCall.tsx +4 -4
- package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
- package/src/chat/tool-ui/ToolUiTrailing.tsx +1 -1
- package/src/chat/tool-ui/registry.ts +5 -19
- package/src/checkbox/Checkbox.tsx +12 -10
- package/src/colorpicker/ColorPicker.tsx +2 -2
- package/src/command-palette/CommandPalette.tsx +223 -0
- package/src/drawer/Drawer.tsx +1 -1
- package/src/dropdown/Dropdown.tsx +4 -3
- package/src/dropdown/menuClasses.ts +2 -2
- package/src/empty/Empty.tsx +23 -9
- package/src/form/FormItem.tsx +1 -1
- package/src/form/variants/FieldRadio.tsx +2 -2
- package/src/form/variants/FieldRepeaterItem.tsx +1 -1
- package/src/icon/Icon.tsx +14 -4
- package/src/icon/glyphs.ts +47 -38
- package/src/index.ts +8 -2
- package/src/input/EditableInput.tsx +3 -3
- package/src/input/Input.tsx +30 -13
- package/src/kbd/Kbd.tsx +32 -0
- package/src/lib/cn.ts +7 -0
- package/src/lib/markdownScale.ts +7 -5
- package/src/lib/sizes.ts +1 -1
- package/src/lib/surface.ts +2 -2
- package/src/markdown-editor/MarkdownDiff.tsx +4 -4
- package/src/markdown-editor/MarkdownPreview.tsx +1 -1
- package/src/markdown-editor/MarkdownSource.tsx +2 -2
- package/src/markdown-editor/MarkdownTable.tsx +2 -2
- package/src/markdown-editor/MermaidBlock.tsx +5 -5
- package/src/markdown-editor/ReactCodeFrame.tsx +1 -1
- package/src/menu/Menu.tsx +2 -2
- package/src/message/message.tsx +8 -8
- package/src/modal/Modal.tsx +2 -2
- package/src/page-header/PageHeader.tsx +33 -0
- package/src/pagination/Pagination.tsx +3 -3
- package/src/popconfirm/Popconfirm.tsx +3 -3
- package/src/scroll/OverlayScroll.tsx +1 -1
- package/src/segmented/Segmented.tsx +16 -7
- package/src/select/Select.tsx +76 -47
- package/src/sidebar/Sidebar.tsx +15 -4
- package/src/sortable-tree/SortableTree.tsx +1 -1
- package/src/splitter/Splitter.tsx +1 -1
- package/src/styles.css +258 -45
- package/src/switch/Switch.tsx +21 -20
- package/src/table/Table.tsx +32 -18
- package/src/tabs/Tabs.tsx +16 -13
- package/src/tag/Tag.tsx +16 -7
- package/src/theme-switcher/ThemeSwitcher.tsx +1 -1
- package/src/timepicker/TimePicker.tsx +2 -2
- package/src/tooltip/Tooltip.tsx +25 -3
- package/src/blob-shape/BlobShape.tsx +0 -337
- package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +0 -51
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +0 -82
- package/src/chat/tool-ui/RunJsToolUI.tsx +0 -108
- package/src/chat/tool-ui/WebFetchToolUI.tsx +0 -64
package/README.md
CHANGED
|
@@ -31,3 +31,14 @@ import { MarkdownViewer } from "devnonla-ui/markdown";
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Install, theme, and each control are in the [docs](https://devnonla.github.io/devnonla-ui/).
|
|
34
|
+
|
|
35
|
+
## Claude Code plugin
|
|
36
|
+
|
|
37
|
+
One `devnonla-ui` skill that teaches coding agents to build with NonlaUI: setup, which component to use, house style, theming, and the agent chat kit, plus an API table for every component that agents read on demand.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
/plugin marketplace add devnonla/devnonla-ui
|
|
41
|
+
/plugin install devnonla-ui@devnonla-ui
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Agents load it on their own when a task touches NonlaUI, or call it with `/devnonla-ui:devnonla-ui`.
|
package/package.json
CHANGED
package/src/alert/Alert.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, useState } from "react";
|
|
2
|
-
import { cn } from "../lib/cn";
|
|
2
|
+
import { cn, focusRing } from "../lib/cn";
|
|
3
3
|
|
|
4
4
|
export type AlertType = "success" | "info" | "warning" | "error";
|
|
5
5
|
|
|
@@ -17,10 +17,10 @@ export type AlertProps = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const TYPE_STYLES: Record<AlertType, string> = {
|
|
20
|
-
success: "border-success
|
|
21
|
-
info: "border-link
|
|
22
|
-
warning: "border-warn
|
|
23
|
-
error: "border-destructive
|
|
20
|
+
success: "border-success-border bg-success-bg text-foreground",
|
|
21
|
+
info: "border-link-border bg-link-bg text-foreground",
|
|
22
|
+
warning: "border-warn-border bg-warn-bg text-foreground",
|
|
23
|
+
error: "border-destructive-border bg-destructive-bg text-foreground",
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const ICON_COLOR: Record<AlertType, string> = {
|
|
@@ -91,14 +91,14 @@ export function Alert({
|
|
|
91
91
|
{showIcon ? <AlertIcon type={type} /> : null}
|
|
92
92
|
<div className="min-w-0 flex-1 flex flex-col gap-0.5">
|
|
93
93
|
{heading != null && heading !== "" ? <div className="font-medium leading-5">{heading}</div> : null}
|
|
94
|
-
{description != null && description !== "" ? <div className="leading-5 text-foreground
|
|
94
|
+
{description != null && description !== "" ? <div className="leading-5 text-foreground">{description}</div> : null}
|
|
95
95
|
{children}
|
|
96
96
|
</div>
|
|
97
97
|
{canClose ? (
|
|
98
98
|
<button
|
|
99
99
|
type="button"
|
|
100
100
|
aria-label="Close"
|
|
101
|
-
className="shrink-0 -mr-1 -mt-0.5 inline-flex size-6 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground hover:text-foreground"
|
|
101
|
+
className={cn("shrink-0 -mr-1 -mt-0.5 inline-flex size-6 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground hover:text-foreground", focusRing, "focus-visible:ring-offset-0")}
|
|
102
102
|
onClick={handleClose}
|
|
103
103
|
>
|
|
104
104
|
×
|
package/src/app/App.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
-
import { type ReactNode, useLayoutEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { type ReactNode, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
import { type ControlSize, ControlSizeContext, normalizeSize } from "../lib/sizes";
|
|
5
5
|
import { MessageHolder, message } from "../message/message";
|
|
@@ -22,20 +22,24 @@ export type AppProps = {
|
|
|
22
22
|
/** Root host for NonlaUI — theme scope + message/modal holders. Mount once near app root. */
|
|
23
23
|
export function App({ children, getPopupContainer, componentSize, className }: AppProps) {
|
|
24
24
|
const hostRef = useRef<HTMLDivElement>(null);
|
|
25
|
+
// The host in state, not only a ref: the context changes once after mount, so components that read
|
|
26
|
+
// the popup container during their first render (Tooltip, ContextMenu) re-render and portal into the host.
|
|
27
|
+
const [host, setHost] = useState<HTMLDivElement | null>(null);
|
|
25
28
|
const size = componentSize ? normalizeSize(componentSize) : undefined;
|
|
26
29
|
const value = useMemo<NonlaAppConfig>(
|
|
27
30
|
() => ({
|
|
28
|
-
getPopupContainer: getPopupContainer ?? (() => hostRef.current ?? document.body),
|
|
31
|
+
getPopupContainer: getPopupContainer ?? (() => host ?? hostRef.current ?? document.body),
|
|
29
32
|
componentSize: size,
|
|
30
33
|
}),
|
|
31
|
-
[getPopupContainer, size],
|
|
34
|
+
[getPopupContainer, size, host],
|
|
32
35
|
);
|
|
33
36
|
|
|
34
37
|
useLayoutEffect(() => {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const el = hostRef.current;
|
|
39
|
+
if (!el) return;
|
|
40
|
+
setHost(el);
|
|
41
|
+
bindColorModeTarget(el);
|
|
42
|
+
initColorMode(el);
|
|
39
43
|
return () => bindColorModeTarget(null);
|
|
40
44
|
}, []);
|
|
41
45
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Fragment, type ReactNode } from "react";
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
|
+
import { cn } from "../lib/cn";
|
|
4
|
+
|
|
5
|
+
export type BreadcrumbItem = {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** Renders a link. */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** Click handler, for client-side routing. */
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
/** Glyph before the title. */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type BreadcrumbProps = {
|
|
16
|
+
/** Path from the root to the current page. The last item is the current page. */
|
|
17
|
+
items: BreadcrumbItem[];
|
|
18
|
+
/** Between items. Defaults to a small chevron. */
|
|
19
|
+
separator?: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Page path for a top bar (measured on Cloudflare): muted 14px ancestors, the current page in 500 weight. */
|
|
24
|
+
export function Breadcrumb({ items, separator, className }: BreadcrumbProps) {
|
|
25
|
+
const sep = separator ?? <Icon name="arrow-right" size={14} className="text-quaternary-foreground" />;
|
|
26
|
+
return (
|
|
27
|
+
<nav aria-label="Breadcrumb" className={cn("min-w-0", className)}>
|
|
28
|
+
<ol className="m-0 flex min-w-0 list-none items-center gap-1.5 p-0 text-sm">
|
|
29
|
+
{items.map((item, i) => {
|
|
30
|
+
const last = i === items.length - 1;
|
|
31
|
+
const content = (
|
|
32
|
+
<>
|
|
33
|
+
{item.icon ? <span className="inline-flex shrink-0 items-center [&_svg]:size-4">{item.icon}</span> : null}
|
|
34
|
+
<span className="truncate">{item.title}</span>
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
const base = "inline-flex min-w-0 items-center gap-1.5";
|
|
38
|
+
return (
|
|
39
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a path is ordered and short
|
|
40
|
+
<Fragment key={i}>
|
|
41
|
+
<li className={cn("min-w-0", last ? "shrink-0" : "shrink")}>
|
|
42
|
+
{last ? (
|
|
43
|
+
<span aria-current="page" className={cn(base, "font-medium text-foreground")}>
|
|
44
|
+
{content}
|
|
45
|
+
</span>
|
|
46
|
+
) : item.href ? (
|
|
47
|
+
<a
|
|
48
|
+
href={item.href}
|
|
49
|
+
onClick={
|
|
50
|
+
item.onClick
|
|
51
|
+
? (e) => {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
item.onClick?.();
|
|
54
|
+
}
|
|
55
|
+
: undefined
|
|
56
|
+
}
|
|
57
|
+
className={cn(base, "rounded-sm text-muted-foreground no-underline transition-colors hover:text-foreground")}
|
|
58
|
+
>
|
|
59
|
+
{content}
|
|
60
|
+
</a>
|
|
61
|
+
) : item.onClick ? (
|
|
62
|
+
<button type="button" onClick={item.onClick} className={cn(base, "cursor-pointer rounded-sm border-0 bg-transparent p-0 font-[inherit] text-muted-foreground transition-colors hover:text-foreground")}>
|
|
63
|
+
{content}
|
|
64
|
+
</button>
|
|
65
|
+
) : (
|
|
66
|
+
<span className={cn(base, "text-muted-foreground")}>{content}</span>
|
|
67
|
+
)}
|
|
68
|
+
</li>
|
|
69
|
+
{last ? null : (
|
|
70
|
+
<li aria-hidden className="inline-flex shrink-0 items-center">
|
|
71
|
+
{sep}
|
|
72
|
+
</li>
|
|
73
|
+
)}
|
|
74
|
+
</Fragment>
|
|
75
|
+
);
|
|
76
|
+
})}
|
|
77
|
+
</ol>
|
|
78
|
+
</nav>
|
|
79
|
+
);
|
|
80
|
+
}
|
package/src/button/Button.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type CSSProperties, createContext, type ForwardRefExoticComponent, forwardRef, type MouseEvent, type ReactNode, type RefAttributes, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type CSSProperties, cloneElement, createContext, type ForwardRefExoticComponent, forwardRef, isValidElement, type MouseEvent, type ReactNode, type RefAttributes, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
|
+
import { cn, focusRing } from "../lib/cn";
|
|
3
4
|
import type { ControlSize } from "../lib/sizes";
|
|
4
5
|
import { controlHeightVar, controlRadiusVar, getSizeTokens, useControlSize } from "../lib/sizes";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
export type
|
|
7
|
+
/** `icon` is a square, icon-only button that looks like `text`: no fill or border until hover. Give it an `aria-label`. */
|
|
8
|
+
export type ButtonType = "default" | "primary" | "link" | "text" | "icon";
|
|
9
|
+
export type ButtonVariant = "outlined" | "solid" | "filled" | "text" | "icon" | "link" | "nostyle";
|
|
8
10
|
export type ButtonShape = "default" | "circle" | "round" | "square";
|
|
9
11
|
export type ButtonHtmlType = "submit" | "button" | "reset";
|
|
10
12
|
export type ButtonSize = ControlSize;
|
|
@@ -44,9 +46,9 @@ export type ButtonGroupProps = {
|
|
|
44
46
|
const TYPE_MAP: Record<ButtonType, [ButtonColor, ButtonVariant]> = {
|
|
45
47
|
default: ["default", "outlined"],
|
|
46
48
|
primary: ["primary", "solid"],
|
|
47
|
-
dashed: ["default", "dashed"],
|
|
48
49
|
link: ["link", "link"],
|
|
49
50
|
text: ["default", "text"],
|
|
51
|
+
icon: ["default", "icon"],
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
const HTML_BUTTON_TYPES = new Set(["button", "submit", "reset"]);
|
|
@@ -66,6 +68,9 @@ function resolveTone(type: ButtonType | undefined, color: ButtonColor | undefine
|
|
|
66
68
|
return ["default", variant ?? "outlined"];
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
/** Glyph box for `type="icon"` per size: about 60% of the button. */
|
|
72
|
+
const ICON_BUTTON_GLYPH = { small: 16, default: 20, large: 24 } as const;
|
|
73
|
+
|
|
69
74
|
const PRESET_COLORS = new Set<ButtonColor>(["blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"]);
|
|
70
75
|
|
|
71
76
|
const TWO_CN = /^[\u4e00-\u9fa5]{2}$/;
|
|
@@ -75,35 +80,37 @@ function tokenAppearance(color: "default" | "primary" | "danger" | "link", varia
|
|
|
75
80
|
if (variant === "nostyle") return "";
|
|
76
81
|
const g = ghost && variant !== "text" && variant !== "link";
|
|
77
82
|
if (color === "primary") {
|
|
78
|
-
if (variant === "solid" && !g) return "border-
|
|
79
|
-
if (variant === "filled") return "bg-brand
|
|
80
|
-
if (variant === "text") return "bg-transparent text-brand border-transparent hover:bg-brand
|
|
81
|
-
if (variant === "link") return "text-brand border-transparent hover:
|
|
82
|
-
return "bg-transparent text-brand border-brand hover:bg-brand
|
|
83
|
+
if (variant === "solid" && !g) return "border-(--nonla-brand-ring) bg-brand-fill text-on-brand shadow-(--nonla-solid-shadow) hover:bg-brand-fill-hover active:bg-brand-fill-active";
|
|
84
|
+
if (variant === "filled") return "bg-brand-bg text-brand border-transparent hover:bg-brand-bg-hover active:bg-brand-border";
|
|
85
|
+
if (variant === "text" || variant === "icon") return "bg-transparent text-brand border-transparent hover:bg-brand-bg active:bg-brand-bg-hover";
|
|
86
|
+
if (variant === "link") return "text-brand border-transparent underline-offset-4 hover:underline";
|
|
87
|
+
return "bg-transparent text-brand border-brand hover:bg-brand-bg active:bg-brand-bg-hover";
|
|
83
88
|
}
|
|
84
89
|
if (color === "danger") {
|
|
85
|
-
if (variant === "solid" && !g) return "border-
|
|
86
|
-
if (variant === "filled") return "bg-destructive
|
|
87
|
-
if (variant === "text") return "bg-transparent text-destructive border-transparent hover:bg-destructive
|
|
88
|
-
if (variant === "link") return "text-destructive border-transparent hover:
|
|
89
|
-
return "bg-transparent text-destructive border-destructive hover:bg-destructive
|
|
90
|
+
if (variant === "solid" && !g) return "border-(--nonla-danger-ring) bg-destructive-fill text-on-destructive shadow-(--nonla-solid-shadow) hover:bg-destructive-fill-hover active:bg-destructive-fill-active";
|
|
91
|
+
if (variant === "filled") return "bg-destructive-bg text-destructive border-transparent hover:bg-destructive-bg-hover active:bg-destructive-border";
|
|
92
|
+
if (variant === "text" || variant === "icon") return "bg-transparent text-destructive border-transparent hover:bg-destructive-bg active:bg-destructive-bg-hover";
|
|
93
|
+
if (variant === "link") return "text-destructive border-transparent underline-offset-4 hover:underline";
|
|
94
|
+
return "bg-transparent text-destructive border-destructive-border hover:bg-destructive-bg active:bg-destructive-bg-hover";
|
|
90
95
|
}
|
|
91
|
-
if (color === "link" || variant === "link") return "text-link border-transparent hover:
|
|
92
|
-
if (variant === "filled") return "bg-muted text-foreground border-transparent hover:bg-
|
|
93
|
-
if (variant === "text") return "bg-transparent text-foreground border-transparent hover:bg-ink-hover
|
|
94
|
-
if (variant === "
|
|
95
|
-
|
|
96
|
+
if (color === "link" || variant === "link") return "text-link border-transparent underline-offset-4 hover:underline";
|
|
97
|
+
if (variant === "filled") return "bg-muted text-foreground border-transparent hover:bg-(--nonla-fill-strong) active:bg-ink-active";
|
|
98
|
+
if (variant === "text") return "bg-transparent text-foreground border-transparent hover:bg-ink-hover active:bg-ink-active";
|
|
99
|
+
if (variant === "icon") return "bg-transparent text-foreground border-transparent hover:bg-ink-hover active:bg-ink-active";
|
|
100
|
+
// Raised default (measured on Cloudflare): surface fill, hairline, 1px contact shadow. Hover darkens the fill a step, press a bit more.
|
|
101
|
+
// No press scale on popup triggers (Radix sets `data-state`): the popup anchors to the trigger box and would jump with it.
|
|
102
|
+
return "nonla-btn-glass border-border bg-card text-foreground shadow-(--nonla-btn-shadow) transition-[background-color,transform] duration-(--nonla-dur-fast) ease-(--nonla-ease-out) hover:not-disabled:not-aria-disabled:bg-(--nonla-btn-bg-hover) active:not-disabled:not-aria-disabled:not-data-[state]:scale-[0.97] active:not-disabled:not-aria-disabled:bg-(--nonla-btn-bg-active) motion-reduce:transition-[background-color] motion-reduce:active:transform-none";
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
function presetAppearance(variant: ButtonVariant, ghost: boolean): string {
|
|
99
106
|
if (variant === "nostyle") return "";
|
|
100
107
|
const g = ghost && variant !== "text" && variant !== "link";
|
|
101
|
-
if (variant === "solid" && !g)
|
|
102
|
-
|
|
103
|
-
if (variant === "
|
|
104
|
-
if (variant === "
|
|
105
|
-
if (variant === "text") return "bg-transparent text-(--nonla-btn) border-transparent hover:bg-(--nonla-btn)/10";
|
|
106
|
-
return "bg-transparent text-(--nonla-btn) border-(--nonla-btn) hover:bg-(--nonla-btn)/10";
|
|
108
|
+
if (variant === "solid" && !g)
|
|
109
|
+
return "bg-(--nonla-btn) text-(--nonla-text-on-solid) border-transparent hover:bg-[color-mix(in_oklab,var(--nonla-btn)_90%,var(--nonla-fill-shade))] active:bg-[color-mix(in_oklab,var(--nonla-btn)_82%,var(--nonla-fill-shade))]";
|
|
110
|
+
if (variant === "filled") return "bg-(--nonla-btn)/10 text-(--nonla-btn) border-transparent hover:bg-(--nonla-btn)/16 active:bg-(--nonla-btn)/24";
|
|
111
|
+
if (variant === "link") return "text-(--nonla-btn) border-transparent underline-offset-4 hover:underline";
|
|
112
|
+
if (variant === "text" || variant === "icon") return "bg-transparent text-(--nonla-btn) border-transparent hover:bg-(--nonla-btn)/10 active:bg-(--nonla-btn)/16";
|
|
113
|
+
return "bg-transparent text-(--nonla-btn) border-(--nonla-btn) hover:bg-(--nonla-btn)/10 active:bg-(--nonla-btn)/16";
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
function LoadingDot({ size }: { size: number }) {
|
|
@@ -162,7 +169,10 @@ const ButtonInner = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProp
|
|
|
162
169
|
const [mergedColor, mergedVariant] = resolveTone(type, color, variant, danger);
|
|
163
170
|
const preset = PRESET_COLORS.has(mergedColor);
|
|
164
171
|
const placement = iconPlacement ?? iconPosition ?? "start";
|
|
165
|
-
const
|
|
172
|
+
const iconVariant = mergedVariant === "icon";
|
|
173
|
+
// `type="icon"` takes the glyph from `icon` or, if unset, from `children`. It never renders a label.
|
|
174
|
+
const iconProp = iconVariant && icon == null ? children : icon;
|
|
175
|
+
const iconOnly = iconVariant || children == null || children === false || children === "";
|
|
166
176
|
|
|
167
177
|
const loadingOn = typeof loading === "object" ? true : !!loading;
|
|
168
178
|
const loadingDelay = typeof loading === "object" ? (loading.delay ?? 0) : 0;
|
|
@@ -197,12 +207,16 @@ const ButtonInner = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProp
|
|
|
197
207
|
return children;
|
|
198
208
|
}, [children, autoInsertSpace]);
|
|
199
209
|
|
|
200
|
-
|
|
210
|
+
// Icon-only buttons use a toolbar-sized glyph box (20px in a 32px button, as on Claude desktop).
|
|
211
|
+
const iconSize = iconVariant ? ICON_BUTTON_GLYPH[size] : tok.icon;
|
|
212
|
+
// An `<Icon>` without its own `size` takes the icon button's glyph box, so the stroke weight matches the drawn size.
|
|
213
|
+
const sizedIcon = iconVariant && isValidElement<{ size?: number }>(iconProp) && iconProp.type === Icon && iconProp.props.size == null ? cloneElement(iconProp, { size: iconSize }) : iconProp;
|
|
214
|
+
const iconNode = innerLoading ? typeof loading === "object" && loading.icon ? loading.icon : <LoadingDot size={iconSize} /> : sizedIcon;
|
|
201
215
|
const showIcon = Boolean(iconNode);
|
|
202
216
|
const bare = mergedVariant === "nostyle";
|
|
203
217
|
const radius = shape === "circle" || shape === "round" ? 9999 : shape === "square" ? 4 : controlRadiusVar(size);
|
|
204
218
|
const appearance = bare ? "" : preset ? presetAppearance(mergedVariant, ghost) : tokenAppearance(mergedColor as "default" | "primary" | "danger" | "link", mergedVariant, ghost);
|
|
205
|
-
const bordered = !bare && mergedVariant !== "text" && mergedVariant !== "link";
|
|
219
|
+
const bordered = !bare && mergedVariant !== "text" && mergedVariant !== "icon" && mergedVariant !== "link";
|
|
206
220
|
|
|
207
221
|
const padText = tok.paddingInline;
|
|
208
222
|
const paddingLeft = iconOnly ? 0 : showIcon && placement === "start" ? tok.paddingInlineIconStart : padText;
|
|
@@ -210,8 +224,9 @@ const ButtonInner = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProp
|
|
|
210
224
|
|
|
211
225
|
const rootClass = cn(
|
|
212
226
|
bare
|
|
213
|
-
? "inline-flex items-center justify-center gap-2 cursor-pointer border-0 bg-transparent px-0 py-0 text-inherit rounded-none disabled:cursor-not-allowed"
|
|
214
|
-
: "inline-flex items-center justify-center gap-
|
|
227
|
+
? "inline-flex items-center justify-center gap-2 cursor-pointer border-0 bg-transparent px-0 py-0 text-inherit rounded-none disabled:cursor-not-allowed focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
|
|
228
|
+
: "inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap select-none cursor-pointer border border-solid transition-colors disabled:cursor-not-allowed disabled:opacity-45",
|
|
229
|
+
!bare && focusRing,
|
|
215
230
|
!bare && (bordered ? "border" : "border-transparent"),
|
|
216
231
|
appearance,
|
|
217
232
|
block && "flex w-full",
|
|
@@ -251,11 +266,11 @@ const ButtonInner = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProp
|
|
|
251
266
|
const inner = (
|
|
252
267
|
<>
|
|
253
268
|
{showIcon ? (
|
|
254
|
-
<span className={cn("relative z-10 inline-flex shrink-0 items-center justify-center", !bare && "[&_svg]:size-full", classNames?.icon)} style={bare ? styles?.icon : { width:
|
|
269
|
+
<span className={cn("relative z-10 inline-flex shrink-0 items-center justify-center", !bare && "[&_svg]:size-full", classNames?.icon)} style={bare ? styles?.icon : { width: iconSize, height: iconSize, ...styles?.icon }}>
|
|
255
270
|
{iconNode}
|
|
256
271
|
</span>
|
|
257
272
|
) : null}
|
|
258
|
-
{content != null && content !== false && content !== "" ? (
|
|
273
|
+
{!iconVariant && content != null && content !== false && content !== "" ? (
|
|
259
274
|
<span className={cn("relative z-10 inline-flex min-w-0 items-center", classNames?.content)} style={styles?.content}>
|
|
260
275
|
{content}
|
|
261
276
|
</span>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps, useEffect, useState } from "react";
|
|
2
2
|
import { Icon } from "../icon/Icon";
|
|
3
|
-
import { cn } from "../lib/cn";
|
|
3
|
+
import { cn, focusRing } from "../lib/cn";
|
|
4
4
|
import { type ControlSize, getSizeTokens, useControlSize } from "../lib/sizes";
|
|
5
5
|
|
|
6
6
|
export type ButtonCopyProps = Omit<ComponentProps<"button">, "children" | "size"> & {
|
|
@@ -29,7 +29,7 @@ export function ButtonCopy({ text, getText, label = "Copy", className, onClick,
|
|
|
29
29
|
{...props}
|
|
30
30
|
title={copied ? "Copied" : label}
|
|
31
31
|
aria-label={copied ? "Copied" : label}
|
|
32
|
-
className={cn("inline-flex cursor-pointer shrink-0 items-center justify-center text-muted-foreground transition-colors
|
|
32
|
+
className={cn("inline-flex cursor-pointer shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground", focusRing, className)}
|
|
33
33
|
style={{ width: box, height: box }}
|
|
34
34
|
onClick={async (e) => {
|
|
35
35
|
onClick?.(e);
|
|
@@ -51,11 +51,11 @@ function CalendarDayButton({ className, day, modifiers, children, ...props }: Da
|
|
|
51
51
|
data-range-middle={modifiers.range_middle ? "true" : undefined}
|
|
52
52
|
className={cn(
|
|
53
53
|
"relative flex aspect-square size-full min-w-8 items-center justify-center rounded-md bg-transparent text-sm font-normal leading-none",
|
|
54
|
-
"transition-colors hover:bg-
|
|
55
|
-
"data-[selected-single=true]:bg-
|
|
56
|
-
"data-[range-start=true]:bg-
|
|
57
|
-
"data-[range-end=true]:bg-
|
|
58
|
-
"data-[range-middle=true]:bg-
|
|
54
|
+
"transition-colors hover:bg-ink-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
55
|
+
"data-[selected-single=true]:bg-selected data-[selected-single=true]:text-on-selected data-[selected-single=true]:hover:bg-selected",
|
|
56
|
+
"data-[range-start=true]:bg-selected data-[range-start=true]:text-on-selected data-[range-start=true]:hover:bg-selected data-[range-start=true]:rounded-md",
|
|
57
|
+
"data-[range-end=true]:bg-selected data-[range-end=true]:text-on-selected data-[range-end=true]:hover:bg-selected data-[range-end=true]:rounded-md",
|
|
58
|
+
"data-[range-middle=true]:bg-ink-active data-[range-middle=true]:text-foreground data-[range-middle=true]:rounded-none",
|
|
59
59
|
defaultClassNames.day_button,
|
|
60
60
|
className,
|
|
61
61
|
)}
|
|
@@ -93,12 +93,12 @@ export function Calendar({
|
|
|
93
93
|
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
94
94
|
button_previous: cn(
|
|
95
95
|
"inline-flex size-(--cell-size) items-center justify-center rounded-md p-0 text-foreground select-none",
|
|
96
|
-
"hover:bg-
|
|
96
|
+
"hover:bg-ink-hover disabled:opacity-40",
|
|
97
97
|
defaultClassNames.button_previous,
|
|
98
98
|
),
|
|
99
99
|
button_next: cn(
|
|
100
100
|
"inline-flex size-(--cell-size) items-center justify-center rounded-md p-0 text-foreground select-none",
|
|
101
|
-
"hover:bg-
|
|
101
|
+
"hover:bg-ink-hover disabled:opacity-40",
|
|
102
102
|
defaultClassNames.button_next,
|
|
103
103
|
),
|
|
104
104
|
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
@@ -106,7 +106,7 @@ export function Calendar({
|
|
|
106
106
|
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
107
107
|
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
108
108
|
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
109
|
-
weekday: cn("flex-1 select-none rounded-md text-
|
|
109
|
+
weekday: cn("flex-1 select-none rounded-md text-xs font-normal text-muted-foreground", defaultClassNames.weekday),
|
|
110
110
|
week: cn("mt-1.5 flex w-full", defaultClassNames.week),
|
|
111
111
|
day: cn(
|
|
112
112
|
"group/day relative aspect-square h-full w-full p-0 text-center select-none",
|
|
@@ -114,12 +114,12 @@ export function Calendar({
|
|
|
114
114
|
defaultClassNames.day,
|
|
115
115
|
),
|
|
116
116
|
today: cn(defaultClassNames.today),
|
|
117
|
-
outside: cn("text-
|
|
117
|
+
outside: cn("text-tertiary-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
118
118
|
disabled: cn("text-muted-foreground opacity-40", defaultClassNames.disabled),
|
|
119
119
|
hidden: cn("invisible", defaultClassNames.hidden),
|
|
120
|
-
range_start: cn("rounded-l-md bg-
|
|
121
|
-
range_middle: cn("rounded-none bg-
|
|
122
|
-
range_end: cn("rounded-r-md bg-
|
|
120
|
+
range_start: cn("rounded-l-md bg-ink-active", defaultClassNames.range_start),
|
|
121
|
+
range_middle: cn("rounded-none bg-ink-active", defaultClassNames.range_middle),
|
|
122
|
+
range_end: cn("rounded-r-md bg-ink-active", defaultClassNames.range_end),
|
|
123
123
|
...classNames,
|
|
124
124
|
}}
|
|
125
125
|
components={{
|
package/src/card/Card.tsx
CHANGED
|
@@ -12,8 +12,8 @@ export type CardItemProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
12
12
|
label?: ReactNode;
|
|
13
13
|
description?: ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
* `
|
|
16
|
-
* `
|
|
15
|
+
* `center` (default) — control vertically centered on the row, like settings lists.
|
|
16
|
+
* `start` — control pinned to the first line (tall rows with long text or a multi-line field).
|
|
17
17
|
*/
|
|
18
18
|
align?: "start" | "center";
|
|
19
19
|
/** Split the row in half so a field can fill the trailing column. */
|
|
@@ -24,8 +24,8 @@ export type CardFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
|
24
24
|
|
|
25
25
|
function CardRoot({ title, caption, className, children, ...rest }: CardProps) {
|
|
26
26
|
return (
|
|
27
|
-
<section className={cn("flex flex-col gap-
|
|
28
|
-
{title != null && title !== "" ? <div className="px-
|
|
27
|
+
<section className={cn("flex flex-col gap-2", className)} {...rest}>
|
|
28
|
+
{title != null && title !== "" ? <div className="px-1 text-sm leading-5 font-medium text-foreground">{title}</div> : null}
|
|
29
29
|
<div className="flex flex-col self-stretch rounded-xl bg-card" style={{ boxShadow: "var(--nonla-card-shadow)" }}>
|
|
30
30
|
{children}
|
|
31
31
|
</div>
|
|
@@ -34,16 +34,17 @@ function CardRoot({ title, caption, className, children, ...rest }: CardProps) {
|
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function CardItem({ label, description, align = "
|
|
37
|
+
function CardItem({ label, description, align = "center", split = false, className, children, ...rest }: CardItemProps) {
|
|
38
38
|
const hasCopy = (label != null && label !== "") || (description != null && description !== "");
|
|
39
39
|
const centered = align === "center";
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<div
|
|
43
43
|
className={cn(
|
|
44
|
-
|
|
44
|
+
// Settings rhythm (measured on Cloudflare): 18px sides, 16px rows, full-width 6% dividers.
|
|
45
|
+
"relative flex w-full gap-4 px-4.5 py-4",
|
|
45
46
|
centered ? "items-center" : "items-start",
|
|
46
|
-
"before:pointer-events-none before:absolute before:top-0 before:right-
|
|
47
|
+
"before:pointer-events-none before:absolute before:top-0 before:right-0 before:left-0 before:h-px before:bg-border-secondary before:content-[''] first:before:hidden",
|
|
47
48
|
className,
|
|
48
49
|
)}
|
|
49
50
|
{...rest}
|
|
@@ -51,8 +52,8 @@ function CardItem({ label, description, align = "start", split = false, classNam
|
|
|
51
52
|
{hasCopy ? (
|
|
52
53
|
<>
|
|
53
54
|
<div className={cn("flex min-w-0 flex-1 flex-col gap-0.5", centered && "justify-center")}>
|
|
54
|
-
{label != null && label !== "" ? <div className="flex items-center gap-1 text-sm leading-5 text-foreground">{label}</div> : null}
|
|
55
|
-
{description != null && description !== "" ? <div className="text-sm text-muted-foreground">{description}</div> : null}
|
|
55
|
+
{label != null && label !== "" ? <div className="flex items-center gap-1.5 text-sm leading-5 font-medium text-foreground">{label}</div> : null}
|
|
56
|
+
{description != null && description !== "" ? <div className="text-sm leading-5 text-muted-foreground">{description}</div> : null}
|
|
56
57
|
</div>
|
|
57
58
|
{children != null ? (
|
|
58
59
|
<div className={cn("flex min-h-6 min-w-0 justify-end gap-2 text-sm text-foreground", split ? "flex-1" : "shrink-0", centered ? "items-center self-center" : "items-start self-stretch pt-[3px]")}>{children}</div>
|
|
@@ -73,6 +74,10 @@ function CardFooter({ className, children, ...rest }: CardFooterProps) {
|
|
|
73
74
|
);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Settings surface — title outside, rows inside, caption underneath.
|
|
79
|
+
* Each `Card.Item` is a settings row: `label` + `description` on the left, the control (Switch, Button, Select) as children on the right.
|
|
80
|
+
* Stack several cards with `gap-10` between sections.
|
|
81
|
+
*/
|
|
77
82
|
export const Card = Object.assign(CardRoot, { Item: CardItem, Footer: CardFooter });
|
|
78
83
|
export { CardFooter, CardItem };
|
package/src/chat/AgentPanel.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export type AgentPanelProps = {
|
|
|
31
31
|
triggers?: ChatTrigger[];
|
|
32
32
|
/** Imperative composer handle, e.g. `insertChip` to add a text selection as context. */
|
|
33
33
|
inputRef?: Ref<ChatInputHandle>;
|
|
34
|
-
/**
|
|
34
|
+
/** Tool cards keyed by stream `toolName`. Unmatched tools render `ChatToolCall`. */
|
|
35
35
|
toolUis?: AgentToolUI[];
|
|
36
36
|
/** Fence language → component for assistant markdown (`step`, `subagent`, `mindmap`). */
|
|
37
37
|
components?: MarkdownComponents;
|
package/src/chat/index.ts
CHANGED
|
@@ -35,12 +35,8 @@ export { BackgroundTasksBar } from "./tool-ui/BackgroundTasksBar";
|
|
|
35
35
|
export { BackgroundTaskToolUI } from "./tool-ui/BackgroundTaskToolUI";
|
|
36
36
|
export type { ChatToolCallProps } from "./tool-ui/ChatToolCall";
|
|
37
37
|
export { ChatToolCall } from "./tool-ui/ChatToolCall";
|
|
38
|
-
export { GetCurrentTimeToolUI } from "./tool-ui/GetCurrentTimeToolUI";
|
|
39
|
-
export { ReadSkillToolUI } from "./tool-ui/ReadSkillToolUI";
|
|
40
|
-
export { RunJsToolUI } from "./tool-ui/RunJsToolUI";
|
|
41
38
|
export type { AgentToolUI, AgentToolUIName } from "./tool-ui/registry";
|
|
42
|
-
export {
|
|
39
|
+
export { matchesToolUIName, resolveToolUI } from "./tool-ui/registry";
|
|
43
40
|
export { ToolUiTrailing } from "./tool-ui/ToolUiTrailing";
|
|
44
41
|
export type { ChatToolMessage, ToolUIProps } from "./tool-ui/types";
|
|
45
42
|
export { isToolRunning } from "./tool-ui/types";
|
|
46
|
-
export { WebFetchToolUI } from "./tool-ui/WebFetchToolUI";
|
|
@@ -13,7 +13,7 @@ export function ChatError({ children, className }: ChatErrorProps) {
|
|
|
13
13
|
<div className={cn("nonla-chat-error px-4 py-1", chatRowClass, className)}>
|
|
14
14
|
<div
|
|
15
15
|
role="alert"
|
|
16
|
-
className="flex items-center gap-2 rounded-lg border border-destructive
|
|
16
|
+
className="flex items-center gap-2 rounded-lg border border-destructive-border bg-destructive-bg px-3 py-2 text-sm text-destructive"
|
|
17
17
|
>
|
|
18
18
|
<Icon name="error" size={16} className="shrink-0" />
|
|
19
19
|
<div className="min-w-0">{children}</div>
|
|
@@ -160,7 +160,7 @@ const DEFAULT_CHIP_COLOR = "#c9841a";
|
|
|
160
160
|
const NEUTRAL_CHIP_COLOR = "#71717a";
|
|
161
161
|
const HEX_COLOR = /^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
162
162
|
|
|
163
|
-
const chipClass = "mx-px inline max-w-full truncate rounded-
|
|
163
|
+
const chipClass = "mx-px inline max-w-full truncate rounded-xs px-1 align-middle text-xs leading-4 text-white";
|
|
164
164
|
|
|
165
165
|
function paintComposer(root: HTMLElement, parts: readonly ComposerPart[]) {
|
|
166
166
|
const frag = document.createDocumentFragment();
|
|
@@ -525,8 +525,8 @@ export function ChatInput({ inputRef, generating = false, placeholder = "Message
|
|
|
525
525
|
<div className="flex-1" />
|
|
526
526
|
|
|
527
527
|
{generating ? (
|
|
528
|
-
<button type="button" onClick={onCancel} title="Stop" className="w-6 h-6 rounded-full bg-brand text-(--nonla-text-on-
|
|
529
|
-
<Icon name="stop" size={
|
|
528
|
+
<button type="button" onClick={onCancel} title="Stop" className="w-6 h-6 rounded-full bg-brand text-(--nonla-text-on-brand) flex items-center justify-center shrink-0 cursor-pointer hover:bg-brand/90 active:scale-[0.97] transition-[background-color,transform] duration-(--nonla-dur-instant) border-0">
|
|
529
|
+
<Icon name="stop" size={16} />
|
|
530
530
|
<span className="sr-only">Stop</span>
|
|
531
531
|
</button>
|
|
532
532
|
) : (
|
|
@@ -535,7 +535,7 @@ export function ChatInput({ inputRef, generating = false, placeholder = "Message
|
|
|
535
535
|
disabled={!canSend}
|
|
536
536
|
onClick={handleSend}
|
|
537
537
|
title="Send (Enter)"
|
|
538
|
-
className={cn("w-6 h-6 rounded-full flex items-center justify-center shrink-0 transition-
|
|
538
|
+
className={cn("w-6 h-6 rounded-full flex items-center justify-center shrink-0 transition-[background-color,color,transform] duration-(--nonla-dur-instant) border-0", canSend ? "bg-foreground text-background cursor-pointer" : "bg-border text-muted-foreground cursor-not-allowed opacity-50")}
|
|
539
539
|
>
|
|
540
540
|
<Icon name="arrow-up" size={14} />
|
|
541
541
|
<span className="sr-only">Send</span>
|
|
@@ -51,7 +51,7 @@ export function ChatThinking({ thinking, duration = 0, streaming = false, classN
|
|
|
51
51
|
>
|
|
52
52
|
<summary className={cn(chatToolLineClass, "cursor-pointer list-none font-medium select-none [&::-webkit-details-marker]:hidden")}>
|
|
53
53
|
<Shimmer active={streaming} className="text-muted-foreground">{label}</Shimmer>
|
|
54
|
-
<Icon name="arrow-right" size={12} className="shrink-0 opacity-0 text-muted-foreground transition-[opacity,transform]
|
|
54
|
+
<Icon name="arrow-right" size={12} className="shrink-0 opacity-0 text-muted-foreground transition-[opacity,transform] group-hover/thinking:opacity-100 group-open/thinking:opacity-100 group-open/thinking:rotate-90" />
|
|
55
55
|
</summary>
|
|
56
56
|
|
|
57
57
|
<div ref={bodyRef} className="pt-2 max-h-40 min-w-0 overflow-y-auto overflow-x-hidden mb-2 text-sm">
|
|
@@ -29,8 +29,8 @@ export function ChatUserMessage({ content, className }: ChatUserMessageProps) {
|
|
|
29
29
|
return (
|
|
30
30
|
<div
|
|
31
31
|
className={cn(
|
|
32
|
-
|
|
33
|
-
"
|
|
32
|
+
// Borderless wash and roomy padding, like Claude desktop. `bg-bar` is #f2f2f2 in light and follows the mode.
|
|
33
|
+
"nonla-chat-user relative isolate mx-4 mt-8 mb-3 overflow-hidden rounded-xl bg-bar px-4 py-2.5",
|
|
34
34
|
className,
|
|
35
35
|
)}
|
|
36
36
|
>
|
|
@@ -55,7 +55,7 @@ export function ChatUserMessage({ content, className }: ChatUserMessageProps) {
|
|
|
55
55
|
}}
|
|
56
56
|
className="flex w-full cursor-pointer items-center justify-center border-0 bg-transparent pt-1 text-muted-foreground hover:text-foreground"
|
|
57
57
|
>
|
|
58
|
-
<Icon name="arrow-down" size={12} className={cn("transition-transform duration-
|
|
58
|
+
<Icon name="arrow-down" size={12} className={cn("transition-transform duration-(--nonla-dur)", isExpanded && "rotate-180")} />
|
|
59
59
|
</button>
|
|
60
60
|
) : null}
|
|
61
61
|
</div>
|
|
@@ -31,9 +31,9 @@ export function ChatWelcome({ name, description, avatar, starters = [...DEFAULT_
|
|
|
31
31
|
<div className={cn("nonla-chat-welcome flex flex-col items-center justify-center min-h-full w-full px-6 py-10 text-center", className)}>
|
|
32
32
|
<div className="mb-5">{avatar ?? <DefaultAvatar name={name} />}</div>
|
|
33
33
|
|
|
34
|
-
<h2 className="m-0 text-
|
|
34
|
+
<h2 className="m-0 text-xl font-semibold tracking-tight text-foreground leading-snug">Hi, I'm {name}</h2>
|
|
35
35
|
|
|
36
|
-
{desc ? <p className="mt-2 mb-0 max-w-90 text-
|
|
36
|
+
{desc ? <p className="mt-2 mb-0 max-w-90 text-sm leading-relaxed text-tertiary-foreground line-clamp-2">{desc}</p> : <p className="mt-2 mb-0 max-w-[320px] text-sm leading-relaxed text-tertiary-foreground">Send a message to start working together.</p>}
|
|
37
37
|
|
|
38
38
|
{starters.length > 0 && onStarter ? (
|
|
39
39
|
<div className="mt-8 flex flex-wrap items-center justify-center gap-2 max-w-130">
|