devnonla-ui 0.19.1 → 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 +18 -7
- 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/MarkdownViewer.tsx +8 -8
- 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 +262 -49
- 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/typography/Typography.tsx +3 -5
- 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
|
@@ -4,7 +4,7 @@ import remarkGfm from "remark-gfm";
|
|
|
4
4
|
import { Checkbox } from "../checkbox/Checkbox";
|
|
5
5
|
import { CodeBlock } from "../codeblock/CodeBlock";
|
|
6
6
|
import { cn } from "../lib/cn";
|
|
7
|
-
import { headingClass, markdownScaleStyle } from "../lib/markdownScale";
|
|
7
|
+
import { headingClass, markdownInlineCodeClass, markdownScaleStyle } from "../lib/markdownScale";
|
|
8
8
|
import { type InlineEdit, type MarkdownBlock, parseMarkdownDoc, readFence, readInlineEdit } from "./blocks";
|
|
9
9
|
import { MarkdownTable } from "./MarkdownTable";
|
|
10
10
|
import { MermaidBlock } from "./MermaidBlock";
|
|
@@ -18,7 +18,7 @@ const taskCheckClass =
|
|
|
18
18
|
"data-[state=checked]:border-foreground! data-[state=checked]:bg-foreground! data-[state=checked]:text-background! data-[state=indeterminate]:border-foreground! data-[state=indeterminate]:bg-foreground! data-[state=indeterminate]:text-background!";
|
|
19
19
|
|
|
20
20
|
const documentClass = cn(
|
|
21
|
-
"min-w-0 wrap-anywhere text-(length:--md-body-size,var(--nonla-
|
|
21
|
+
"min-w-0 wrap-anywhere text-(length:--md-body-size,var(--nonla-base-text-size,15px)) leading-(--md-body-leading,calc(var(--nonla-base-text-size,15px)*1.6)) text-foreground",
|
|
22
22
|
"[&_:is(h1,h2,h3,h4,h5,h6)]:text-foreground",
|
|
23
23
|
"[&_:is(h1,h2)]:mt-(--md-h2-mt,24px) [&_h1]:mb-(--md-h1-mb,12px) [&_h2]:mb-(--md-h2-mb,8px) [&_:is(h1,h2)]:pt-(--md-h2-py,3px) [&_:is(h1,h2)]:pb-(--md-h2-py,3px) [&_:is(h1,h2)]:text-(length:--md-h2-size,26px) [&_:is(h1,h2)]:leading-(--md-h2-leading,32px) [&_:is(h1,h2)]:font-(--md-h2-weight,600) [&_:is(h1,h2)]:tracking-normal",
|
|
24
24
|
"[&_h3]:mt-(--md-h3-mt,22px) [&_h3]:mb-(--md-h3-mb,8px) [&_h3]:text-(length:--md-h3-size,24px) [&_h3]:leading-(--md-h3-leading,32px) [&_h3]:font-(--md-h3-weight,600)",
|
|
@@ -47,7 +47,7 @@ const previewComponents: Components = {
|
|
|
47
47
|
const codeText = String(children).replace(/\n$/, "");
|
|
48
48
|
const isBlock = codeText.includes("\n") || !!match;
|
|
49
49
|
if (!isBlock) {
|
|
50
|
-
return <code className=
|
|
50
|
+
return <code className={markdownInlineCodeClass}>{children}</code>;
|
|
51
51
|
}
|
|
52
52
|
if (lang.toLowerCase() === "mermaid") return <MermaidView code={codeText} />;
|
|
53
53
|
return <CodeBlock code={codeText} language={lang || undefined} className="my-(--md-code-my,8px)" />;
|
|
@@ -65,7 +65,7 @@ const previewComponents: Components = {
|
|
|
65
65
|
input({ type, checked }) {
|
|
66
66
|
if (type !== "checkbox") return <input type={type} checked={checked} readOnly />;
|
|
67
67
|
return (
|
|
68
|
-
<span className="nonla-md-task-check pointer-events-none inline-flex h-(--md-body-leading,calc(var(--nonla-
|
|
68
|
+
<span className="nonla-md-task-check pointer-events-none inline-flex h-(--md-body-leading,calc(var(--nonla-base-text-size,15px)*1.6)) items-center">
|
|
69
69
|
<Checkbox checked={Boolean(checked)} tabIndex={-1} className={taskCheckClass} />
|
|
70
70
|
</span>
|
|
71
71
|
);
|
|
@@ -133,16 +133,16 @@ export function RichText({ source }: { source: string }) {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
* List body
|
|
137
|
-
*
|
|
136
|
+
* List body keeps paragraph leading so wrapped lines stay readable.
|
|
137
|
+
* View and edit share the same rhythm so the block does not jump.
|
|
138
138
|
*/
|
|
139
139
|
const listBodyClass =
|
|
140
|
-
"[&_p]:my-0! [&_p]:
|
|
140
|
+
"[&_p]:my-0! [&_p]:py-0.5! [&_p]:leading-(--md-p-leading,1.6)! [&_textarea]:my-0! [&_textarea]:py-0.5! [&_textarea]:leading-(--md-p-leading,1.6)!";
|
|
141
141
|
|
|
142
142
|
export function ListItem({ view, children }: { view: Extract<InlineEdit, { kind: "list" }>; children: ReactNode }) {
|
|
143
143
|
const level = Math.floor(view.indent.length / 2);
|
|
144
144
|
const ordinal = Number(/^(\d+)/.exec(view.marker)?.[1] ?? "1");
|
|
145
|
-
const marker = "w-6 shrink-0 pt-0.5 text-(length:--md-body-size,var(--nonla-
|
|
145
|
+
const marker = "w-6 shrink-0 pt-0.5 text-(length:--md-body-size,var(--nonla-base-text-size,15px)) leading-(--md-p-leading,1.6)";
|
|
146
146
|
return (
|
|
147
147
|
<div data-md-list="" className="flex items-start gap-1.5 pl-(--md-item-pl,4px)" style={level > 0 ? { marginLeft: `calc(${level} * var(--md-nest, 1.25rem))` } : undefined}>
|
|
148
148
|
{view.task ? (
|
|
@@ -188,9 +188,9 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
188
188
|
|
|
189
189
|
if (error) {
|
|
190
190
|
return (
|
|
191
|
-
<div className={cn("my-3 rounded-lg bg-
|
|
191
|
+
<div className={cn("my-3 rounded-lg bg-destructive-bg border border-destructive-border p-4 text-xs text-destructive", className)}>
|
|
192
192
|
<p className="font-medium mb-1">Mermaid render error</p>
|
|
193
|
-
<pre className="whitespace-pre-wrap text-
|
|
193
|
+
<pre className="whitespace-pre-wrap text-xs text-muted-foreground">{error}</pre>
|
|
194
194
|
</div>
|
|
195
195
|
);
|
|
196
196
|
}
|
|
@@ -210,7 +210,7 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
210
210
|
|
|
211
211
|
<dialog
|
|
212
212
|
ref={dialogRef}
|
|
213
|
-
className="inset-2.5 m-0 h-auto w-auto max-h-none max-w-none overflow-hidden rounded-xl border border-
|
|
213
|
+
className="inset-2.5 m-0 h-auto w-auto max-h-none max-w-none overflow-hidden rounded-xl border border-border bg-card p-0 shadow-(--nonla-shadow) backdrop:bg-black/40 open:flex open:flex-col"
|
|
214
214
|
onClose={resetView}
|
|
215
215
|
onKeyDown={(e) => {
|
|
216
216
|
if (e.key !== "Escape") return;
|
|
@@ -219,14 +219,14 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
219
219
|
closeFullscreen();
|
|
220
220
|
}}
|
|
221
221
|
>
|
|
222
|
-
<div className="absolute top-5 right-5 z-
|
|
222
|
+
<div className="absolute top-5 right-5 z-10 flex items-center gap-1.5">
|
|
223
223
|
<Button size="small" icon={<Icon name="download" size={12} />} title="Download SVG" aria-label="Download SVG" onClick={downloadSvg} disabled={!svgContent} />
|
|
224
224
|
<Button size="small" icon={<Icon name="minimize" size={12} />} title="Exit fullscreen" onClick={closeFullscreen}>
|
|
225
225
|
Exit
|
|
226
226
|
</Button>
|
|
227
227
|
</div>
|
|
228
228
|
|
|
229
|
-
<div className="absolute bottom-5 left-1/2 z-
|
|
229
|
+
<div className="absolute bottom-5 left-1/2 z-10 flex -translate-x-1/2 items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 text-xs text-muted-foreground shadow-(--nonla-shadow) select-none">
|
|
230
230
|
<span>{Math.round(zoom * 100)}%</span>
|
|
231
231
|
{!isDefaultView ? (
|
|
232
232
|
<Button type="text" size="small" onClick={resetView}>
|
|
@@ -56,7 +56,7 @@ export function ReactCodeFrame({ title, icon, showHeader = true, code, className
|
|
|
56
56
|
aria-expanded={open}
|
|
57
57
|
aria-label={codeLabel}
|
|
58
58
|
className={cn(
|
|
59
|
-
"inline-flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-
|
|
59
|
+
"inline-flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-ink-hover active:bg-ink-active hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
60
60
|
open ? "bg-muted text-foreground" : "text-muted-foreground",
|
|
61
61
|
)}
|
|
62
62
|
onClick={() => setOpen((value) => !value)}
|
package/src/menu/Menu.tsx
CHANGED
|
@@ -42,13 +42,13 @@ export function MenuTrigger({ active, open, className, children, ...rest }: Menu
|
|
|
42
42
|
aria-current={active ? "true" : undefined}
|
|
43
43
|
className={cn(
|
|
44
44
|
"inline-flex h-7 max-w-44 items-center gap-0.5 rounded-md border-0 bg-transparent px-2.5 text-sm font-medium leading-5 cursor-pointer",
|
|
45
|
-
active || open ? "bg-ink-active text-foreground" : "text-foreground
|
|
45
|
+
active || open ? "bg-ink-active text-foreground" : "text-foreground hover:bg-ink-hover",
|
|
46
46
|
className,
|
|
47
47
|
)}
|
|
48
48
|
{...rest}
|
|
49
49
|
>
|
|
50
50
|
<span className="min-w-0 truncate leading-5">{children}</span>
|
|
51
|
-
<Icon name="arrow-down" size={12} className={cn("shrink-0 transition-transform duration-
|
|
51
|
+
<Icon name="arrow-down" size={12} className={cn("shrink-0 transition-transform duration-(--nonla-dur)", open && "rotate-180")} />
|
|
52
52
|
</button>
|
|
53
53
|
);
|
|
54
54
|
}
|
package/src/message/message.tsx
CHANGED
|
@@ -45,8 +45,8 @@ const timers = new Map<string, number>();
|
|
|
45
45
|
function IconSuccess() {
|
|
46
46
|
return (
|
|
47
47
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
|
|
48
|
-
<circle cx="8" cy="8" r="8" fill="var(--success)" />
|
|
49
|
-
<path d="M4.6 8.15L6.85 10.3L11.4 5.7" stroke="var(--nonla-
|
|
48
|
+
<circle cx="8" cy="8" r="8" fill="var(--nonla-success-fill)" />
|
|
49
|
+
<path d="M4.6 8.15L6.85 10.3L11.4 5.7" stroke="var(--nonla-text-on-success)" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" />
|
|
50
50
|
</svg>
|
|
51
51
|
);
|
|
52
52
|
}
|
|
@@ -54,8 +54,8 @@ function IconSuccess() {
|
|
|
54
54
|
function IconError() {
|
|
55
55
|
return (
|
|
56
56
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
|
|
57
|
-
<circle cx="8" cy="8" r="8" fill="var(--
|
|
58
|
-
<path d="M5.4 5.4L10.6 10.6M10.6 5.4L5.4 10.6" stroke="var(--nonla-text-on-
|
|
57
|
+
<circle cx="8" cy="8" r="8" fill="var(--nonla-danger-fill)" />
|
|
58
|
+
<path d="M5.4 5.4L10.6 10.6M10.6 5.4L5.4 10.6" stroke="var(--nonla-text-on-danger)" strokeWidth="1.6" strokeLinecap="round" />
|
|
59
59
|
</svg>
|
|
60
60
|
);
|
|
61
61
|
}
|
|
@@ -64,7 +64,7 @@ function IconInfo() {
|
|
|
64
64
|
return (
|
|
65
65
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
|
|
66
66
|
<circle cx="8" cy="8" r="8" fill="var(--link)" />
|
|
67
|
-
<path d="M8 7.1V11.2M8 4.8V5.5" stroke="var(--nonla-
|
|
67
|
+
<path d="M8 7.1V11.2M8 4.8V5.5" stroke="var(--nonla-bg)" strokeWidth="1.7" strokeLinecap="round" />
|
|
68
68
|
</svg>
|
|
69
69
|
);
|
|
70
70
|
}
|
|
@@ -72,8 +72,8 @@ function IconInfo() {
|
|
|
72
72
|
function IconWarning() {
|
|
73
73
|
return (
|
|
74
74
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
|
|
75
|
-
<circle cx="8" cy="8" r="8" fill="var(--warn)" />
|
|
76
|
-
<path d="M8 4.6V8.8M8 10.8V11.4" stroke="var(--nonla-
|
|
75
|
+
<circle cx="8" cy="8" r="8" fill="var(--nonla-warn-fill)" />
|
|
76
|
+
<path d="M8 4.6V8.8M8 10.8V11.4" stroke="var(--nonla-text-on-warn)" strokeWidth="1.7" strokeLinecap="round" />
|
|
77
77
|
</svg>
|
|
78
78
|
);
|
|
79
79
|
}
|
|
@@ -111,7 +111,7 @@ function MessageList({ list }: { list: Active[] }) {
|
|
|
111
111
|
className={cn(
|
|
112
112
|
glassSurfaceClass,
|
|
113
113
|
"nonla-message-item pointer-events-auto inline-flex items-center gap-2 rounded-(--radius) px-3 py-[9px] text-sm leading-[1.5714] will-change-[transform,opacity] animate-[nonla-message-in_var(--nonla-dur)_var(--nonla-ease-out)]",
|
|
114
|
-
item.leaving && "animate-[nonla-message-
|
|
114
|
+
item.leaving && "animate-[nonla-message-out_var(--nonla-dur-fast)_var(--nonla-ease-in)_forwards]",
|
|
115
115
|
item.className,
|
|
116
116
|
)}
|
|
117
117
|
data-type={item.type}
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -195,9 +195,9 @@ function ModalView({
|
|
|
195
195
|
>
|
|
196
196
|
{(title || closable) && (
|
|
197
197
|
<div className="nonla-modal-header flex shrink-0 items-center justify-between gap-3 bg-transparent px-4 py-3" style={styles?.header}>
|
|
198
|
-
<Dialog.Title className="nonla-modal-title m-0 text-
|
|
198
|
+
<Dialog.Title className="nonla-modal-title m-0 text-lg leading-snug font-semibold text-foreground">{title}</Dialog.Title>
|
|
199
199
|
{closable ? (
|
|
200
|
-
<Dialog.Close className="nonla-modal-close -mt-1 -mr-1.5 -mb-1 ml-0 inline-flex size-7 cursor-pointer items-center justify-center rounded-(--radius) border-0 bg-transparent text-[18px] leading-none text-muted-foreground hover:bg-
|
|
200
|
+
<Dialog.Close className="nonla-modal-close -mt-1 -mr-1.5 -mb-1 ml-0 inline-flex size-7 cursor-pointer items-center justify-center rounded-(--radius) border-0 bg-transparent text-[18px] leading-none text-muted-foreground hover:bg-ink-hover active:bg-ink-active hover:text-foreground" aria-label="Close">
|
|
201
201
|
×
|
|
202
202
|
</Dialog.Close>
|
|
203
203
|
) : null}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../lib/cn";
|
|
3
|
+
|
|
4
|
+
export type PageHeaderProps = Omit<HTMLAttributes<HTMLElement>, "title"> & {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Muted line under the title. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** Beside the title: a docs link, a status tag. */
|
|
9
|
+
meta?: ReactNode;
|
|
10
|
+
/** Right side: page actions (buttons, a date range). */
|
|
11
|
+
extra?: ReactNode;
|
|
12
|
+
/** Full-width hairline under the header. Default `true`. */
|
|
13
|
+
bordered?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Page title row — title, meta, description, and actions on the right, over a hairline. */
|
|
17
|
+
export function PageHeader({ title, description, meta, extra, bordered = true, className, children, ...rest }: PageHeaderProps) {
|
|
18
|
+
return (
|
|
19
|
+
<header className={cn("flex flex-col gap-4 pb-5", bordered && "border-b border-solid border-border", className)} {...rest}>
|
|
20
|
+
<div className="flex flex-wrap items-start justify-between gap-x-6 gap-y-3">
|
|
21
|
+
<div className="flex min-w-0 flex-1 basis-64 flex-col gap-1">
|
|
22
|
+
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
|
23
|
+
<h1 className="m-0 text-lg leading-7 font-semibold text-foreground">{title}</h1>
|
|
24
|
+
{meta}
|
|
25
|
+
</div>
|
|
26
|
+
{description != null && description !== "" ? <p className="m-0 text-sm text-muted-foreground">{description}</p> : null}
|
|
27
|
+
</div>
|
|
28
|
+
{extra != null ? <div className="flex shrink-0 items-center gap-2">{extra}</div> : null}
|
|
29
|
+
</div>
|
|
30
|
+
{children}
|
|
31
|
+
</header>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -115,7 +115,7 @@ function ItemBtn({
|
|
|
115
115
|
className={cn(
|
|
116
116
|
"group inline-flex min-w-0 cursor-pointer items-center justify-center px-1.5 tabular-nums select-none",
|
|
117
117
|
"transition-colors disabled:cursor-not-allowed disabled:opacity-40",
|
|
118
|
-
active ? "bg-
|
|
118
|
+
active ? "bg-selected font-medium text-on-selected" : "text-muted-foreground hover:bg-ink-hover hover:text-foreground",
|
|
119
119
|
className,
|
|
120
120
|
)}
|
|
121
121
|
style={{
|
|
@@ -185,7 +185,7 @@ function MiniField({
|
|
|
185
185
|
}
|
|
186
186
|
}}
|
|
187
187
|
className={cn(
|
|
188
|
-
"text-center tabular-nums text-foreground placeholder:text-
|
|
188
|
+
"text-center tabular-nums text-foreground placeholder:text-tertiary-foreground",
|
|
189
189
|
controlFieldSurface,
|
|
190
190
|
controlFieldTransition,
|
|
191
191
|
controlFieldFocusBorder,
|
|
@@ -562,7 +562,7 @@ function JumperField({
|
|
|
562
562
|
}
|
|
563
563
|
}}
|
|
564
564
|
className={cn(
|
|
565
|
-
"text-center tabular-nums text-foreground placeholder:text-
|
|
565
|
+
"text-center tabular-nums text-foreground placeholder:text-tertiary-foreground",
|
|
566
566
|
controlFieldSurface,
|
|
567
567
|
controlFieldTransition,
|
|
568
568
|
controlFieldFocusBorder,
|
|
@@ -12,7 +12,7 @@ export type PopconfirmProps = {
|
|
|
12
12
|
onCancel?: () => void;
|
|
13
13
|
okText?: ReactNode;
|
|
14
14
|
cancelText?: ReactNode;
|
|
15
|
-
okType?: "primary" | "default" | "
|
|
15
|
+
okType?: "primary" | "default" | "link" | "text" | "danger";
|
|
16
16
|
okButtonProps?: { danger?: boolean; type?: string; color?: string; variant?: string };
|
|
17
17
|
cancelButtonProps?: Record<string, unknown>;
|
|
18
18
|
/** Customize / hide the leading icon. Pass `null` to hide. */
|
|
@@ -90,7 +90,7 @@ export function Popconfirm({
|
|
|
90
90
|
{showIcon ? <span className="nonla-popconfirm-icon">{resolvedIcon}</span> : null}
|
|
91
91
|
<div className="min-w-0 flex-1">
|
|
92
92
|
{title != null && title !== false ? <div className="text-sm font-medium leading-snug text-foreground">{title}</div> : null}
|
|
93
|
-
{description != null && description !== false ? <div className={cn("text-
|
|
93
|
+
{description != null && description !== false ? <div className={cn("text-sm leading-snug text-muted-foreground", title != null && title !== false && "mt-1")}>{description}</div> : null}
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
96
|
<div className="mt-3 flex justify-end gap-2">
|
|
@@ -109,7 +109,7 @@ export function Popconfirm({
|
|
|
109
109
|
) : null}
|
|
110
110
|
<Button
|
|
111
111
|
size="small"
|
|
112
|
-
type={okBtnType as "primary" | "default" | "
|
|
112
|
+
type={okBtnType as "primary" | "default" | "link" | "text"}
|
|
113
113
|
danger={okDanger}
|
|
114
114
|
loading={loading}
|
|
115
115
|
onClick={async () => {
|
|
@@ -150,7 +150,7 @@ export function OverlayScroll({ visibility = "hover", scope = "scroll", autoHeig
|
|
|
150
150
|
|
|
151
151
|
const thumbVisible = visibility === "always" || dragging || scrolling;
|
|
152
152
|
const thumbClass = cn(
|
|
153
|
-
"absolute z-20 rounded-full bg-(--nonla-scrollbar-thumb) transition-opacity
|
|
153
|
+
"absolute z-20 rounded-full bg-(--nonla-scrollbar-thumb) transition-opacity",
|
|
154
154
|
scope === "table" ? "group-hover/table:bg-(--nonla-scrollbar-thumb-hover)" : "group-hover/scroll:bg-(--nonla-scrollbar-thumb-hover)",
|
|
155
155
|
visibility === "always" || dragging
|
|
156
156
|
? "pointer-events-auto opacity-100"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
-
import { cn } from "../lib/cn";
|
|
2
|
+
import { cn, focusRing } from "../lib/cn";
|
|
3
3
|
import { type ControlSize, controlHeightVar, controlRadiusVar, getSizeTokens, useControlSize } from "../lib/sizes";
|
|
4
4
|
|
|
5
5
|
export type SegmentedOption<V extends string | number = string | number> = V | { label: ReactNode; value: V; disabled?: boolean; icon?: ReactNode };
|
|
@@ -24,7 +24,10 @@ type Thumb = { left: number; top: number; width: number; height: number };
|
|
|
24
24
|
|
|
25
25
|
export function Segmented<V extends string | number = string | number>({ options, value, defaultValue, onChange, size, block, disabled, className }: SegmentedProps<V>) {
|
|
26
26
|
const items = options.map((o) => norm(o));
|
|
27
|
-
|
|
27
|
+
// Uncontrolled when `value` is unset: keep the pick locally so a click moves the selection.
|
|
28
|
+
const [inner, setInner] = useState<V | undefined>(defaultValue);
|
|
29
|
+
const controlled = value !== undefined;
|
|
30
|
+
const current = (controlled ? value : inner) ?? items[0]?.value;
|
|
28
31
|
const resolvedSize = useControlSize(size);
|
|
29
32
|
const tok = getSizeTokens(resolvedSize);
|
|
30
33
|
const itemPadX = Math.max(tok.paddingInline - 4, 6);
|
|
@@ -60,7 +63,7 @@ export function Segmented<V extends string | number = string | number>({ options
|
|
|
60
63
|
<div
|
|
61
64
|
ref={rootRef}
|
|
62
65
|
className={cn(
|
|
63
|
-
"relative inline-flex w-fit max-w-full shrink-0 items-center gap-0.5 rounded-lg
|
|
66
|
+
"relative inline-flex w-fit max-w-full shrink-0 items-center gap-0.5 rounded-lg bg-(--nonla-pill-track) p-0.5",
|
|
64
67
|
block && "flex w-full",
|
|
65
68
|
className,
|
|
66
69
|
)}
|
|
@@ -71,7 +74,7 @@ export function Segmented<V extends string | number = string | number>({ options
|
|
|
71
74
|
{thumb ? (
|
|
72
75
|
<span
|
|
73
76
|
aria-hidden
|
|
74
|
-
className="nonla-segmented-thumb pointer-events-none absolute top-0 left-0
|
|
77
|
+
className="nonla-segmented-thumb pointer-events-none absolute top-0 left-0 bg-card shadow-(--nonla-pill-thumb-shadow) transition-[transform,width,height] duration-(--nonla-dur-slow) ease-(--nonla-ease-spring) motion-reduce:transition-none"
|
|
75
78
|
style={{
|
|
76
79
|
width: thumb.width,
|
|
77
80
|
height: thumb.height,
|
|
@@ -94,9 +97,12 @@ export function Segmented<V extends string | number = string | number>({ options
|
|
|
94
97
|
aria-selected={active}
|
|
95
98
|
disabled={disabled || item.disabled}
|
|
96
99
|
className={cn(
|
|
97
|
-
"relative z-10 inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border
|
|
100
|
+
"relative z-10 inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border-0 bg-transparent font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-45",
|
|
101
|
+
focusRing,
|
|
102
|
+
"focus-visible:ring-offset-0",
|
|
98
103
|
block ? "min-w-0 flex-1" : "shrink-0",
|
|
99
|
-
|
|
104
|
+
// Cloudflare-style: idle labels are muted and only brighten on hover; the raised thumb marks the pick.
|
|
105
|
+
active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
|
|
100
106
|
)}
|
|
101
107
|
style={{
|
|
102
108
|
height: `max(22px, calc(${controlHeightVar(resolvedSize)} - 4px))`,
|
|
@@ -105,7 +111,10 @@ export function Segmented<V extends string | number = string | number>({ options
|
|
|
105
111
|
fontSize: tok.fontSize,
|
|
106
112
|
borderRadius: `max(4px, calc(${radius} - 2px))`,
|
|
107
113
|
}}
|
|
108
|
-
onClick={() =>
|
|
114
|
+
onClick={() => {
|
|
115
|
+
if (!controlled) setInner(item.value);
|
|
116
|
+
onChange?.(item.value);
|
|
117
|
+
}}
|
|
109
118
|
>
|
|
110
119
|
{item.icon}
|
|
111
120
|
{item.label}
|
package/src/select/Select.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "react";
|
|
15
15
|
import { usePopupContainer } from "../app/context";
|
|
16
16
|
import { menuItemClass } from "../dropdown/menuClasses";
|
|
17
|
+
import { Icon } from "../icon/Icon";
|
|
17
18
|
import { cn } from "../lib/cn";
|
|
18
19
|
import { type ControlSize, controlFieldFocusBorder, controlFieldStyle, controlFieldSurface, controlFieldTransition, controlStatusClass, useControlSize } from "../lib/sizes";
|
|
19
20
|
import { glassOverlayClass } from "../lib/surface";
|
|
@@ -21,9 +22,12 @@ import { glassOverlayClass } from "../lib/surface";
|
|
|
21
22
|
export type SelectValue = string | number;
|
|
22
23
|
|
|
23
24
|
export type SelectOptionConfig = {
|
|
25
|
+
/** Shown in the list and in the trigger. */
|
|
24
26
|
label: ReactNode;
|
|
25
27
|
value: SelectValue;
|
|
26
28
|
disabled?: boolean;
|
|
29
|
+
/** Muted second line, in the list only (the trigger keeps one line). Search matches it too. */
|
|
30
|
+
description?: ReactNode;
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
export type SelectProps = {
|
|
@@ -44,9 +48,12 @@ export type SelectProps = {
|
|
|
44
48
|
status?: "error" | "warning";
|
|
45
49
|
className?: string;
|
|
46
50
|
popupClassName?: string;
|
|
51
|
+
/** @deprecated Not parsed; pass `options`. Kept so antd-style markup type-checks. */
|
|
47
52
|
children?: ReactNode;
|
|
48
53
|
/** Alias of `onChange` for a single pick. */
|
|
49
54
|
onSelect?: (value: SelectValue) => void;
|
|
55
|
+
/** Custom row content in the list (any height). The trigger still shows `label`. Extra fields you put on an option (email, role) come through. */
|
|
56
|
+
optionRender?: (option: SelectOptionConfig & Record<string, any>, info: { selected: boolean }) => ReactNode;
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
function Chevron() {
|
|
@@ -75,7 +82,7 @@ function textOf(node: ReactNode): string {
|
|
|
75
82
|
|
|
76
83
|
function optionSearchText(opt: SelectOptionConfig, prop: string): string {
|
|
77
84
|
if (prop === "value") return String(opt.value);
|
|
78
|
-
return textOf(opt.label) || String(opt.value);
|
|
85
|
+
return [textOf(opt.label) || String(opt.value), textOf(opt.description)].join(" ");
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select(
|
|
@@ -94,6 +101,7 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
94
101
|
status,
|
|
95
102
|
className,
|
|
96
103
|
popupClassName,
|
|
104
|
+
optionRender,
|
|
97
105
|
},
|
|
98
106
|
ref,
|
|
99
107
|
) {
|
|
@@ -112,8 +120,9 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
112
120
|
const portal = usePopupContainer()?.();
|
|
113
121
|
|
|
114
122
|
const searchable = Boolean(showSearch);
|
|
123
|
+
// Search what the user sees: the label (falls back to value when the label is not text).
|
|
115
124
|
const filterProp =
|
|
116
|
-
typeof showSearch === "object" ? (showSearch.optionFilterProp ?? "
|
|
125
|
+
typeof showSearch === "object" ? (showSearch.optionFilterProp ?? "label") : "label";
|
|
117
126
|
|
|
118
127
|
const selectedOpt = options.find((o) => o.value === selected);
|
|
119
128
|
|
|
@@ -243,6 +252,8 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
243
252
|
const showClear = allowClear && selected != null && selected !== "" && !disabled;
|
|
244
253
|
const display = selectedOpt ? selectedOpt.label : selected != null && selected !== "" ? String(selected) : placeholder;
|
|
245
254
|
const displayEmpty = !selectedOpt && (selected == null || selected === "");
|
|
255
|
+
// A rich label (icon + text) is an element: lay it out as a centered flex row, not inline on the text baseline.
|
|
256
|
+
const richDisplay = isValidElement(display);
|
|
246
257
|
const activeId = open && filtered[active] ? `${listId}-opt-${active}` : undefined;
|
|
247
258
|
|
|
248
259
|
const fieldClass = cn(
|
|
@@ -283,8 +294,9 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
283
294
|
}}
|
|
284
295
|
>
|
|
285
296
|
<div className="relative min-w-0 flex-1 overflow-hidden">
|
|
286
|
-
|
|
287
|
-
|
|
297
|
+
{/* While searching, the current pick fades to plain text (no icon), so the caret starts cleanly before it. */}
|
|
298
|
+
<span aria-hidden className={cn(richDisplay && !open ? "flex h-5 items-center overflow-hidden whitespace-nowrap" : "block truncate", (open && query) || displayEmpty ? "invisible" : open && "text-tertiary-foreground")}>
|
|
299
|
+
{displayEmpty ? placeholder : open ? textOf(display) || display : display}
|
|
288
300
|
</span>
|
|
289
301
|
<input
|
|
290
302
|
ref={searchRef}
|
|
@@ -307,42 +319,45 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
307
319
|
}}
|
|
308
320
|
onKeyDown={onSearchKey}
|
|
309
321
|
className={cn(
|
|
310
|
-
"absolute inset-0 w-full border-0 bg-transparent p-0 font-[inherit] leading-[inherit] text-inherit outline-none placeholder:text-
|
|
322
|
+
"absolute inset-0 w-full border-0 bg-transparent p-0 font-[inherit] leading-[inherit] text-inherit outline-none placeholder:text-tertiary-foreground",
|
|
311
323
|
!open && "caret-transparent",
|
|
312
324
|
)}
|
|
313
325
|
/>
|
|
314
326
|
</div>
|
|
315
|
-
{
|
|
327
|
+
{/* One slot: the chevron, swapped for the clear button while hovered (no two icons side by side). */}
|
|
328
|
+
<span className="grid size-4 shrink-0 place-items-center">
|
|
329
|
+
{showClear ? (
|
|
330
|
+
<span
|
|
331
|
+
data-select-affix=""
|
|
332
|
+
role="button"
|
|
333
|
+
tabIndex={-1}
|
|
334
|
+
aria-label="Clear"
|
|
335
|
+
className="pointer-events-none inline-flex size-4 cursor-pointer items-center justify-center rounded-full text-muted-foreground opacity-0 transition-opacity [grid-area:1/1] hover:text-foreground group-hover/select:pointer-events-auto group-hover/select:opacity-100"
|
|
336
|
+
onPointerDown={(e) => {
|
|
337
|
+
e.preventDefault();
|
|
338
|
+
e.stopPropagation();
|
|
339
|
+
}}
|
|
340
|
+
onClick={(e) => {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
e.stopPropagation();
|
|
343
|
+
commit(null);
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
<ClearIcon />
|
|
347
|
+
</span>
|
|
348
|
+
) : null}
|
|
316
349
|
<span
|
|
317
350
|
data-select-affix=""
|
|
318
|
-
|
|
319
|
-
tabIndex={-1}
|
|
320
|
-
aria-label="Clear"
|
|
321
|
-
className="inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground opacity-0 transition-opacity hover:bg-ink-hover hover:text-foreground group-hover/select:opacity-100"
|
|
351
|
+
className={cn("inline-flex cursor-pointer items-center justify-center transition-opacity [grid-area:1/1]", showClear && "group-hover/select:opacity-0")}
|
|
322
352
|
onPointerDown={(e) => {
|
|
323
353
|
e.preventDefault();
|
|
324
354
|
e.stopPropagation();
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
e.preventDefault();
|
|
328
|
-
e.stopPropagation();
|
|
329
|
-
commit(null);
|
|
355
|
+
if (disabled) return;
|
|
356
|
+
setOpen((v) => !v);
|
|
330
357
|
}}
|
|
331
358
|
>
|
|
332
|
-
<
|
|
359
|
+
<Chevron />
|
|
333
360
|
</span>
|
|
334
|
-
) : null}
|
|
335
|
-
<span
|
|
336
|
-
data-select-affix=""
|
|
337
|
-
className="inline-flex shrink-0 cursor-pointer"
|
|
338
|
-
onPointerDown={(e) => {
|
|
339
|
-
e.preventDefault();
|
|
340
|
-
e.stopPropagation();
|
|
341
|
-
if (disabled) return;
|
|
342
|
-
setOpen((v) => !v);
|
|
343
|
-
}}
|
|
344
|
-
>
|
|
345
|
-
<Chevron />
|
|
346
361
|
</span>
|
|
347
362
|
</div>
|
|
348
363
|
</PopoverPrimitive.Anchor>
|
|
@@ -358,24 +373,28 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
358
373
|
style={controlFieldStyle(resolvedSize)}
|
|
359
374
|
onKeyDown={onTriggerKey}
|
|
360
375
|
>
|
|
361
|
-
<span className={cn("min-w-0 flex-1 truncate", displayEmpty && "text-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
e
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
+
<span className={cn("min-w-0 flex-1", richDisplay ? "flex h-5 items-center overflow-hidden whitespace-nowrap" : "truncate", displayEmpty && "text-tertiary-foreground")}>{display}</span>
|
|
377
|
+
<span className="grid size-4 shrink-0 place-items-center">
|
|
378
|
+
{showClear ? (
|
|
379
|
+
<span
|
|
380
|
+
role="button"
|
|
381
|
+
tabIndex={-1}
|
|
382
|
+
aria-label="Clear"
|
|
383
|
+
className="pointer-events-none inline-flex size-4 cursor-pointer items-center justify-center rounded-full text-muted-foreground opacity-0 transition-opacity [grid-area:1/1] hover:text-foreground group-hover/select:pointer-events-auto group-hover/select:opacity-100"
|
|
384
|
+
onPointerDown={(e) => e.preventDefault()}
|
|
385
|
+
onClick={(e) => {
|
|
386
|
+
e.preventDefault();
|
|
387
|
+
e.stopPropagation();
|
|
388
|
+
commit(null);
|
|
389
|
+
}}
|
|
390
|
+
>
|
|
391
|
+
<ClearIcon />
|
|
392
|
+
</span>
|
|
393
|
+
) : null}
|
|
394
|
+
<span className={cn("inline-flex items-center justify-center transition-opacity [grid-area:1/1]", showClear && "group-hover/select:opacity-0")}>
|
|
395
|
+
<Chevron />
|
|
376
396
|
</span>
|
|
377
|
-
|
|
378
|
-
<Chevron />
|
|
397
|
+
</span>
|
|
379
398
|
</button>
|
|
380
399
|
</PopoverPrimitive.Trigger>
|
|
381
400
|
)}
|
|
@@ -426,7 +445,7 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
426
445
|
data-highlighted={!opt.disabled && i === active && opt.value !== selected ? "" : undefined}
|
|
427
446
|
className={cn(
|
|
428
447
|
menuItemClass,
|
|
429
|
-
"cursor-pointer transition-
|
|
448
|
+
"cursor-pointer transition-none data-highlighted:border-transparent data-highlighted:bg-ink-hover",
|
|
430
449
|
opt.disabled && "pointer-events-none opacity-40",
|
|
431
450
|
!opt.disabled && opt.value === selected && "border-transparent bg-ink-active text-foreground shadow-none",
|
|
432
451
|
)}
|
|
@@ -436,7 +455,17 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
436
455
|
if (!opt.disabled) commit(opt.value);
|
|
437
456
|
}}
|
|
438
457
|
>
|
|
439
|
-
{
|
|
458
|
+
{optionRender ? (
|
|
459
|
+
<div className="min-w-0 flex-1">{optionRender(opt, { selected: opt.value === selected })}</div>
|
|
460
|
+
) : opt.description != null ? (
|
|
461
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
462
|
+
<span className="truncate">{opt.label}</span>
|
|
463
|
+
<span className="truncate text-xs leading-4 text-muted-foreground">{opt.description}</span>
|
|
464
|
+
</span>
|
|
465
|
+
) : (
|
|
466
|
+
<span className="min-w-0 flex-1 truncate">{opt.label}</span>
|
|
467
|
+
)}
|
|
468
|
+
{opt.value === selected ? <Icon name="check" size={14} className="shrink-0 text-foreground" aria-hidden /> : null}
|
|
440
469
|
</div>
|
|
441
470
|
))
|
|
442
471
|
)}
|
package/src/sidebar/Sidebar.tsx
CHANGED
|
@@ -7,6 +7,8 @@ import { OverlayScroll } from "../scroll/OverlayScroll";
|
|
|
7
7
|
export type SidebarItemType = {
|
|
8
8
|
key?: string;
|
|
9
9
|
label?: ReactNode;
|
|
10
|
+
/** Muted second line under the label (context, owner, path). The row grows to two lines. */
|
|
11
|
+
description?: ReactNode;
|
|
10
12
|
/** An `Icon` name, or a node. */
|
|
11
13
|
icon?: ReactNode;
|
|
12
14
|
disabled?: boolean;
|
|
@@ -46,7 +48,7 @@ function labelText(label: ReactNode) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
function matchesQuery(item: SidebarItemType, q: string) {
|
|
49
|
-
return labelText(item.label).toLowerCase().includes(q);
|
|
51
|
+
return `${labelText(item.label)} ${labelText(item.description)}`.toLowerCase().includes(q);
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/** A group label stays when it matches, or when a later row matches before the next group. */
|
|
@@ -109,15 +111,17 @@ function SidebarList({
|
|
|
109
111
|
if (item.type === "group") {
|
|
110
112
|
if (item.label == null || item.label === "") return null;
|
|
111
113
|
return (
|
|
112
|
-
<div key={key} className={cn("px-3 pb-1 pt-3 text-
|
|
114
|
+
<div key={key} className={cn("px-3 pb-1 pt-3 text-xs font-medium text-muted-foreground not-first:mt-2", item.className)}>
|
|
113
115
|
{item.label}
|
|
114
116
|
</div>
|
|
115
117
|
);
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
const active = selected != null && key === selected;
|
|
121
|
+
const twoLine = item.description != null && item.description !== "";
|
|
119
122
|
const className = cn(
|
|
120
|
-
"
|
|
123
|
+
twoLine ? "min-h-(--nonla-height) py-1.5" : "h-(--nonla-height)",
|
|
124
|
+
"nonla-sidebar-item box-border flex w-full items-center gap-3 rounded-(--nonla-radius) border-0 bg-transparent px-3 text-left text-(length:--nonla-nav-text-size) font-medium text-foreground no-underline transition-[background-color,box-shadow] duration-(--nonla-dur-fast) ease-(--nonla-ease-out) hover:not-aria-current:not-disabled:not-aria-disabled:bg-ink-hover hover:not-disabled:not-aria-disabled:shadow-none aria-current:bg-ink-active aria-current:shadow-none aria-[current=page]:bg-ink-active aria-[current=page]:shadow-none",
|
|
121
125
|
item.disabled ? "pointer-events-none cursor-not-allowed opacity-40" : "cursor-pointer",
|
|
122
126
|
item.className,
|
|
123
127
|
);
|
|
@@ -125,7 +129,14 @@ function SidebarList({
|
|
|
125
129
|
const body = (
|
|
126
130
|
<>
|
|
127
131
|
<ItemIcon icon={item.icon} />
|
|
128
|
-
|
|
132
|
+
{twoLine ? (
|
|
133
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
134
|
+
<span className="truncate">{item.label}</span>
|
|
135
|
+
<span className="truncate text-xs text-tertiary-foreground">{item.description}</span>
|
|
136
|
+
</span>
|
|
137
|
+
) : (
|
|
138
|
+
<span className="min-w-0 flex-1 truncate">{item.label}</span>
|
|
139
|
+
)}
|
|
129
140
|
{item.extra != null ? <span className="shrink-0 text-sm tabular-nums text-muted-foreground">{item.extra}</span> : null}
|
|
130
141
|
</>
|
|
131
142
|
);
|