devnonla-ui 0.13.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/package.json +1 -1
- package/src/app/App.tsx +2 -2
- package/src/app/context.ts +1 -12
- 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 +1 -1
- package/src/chat/message-ui/ChatError.tsx +1 -1
- package/src/chat/message-ui/ChatInput.tsx +5 -4
- 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 +1 -1
- 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 +3 -3
- 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 +4 -4
- package/src/markdown-editor/MarkdownSource.tsx +1 -1
- package/src/markdown-editor/MarkdownTable.tsx +1 -1
- package/src/markdown-editor/MarkdownViewer.tsx +7 -7
- package/src/markdown-editor/MermaidBlock.tsx +1 -1
- package/src/markdown-editor/ReactCodeFrame.tsx +8 -4
- package/src/markdown-editor/markdownScale.ts +30 -25
- 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 +166 -842
- package/src/table/Table.tsx +12 -12
- package/src/tabs/Tabs.tsx +3 -3
- package/src/tag/Tag.tsx +3 -3
- package/src/theme.ts +53 -147
- package/src/timepicker/TimePicker.tsx +2 -2
- package/src/typography/Typography.tsx +6 -6
|
@@ -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-brand font-medium text-(--nonla-solid
|
|
118
|
+
active ? "bg-brand font-medium text-(--nonla-text-on-solid)" : "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-quaternary-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-quaternary-foreground",
|
|
566
566
|
controlFieldSurface,
|
|
567
567
|
controlFieldTransition,
|
|
568
568
|
controlFieldFocusBorder,
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -106,7 +106,7 @@ export function Popover({
|
|
|
106
106
|
>
|
|
107
107
|
{title ? <div className="mb-2 text-sm font-medium">{title}</div> : null}
|
|
108
108
|
{content}
|
|
109
|
-
{showArrow ? <PopoverPrimitive.Arrow width={12} height={6} className="fill-
|
|
109
|
+
{showArrow ? <PopoverPrimitive.Arrow width={12} height={6} className="fill-card drop-shadow-[0_1px_0_var(--border)]" /> : null}
|
|
110
110
|
</PopoverPrimitive.Content>
|
|
111
111
|
</PopoverPrimitive.Portal>
|
|
112
112
|
</PopoverPrimitive.Root>
|
|
@@ -146,7 +146,7 @@ export function OverlayScroll({ visibility = "hover", autoHeight = false, classN
|
|
|
146
146
|
|
|
147
147
|
const thumbVisible = visibility === "always" || dragging || scrolling;
|
|
148
148
|
const thumbClass = cn(
|
|
149
|
-
"
|
|
149
|
+
"absolute z-20 rounded-full bg-(--nonla-scrollbar-thumb) transition-opacity duration-150 group-hover/scroll:bg-(--nonla-scrollbar-thumb-hover)",
|
|
150
150
|
visibility === "always" || dragging
|
|
151
151
|
? "pointer-events-auto opacity-100"
|
|
152
152
|
: "pointer-events-none opacity-0 group-hover/scroll:pointer-events-auto group-hover/scroll:opacity-100 group-data-scrolling/scroll:pointer-events-auto group-data-scrolling/scroll:opacity-100",
|
|
@@ -157,7 +157,7 @@ export function OverlayScroll({ visibility = "hover", autoHeight = false, classN
|
|
|
157
157
|
<div
|
|
158
158
|
ref={setNode}
|
|
159
159
|
onScroll={handleScroll}
|
|
160
|
-
className={cn("
|
|
160
|
+
className={cn("overflow-y-auto overflow-x-hidden [overflow-anchor:none] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden [&::-webkit-scrollbar]:h-0 [&::-webkit-scrollbar]:w-0", autoHeight ? "max-h-[inherit]" : "absolute inset-0", innerClassName)}
|
|
161
161
|
>
|
|
162
162
|
{children}
|
|
163
163
|
</div>
|
|
@@ -71,7 +71,7 @@ export function Segmented<V extends string | number = string | number>({ options
|
|
|
71
71
|
{thumb ? (
|
|
72
72
|
<span
|
|
73
73
|
aria-hidden
|
|
74
|
-
className="nonla-segmented-thumb pointer-events-none absolute border border-solid border-border bg-card"
|
|
74
|
+
className="nonla-segmented-thumb pointer-events-none absolute top-0 left-0 border border-solid border-border bg-card transition-[transform,width,height] duration-380 ease-[cubic-bezier(0.3,1.25,0.5,1)] motion-reduce:transition-none"
|
|
75
75
|
style={{
|
|
76
76
|
width: thumb.width,
|
|
77
77
|
height: thumb.height,
|
package/src/select/Select.tsx
CHANGED
|
@@ -307,7 +307,7 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
307
307
|
}}
|
|
308
308
|
onKeyDown={onSearchKey}
|
|
309
309
|
className={cn(
|
|
310
|
-
"absolute inset-0 w-full border-0 bg-transparent p-0 font-[inherit] leading-[inherit] text-inherit outline-none placeholder:text-
|
|
310
|
+
"absolute inset-0 w-full border-0 bg-transparent p-0 font-[inherit] leading-[inherit] text-inherit outline-none placeholder:text-quaternary-foreground",
|
|
311
311
|
!open && "caret-transparent",
|
|
312
312
|
)}
|
|
313
313
|
/>
|
|
@@ -358,7 +358,7 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
358
358
|
style={controlFieldStyle(resolvedSize)}
|
|
359
359
|
onKeyDown={onTriggerKey}
|
|
360
360
|
>
|
|
361
|
-
<span className={cn("min-w-0 flex-1 truncate", displayEmpty && "text-
|
|
361
|
+
<span className={cn("min-w-0 flex-1 truncate", displayEmpty && "text-quaternary-foreground")}>{display}</span>
|
|
362
362
|
{showClear ? (
|
|
363
363
|
<span
|
|
364
364
|
role="button"
|
|
@@ -426,9 +426,9 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select
|
|
|
426
426
|
data-highlighted={!opt.disabled && i === active && opt.value !== selected ? "" : undefined}
|
|
427
427
|
className={cn(
|
|
428
428
|
menuItemClass,
|
|
429
|
-
"cursor-pointer",
|
|
429
|
+
"cursor-pointer transition-[background-color] duration-20 ease-in motion-reduce:transition-none data-highlighted:border-transparent data-highlighted:bg-ink-hover",
|
|
430
430
|
opt.disabled && "pointer-events-none opacity-40",
|
|
431
|
-
!opt.disabled && opt.value === selected && "
|
|
431
|
+
!opt.disabled && opt.value === selected && "border-transparent bg-ink-active text-foreground shadow-none",
|
|
432
432
|
)}
|
|
433
433
|
onMouseEnter={() => setActive(i)}
|
|
434
434
|
onMouseDown={(e) => e.preventDefault()}
|
package/src/sidebar/Sidebar.tsx
CHANGED
|
@@ -11,8 +11,8 @@ export type SidebarItemType = {
|
|
|
11
11
|
/** Solar icon name (`settings`), a legacy Fluent Color id (`settings-24`), or a node. String icons render as bold-duotone. */
|
|
12
12
|
icon?: ReactNode;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
/** `"group"` is a section label. `"divider"` is a rule. Anything else is a row. */
|
|
14
15
|
type?: "item" | "group" | "divider";
|
|
15
|
-
children?: SidebarItemType[];
|
|
16
16
|
href?: string;
|
|
17
17
|
extra?: ReactNode;
|
|
18
18
|
className?: string;
|
|
@@ -38,11 +38,7 @@ export type SidebarProps = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
function itemKey(item: SidebarItemType, i: number) {
|
|
41
|
-
return item.key ?? (item.type === "divider" ? `divider-${i}` :
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function isGroup(item: SidebarItemType) {
|
|
45
|
-
return item.type === "group" || (item.type !== "item" && item.type !== "divider" && Boolean(item.children?.length));
|
|
41
|
+
return item.key ?? (item.type === "divider" ? `divider-${i}` : item.type === "group" ? `group-${i}` : `item-${i}`);
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
function labelText(label: ReactNode) {
|
|
@@ -51,26 +47,40 @@ function labelText(label: ReactNode) {
|
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
function matchesQuery(item: SidebarItemType, q: string) {
|
|
54
|
-
if (!q) return true;
|
|
55
50
|
return labelText(item.label).toLowerCase().includes(q);
|
|
56
51
|
}
|
|
57
52
|
|
|
53
|
+
/** A group label stays when it matches, or when a later row matches before the next group. */
|
|
58
54
|
function filterItems(items: SidebarItemType[], q: string): SidebarItemType[] {
|
|
59
55
|
if (!q) return items;
|
|
60
|
-
|
|
56
|
+
|
|
57
|
+
type Section = { group?: SidebarItemType; rows: SidebarItemType[] };
|
|
58
|
+
const sections: Section[] = [];
|
|
59
|
+
let current: Section = { rows: [] };
|
|
61
60
|
for (const item of items) {
|
|
62
|
-
if (item.type === "
|
|
63
|
-
if (
|
|
61
|
+
if (item.type === "group") {
|
|
62
|
+
if (current.group || current.rows.length) sections.push(current);
|
|
63
|
+
current = { group: item, rows: [] };
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
current.rows.push(item);
|
|
67
|
+
}
|
|
68
|
+
if (current.group || current.rows.length) sections.push(current);
|
|
69
|
+
|
|
70
|
+
const out: SidebarItemType[] = [];
|
|
71
|
+
for (const section of sections) {
|
|
72
|
+
const kept: SidebarItemType[] = [];
|
|
73
|
+
for (const row of section.rows) {
|
|
74
|
+
if (row.type === "divider") {
|
|
75
|
+
if (kept.length && kept[kept.length - 1]?.type !== "divider") kept.push(row);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (matchesQuery(row, q)) kept.push(row);
|
|
70
79
|
}
|
|
71
|
-
|
|
80
|
+
while (kept[kept.length - 1]?.type === "divider") kept.pop();
|
|
81
|
+
if (section.group && (matchesQuery(section.group, q) || kept.length)) out.push(section.group);
|
|
82
|
+
out.push(...kept);
|
|
72
83
|
}
|
|
73
|
-
while (out[out.length - 1]?.type === "divider") out.pop();
|
|
74
84
|
return out;
|
|
75
85
|
}
|
|
76
86
|
|
|
@@ -90,32 +100,25 @@ function SidebarList({
|
|
|
90
100
|
onSelect?: SidebarProps["onSelect"];
|
|
91
101
|
}) {
|
|
92
102
|
return (
|
|
93
|
-
|
|
103
|
+
<div className="flex flex-col gap-1">
|
|
94
104
|
{items.map((item, i) => {
|
|
95
105
|
const key = itemKey(item, i);
|
|
96
106
|
if (item.type === "divider") {
|
|
97
|
-
return <div key={key} className="mx-2 my-1 h-px bg-
|
|
107
|
+
return <div key={key} className="mx-2 my-1 h-px bg-border" />;
|
|
98
108
|
}
|
|
99
|
-
if (
|
|
109
|
+
if (item.type === "group") {
|
|
110
|
+
if (item.label == null || item.label === "") return null;
|
|
100
111
|
return (
|
|
101
|
-
<div key={key} className="
|
|
102
|
-
{item.label
|
|
103
|
-
<div className={cn("px-3 pb-2 pt-3 text-[11px] font-semibold uppercase tracking-wider text-quaternary-foreground", item.className)}>
|
|
104
|
-
{item.label}
|
|
105
|
-
</div>
|
|
106
|
-
) : null}
|
|
107
|
-
<div className="flex flex-col gap-1">
|
|
108
|
-
<SidebarList items={item.children ?? []} selected={selected} onSelect={onSelect} />
|
|
109
|
-
</div>
|
|
112
|
+
<div key={key} className={cn("px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wider text-tertiary-foreground not-first:mt-4", item.className)}>
|
|
113
|
+
{item.label}
|
|
110
114
|
</div>
|
|
111
115
|
);
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
const active = selected != null && key === selected;
|
|
115
119
|
const className = cn(
|
|
116
|
-
"nonla-sidebar-item flex w-full items-center gap-3 px-3 text-left text-[14px] font-normal no-underline",
|
|
120
|
+
"nonla-sidebar-item box-border flex h-(--nonla-height) w-full items-center gap-3 rounded-(--nonla-radius) border-0 bg-transparent px-3 text-left text-[14px] font-normal 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",
|
|
117
121
|
item.disabled ? "pointer-events-none cursor-not-allowed opacity-40" : "cursor-pointer",
|
|
118
|
-
active ? "text-foreground" : "text-foreground/80 hover:text-foreground",
|
|
119
122
|
item.className,
|
|
120
123
|
);
|
|
121
124
|
|
|
@@ -151,11 +154,11 @@ function SidebarList({
|
|
|
151
154
|
</button>
|
|
152
155
|
);
|
|
153
156
|
})}
|
|
154
|
-
|
|
157
|
+
</div>
|
|
155
158
|
);
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
/**
|
|
161
|
+
/** Side nav from a flat list. `type: "group"` is a section label. Router stays in the app (`onSelect` / `href`). */
|
|
159
162
|
export function Sidebar({
|
|
160
163
|
items = [],
|
|
161
164
|
selectedKey,
|
|
@@ -17,11 +17,11 @@ function SkeletonRoot({ active = true, loading = true, paragraph = true, title =
|
|
|
17
17
|
const pulse = active ? "animate-pulse" : "";
|
|
18
18
|
return (
|
|
19
19
|
<div className={cn("flex gap-3", className)}>
|
|
20
|
-
{avatar ? <div className={cn("size-10 shrink-0 rounded-full bg-
|
|
20
|
+
{avatar ? <div className={cn("size-10 shrink-0 rounded-full bg-muted", pulse)} /> : null}
|
|
21
21
|
<div className="flex-1 space-y-2">
|
|
22
|
-
{title ? <div className={cn("h-4 w-1/3 rounded bg-
|
|
22
|
+
{title ? <div className={cn("h-4 w-1/3 rounded bg-muted", pulse)} /> : null}
|
|
23
23
|
{Array.from({ length: rows }, (_, i) => `sk-${i}`).map((key, i) => (
|
|
24
|
-
<div key={key} className={cn("h-3 rounded bg-
|
|
24
|
+
<div key={key} className={cn("h-3 rounded bg-muted", pulse, i === rows - 1 ? "w-2/3" : "w-full")} />
|
|
25
25
|
))}
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
@@ -38,7 +38,7 @@ export type SkeletonInputProps = {
|
|
|
38
38
|
function SkeletonInput({ active = true, block, className, style }: SkeletonInputProps) {
|
|
39
39
|
return (
|
|
40
40
|
<div
|
|
41
|
-
className={cn("h-8 rounded-md bg-
|
|
41
|
+
className={cn("h-8 rounded-md bg-muted", active && "animate-pulse", block ? "w-full" : "w-40", className)}
|
|
42
42
|
style={style}
|
|
43
43
|
/>
|
|
44
44
|
);
|
package/src/spin/Spin.tsx
CHANGED
|
@@ -105,7 +105,7 @@ function MatrixSnake({ size, color, tickMs = 240 }: { size: ControlSize | undefi
|
|
|
105
105
|
|
|
106
106
|
return (
|
|
107
107
|
<span
|
|
108
|
-
className=
|
|
108
|
+
className="inline-grid place-content-center"
|
|
109
109
|
style={{
|
|
110
110
|
width: dim,
|
|
111
111
|
height: dim,
|
|
@@ -116,7 +116,19 @@ function MatrixSnake({ size, color, tickMs = 240 }: { size: ControlSize | undefi
|
|
|
116
116
|
aria-hidden
|
|
117
117
|
>
|
|
118
118
|
{MATRIX_CELLS.map((cell) => (
|
|
119
|
-
<span
|
|
119
|
+
<span
|
|
120
|
+
key={cell}
|
|
121
|
+
className={cn(
|
|
122
|
+
"block size-full rounded-full transition-colors duration-120 ease-linear motion-reduce:transition-none",
|
|
123
|
+
color === "neutral"
|
|
124
|
+
? lit.has(cell)
|
|
125
|
+
? "bg-muted-foreground"
|
|
126
|
+
: "bg-[color-mix(in_oklab,var(--foreground)_16%,transparent)]"
|
|
127
|
+
: lit.has(cell)
|
|
128
|
+
? "bg-brand"
|
|
129
|
+
: "bg-[color-mix(in_oklab,var(--brand)_10%,transparent)]",
|
|
130
|
+
)}
|
|
131
|
+
/>
|
|
120
132
|
))}
|
|
121
133
|
</span>
|
|
122
134
|
);
|
|
@@ -301,7 +301,7 @@ function SplitterRoot({
|
|
|
301
301
|
{draggerIcon ? (
|
|
302
302
|
<span
|
|
303
303
|
className={cn(
|
|
304
|
-
"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-sm bg-card text-muted-foreground
|
|
304
|
+
"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-sm bg-card text-muted-foreground ring-1 ring-border",
|
|
305
305
|
isVertical ? "h-1.5 w-5" : "h-5 w-1.5",
|
|
306
306
|
)}
|
|
307
307
|
>
|