devnonla-ui 0.12.0 → 0.14.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 +6 -245
- package/package.json +2 -2
- package/src/app/App.tsx +6 -22
- package/src/app/context.ts +2 -17
- package/src/avatar/AgentAvatar.tsx +17 -6
- package/src/avatar/avatar.css +107 -0
- package/src/button/Button.tsx +4 -4
- package/src/button/ButtonCopy.tsx +1 -1
- package/src/calendar/Calendar.tsx +1 -1
- package/src/card/Card.tsx +2 -5
- package/src/chat/AgentChatbox.tsx +1 -1
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/chatMessageList.tsx +1 -4
- package/src/chat/message-ui/ChatAgentMessage.tsx +6 -4
- package/src/chat/message-ui/ChatError.tsx +1 -1
- package/src/chat/message-ui/ChatInput.tsx +5 -4
- package/src/chat/message-ui/ChatMarkdown.tsx +2 -2
- package/src/chat/message-ui/ChatUserMessage.tsx +3 -3
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +3 -3
- package/src/chat/tool-ui/CallAgentToolUI.tsx +2 -2
- package/src/chat/tool-ui/ChatToolCall.tsx +3 -3
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +2 -2
- package/src/chat/tool-ui/RunJsToolUI.tsx +1 -1
- package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
- package/src/chat/tool-ui/WebFetchToolUI.tsx +1 -1
- package/src/checkbox/Checkbox.tsx +2 -2
- package/src/codeblock/CodeBlock.tsx +2 -2
- package/src/colorpicker/ColorPicker.tsx +10 -8
- package/src/datepicker/DatePicker.tsx +3 -3
- package/src/desktop/DesktopHeader.tsx +2 -2
- package/src/desktop/DesktopStage.tsx +1 -1
- package/src/desktop/DesktopWindow.tsx +3 -3
- package/src/desktop/MeadowDesktop.tsx +2 -2
- package/src/drawer/Drawer.tsx +6 -2
- package/src/dropdown/menuClasses.ts +1 -1
- package/src/empty/Empty.tsx +1 -1
- package/src/form/variants/FieldRadio.tsx +1 -1
- package/src/form/variants/FieldRepeaterItem.tsx +1 -1
- package/src/index.ts +7 -5
- package/src/input/EditableInput.tsx +3 -2
- package/src/input/Input.tsx +15 -7
- package/src/lib/sizes.ts +6 -6
- package/src/lib/surface.ts +14 -4
- package/src/markdown-editor/MarkdownDiff.tsx +4 -4
- package/src/markdown-editor/MarkdownPreview.tsx +6 -6
- package/src/markdown-editor/MarkdownSource.tsx +1 -1
- package/src/markdown-editor/MarkdownTable.tsx +2 -2
- package/src/markdown-editor/MarkdownViewer.tsx +54 -56
- package/src/markdown-editor/MermaidBlock.tsx +2 -2
- package/src/markdown-editor/ReactCode.tsx +6 -7
- package/src/markdown-editor/ReactCodeFrame.tsx +45 -15
- package/src/markdown-editor/ReactCodeSandbox.tsx +1 -1
- package/src/markdown-editor/markdownScale.ts +149 -0
- package/src/menu/Menu.tsx +1 -1
- package/src/message/message.tsx +18 -8
- package/src/modal/Modal.tsx +13 -7
- package/src/pagination/Pagination.tsx +3 -3
- package/src/popover/Popover.tsx +1 -1
- package/src/scroll/OverlayScroll.tsx +2 -2
- package/src/segmented/Segmented.tsx +1 -1
- package/src/select/Select.tsx +4 -4
- package/src/sidebar/Sidebar.tsx +35 -32
- package/src/skeleton/Skeleton.tsx +4 -4
- package/src/spin/Spin.tsx +14 -2
- package/src/splitter/Splitter.tsx +1 -1
- package/src/styles.css +171 -813
- package/src/table/Table.tsx +12 -12
- package/src/tabs/Tabs.tsx +261 -0
- package/src/tag/Tag.tsx +16 -16
- package/src/theme.ts +53 -232
- package/src/timepicker/TimePicker.tsx +2 -2
- package/src/typography/Typography.tsx +41 -35
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
React controls for Nonla Agents.
|
|
4
4
|
|
|
5
|
+
Docs: https://devnonla.github.io/devnonla-ui/
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
8
|
bun add devnonla-ui
|
|
7
9
|
```
|
|
@@ -10,256 +12,15 @@ Peer deps: `react` / `react-dom` >= 19, `react-hook-form`. Consumer should use T
|
|
|
10
12
|
|
|
11
13
|
```tsx
|
|
12
14
|
import "devnonla-ui/styles.css";
|
|
13
|
-
import { App, Button
|
|
14
|
-
import { useForm } from "react-hook-form";
|
|
15
|
-
|
|
16
|
-
message.success("Saved");
|
|
17
|
-
Modal.confirm({ title: "Delete?", onOk: async () => {} });
|
|
15
|
+
import { App, Button } from "devnonla-ui";
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
type: EFormItemType.Input,
|
|
22
|
-
name: "name",
|
|
23
|
-
label: "Name",
|
|
24
|
-
rules: { required: "Name is required" },
|
|
25
|
-
options: { placeholder: "Your name" },
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
function Example() {
|
|
30
|
-
const form = useForm({ defaultValues: { name: "" } });
|
|
17
|
+
export function Root() {
|
|
31
18
|
return (
|
|
32
19
|
<App>
|
|
33
|
-
<
|
|
34
|
-
<SchemaForm form={form} items={items} />
|
|
35
|
-
<Button type="primary" htmlType="submit">
|
|
36
|
-
Save
|
|
37
|
-
</Button>
|
|
38
|
-
</form>
|
|
20
|
+
<Button type="primary">Save</Button>
|
|
39
21
|
</App>
|
|
40
22
|
);
|
|
41
23
|
}
|
|
42
24
|
```
|
|
43
25
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# Sizes
|
|
47
|
-
|
|
48
|
-
Only **3 canonical sizes**: `small` | `default` | `large`.
|
|
49
|
-
|
|
50
|
-
Edit [`src/lib/sizes.ts`](src/lib/sizes.ts) — `CONTROL_SIZES`.
|
|
51
|
-
|
|
52
|
-
Aliases: `xs` → small, `middle` / `medium` → default.
|
|
53
|
-
|
|
54
|
-
# Theme (colors)
|
|
55
|
-
|
|
56
|
-
All color lives in **`--nonla-*` knobs** (`src/styles.css`). Components never hardcode palette hex.
|
|
57
|
-
|
|
58
|
-
Dark is the default (`:root` and `.dark`). `.light` is the daylight palette. `<App>` calls `initColorMode()` once and restores `localStorage` key `nonla-color-mode`, falling back to dark. Switch with `setColorMode("light" | "dark")` or `<ThemeToggle>`. `setColorPreference("light" | "dark" | "system")` and `<ThemeSwitcher>` also store `system`, which follows the OS and still paints `light` or `dark`. To start in daylight before paint, put `class="light"` on `<html>`.
|
|
59
|
-
|
|
60
|
-
**Other apps** — import the CSS, then override knobs. Do not fork Button/Tag/….
|
|
61
|
-
|
|
62
|
-
```css
|
|
63
|
-
@import "tailwindcss";
|
|
64
|
-
@import "devnonla-ui/styles.css";
|
|
65
|
-
|
|
66
|
-
:root {
|
|
67
|
-
--nonla-brand: #3b82f6;
|
|
68
|
-
--nonla-bg: #0b0f19;
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
`--brand-50` … `--brand-800` follow `--nonla-brand` (500 = the knob). Tints mix into the surface; `brand-700` stays with the ink. Text **on** the brand fill (Button primary, Tag solid, Checkbox) is `--nonla-solid-fg` / `colors.solidFg` — default `#181818` on the neutral `#f0f0f0` fill.
|
|
73
|
-
|
|
74
|
-
Or at runtime:
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
<App
|
|
78
|
-
theme={{
|
|
79
|
-
colors: { brand: "#3b82f6", bg: "#0b0f19", border: "#666666", borderInput: "#8a8a8a" },
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
…
|
|
83
|
-
</App>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Flat knobs still work (`brand`, `colorBorder`, `colorBorderInput`, …). `applyNonlaTheme({ brand: "#3b82f6" })` does the same on `:root`.
|
|
87
|
-
|
|
88
|
-
Core knobs: `--nonla-bg`, `--nonla-fg`, `--nonla-brand`, `--nonla-solid-fg`, `--nonla-danger`, `--nonla-success`, `--nonla-warn`, `--nonla-link`, `--nonla-radius` (small = −2px, large = +2px), `--nonla-height` / `--nonla-height-sm` / `--nonla-height-lg`, plus surfaces (`--nonla-surface`, `--nonla-chip`, …) and preset accents (`--nonla-blue`, `--nonla-purple`, …).
|
|
89
|
-
|
|
90
|
-
Those map into shadcn-standard tokens (`--background`, `--destructive`, …) plus Nonla aliases (`--brand`, `--success`, …).
|
|
91
|
-
|
|
92
|
-
- You: only touch `--nonla-*` (CSS or `theme` / `applyNonlaTheme`).
|
|
93
|
-
- Shadcn consumers: can still override `--background` / `--primary` / etc.
|
|
94
|
-
- Nonla CTA = `--brand` (from `--nonla-brand`). Label on that fill = `--nonla-solid-fg`. `--primary` = ink (emphasis), not the brand button.
|
|
95
|
-
|
|
96
|
-
`<App>` is the ConfigProvider: `theme`, `componentSize`, `getPopupContainer`. Overlay portals (Select, Dropdown, DatePicker, Modal, Drawer, …) read `getPopupContainer`. `message.*` and `Modal.confirm` render into holders under `App`. `useToken()` / `getDesignToken()` read the live seed knobs.
|
|
97
|
-
|
|
98
|
-
```tsx
|
|
99
|
-
<App componentSize="large" getPopupContainer={() => document.getElementById("app")!}>
|
|
100
|
-
…
|
|
101
|
-
</App>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
# Card
|
|
105
|
-
|
|
106
|
-
Titled settings surface. `Card.Item` is a label row; `align="center"` for a short row, `split` so a field fills the trailing half. `Card.Footer` sits under the rows. `caption` is the note under the frame.
|
|
107
|
-
|
|
108
|
-
```tsx
|
|
109
|
-
import { Card, Switch } from "devnonla-ui";
|
|
110
|
-
|
|
111
|
-
<Card title="General" caption="Applies to this workspace.">
|
|
112
|
-
<Card.Item label="Notifications" align="center">
|
|
113
|
-
<Switch />
|
|
114
|
-
</Card.Item>
|
|
115
|
-
<Card.Footer>Saved</Card.Footer>
|
|
116
|
-
</Card>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
# Desktop
|
|
120
|
-
|
|
121
|
-
Meadow wallpaper, window chrome, header bar, and desktop icons live in this package so other Nonla apps share the same shell.
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
import { DesktopStage, DesktopHeader, MeadowDesktop, DesktopWindow, MeadowShell, Menu, SolarIcon } from "devnonla-ui";
|
|
125
|
-
|
|
126
|
-
<DesktopStage>
|
|
127
|
-
<MeadowDesktop>{icons}</MeadowDesktop>
|
|
128
|
-
<DesktopHeader left={nav} right={apps} />
|
|
129
|
-
<DesktopWindow title="Tools" left={nav} right={actions} expanded={false} onClose={close} onToggleExpand={toggle}>
|
|
130
|
-
{children}
|
|
131
|
-
</DesktopWindow>
|
|
132
|
-
</DesktopStage>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
`MeadowShell` is the login/setup backdrop. `DesktopWindow` chrome is inline: traffic lights, `left`, a flex middle (title — double-click to expand), then `right`. A child can fill the same slots with `WindowHeader`. The window zooms open; `origin` is the element it zooms from, and `closeRef` receives a close function to call instead of unmounting so it can shrink back. Last collapsed position and size are restored on reopen (`persistKey`, or `false` to disable). Resize handles stay when expanded; dragging an edge leaves expand and keeps the new size. `Menu` is the glass picker (trigger + items + hover action) used by AgentsMenu. Wallpaper defaults to the bundled meadow; pass `src` on `MeadowWallpaper` to swap.
|
|
136
|
-
|
|
137
|
-
# Sidebar
|
|
138
|
-
|
|
139
|
-
Grouped side nav. Pass JSON groups + items; the app owns routing.
|
|
140
|
-
|
|
141
|
-
```tsx
|
|
142
|
-
import { Sidebar, type SidebarItemType } from "devnonla-ui";
|
|
143
|
-
|
|
144
|
-
const items: SidebarItemType[] = [
|
|
145
|
-
{
|
|
146
|
-
type: "group",
|
|
147
|
-
key: "chat",
|
|
148
|
-
label: "Chat",
|
|
149
|
-
children: [
|
|
150
|
-
{ key: "inbox", label: "Inbox", icon: "chat-24" },
|
|
151
|
-
{ key: "archive", label: "Archive", icon: "library-24" },
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
];
|
|
155
|
-
|
|
156
|
-
<Sidebar items={items} selectedKey={active} searchable onSelect={({ key }) => setActive(key)} />
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
`icon` may be a Fluent name string (JSON-friendly) or a node. Set `href` to render `<a>`; left-click still goes through `onSelect` so a SPA can `navigate`. Cmd/Ctrl-click keeps the native new-tab. Parent sets width; `Sidebar` fills height.
|
|
160
|
-
|
|
161
|
-
# Chat
|
|
162
|
-
|
|
163
|
-
`AgentPanel` is the full chat surface: welcome, messages, thinking, tool calls, markdown, composer. Attach an SSE endpoint and send. The panel POSTs `{ messages }` (plus optional `extraBody`).
|
|
164
|
-
|
|
165
|
-
`AgentChatbox` is the same UI when the **app** owns the request: `send` POSTs only the new user text; `resume` reattaches a live stream on mount; `onStop` runs after the client abort.
|
|
166
|
-
|
|
167
|
-
```tsx
|
|
168
|
-
import { AgentChatbox, AgentPanel } from "devnonla-ui";
|
|
169
|
-
|
|
170
|
-
<AgentPanel
|
|
171
|
-
endpoint="/api/agents/abc/assistant/stream"
|
|
172
|
-
title="Nova"
|
|
173
|
-
toolbar={<ModelPicker />}
|
|
174
|
-
toolUis={[{ name: "get_calendar_events", component: CalendarToolUI }]}
|
|
175
|
-
toolHooks={[
|
|
176
|
-
{ name: "web_fetch", onCall: (e) => console.log("fetch", e.input), onResult: (e) => console.log("done", e.output) },
|
|
177
|
-
]}
|
|
178
|
-
/>
|
|
179
|
-
|
|
180
|
-
<AgentChatbox
|
|
181
|
-
send={({ text, signal }) => fetch("/api/chat", { method: "POST", body: JSON.stringify({ text }), signal })}
|
|
182
|
-
resume={({ signal }) => fetch("/api/chat/stream", { signal })}
|
|
183
|
-
onStop={() => fetch("/api/chat/stop", { method: "POST" })}
|
|
184
|
-
/>
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
`endpoint` can also be a function that returns a `Response` (tests, mocks). Pass any node to `toolbar` for the composer (model picker, tools, …). Extra tool cards go in `toolUis` and win over builtins on the same `toolName`. `toolHooks` fire `onCall` / `onResult` for matching tools (omit `name` to hear every tool).
|
|
188
|
-
|
|
189
|
-
Stream events:
|
|
190
|
-
|
|
191
|
-
`text-delta` | `thinking-delta` | `tool-call` | `tool-result` | `done` | `error`
|
|
192
|
-
|
|
193
|
-
Primitives (`ChatWelcome`, `ChatUserMessage`, `ChatAgentMessage`, `ChatThinking`, `ChatToolCall`, `ChatInput`, `ChatError`, `ChatMarkdown`) stay exported for custom layouts.
|
|
194
|
-
|
|
195
|
-
# Markdown
|
|
196
|
-
|
|
197
|
-
`MarkdownViewer` renders markdown for reading: headings, lists, tables, code, and mermaid. Agent replies use the same view.
|
|
198
|
-
|
|
199
|
-
`MarkdownEditor` edits markdown in preview, source, or diff. Pass `original` to enable the diff view. `diffLayout` is side by side by default. `readOnly` locks the editor and hides the mode switcher.
|
|
200
|
-
|
|
201
|
-
```tsx
|
|
202
|
-
import { MarkdownEditor, MarkdownViewer } from "devnonla-ui";
|
|
203
|
-
|
|
204
|
-
<MarkdownViewer value={article} />
|
|
205
|
-
<MarkdownEditor value={text} original={previous} onChange={setText} />
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Live React in markdown
|
|
209
|
-
|
|
210
|
-
A `live-react` fence exports a default component and renders it above its source. It is off unless you opt in.
|
|
211
|
-
|
|
212
|
-
- **Markdown from users or agents:** pass `sandboxSrc`. The fence runs in an iframe with `sandbox="allow-scripts"` and no `allow-same-origin`, so it cannot reach the page's cookies, storage, or DOM. `sandboxSrc` is a page you host on its own origin that calls `mountReactCodeRunner`; its `modules` are the only imports markdown gets.
|
|
213
|
-
- **Markdown you wrote:** pass `trustedModules`. The fence runs in your page with full access. Never use it for content someone else can write.
|
|
214
|
-
|
|
215
|
-
```tsx
|
|
216
|
-
// sandbox page
|
|
217
|
-
import * as ui from "devnonla-ui";
|
|
218
|
-
import { mountReactCodeRunner } from "devnonla-ui";
|
|
219
|
-
|
|
220
|
-
mountReactCodeRunner(document.getElementById("root")!, { "devnonla-ui": ui });
|
|
221
|
-
|
|
222
|
-
// app
|
|
223
|
-
<MarkdownViewer value={article} sandboxSrc="https://sandbox.example.com/runner.html" />
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
Outside markdown, use the pieces directly. `ReactCodeSandbox` takes `code` and `src` and renders the same framed result with a Code tab. `ReactCode` is the in-page version for source you wrote. `ReactCodeFrame` is the header and tab box, if you want to wrap your own result.
|
|
227
|
-
|
|
228
|
-
```tsx
|
|
229
|
-
<ReactCodeSandbox code={source} src="https://sandbox.example.com/runner.html" />
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
Serve the runner page with `Content-Security-Policy: connect-src 'none'` and `Access-Control-Allow-Origin: *` on its assets, since a sandboxed frame loads them cross-origin.
|
|
233
|
-
|
|
234
|
-
# Typography
|
|
235
|
-
|
|
236
|
-
`Text`, `Title`, `Paragraph`, and `Link` share one decoration set: `type` (`secondary` | `success` | `warning` | `danger`), `disabled`, `mark`, `code`, `keyboard`, `underline`, `delete`, `strong`, and `italic`. `Title` `level` is 1–5. `Typography` groups the same pieces.
|
|
237
|
-
|
|
238
|
-
```tsx
|
|
239
|
-
import { Link, Paragraph, Text, Title } from "devnonla-ui";
|
|
240
|
-
|
|
241
|
-
<Title level={2}>Agents</Title>
|
|
242
|
-
<Paragraph>Run them on your machine.</Paragraph>
|
|
243
|
-
<Text type="secondary">Updated today</Text>
|
|
244
|
-
<Link href="https://nonlaagents.com">nonlaagents.com</Link>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
# Logo
|
|
248
|
-
|
|
249
|
-
`Logo` is the mark and the wordmark “Nonla Agents”. The wordmark is K2D regular, drawn as SVG outlines. `variant` is `icon`, `text`, or `full` (default). `size` is the icon height in px (default 32). `color` recolors the mark and the wordmark; the eyes and the smile stay.
|
|
250
|
-
|
|
251
|
-
```tsx
|
|
252
|
-
import { Logo } from "devnonla-ui";
|
|
253
|
-
|
|
254
|
-
<Logo />
|
|
255
|
-
<Logo variant="icon" size={24} />
|
|
256
|
-
<Logo color="#181818" />
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
# Icons
|
|
260
|
-
|
|
261
|
-
`SolarIcon` renders vendored Solar icons (`@iconify-json/solar`) as inline SVG, so they follow `currentColor`. Default style is `linear`. A legacy Fluent Color id such as `settings-24` still resolves to the Solar equivalent.
|
|
262
|
-
|
|
263
|
-
```tsx
|
|
264
|
-
<SolarIcon name="settings-linear" size={16} />
|
|
265
|
-
```
|
|
26
|
+
Install, theme, and each control are in the [docs](https://devnonla.github.io/devnonla-ui/).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devnonla-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "NonlaUI — React controls for Nonla Agents",
|
|
6
6
|
"author": "devlangla <devlangla0x01@gmail.com>",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/devnonla/devnonla-ui.git"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://github.
|
|
12
|
+
"homepage": "https://devnonla.github.io/devnonla-ui/",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/devnonla/devnonla-ui/issues"
|
|
15
15
|
},
|
package/src/app/App.tsx
CHANGED
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
-
import { type ReactNode,
|
|
2
|
+
import { type ReactNode, useMemo } from "react";
|
|
3
3
|
import { type ControlSize, ControlSizeContext, normalizeSize } from "../lib/sizes";
|
|
4
4
|
import { MessageHolder, message } from "../message/message";
|
|
5
5
|
import { ConfirmHolder, Modal } from "../modal/Modal";
|
|
6
|
-
import {
|
|
7
|
-
import { AppContext, type NonlaAppConfig, useAppConfig, usePopupContainer
|
|
6
|
+
import { initColorMode } from "../theme";
|
|
7
|
+
import { AppContext, type NonlaAppConfig, useAppConfig, usePopupContainer } from "./context";
|
|
8
8
|
|
|
9
9
|
export type { NonlaAppConfig };
|
|
10
|
-
export { useAppConfig, usePopupContainer
|
|
10
|
+
export { useAppConfig, usePopupContainer };
|
|
11
11
|
|
|
12
12
|
export type AppProps = {
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
getPopupContainer?: () => HTMLElement;
|
|
15
15
|
/** Default control size (`componentSize`). Per-control `size` still wins. */
|
|
16
16
|
componentSize?: ControlSize;
|
|
17
|
-
/** Override `--nonla-*` knobs on `:root` (portals inherit). Prefer CSS in the host when possible. */
|
|
18
|
-
theme?: NonlaThemeConfig;
|
|
19
17
|
};
|
|
20
18
|
|
|
21
19
|
/** Root host for NonlaUI — ConfigProvider + message/modal holders. Mount once near app root. */
|
|
22
|
-
export function App({ children, getPopupContainer, componentSize
|
|
20
|
+
export function App({ children, getPopupContainer, componentSize }: AppProps) {
|
|
23
21
|
// Before children paint, so a sandbox iframe can open on the saved mode instead of flashing the default.
|
|
24
22
|
initColorMode();
|
|
25
|
-
const [themeRev, setThemeRev] = useState(0);
|
|
26
23
|
const size = componentSize ? normalizeSize(componentSize) : undefined;
|
|
27
|
-
const value = useMemo<NonlaAppConfig>(
|
|
28
|
-
() => ({ getPopupContainer, componentSize: size, themeRev }),
|
|
29
|
-
[getPopupContainer, size, themeRev],
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
useLayoutEffect(() => {
|
|
33
|
-
if (!theme) return;
|
|
34
|
-
const restore = applyNonlaTheme(theme);
|
|
35
|
-
setThemeRev((n) => n + 1);
|
|
36
|
-
return () => {
|
|
37
|
-
restore();
|
|
38
|
-
setThemeRev((n) => n + 1);
|
|
39
|
-
};
|
|
40
|
-
}, [theme]);
|
|
24
|
+
const value = useMemo<NonlaAppConfig>(() => ({ getPopupContainer, componentSize: size }), [getPopupContainer, size]);
|
|
41
25
|
|
|
42
26
|
return (
|
|
43
27
|
<AppContext.Provider value={value}>
|
package/src/app/context.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { createContext, useContext
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
2
|
import type { CanonicalSize } from "../lib/sizes";
|
|
3
|
-
import { getColorMode, getDesignToken, type NonlaTokenSnapshot, subscribeColorMode } from "../theme";
|
|
4
3
|
|
|
5
4
|
export type NonlaAppConfig = {
|
|
6
5
|
getPopupContainer?: () => HTMLElement;
|
|
7
6
|
componentSize?: CanonicalSize;
|
|
8
|
-
/** Bumps when `<App theme>` applies knobs — `useToken` re-reads CSS. */
|
|
9
|
-
themeRev: number;
|
|
10
7
|
};
|
|
11
8
|
|
|
12
|
-
export const AppContext = createContext<NonlaAppConfig>({
|
|
9
|
+
export const AppContext = createContext<NonlaAppConfig>({});
|
|
13
10
|
|
|
14
11
|
export function useAppConfig() {
|
|
15
12
|
return useContext(AppContext);
|
|
@@ -20,15 +17,3 @@ export function usePopupContainer(override?: () => HTMLElement) {
|
|
|
20
17
|
const { getPopupContainer } = useAppConfig();
|
|
21
18
|
return () => (override ?? getPopupContainer)?.() ?? document.body;
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
/** Computed seed knobs under the current App theme (`useToken`). */
|
|
25
|
-
export function useToken(): { token: NonlaTokenSnapshot } {
|
|
26
|
-
const { themeRev } = useAppConfig();
|
|
27
|
-
const mode = useSyncExternalStore(subscribeColorMode, getColorMode, () => "dark" as const);
|
|
28
|
-
const token = useMemo(() => {
|
|
29
|
-
void themeRev;
|
|
30
|
-
void mode;
|
|
31
|
-
return getDesignToken();
|
|
32
|
-
}, [themeRev, mode]);
|
|
33
|
-
return { token };
|
|
34
|
-
}
|
|
@@ -7,6 +7,9 @@ export type AgentAvatarMotion = "still" | "idle";
|
|
|
7
7
|
/** Fixed facing. The head turns that way and the eyes follow. */
|
|
8
8
|
export type AgentAvatarLook = "forward" | "left" | "right" | "up" | "down" | "up-left" | "up-right" | "down-left" | "down-right";
|
|
9
9
|
|
|
10
|
+
/** Pupil color. Omitted picks black, or white when the face is dark. */
|
|
11
|
+
export type AgentAvatarEyeColor = "black" | "white";
|
|
12
|
+
|
|
10
13
|
export const AGENT_AVATAR_PARTS = {
|
|
11
14
|
shape: ["circle", "square", "triangle", "diamond", "hex", "gem", "pill", "arch", "cloud", "blob", "drop", "shield"],
|
|
12
15
|
color: ["#6E56F0", "#1C1C1C", "#F0B429", "#3DCFC0", "#F47820", "#3B82F6", "#F2549B", "#A56B3C"],
|
|
@@ -14,10 +17,11 @@ export const AGENT_AVATAR_PARTS = {
|
|
|
14
17
|
|
|
15
18
|
type Part<K extends keyof typeof AGENT_AVATAR_PARTS> = (typeof AGENT_AVATAR_PARTS)[K][number];
|
|
16
19
|
|
|
17
|
-
/** A character is one shape
|
|
20
|
+
/** A character is one shape, a color, and two eyes. */
|
|
18
21
|
export type AgentAvatarConfig = {
|
|
19
22
|
shape: Part<"shape">;
|
|
20
23
|
color: string;
|
|
24
|
+
eyeColor?: AgentAvatarEyeColor;
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
export type AgentAvatarProps = {
|
|
@@ -51,6 +55,7 @@ function resolveConfig(config?: Partial<AgentAvatarConfig>): AgentAvatarConfig {
|
|
|
51
55
|
return {
|
|
52
56
|
shape: config?.shape ?? DEFAULT_CONFIG.shape,
|
|
53
57
|
color: config?.color ?? DEFAULT_CONFIG.color,
|
|
58
|
+
eyeColor: config?.eyeColor,
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -71,6 +76,12 @@ function eyeInk(color: string) {
|
|
|
71
76
|
return luma < 0.28 ? EYE_ON_DARK : EYE;
|
|
72
77
|
}
|
|
73
78
|
|
|
79
|
+
function eyeFill(color: string, eyeColor?: AgentAvatarEyeColor) {
|
|
80
|
+
if (eyeColor === "white") return EYE_ON_DARK;
|
|
81
|
+
if (eyeColor === "black") return EYE;
|
|
82
|
+
return eyeInk(color);
|
|
83
|
+
}
|
|
84
|
+
|
|
74
85
|
/** Head shift, then how much further the eyes travel, in viewBox units. */
|
|
75
86
|
const LOOK: Record<AgentAvatarLook, { head: [number, number]; eyes: [number, number] }> = {
|
|
76
87
|
forward: { head: [0, 0], eyes: [0, 0] },
|
|
@@ -112,21 +123,21 @@ function Eyes({ cx, cy, w = 5.2, h = 12 }: { cx: number; cy: number; w?: number;
|
|
|
112
123
|
);
|
|
113
124
|
}
|
|
114
125
|
|
|
115
|
-
function Shape({ shape, color }: AgentAvatarConfig) {
|
|
126
|
+
function Shape({ shape, color, eyeColor }: AgentAvatarConfig) {
|
|
116
127
|
const paint = useContext(PaintContext);
|
|
117
128
|
const shadow = useContext(ShadowContext);
|
|
118
129
|
const soft = { fill: paint, stroke: paint, strokeLinejoin: "round" as const };
|
|
119
|
-
const face = (mark: ReactNode,
|
|
130
|
+
const face = (mark: ReactNode, pupils: ReactNode, shiftY = 0) => (
|
|
120
131
|
<g transform={shiftY ? `translate(0 ${shiftY})` : undefined}>
|
|
121
132
|
<g filter={shadow}>{mark}</g>
|
|
122
|
-
{
|
|
133
|
+
{pupils}
|
|
123
134
|
</g>
|
|
124
135
|
);
|
|
125
136
|
const body: Record<AgentAvatarConfig["shape"], ReactNode> = {
|
|
126
137
|
circle: face(<circle cx="32" cy="32" r="22" fill={paint} />, <Eyes cx={32} cy={30} />),
|
|
127
138
|
square: face(<rect x="9" y="9" width="46" height="46" rx="16" fill={paint} />, <Eyes cx={32} cy={30} />),
|
|
128
139
|
triangle: face(<path d="M32 16 L50 50 H14 Z" strokeWidth="14" {...soft} />, <Eyes cx={32} cy={38} />, -1),
|
|
129
|
-
diamond: face(<path d="M32
|
|
140
|
+
diamond: face(<path d="M32 14 L50 32 L32 50 L14 32 Z" strokeWidth="8" {...soft} />, <Eyes cx={32} cy={30} />),
|
|
130
141
|
hex: face(<path d="M32 12 L49 22 L49 42 L32 52 L15 42 L15 22 Z" strokeWidth="8" {...soft} />, <Eyes cx={32} cy={30} />),
|
|
131
142
|
gem: face(<path d="M22 12 H42 L52 22 V42 L42 52 H22 L12 42 V22 Z" strokeWidth="8" {...soft} />, <Eyes cx={32} cy={30} />),
|
|
132
143
|
pill: face(<rect x="6" y="18" width="52" height="28" rx="14" fill={paint} />, <Eyes cx={32} cy={30} />),
|
|
@@ -152,7 +163,7 @@ function Shape({ shape, color }: AgentAvatarConfig) {
|
|
|
152
163
|
-6,
|
|
153
164
|
),
|
|
154
165
|
};
|
|
155
|
-
return <InkContext.Provider value={
|
|
166
|
+
return <InkContext.Provider value={eyeFill(color, eyeColor)}>{body[shape]}</InkContext.Provider>;
|
|
156
167
|
}
|
|
157
168
|
|
|
158
169
|
export function AgentAvatar({ config, size = 64, motion = "still", look = "forward", className, label = "Agent" }: AgentAvatarProps) {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@keyframes nonla-avatar-wander {
|
|
2
|
+
0%,
|
|
3
|
+
14%,
|
|
4
|
+
100% {
|
|
5
|
+
transform: translate(var(--nonla-avatar-hx, 0), var(--nonla-avatar-hy, 0));
|
|
6
|
+
}
|
|
7
|
+
22%,
|
|
8
|
+
34% {
|
|
9
|
+
transform: translate(-5%, 1%);
|
|
10
|
+
}
|
|
11
|
+
42%,
|
|
12
|
+
54% {
|
|
13
|
+
transform: translate(0, -4%);
|
|
14
|
+
}
|
|
15
|
+
62%,
|
|
16
|
+
74% {
|
|
17
|
+
transform: translate(5%, 1%);
|
|
18
|
+
}
|
|
19
|
+
82%,
|
|
20
|
+
94% {
|
|
21
|
+
transform: translate(0, 4.4%);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@keyframes nonla-avatar-glance {
|
|
26
|
+
0%,
|
|
27
|
+
14%,
|
|
28
|
+
100% {
|
|
29
|
+
transform: translate(var(--nonla-avatar-ex, 0), var(--nonla-avatar-ey, 0));
|
|
30
|
+
}
|
|
31
|
+
22%,
|
|
32
|
+
34% {
|
|
33
|
+
transform: translate(-10%, 0.6%);
|
|
34
|
+
}
|
|
35
|
+
42%,
|
|
36
|
+
54% {
|
|
37
|
+
transform: translate(0, -6.9%);
|
|
38
|
+
}
|
|
39
|
+
62%,
|
|
40
|
+
74% {
|
|
41
|
+
transform: translate(10%, 0.6%);
|
|
42
|
+
}
|
|
43
|
+
82%,
|
|
44
|
+
94% {
|
|
45
|
+
transform: translate(0, 7.2%);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes nonla-avatar-blink {
|
|
50
|
+
0%,
|
|
51
|
+
46%,
|
|
52
|
+
52%,
|
|
53
|
+
100% {
|
|
54
|
+
transform: scaleY(1);
|
|
55
|
+
}
|
|
56
|
+
49% {
|
|
57
|
+
transform: scaleY(0.15);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* A quiet shift, not a bounce. */
|
|
62
|
+
.nonla-avatar {
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
line-height: 0;
|
|
66
|
+
vertical-align: middle;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.nonla-avatar-bob {
|
|
70
|
+
display: block;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 100%;
|
|
73
|
+
transform: translate(var(--nonla-avatar-hx, 0), var(--nonla-avatar-hy, 0));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.nonla-avatar-gaze {
|
|
77
|
+
transform-box: view-box;
|
|
78
|
+
transform: translate(var(--nonla-avatar-ex, 0), var(--nonla-avatar-ey, 0));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nonla-avatar-eyes {
|
|
82
|
+
transform-box: fill-box;
|
|
83
|
+
transform-origin: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.nonla-avatar[data-motion="idle"] .nonla-avatar-bob {
|
|
87
|
+
animation: nonla-avatar-wander 8.4s ease-in-out infinite;
|
|
88
|
+
animation-delay: var(--nonla-avatar-delay, 0s);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.nonla-avatar[data-motion="idle"] .nonla-avatar-gaze {
|
|
92
|
+
animation: nonla-avatar-glance 8.4s ease-in-out infinite;
|
|
93
|
+
animation-delay: var(--nonla-avatar-delay, 0s);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.nonla-avatar[data-motion="idle"] .nonla-avatar-eyes {
|
|
97
|
+
animation: nonla-avatar-blink 6.4s ease-in-out infinite;
|
|
98
|
+
animation-delay: var(--nonla-avatar-delay, 0s);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (prefers-reduced-motion: reduce) {
|
|
102
|
+
.nonla-avatar[data-motion] .nonla-avatar-bob,
|
|
103
|
+
.nonla-avatar[data-motion] .nonla-avatar-gaze,
|
|
104
|
+
.nonla-avatar[data-motion] .nonla-avatar-eyes {
|
|
105
|
+
animation: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
package/src/button/Button.tsx
CHANGED
|
@@ -75,14 +75,14 @@ function tokenAppearance(color: "default" | "primary" | "danger" | "link", varia
|
|
|
75
75
|
if (variant === "nostyle") return "";
|
|
76
76
|
const g = ghost && variant !== "text" && variant !== "link";
|
|
77
77
|
if (color === "primary") {
|
|
78
|
-
if (variant === "solid" && !g) return "border-transparent bg-brand text-[var(--nonla-solid
|
|
78
|
+
if (variant === "solid" && !g) return "border-transparent bg-brand text-[var(--nonla-text-on-solid)] hover:bg-[color-mix(in_oklab,var(--brand),var(--background)_14%)] active:bg-[color-mix(in_oklab,var(--brand),black_18%)]";
|
|
79
79
|
if (variant === "filled") return "bg-brand/15 text-brand-700 border-transparent hover:bg-brand/25";
|
|
80
80
|
if (variant === "text") return "bg-transparent text-brand border-transparent hover:bg-brand/10";
|
|
81
81
|
if (variant === "link") return "text-brand border-transparent hover:text-brand-700";
|
|
82
82
|
return "bg-transparent text-brand border-brand hover:bg-brand/10";
|
|
83
83
|
}
|
|
84
84
|
if (color === "danger") {
|
|
85
|
-
if (variant === "solid" && !g) return "border-transparent bg-destructive text-
|
|
85
|
+
if (variant === "solid" && !g) return "border-transparent bg-destructive text-(--nonla-text-on-solid) hover:bg-destructive/90";
|
|
86
86
|
if (variant === "filled") return "bg-destructive/15 text-destructive border-transparent hover:bg-destructive/25";
|
|
87
87
|
if (variant === "text") return "bg-transparent text-destructive border-transparent hover:bg-destructive/10";
|
|
88
88
|
if (variant === "link") return "text-destructive border-transparent hover:text-destructive/80";
|
|
@@ -92,13 +92,13 @@ function tokenAppearance(color: "default" | "primary" | "danger" | "link", varia
|
|
|
92
92
|
if (variant === "filled") return "bg-muted text-foreground border-transparent hover:bg-muted/80";
|
|
93
93
|
if (variant === "text") return "bg-transparent text-foreground border-transparent hover:bg-ink-hover hover:text-foreground";
|
|
94
94
|
if (variant === "dashed") return "bg-transparent text-foreground border-dashed border-border hover:bg-ink-hover";
|
|
95
|
-
return "nonla-btn-glass text-foreground";
|
|
95
|
+
return "nonla-btn-glass border-border bg-transparent text-foreground shadow-none transition-[box-shadow,transform] duration-(--nonla-dur-fast) ease-(--nonla-ease-out) hover:not-disabled:not-aria-disabled:shadow-[inset_0_0_0_999px_var(--nonla-ink-hover)] active:not-disabled:not-aria-disabled:scale-[0.98] active:not-disabled:not-aria-disabled:shadow-[inset_0_0_0_999px_var(--nonla-ink-active)] motion-reduce:transition-[box-shadow] motion-reduce:active:transform-none";
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function presetAppearance(variant: ButtonVariant, ghost: boolean): string {
|
|
99
99
|
if (variant === "nostyle") return "";
|
|
100
100
|
const g = ghost && variant !== "text" && variant !== "link";
|
|
101
|
-
if (variant === "solid" && !g) return "bg-(--nonla-btn) text-[var(--nonla-solid
|
|
101
|
+
if (variant === "solid" && !g) return "bg-(--nonla-btn) text-[var(--nonla-text-on-solid)] border-transparent hover:brightness-110";
|
|
102
102
|
if (variant === "filled") return "bg-(--nonla-btn)/15 text-(--nonla-btn) border-transparent hover:bg-(--nonla-btn)/25";
|
|
103
103
|
if (variant === "link") return "text-(--nonla-btn) border-transparent hover:opacity-80";
|
|
104
104
|
if (variant === "dashed") return "bg-transparent text-(--nonla-btn) border-dashed border-(--nonla-btn) hover:bg-(--nonla-btn)/10";
|
|
@@ -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 duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
32
|
+
className={cn("inline-flex cursor-pointer shrink-0 items-center justify-center text-muted-foreground transition-colors duration-200 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/55", className)}
|
|
33
33
|
style={{ width: box, height: box }}
|
|
34
34
|
onClick={async (e) => {
|
|
35
35
|
onClick?.(e);
|
|
@@ -51,7 +51,7 @@ 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-brand-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
54
|
+
"transition-colors hover:bg-brand-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/55",
|
|
55
55
|
"data-[selected-single=true]:bg-brand-200 data-[selected-single=true]:text-foreground data-[selected-single=true]:hover:bg-brand-200",
|
|
56
56
|
"data-[range-start=true]:bg-brand-200 data-[range-start=true]:text-foreground data-[range-start=true]:hover:bg-brand-200 data-[range-start=true]:rounded-md",
|
|
57
57
|
"data-[range-end=true]:bg-brand-200 data-[range-end=true]:text-foreground data-[range-end=true]:hover:bg-brand-200 data-[range-end=true]:rounded-md",
|
package/src/card/Card.tsx
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
3
|
|
|
4
|
-
/** Hairline used by the dashboard card ring and row rules (`--nonla-hairline`). */
|
|
5
|
-
const HAIRLINE = "var(--nonla-hairline)";
|
|
6
|
-
|
|
7
4
|
export type CardProps = HTMLAttributes<HTMLElement> & {
|
|
8
5
|
/** Section label above the surface. */
|
|
9
6
|
title?: ReactNode;
|
|
@@ -29,7 +26,7 @@ function CardRoot({ title, caption, className, children, ...rest }: CardProps) {
|
|
|
29
26
|
return (
|
|
30
27
|
<section className={cn("flex flex-col gap-[9px]", className)} {...rest}>
|
|
31
28
|
{title != null && title !== "" ? <div className="px-2 text-sm leading-4 text-foreground">{title}</div> : null}
|
|
32
|
-
<div className="flex flex-col self-stretch rounded-xl bg-card" style={{ boxShadow:
|
|
29
|
+
<div className="flex flex-col self-stretch rounded-xl bg-card" style={{ boxShadow: "var(--nonla-card-shadow)" }}>
|
|
33
30
|
{children}
|
|
34
31
|
</div>
|
|
35
32
|
{caption != null && caption !== "" ? <div className="px-3 text-xs leading-4 text-tertiary-foreground">{caption}</div> : null}
|
|
@@ -46,7 +43,7 @@ function CardItem({ label, description, align = "start", split = false, classNam
|
|
|
46
43
|
className={cn(
|
|
47
44
|
"relative flex w-full gap-5 px-4 py-3",
|
|
48
45
|
centered ? "items-center" : "items-start",
|
|
49
|
-
"before:pointer-events-none before:absolute before:top-0 before:right-4 before:left-4 before:h-px before:bg-
|
|
46
|
+
"before:pointer-events-none before:absolute before:top-0 before:right-4 before:left-4 before:h-px before:bg-border-secondary before:content-[''] first:before:hidden",
|
|
50
47
|
className,
|
|
51
48
|
)}
|
|
52
49
|
{...rest}
|
|
@@ -90,7 +90,7 @@ export function AgentChatbox({
|
|
|
90
90
|
return (
|
|
91
91
|
<div className={cn("nonla-agent-chatbox relative flex h-full min-h-0 flex-col overflow-hidden bg-transparent", className)}>
|
|
92
92
|
<OverlayScroll visibility={scrollbar} scrollRef={scrollRef} onScroll={onScroll} className="flex-1 min-h-0 min-w-0" innerClassName={messages.length === 0 ? "flex flex-col" : undefined}>
|
|
93
|
-
<div data-chat-scroll-content className={`max-w-200 mx-auto min-w-0 w-full ${messages.length === 0 ? "flex flex-1 flex-col
|
|
93
|
+
<div data-chat-scroll-content className={`max-w-200 mx-auto min-w-0 w-full ${messages.length === 0 ? "flex flex-1 flex-col" : "pt-4 pb-20"}`}>
|
|
94
94
|
{messages.length === 0 ? (
|
|
95
95
|
(emptyState ?? (
|
|
96
96
|
<ChatWelcome name={welcomeName} description={description} avatar={avatar} starters={starters} onStarter={sendMessage} disabled={generating} />
|
package/src/chat/AgentPanel.tsx
CHANGED
|
@@ -97,7 +97,7 @@ export function AgentPanel({
|
|
|
97
97
|
return (
|
|
98
98
|
<div className={cn("nonla-agent-panel relative flex h-full min-h-0 flex-col overflow-hidden bg-transparent", className)}>
|
|
99
99
|
<OverlayScroll visibility={scrollbar} scrollRef={scrollRef} onScroll={onScroll} className="flex-1 min-h-0 min-w-0" innerClassName={messages.length === 0 ? "flex flex-col" : undefined}>
|
|
100
|
-
<div data-chat-scroll-content className={`max-w-200 mx-auto min-w-0 w-full ${messages.length === 0 ? "flex flex-1 flex-col
|
|
100
|
+
<div data-chat-scroll-content className={`max-w-200 mx-auto min-w-0 w-full ${messages.length === 0 ? "flex flex-1 flex-col" : "pt-4 pb-28"}`}>
|
|
101
101
|
{messages.length === 0 ? (
|
|
102
102
|
(emptyState ?? (
|
|
103
103
|
<ChatWelcome name={welcomeName} description={description} avatar={avatar} starters={starters} onStarter={sendMessage} disabled={generating} />
|