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
package/src/table/Table.tsx
CHANGED
|
@@ -26,6 +26,7 @@ export type ColumnType<T> = {
|
|
|
26
26
|
*/
|
|
27
27
|
flex?: boolean | number;
|
|
28
28
|
ellipsis?: boolean;
|
|
29
|
+
/** @deprecated Not supported yet: columns do not pin. Use `scroll` for long tables. */
|
|
29
30
|
fixed?: "left" | "right";
|
|
30
31
|
/** `true` = default compare on `dataIndex`; or pass a compare fn. */
|
|
31
32
|
sorter?: boolean | ((a: T, b: T) => number);
|
|
@@ -141,10 +142,10 @@ function defaultCompare(a: unknown, b: unknown): number {
|
|
|
141
142
|
function SortIcon({ order }: { order: SortOrder | undefined }) {
|
|
142
143
|
return (
|
|
143
144
|
<span className="ml-1.5 inline-flex shrink-0 flex-col items-center gap-0.5" aria-hidden>
|
|
144
|
-
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "ascend" ? "text-foreground" : "text-
|
|
145
|
+
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "ascend" ? "text-foreground" : "text-quaternary-foreground")}>
|
|
145
146
|
<path d="M3.5 0 7 4H0z" fill="currentColor" />
|
|
146
147
|
</svg>
|
|
147
|
-
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "descend" ? "text-foreground" : "text-
|
|
148
|
+
<svg width="7" height="4" viewBox="0 0 7 4" className={cn(order === "descend" ? "text-foreground" : "text-quaternary-foreground")}>
|
|
148
149
|
<path d="M3.5 4 0 0h7z" fill="currentColor" />
|
|
149
150
|
</svg>
|
|
150
151
|
</span>
|
|
@@ -180,21 +181,21 @@ function TableBodyScroll({ x, y, scrollRef, insetTop = 0, children }: { x?: numb
|
|
|
180
181
|
function sizeClasses(s: CanonicalSize) {
|
|
181
182
|
if (s === "small") {
|
|
182
183
|
return {
|
|
183
|
-
head: "h-8 px-2 text-
|
|
184
|
-
cell: "px-2 py-1 text-
|
|
184
|
+
head: "h-8 px-2 text-sm",
|
|
185
|
+
cell: "px-2 py-1 text-sm",
|
|
185
186
|
check: "w-8 px-2",
|
|
186
187
|
};
|
|
187
188
|
}
|
|
188
189
|
if (s === "large") {
|
|
189
190
|
return {
|
|
190
|
-
head: "h-12 px-4 text-
|
|
191
|
-
cell: "px-4 py-3 text-
|
|
191
|
+
head: "h-12 px-4 text-sm",
|
|
192
|
+
cell: "px-4 py-3 text-sm",
|
|
192
193
|
check: "w-12 px-4",
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
196
|
return {
|
|
196
|
-
head: "h-10 px-3 text-
|
|
197
|
-
cell: "px-3 py-2 text-
|
|
197
|
+
head: "h-10 px-3 text-sm",
|
|
198
|
+
cell: "px-3 py-2 text-sm",
|
|
198
199
|
check: "w-10 px-3",
|
|
199
200
|
};
|
|
200
201
|
}
|
|
@@ -393,8 +394,8 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
393
394
|
const next = head ? Math.ceil(head.getBoundingClientRect().height) + 4 : 0;
|
|
394
395
|
setThumbInset((prev) => (prev === next ? prev : next));
|
|
395
396
|
}, [headSticky, showHeader, size, flexLayout]);
|
|
396
|
-
/**
|
|
397
|
-
const headBg: CSSProperties = { backgroundColor: "var(--
|
|
397
|
+
/** Header recedes (Cloudflare-style): page-colored band, muted labels, so the data reads first. Opaque so sticky headers cover rows. */
|
|
398
|
+
const headBg: CSSProperties = { backgroundColor: "var(--background)" };
|
|
398
399
|
|
|
399
400
|
const colStyle = (col: ColumnType<T>, key: string): CSSProperties => {
|
|
400
401
|
const measured = flexLayout?.cols[key];
|
|
@@ -407,10 +408,10 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
407
408
|
{titleNode != null ? <div className="mb-3 text-sm font-medium text-foreground">{titleNode}</div> : null}
|
|
408
409
|
|
|
409
410
|
<div className={cn(bordered && "overflow-hidden rounded-xl border border-border-secondary")}>
|
|
410
|
-
<Spin spinning={Boolean(loading)}>
|
|
411
|
+
<Spin spinning={Boolean(loading) && pageData.length > 0}>
|
|
411
412
|
<div ref={containerRef} data-slot="table-container" className={cn("relative w-full", flexLayout ? "overflow-x-hidden" : "overflow-x-auto")} style={scroll?.x != null ? { overflowX: "auto" } : undefined}>
|
|
412
413
|
<TableBodyScroll y={scroll?.y} x={scroll?.x} scrollRef={scrollBodyRef} insetTop={thumbInset}>
|
|
413
|
-
<table data-slot="table" className={cn("caption-bottom text-
|
|
414
|
+
<table data-slot="table" className={cn("caption-bottom text-sm", headSticky ? "border-separate border-spacing-0" : "border-collapse", flexLayout ? "w-full table-fixed" : wantsFlex ? "w-max" : "w-full")}>
|
|
414
415
|
{flexLayout ? (
|
|
415
416
|
<colgroup>
|
|
416
417
|
{rowSelection ? <col style={{ width: flexLayout.selection }} /> : null}
|
|
@@ -421,10 +422,10 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
421
422
|
</colgroup>
|
|
422
423
|
) : null}
|
|
423
424
|
{showHeader ? (
|
|
424
|
-
<thead data-slot="table-header" className={cn("[&_tr]:border-b [&_tr]:border-border
|
|
425
|
+
<thead data-slot="table-header" className={cn("[&_tr]:border-b [&_tr]:border-border", headSticky && "relative z-20")}>
|
|
425
426
|
<tr data-slot="table-row" className="border-b border-border-secondary transition-colors hover:bg-transparent">
|
|
426
427
|
{rowSelection ? (
|
|
427
|
-
<th data-slot="table-head" className={cn(sz.head, sz.check, "align-middle font-medium text-foreground", headSticky && "sticky top-0 z-10 border-b border-border
|
|
428
|
+
<th data-slot="table-head" className={cn(sz.head, sz.check, "align-middle font-medium text-muted-foreground", headSticky && "sticky top-0 z-10 border-b border-border", bordered && "border-b border-border-secondary")} style={{ ...(selectionColWidth != null ? { width: selectionColWidth } : undefined), ...headBg }}>
|
|
428
429
|
<div className="flex items-center justify-center">
|
|
429
430
|
{rowSelection.type === "radio" ? null : (
|
|
430
431
|
<Checkbox
|
|
@@ -449,7 +450,7 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
449
450
|
<th
|
|
450
451
|
key={key}
|
|
451
452
|
data-slot="table-head"
|
|
452
|
-
className={cn(sz.head, "align-middle font-medium text-foreground", headSticky && "sticky top-0 z-10 border-b border-border
|
|
453
|
+
className={cn(sz.head, "align-middle font-medium text-muted-foreground", headSticky && "sticky top-0 z-10 border-b border-border", flexLayout && flexWeight(col) > 0 ? "min-w-0" : "whitespace-nowrap", alignClass(col.align), bordered && "border-b border-border-secondary", sortable && "cursor-pointer select-none", col.className, headerExtra?.className)}
|
|
453
454
|
style={{
|
|
454
455
|
...colStyle(col, key),
|
|
455
456
|
...headBg,
|
|
@@ -469,10 +470,23 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
469
470
|
) : null}
|
|
470
471
|
|
|
471
472
|
<tbody data-slot="table-body" className={cn("[&_tr:last-child]:border-0", headSticky && "relative z-0")}>
|
|
472
|
-
{pageData.length === 0 ? (
|
|
473
|
+
{loading && pageData.length === 0 ? (
|
|
474
|
+
// First load: skeleton rows in the real column grid instead of a spinner over "No data".
|
|
475
|
+
Array.from({ length: 5 }, (_, r) => (
|
|
476
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static placeholder rows
|
|
477
|
+
<tr key={`skeleton-${r}`} data-slot="table-row" className="border-b border-border-secondary">
|
|
478
|
+
{Array.from({ length: colCount }, (_, c) => (
|
|
479
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: static placeholder cells
|
|
480
|
+
<td key={c} data-slot="table-cell" className={cn(sz.cell, "align-middle")}>
|
|
481
|
+
<span aria-hidden className="block h-2.5 animate-pulse rounded-full bg-muted" style={{ width: `${[72, 56, 64, 48, 60][(r + c) % 5]}%` }} />
|
|
482
|
+
</td>
|
|
483
|
+
))}
|
|
484
|
+
</tr>
|
|
485
|
+
))
|
|
486
|
+
) : pageData.length === 0 ? (
|
|
473
487
|
<tr data-slot="table-row" className="border-b border-border-secondary">
|
|
474
488
|
<td data-slot="table-cell" colSpan={colCount} className={cn(sz.cell, "text-center align-middle")}>
|
|
475
|
-
{locale?.emptyText ?? <Empty description="No data" className="py-10" />}
|
|
489
|
+
{locale?.emptyText ?? <Empty bordered={false} icon={null} description="No data" className="py-10" />}
|
|
476
490
|
</td>
|
|
477
491
|
</tr>
|
|
478
492
|
) : (
|
|
@@ -489,7 +503,7 @@ export function Table<T extends object = Record<string, unknown>>({ columns = []
|
|
|
489
503
|
key={key}
|
|
490
504
|
data-slot="table-row"
|
|
491
505
|
data-state={selected ? "selected" : undefined}
|
|
492
|
-
className={cn("border-b border-border-secondary transition-colors hover:bg-
|
|
506
|
+
className={cn("border-b border-border-secondary transition-colors hover:bg-ink-hover data-[state=selected]:bg-ink-active", inSelectionMode && !rowDisabled && "cursor-pointer", rowProps?.className, extraClass)}
|
|
493
507
|
style={rowProps?.style}
|
|
494
508
|
onClick={inSelectionMode ? undefined : rowProps?.onClick}
|
|
495
509
|
onClickCapture={
|
package/src/tabs/Tabs.tsx
CHANGED
|
@@ -13,6 +13,8 @@ export type TabsItem = {
|
|
|
13
13
|
|
|
14
14
|
export type TabsProps = {
|
|
15
15
|
items: TabsItem[];
|
|
16
|
+
/** `line` (default): underline ink. `pill`: page tabs on a soft track, the active one raised (Cloudflare header style). */
|
|
17
|
+
variant?: "line" | "pill";
|
|
16
18
|
activeKey?: string;
|
|
17
19
|
defaultActiveKey?: string;
|
|
18
20
|
onChange?: (key: string) => void;
|
|
@@ -82,7 +84,7 @@ function ScrollButton({ dir, onClick }: { dir: "left" | "right"; onClick: () =>
|
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
export function Tabs({ items, activeKey, defaultActiveKey, onChange, className, style, "aria-label": ariaLabel = "Tabs" }: TabsProps) {
|
|
87
|
+
export function Tabs({ items, activeKey, defaultActiveKey, onChange, className, style, "aria-label": ariaLabel = "Tabs", variant = "line" }: TabsProps) {
|
|
86
88
|
const uid = useId();
|
|
87
89
|
|
|
88
90
|
const [inner, setInner] = useState(() => firstEnabled(items, defaultActiveKey));
|
|
@@ -252,7 +254,7 @@ export function Tabs({ items, activeKey, defaultActiveKey, onChange, className,
|
|
|
252
254
|
return (
|
|
253
255
|
<div className={cn("w-full min-w-0", className)} style={style}>
|
|
254
256
|
<div className="relative">
|
|
255
|
-
<div aria-hidden className="pointer-events-none absolute inset-x-0 bottom-0 h-px bg-border" />
|
|
257
|
+
{variant === "line" ? <div aria-hidden className="pointer-events-none absolute inset-x-0 bottom-0 h-px bg-border" /> : null}
|
|
256
258
|
<div
|
|
257
259
|
ref={scrollerRef}
|
|
258
260
|
className="relative overflow-x-auto overflow-y-hidden overscroll-x-contain touch-pan-y select-none [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden [&::-webkit-scrollbar]:h-0 [&::-webkit-scrollbar]:w-0"
|
|
@@ -269,8 +271,8 @@ export function Tabs({ items, activeKey, defaultActiveKey, onChange, className,
|
|
|
269
271
|
onPointerCancel={endDrag}
|
|
270
272
|
onClickCapture={onClickCapture}
|
|
271
273
|
>
|
|
272
|
-
<div ref={rowRef} role="tablist" aria-label={ariaLabel} aria-orientation="horizontal" className="relative flex w-max gap-3" onKeyDown={onKeyDown}>
|
|
273
|
-
{ink ? <span aria-hidden className="pointer-events-none absolute bottom-0 left-0 z-1 h-0.5 rounded-t-xs bg-
|
|
274
|
+
<div ref={rowRef} role="tablist" aria-label={ariaLabel} aria-orientation="horizontal" className={cn("relative flex w-max", variant === "pill" ? "gap-0.5 rounded-lg bg-(--nonla-pill-track) p-0.5" : "gap-3")} onKeyDown={onKeyDown}>
|
|
275
|
+
{ink && variant === "line" ? <span aria-hidden className="pointer-events-none absolute bottom-0 left-0 z-1 h-0.5 rounded-t-xs bg-selected transition-[transform,width] duration-(--nonla-dur-slow) ease-(--nonla-ease-spring) motion-reduce:transition-none" style={{ width: ink.width, transform: `translateX(${ink.left}px)` }} /> : null}
|
|
274
276
|
{items.map((item) => {
|
|
275
277
|
const selected = item.key === active;
|
|
276
278
|
return (
|
|
@@ -288,17 +290,18 @@ export function Tabs({ items, activeKey, defaultActiveKey, onChange, className,
|
|
|
288
290
|
tabIndex={selected ? 0 : -1}
|
|
289
291
|
disabled={item.disabled}
|
|
290
292
|
className={cn(
|
|
291
|
-
"relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border-0 bg-transparent font-
|
|
292
|
-
"focus-visible:ring-
|
|
293
|
+
"relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border-0 bg-transparent font-medium transition-colors select-none",
|
|
294
|
+
"focus-visible:ring-focus-ring focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset",
|
|
293
295
|
"disabled:cursor-not-allowed disabled:opacity-40",
|
|
294
|
-
|
|
296
|
+
variant === "pill" && "rounded-md font-medium transition-[color,background-color,box-shadow]",
|
|
297
|
+
variant === "pill" && selected && "bg-card shadow-(--nonla-pill-thumb-shadow)",
|
|
298
|
+
selected ? "text-foreground" : "text-muted-foreground hover:text-foreground",
|
|
295
299
|
)}
|
|
296
|
-
style={
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}}
|
|
300
|
+
style={
|
|
301
|
+
variant === "pill"
|
|
302
|
+
? { height: TAB_HEIGHT - 8, paddingLeft: 10, paddingRight: 10, fontSize: 14 }
|
|
303
|
+
: { height: TAB_HEIGHT, paddingLeft: 4, paddingRight: 4, fontSize: 14 }
|
|
304
|
+
}
|
|
302
305
|
onClick={() => {
|
|
303
306
|
if (!item.disabled) select(item.key);
|
|
304
307
|
}}
|
package/src/tag/Tag.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import { cn } from "../lib/cn";
|
|
2
|
+
import { cn, focusRing } from "../lib/cn";
|
|
3
3
|
|
|
4
4
|
export type TagVariant = "soft" | "solid";
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ export type TagProps = {
|
|
|
17
17
|
className?: string;
|
|
18
18
|
onClose?: () => void;
|
|
19
19
|
closable?: boolean;
|
|
20
|
-
/**
|
|
20
|
+
/** Leading status dot. On by default for soft colored tags; `false` hides it, `true` forces it. */
|
|
21
21
|
dot?: boolean;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -42,8 +42,17 @@ const NAMED_VAR: Record<string, string> = {
|
|
|
42
42
|
lime: "light-dark(#3d8f5c, #70b489)",
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const SOFT = "bg-[color-mix(in_oklab,var(--nonla-tag)_12%,transparent)] text-[color-mix(in_oklab,var(--nonla-tag)_72%,
|
|
46
|
-
const SOLID = "bg-(--nonla-tag) text-[var(--nonla-
|
|
45
|
+
const SOFT = "bg-[color-mix(in_oklab,var(--nonla-tag)_12%,transparent)] text-[color-mix(in_oklab,var(--nonla-tag)_72%,var(--nonla-text-main))]";
|
|
46
|
+
const SOLID = "bg-[var(--nonla-tag-fill,var(--nonla-tag))] text-[var(--nonla-tag-ink,light-dark(#ffffff,#141413))]";
|
|
47
|
+
|
|
48
|
+
/** Status roles: solid chips take the role fill and its label color. Presets: white in light, ink in dark (their dark tones are light). */
|
|
49
|
+
const ROLE_SOLID: Record<string, { fill: string; ink: string }> = {
|
|
50
|
+
success: { fill: "var(--nonla-success-fill)", ink: "var(--nonla-text-on-success)" },
|
|
51
|
+
error: { fill: "var(--nonla-danger-fill)", ink: "var(--nonla-text-on-danger)" },
|
|
52
|
+
warning: { fill: "var(--nonla-warn-fill)", ink: "var(--nonla-text-on-warn)" },
|
|
53
|
+
processing: { fill: "var(--nonla-link)", ink: "var(--nonla-bg)" },
|
|
54
|
+
brand: { fill: "var(--nonla-brand)", ink: "var(--nonla-text-on-brand)" },
|
|
55
|
+
};
|
|
47
56
|
|
|
48
57
|
function resolveVariant(variant: TagProps["variant"]): TagVariant {
|
|
49
58
|
if (variant === "solid") return "solid";
|
|
@@ -78,12 +87,12 @@ export function Tag({
|
|
|
78
87
|
return (
|
|
79
88
|
<span
|
|
80
89
|
className={cn(
|
|
81
|
-
"inline-flex h-5.5 max-w-full items-center gap-1.5 rounded-full px-2.5 text-
|
|
90
|
+
"inline-flex h-5.5 max-w-full items-center gap-1.5 rounded-full px-2.5 text-xs font-medium",
|
|
82
91
|
isDefault && (solid ? "bg-foreground/10 text-foreground" : "bg-muted text-muted-foreground"),
|
|
83
92
|
!isDefault && (solid ? SOLID : SOFT),
|
|
84
93
|
className,
|
|
85
94
|
)}
|
|
86
|
-
style={token ? ({ "--nonla-tag": token } as CSSProperties) : undefined}
|
|
95
|
+
style={token ? ({ "--nonla-tag": token, ...(ROLE_SOLID[color] && { "--nonla-tag-fill": ROLE_SOLID[color].fill, "--nonla-tag-ink": ROLE_SOLID[color].ink }) } as CSSProperties) : undefined}
|
|
87
96
|
>
|
|
88
97
|
{showDot ? (
|
|
89
98
|
<span
|
|
@@ -97,7 +106,7 @@ export function Tag({
|
|
|
97
106
|
{closable ? (
|
|
98
107
|
<button
|
|
99
108
|
type="button"
|
|
100
|
-
className="-mr-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded-full text-current/55 transition-colors hover:bg-ink-hover hover:text-current"
|
|
109
|
+
className={cn("-mr-0.5 inline-flex size-3.5 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-transparent p-0 text-current/55 transition-colors hover:bg-ink-hover hover:text-current", focusRing, "focus-visible:ring-offset-0")}
|
|
101
110
|
aria-label="Remove"
|
|
102
111
|
onClick={onClose}
|
|
103
112
|
>
|
|
@@ -42,7 +42,7 @@ export function ThemeSwitcher({ className }: ThemeSwitcherProps) {
|
|
|
42
42
|
aria-label={option.label}
|
|
43
43
|
onClick={() => setColorPreference(option.value)}
|
|
44
44
|
className={cn(
|
|
45
|
-
"inline-flex size-5 items-center justify-center rounded-full border-0 bg-transparent p-0 cursor-pointer text-foreground
|
|
45
|
+
"inline-flex size-5 items-center justify-center rounded-full border-0 bg-transparent p-0 cursor-pointer text-muted-foreground",
|
|
46
46
|
selected ? "bg-ink-active text-foreground" : "hover:bg-ink-hover hover:text-foreground",
|
|
47
47
|
)}
|
|
48
48
|
>
|
|
@@ -297,7 +297,7 @@ function PickGrid({
|
|
|
297
297
|
type="button"
|
|
298
298
|
tabIndex={-1}
|
|
299
299
|
className={cn(
|
|
300
|
-
"flex h-11 items-center justify-center rounded-md tabular-nums text-
|
|
300
|
+
"flex h-11 items-center justify-center rounded-md tabular-nums text-sm font-normal transition-colors",
|
|
301
301
|
selected ? "bg-ink-active text-foreground" : "text-foreground hover:bg-ink-hover",
|
|
302
302
|
)}
|
|
303
303
|
onClick={() => onSelect(opt.value)}
|
|
@@ -632,7 +632,7 @@ export const TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function
|
|
|
632
632
|
onKeyDown={handleKeyDown}
|
|
633
633
|
onKeyUp={(e) => syncPartFromCaret(e.currentTarget)}
|
|
634
634
|
onClick={(e) => syncPartFromCaret(e.currentTarget)}
|
|
635
|
-
className="min-w-0 flex-1 border-0 bg-transparent p-0 text-foreground placeholder:text-
|
|
635
|
+
className="min-w-0 flex-1 border-0 bg-transparent p-0 text-foreground placeholder:text-tertiary-foreground outline-none disabled:cursor-not-allowed"
|
|
636
636
|
style={{ fontSize: fieldStyle.fontSize, lineHeight: fieldStyle.lineHeight }}
|
|
637
637
|
/>
|
|
638
638
|
{allowClear && selected && !disabled ? (
|
package/src/tooltip/Tooltip.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export type TooltipProps = {
|
|
|
19
19
|
/** Extra class on the overlay panel. */
|
|
20
20
|
overlayClassName?: string;
|
|
21
21
|
getPopupContainer?: () => HTMLElement;
|
|
22
|
-
/**
|
|
22
|
+
/** Show the small arrow pointing at the trigger. Default `true`. */
|
|
23
23
|
arrow?: boolean | { pointAtCenter?: boolean };
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -34,6 +34,7 @@ export function Tooltip({
|
|
|
34
34
|
className,
|
|
35
35
|
overlayClassName,
|
|
36
36
|
getPopupContainer,
|
|
37
|
+
arrow = true,
|
|
37
38
|
}: TooltipProps) {
|
|
38
39
|
const getContainer = usePopupContainer(getPopupContainer);
|
|
39
40
|
const { side, align } = placementToRadix(placement);
|
|
@@ -46,10 +47,31 @@ export function Tooltip({
|
|
|
46
47
|
<TooltipPrimitive.Content
|
|
47
48
|
side={side}
|
|
48
49
|
align={align}
|
|
49
|
-
sideOffset={
|
|
50
|
-
className={cn(
|
|
50
|
+
sideOffset={10}
|
|
51
|
+
className={cn(
|
|
52
|
+
glassOverlayClass,
|
|
53
|
+
// Cloudflare-style bubble: 6px radius, an outline ring (in the shadow token), a medium drop.
|
|
54
|
+
"max-w-80 rounded-md border-0 px-2.5 py-1.5 text-(length:--nonla-nav-text-size) leading-[18px] shadow-(--nonla-tooltip-shadow)",
|
|
55
|
+
// Radix tooltips open as `delayed-open` / `instant-open`; scale 0.9 + fade from the trigger, out the same way.
|
|
56
|
+
"data-[state=delayed-open]:animate-[nonla-tooltip-in_var(--nonla-dur-fast)_cubic-bezier(0.4,0,0.2,1)] data-[state=instant-open]:animate-none",
|
|
57
|
+
"data-[state=closed]:animate-[nonla-tooltip-out_var(--nonla-dur-fast)_cubic-bezier(0.4,0,0.2,1)_forwards]",
|
|
58
|
+
className,
|
|
59
|
+
overlayClassName,
|
|
60
|
+
)}
|
|
51
61
|
>
|
|
52
62
|
{title}
|
|
63
|
+
{arrow ? (
|
|
64
|
+
<TooltipPrimitive.Arrow asChild width={20} height={10}>
|
|
65
|
+
{/* Soft-tipped arrow: the fill hides the ring under its base, the edge path carries the ring around the tip. */}
|
|
66
|
+
<svg viewBox="0 0 20 10" overflow="visible" aria-hidden="true">
|
|
67
|
+
<path className="fill-card" d="M9.66 6.4L4.81 2.03C4.07 1.37 3.12 1 2.13 1H0V-1H20V1H18.53C17.55 1 16.59 1.37 15.86 2.03L11 6.4C10.62 6.74 10.04 6.74 9.66 6.4Z" />
|
|
68
|
+
<path
|
|
69
|
+
className="fill-(--nonla-tooltip-arrow-edge)"
|
|
70
|
+
d="M10.33 5.65L5.48 1.28C4.56 0.46 3.37 0 2.13 0H0V1H2.13C3.12 1 4.07 1.37 4.81 2.03L9.66 6.4C10.04 6.74 10.62 6.74 11 6.4L15.86 2.03C16.59 1.37 17.55 1 18.53 1H20V0H18.53C17.3 0 16.11 0.46 15.19 1.28L10.33 5.65Z"
|
|
71
|
+
/>
|
|
72
|
+
</svg>
|
|
73
|
+
</TooltipPrimitive.Arrow>
|
|
74
|
+
) : null}
|
|
53
75
|
</TooltipPrimitive.Content>
|
|
54
76
|
</TooltipPrimitive.Portal>
|
|
55
77
|
</TooltipPrimitive.Root>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AnchorHTMLAttributes, type CSSProperties, createElement, type HTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
|
-
import { headingClass, markdownBodyClass, markdownParagraphClass, markdownScaleStyle, pageTitleClass } from "../lib/markdownScale";
|
|
3
|
+
import { headingClass, markdownBodyClass, markdownInlineCodeClass, markdownParagraphClass, markdownScaleStyle, pageTitleClass } from "../lib/markdownScale";
|
|
4
4
|
|
|
5
5
|
export type TypographyType = "secondary" | "success" | "warning" | "danger";
|
|
6
6
|
|
|
@@ -40,11 +40,9 @@ const TITLE_TAG = {
|
|
|
40
40
|
6: "h6",
|
|
41
41
|
} as const;
|
|
42
42
|
|
|
43
|
-
/** Same scale as MarkdownViewer. Body size is `text-
|
|
43
|
+
/** Same scale as MarkdownViewer. Body size is `text-base`. Inline code uses the viewer chip. */
|
|
44
44
|
const BODY = markdownBodyClass;
|
|
45
45
|
|
|
46
|
-
const INLINE_CODE = "nonla-inline-code rounded-[4px] bg-muted px-[2px] py-px align-baseline font-mono text-(length:--md-inline-size,var(--nonla-mono-text-size)) leading-none whitespace-nowrap [box-decoration-break:clone] [-webkit-box-decoration-break:clone]";
|
|
47
|
-
|
|
48
46
|
const TITLE_SPACE = "nonla-typo";
|
|
49
47
|
|
|
50
48
|
function decorationLine(underline?: boolean, deleted?: boolean) {
|
|
@@ -60,7 +58,7 @@ function wrapDecorations(children: ReactNode, props: Decorations) {
|
|
|
60
58
|
node = <mark className="rounded-sm bg-[color-mix(in_oklab,var(--nonla-warn)_40%,transparent)] px-0.5 text-inherit">{node}</mark>;
|
|
61
59
|
}
|
|
62
60
|
if (props.code) {
|
|
63
|
-
node = <code className={
|
|
61
|
+
node = <code className={markdownInlineCodeClass}>{node}</code>;
|
|
64
62
|
}
|
|
65
63
|
if (props.keyboard) {
|
|
66
64
|
node = <kbd className="inline-block rounded-md border border-b-2 border-border bg-muted px-1.5 font-mono text-[0.85em] leading-5">{node}</kbd>;
|