devnonla-ui 0.13.0 → 0.15.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 +2 -2
- package/src/app/App.tsx +2 -2
- package/src/app/context.ts +1 -12
- package/src/avatar/avatar.css +107 -0
- package/src/blob-shape/BlobShape.tsx +337 -0
- package/src/button/Button.tsx +4 -4
- package/src/button/ButtonCopy.tsx +3 -3
- package/src/calendar/Calendar.tsx +1 -1
- package/src/card/Card.tsx +1 -1
- package/src/chat/AgentChatbox.tsx +1 -1
- package/src/chat/AgentPanel.tsx +1 -1
- package/src/chat/chatMessageList.tsx +5 -3
- package/src/chat/chatRhythm.ts +8 -0
- package/src/chat/common/createAgentSseSession.ts +9 -3
- package/src/chat/common/sse.ts +290 -122
- package/src/chat/common/useAgentStream.ts +1 -1
- package/src/chat/index.ts +2 -2
- package/src/chat/message-ui/ChatAgentMessage.tsx +4 -3
- package/src/chat/message-ui/ChatError.tsx +5 -4
- package/src/chat/message-ui/ChatInput.tsx +9 -8
- package/src/chat/message-ui/ChatMarkdown.tsx +36 -2
- package/src/chat/message-ui/ChatThinking.tsx +8 -7
- package/src/chat/message-ui/ChatUserMessage.tsx +5 -5
- package/src/chat/tool-ui/BackgroundTaskToolUI.tsx +7 -6
- package/src/chat/tool-ui/BackgroundTasksBar.tsx +9 -9
- package/src/chat/tool-ui/CallAgentToolUI.tsx +16 -15
- package/src/chat/tool-ui/ChatToolCall.tsx +13 -12
- package/src/chat/tool-ui/GetCurrentTimeToolUI.tsx +7 -6
- package/src/chat/tool-ui/ReadSkillToolUI.tsx +10 -9
- package/src/chat/tool-ui/RunJsToolUI.tsx +9 -8
- package/src/chat/tool-ui/ToolUiBadge.tsx +1 -1
- package/src/chat/tool-ui/ToolUiTrailing.tsx +3 -3
- package/src/chat/tool-ui/WebFetchToolUI.tsx +10 -9
- 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/DesktopIcon.tsx +3 -4
- 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/icon/Icon.tsx +21 -0
- package/src/icon/glyphs.ts +35 -0
- package/src/index.ts +9 -23
- package/src/input/EditableInput.tsx +5 -4
- 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/MarkdownEditor.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 +48 -11
- package/src/markdown-editor/MarkdownViewer.tsx +28 -31
- package/src/markdown-editor/MermaidBlock.tsx +5 -5
- package/src/markdown-editor/ReactCodeFrame.tsx +10 -6
- package/src/markdown-editor/ReactCodeSandbox.tsx +2 -2
- package/src/markdown-editor/markdownScale.ts +66 -127
- package/src/menu/Menu.tsx +3 -3
- package/src/message/message.tsx +18 -8
- package/src/modal/Modal.tsx +13 -7
- package/src/pagination/Pagination.tsx +7 -7
- package/src/popover/Popover.tsx +1 -1
- package/src/scroll/OverlayScroll.tsx +13 -5
- package/src/segmented/Segmented.tsx +1 -1
- package/src/select/Select.tsx +4 -4
- package/src/sidebar/Sidebar.tsx +39 -36
- 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 +188 -844
- package/src/table/Table.tsx +12 -12
- package/src/tabs/Tabs.tsx +76 -14
- package/src/tag/Tag.tsx +3 -3
- package/src/theme-switcher/ThemeSwitcher.tsx +6 -6
- package/src/theme.ts +53 -147
- package/src/timepicker/TimePicker.tsx +2 -2
- package/src/typography/Typography.tsx +8 -8
- package/src/icon/SolarIcon.tsx +0 -39
- package/src/icon/solar.ts +0 -172
|
@@ -39,6 +39,11 @@ import {
|
|
|
39
39
|
export type { ColorFormat, ColorType, HsbaColor };
|
|
40
40
|
export { Color, DEFAULT_COLOR, parseColor };
|
|
41
41
|
|
|
42
|
+
const CHECKERED =
|
|
43
|
+
"nonla-color-checkered bg-white [background-image:conic-gradient(#d9d9d9_0.25turn,#fff_0.25turn_0.5turn,#d9d9d9_0.5turn_0.75turn,#fff_0.75turn)] [background-size:8px_8px]";
|
|
44
|
+
const CLEARED =
|
|
45
|
+
"nonla-color-cleared bg-[linear-gradient(to_bottom_left,transparent_calc(50%-1px),var(--destructive)_calc(50%-1px)_calc(50%+1px),transparent_calc(50%+1px))]";
|
|
46
|
+
|
|
42
47
|
export type PresetColorType = {
|
|
43
48
|
label: ReactNode;
|
|
44
49
|
defaultOpen?: boolean;
|
|
@@ -383,10 +388,7 @@ function PresetGroup({
|
|
|
383
388
|
type="button"
|
|
384
389
|
title={color.toHexString()}
|
|
385
390
|
aria-label={color.toHexString()}
|
|
386
|
-
className={cn(
|
|
387
|
-
"nonla-color-checkered size-5 cursor-pointer overflow-hidden rounded-sm border border-glass-border",
|
|
388
|
-
active && "ring-2 ring-brand ring-offset-1 ring-offset-background",
|
|
389
|
-
)}
|
|
391
|
+
className={cn(CHECKERED, "size-5 cursor-pointer overflow-hidden rounded-sm border border-border", active && "ring-2 ring-brand ring-offset-1 ring-offset-background")}
|
|
390
392
|
onClick={() => onPick(color)}
|
|
391
393
|
>
|
|
392
394
|
<span className="block size-full" style={{ backgroundColor: color.toRgbString() }} />
|
|
@@ -411,9 +413,9 @@ function ColorBlock({
|
|
|
411
413
|
style?: CSSProperties;
|
|
412
414
|
}) {
|
|
413
415
|
return (
|
|
414
|
-
<span className={cn("
|
|
416
|
+
<span className={cn(CHECKERED, "relative block overflow-hidden", className)} style={style}>
|
|
415
417
|
<span className="absolute inset-0" style={{ backgroundColor: cleared ? "transparent" : color.toRgbString() }} />
|
|
416
|
-
{cleared ? <span className="
|
|
418
|
+
{cleared ? <span className={cn(CLEARED, "absolute inset-0")} /> : null}
|
|
417
419
|
</span>
|
|
418
420
|
);
|
|
419
421
|
}
|
|
@@ -557,7 +559,7 @@ export function ColorPicker({
|
|
|
557
559
|
/>
|
|
558
560
|
{disabledAlpha ? null : (
|
|
559
561
|
<div className="relative">
|
|
560
|
-
<span className="
|
|
562
|
+
<span className={cn(CHECKERED, "pointer-events-none absolute inset-0 rounded-full")} />
|
|
561
563
|
<Slider
|
|
562
564
|
ariaLabel="Alpha"
|
|
563
565
|
value={hsba.a}
|
|
@@ -701,7 +703,7 @@ export function ColorPicker({
|
|
|
701
703
|
style={styles?.popup}
|
|
702
704
|
>
|
|
703
705
|
{rendered}
|
|
704
|
-
{showArrow ? <PopoverPrimitive.Arrow width={12} height={6} className="fill-
|
|
706
|
+
{showArrow ? <PopoverPrimitive.Arrow width={12} height={6} className="fill-card drop-shadow-[0_1px_0_var(--border)]" /> : null}
|
|
705
707
|
</PopoverPrimitive.Content>
|
|
706
708
|
</PopoverPrimitive.Portal>
|
|
707
709
|
</PopoverPrimitive.Root>
|
|
@@ -278,7 +278,7 @@ const DatePickerRoot = forwardRef<HTMLButtonElement, DatePickerProps>(function D
|
|
|
278
278
|
) : null
|
|
279
279
|
}
|
|
280
280
|
>
|
|
281
|
-
<span className={cn(!selected && "text-
|
|
281
|
+
<span className={cn(!selected && "text-quaternary-foreground")}>{selected ? label : placeholder}</span>
|
|
282
282
|
</TriggerChrome>
|
|
283
283
|
</PopoverPrimitive.Trigger>
|
|
284
284
|
<PopoverPrimitive.Portal container={portal}>
|
|
@@ -418,9 +418,9 @@ const RangePicker = forwardRef<HTMLButtonElement, RangePickerProps>(function Ran
|
|
|
418
418
|
}
|
|
419
419
|
>
|
|
420
420
|
<span className="inline-flex min-w-0 items-center gap-1.5">
|
|
421
|
-
<span className={cn("truncate", !selected?.from && "text-
|
|
421
|
+
<span className={cn("truncate", !selected?.from && "text-quaternary-foreground")}>{selected?.from ? startLabel : placeholders[0]}</span>
|
|
422
422
|
<span className="shrink-0 text-muted-foreground">{separator}</span>
|
|
423
|
-
<span className={cn("truncate", !rangeComplete && "text-
|
|
423
|
+
<span className={cn("truncate", !rangeComplete && "text-quaternary-foreground")}>{rangeComplete ? endLabel : placeholders[1]}</span>
|
|
424
424
|
</span>
|
|
425
425
|
</TriggerChrome>
|
|
426
426
|
</PopoverPrimitive.Trigger>
|
|
@@ -63,7 +63,7 @@ export function DesktopBarItem({
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export function DesktopBarDivider({ className }: { className?: string }) {
|
|
66
|
-
return <span className={cn("mx-2 h-4 w-px bg-
|
|
66
|
+
return <span className={cn("mx-2 h-4 w-px bg-border", className)} aria-hidden />;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export type DesktopHeaderProps = {
|
|
@@ -76,7 +76,7 @@ export function DesktopHeader({ left, right, className }: DesktopHeaderProps) {
|
|
|
76
76
|
return (
|
|
77
77
|
<header
|
|
78
78
|
className={cn(
|
|
79
|
-
"nonla-header-layer fixed inset-x-0 top-0 flex h-
|
|
79
|
+
"nonla-header-layer fixed inset-x-0 top-0 z-(--nonla-z-header,40) flex h-[42px] items-center justify-between gap-3 border-0 bg-background px-3",
|
|
80
80
|
className,
|
|
81
81
|
)}
|
|
82
82
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
3
|
|
|
4
4
|
const iconButtonClass =
|
|
5
5
|
"group w-[96px] flex flex-col items-center gap-0.5 py-2 px-0 rounded-md border-none cursor-pointer select-none outline-none bg-transparent focus-visible:outline-2 focus-visible:outline-brand motion-safe:transition-transform motion-safe:hover:-translate-y-0.5 motion-safe:active:scale-[0.98]";
|
|
@@ -10,16 +10,15 @@ export const DesktopIcon = forwardRef<
|
|
|
10
10
|
HTMLButtonElement,
|
|
11
11
|
{
|
|
12
12
|
label: string;
|
|
13
|
-
icon?: string;
|
|
14
13
|
media?: ReactNode;
|
|
15
14
|
active?: boolean;
|
|
16
15
|
onCard?: boolean;
|
|
17
16
|
onClick?: () => void;
|
|
18
17
|
}
|
|
19
|
-
>(function DesktopIcon({ label,
|
|
18
|
+
>(function DesktopIcon({ label, media, active = false, onCard = false, onClick }, ref) {
|
|
20
19
|
return (
|
|
21
20
|
<button ref={ref} type="button" title={label} aria-label={label} aria-current={active ? "true" : undefined} dir="ltr" onClick={onClick} className={iconButtonClass}>
|
|
22
|
-
{media ?? <
|
|
21
|
+
{media ?? <Icon name="stars" size={32} />}
|
|
23
22
|
<span className={`${labelClass} ${onCard ? "text-foreground" : "text-white [text-shadow:0_1px_2px_rgba(0,0,0,0.85)]"}`}>{label}</span>
|
|
24
23
|
</button>
|
|
25
24
|
);
|
|
@@ -2,5 +2,5 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
3
|
|
|
4
4
|
export function DesktopStage({ children, className }: { children?: ReactNode; className?: string }) {
|
|
5
|
-
return <div className={cn("relative h-dvh w-screen overflow-hidden bg-
|
|
5
|
+
return <div className={cn("relative h-dvh w-screen overflow-hidden bg-background", className)}>{children}</div>;
|
|
6
6
|
}
|
|
@@ -605,7 +605,7 @@ export function DesktopWindow({
|
|
|
605
605
|
|
|
606
606
|
return (
|
|
607
607
|
<WindowHeaderSlotContext.Provider value={headerChrome}>
|
|
608
|
-
<div ref={overlayRef} className="nonla-window-layer pointer-events-none absolute inset-x-0 bottom-0 top-
|
|
608
|
+
<div ref={overlayRef} className="nonla-window-layer pointer-events-none absolute inset-x-0 bottom-0 top-[42px] z-(--nonla-z-window,30)">
|
|
609
609
|
<section
|
|
610
610
|
ref={frameRef}
|
|
611
611
|
aria-label={typeof title === "string" && title ? title : "Window"}
|
|
@@ -627,13 +627,13 @@ export function DesktopWindow({
|
|
|
627
627
|
transition: [geom, zoom].filter(Boolean).join(", ") || undefined,
|
|
628
628
|
}}
|
|
629
629
|
data-expanded={expanded || undefined}
|
|
630
|
-
className={cn("absolute flex flex-col rounded-xl pointer-events-auto transform-gpu", glassSurfaceClass, "nonla-window-glass", phase !== "open" && "pointer-events-none")}
|
|
630
|
+
className={cn("absolute flex flex-col rounded-xl pointer-events-auto transform-gpu", glassSurfaceClass, "nonla-window-glass border border-solid border-border bg-background shadow-(--nonla-shadow)", phase !== "open" && "pointer-events-none")}
|
|
631
631
|
>
|
|
632
632
|
<div className="relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl">
|
|
633
633
|
{header ? (
|
|
634
634
|
<header
|
|
635
635
|
onPointerDown={startDrag}
|
|
636
|
-
className="nonla-window-header flex h-9 shrink-0 cursor-default items-center gap-4 border-0 px-3 select-none
|
|
636
|
+
className="nonla-window-header flex h-9 shrink-0 cursor-default touch-none items-center gap-4 border-0 bg-bar px-3 select-none"
|
|
637
637
|
>
|
|
638
638
|
<WindowTraffic expanded={expanded} onClose={requestClose} onToggleExpand={onToggleExpand} />
|
|
639
639
|
<div className="flex min-w-0 flex-1 items-center">
|
|
@@ -3,9 +3,9 @@ import { MeadowWallpaper } from "./MeadowWallpaper";
|
|
|
3
3
|
|
|
4
4
|
export function MeadowDesktop({ children, src }: { children?: ReactNode; src?: string }) {
|
|
5
5
|
return (
|
|
6
|
-
<div className="absolute inset-0 bg-
|
|
6
|
+
<div className="absolute inset-0 bg-background">
|
|
7
7
|
<MeadowWallpaper src={src} />
|
|
8
|
-
<div className="nonla-desktop-layer absolute inset-x-0 bottom-0 top-desktop
|
|
8
|
+
<div className="nonla-desktop-layer absolute inset-x-0 bottom-0 top-[42px] z-(--nonla-z-desktop,20)">
|
|
9
9
|
<nav aria-label="Desktop" className="absolute inset-0 overflow-auto pl-0 pr-3 pt-3 pb-3">
|
|
10
10
|
<div className="flex h-full flex-col flex-wrap content-start gap-x-2 gap-y-3">{children}</div>
|
|
11
11
|
</nav>
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -83,11 +83,15 @@ export function Drawer({
|
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
85
|
<Dialog.Portal container={portal}>
|
|
86
|
-
<Dialog.Overlay className="nonla-overlay" />
|
|
86
|
+
<Dialog.Overlay className="nonla-overlay fixed inset-0 z-(--nonla-z-drawer) bg-(--mask) data-[state=open]:animate-[nonla-overlay-in_var(--nonla-dur)_var(--nonla-ease-out)] data-[state=closed]:animate-[nonla-overlay-out_var(--nonla-dur-fast)_var(--nonla-ease-in)]" />
|
|
87
87
|
<Dialog.Content
|
|
88
88
|
data-side={placement}
|
|
89
89
|
className={cn(
|
|
90
|
-
"nonla-drawer-panel fixed flex flex-col outline-none",
|
|
90
|
+
"nonla-drawer-panel fixed flex flex-col outline-none will-change-transform z-[calc(var(--nonla-z-drawer)+1)]",
|
|
91
|
+
"data-[side=right]:data-[state=open]:animate-[nonla-drawer-in-right_var(--nonla-dur-slow)_var(--nonla-ease-out)] data-[side=right]:data-[state=closed]:animate-[nonla-drawer-out-right_var(--nonla-dur)_var(--nonla-ease-in)]",
|
|
92
|
+
"data-[side=left]:data-[state=open]:animate-[nonla-drawer-in-left_var(--nonla-dur-slow)_var(--nonla-ease-out)] data-[side=left]:data-[state=closed]:animate-[nonla-drawer-out-left_var(--nonla-dur)_var(--nonla-ease-in)]",
|
|
93
|
+
"data-[side=bottom]:data-[state=open]:animate-[nonla-drawer-in-bottom_var(--nonla-dur-slow)_var(--nonla-ease-out)] data-[side=bottom]:data-[state=closed]:animate-[nonla-drawer-out-bottom_var(--nonla-dur)_var(--nonla-ease-in)]",
|
|
94
|
+
"data-[side=top]:data-[state=open]:animate-[nonla-drawer-in-top_var(--nonla-dur-slow)_var(--nonla-ease-out)] data-[side=top]:data-[state=closed]:animate-[nonla-drawer-out-top_var(--nonla-dur)_var(--nonla-ease-in)]",
|
|
91
95
|
glassSurfaceClass,
|
|
92
96
|
placement === "right" && "top-0 right-0 bottom-0 max-w-[100vw]",
|
|
93
97
|
placement === "left" && "top-0 left-0 bottom-0 max-w-[100vw]",
|
|
@@ -2,7 +2,7 @@ import { cn } from "../lib/cn";
|
|
|
2
2
|
import { glassOverlayClass } from "../lib/surface";
|
|
3
3
|
|
|
4
4
|
export const menuItemClass =
|
|
5
|
-
"nonla-menu-item relative flex cursor-default select-none items-center gap-2 rounded-lg border border-solid border-transparent px-2.5 py-1 text-sm leading-5 outline-none data-[disabled]:opacity-40";
|
|
5
|
+
"nonla-menu-item relative flex cursor-default select-none items-center gap-2 rounded-lg border border-solid border-transparent px-2.5 py-1 text-sm leading-5 outline-none data-[disabled]:opacity-40 data-highlighted:border-border data-highlighted:bg-ink-hover";
|
|
6
6
|
|
|
7
7
|
export const menuContentClass = cn(glassOverlayClass, "min-w-40 overflow-hidden p-1");
|
|
8
8
|
|
package/src/empty/Empty.tsx
CHANGED
|
@@ -22,7 +22,7 @@ function LogoMark() {
|
|
|
22
22
|
<ellipse cx="607.5" cy="705" rx="44.5" ry="68" />
|
|
23
23
|
<ellipse cx="921.5" cy="705" rx="44.5" ry="68" />
|
|
24
24
|
</g>
|
|
25
|
-
<g fill="var(--nonla-solid
|
|
25
|
+
<g fill="var(--nonla-text-on-solid)">
|
|
26
26
|
<ellipse cx="618" cy="678" rx="13" ry="19" />
|
|
27
27
|
<ellipse cx="932" cy="678" rx="13" ry="19" />
|
|
28
28
|
</g>
|
|
@@ -27,7 +27,7 @@ export function FieldRadio({ field, choices }: Props) {
|
|
|
27
27
|
/>
|
|
28
28
|
<span
|
|
29
29
|
aria-hidden
|
|
30
|
-
className="pointer-events-none size-4 rounded-full border border-solid border-input bg-
|
|
30
|
+
className="pointer-events-none size-4 rounded-full border border-solid border-input bg-muted peer-checked:border-brand"
|
|
31
31
|
/>
|
|
32
32
|
<span aria-hidden className="pointer-events-none absolute inset-[3.5px] rounded-full bg-brand opacity-0 peer-checked:opacity-100" />
|
|
33
33
|
</span>
|
|
@@ -37,7 +37,7 @@ export function FieldRepeaterItem({ index, remove, namePrefix, childItems, contr
|
|
|
37
37
|
<button
|
|
38
38
|
type="button"
|
|
39
39
|
aria-label="Remove item"
|
|
40
|
-
className="inline-flex size-5 items-center justify-center rounded border-0 bg-muted text-muted-foreground cursor-pointer hover:bg-destructive hover:text-
|
|
40
|
+
className="inline-flex size-5 items-center justify-center rounded border-0 bg-muted text-muted-foreground cursor-pointer hover:bg-destructive hover:text-(--nonla-text-on-solid)"
|
|
41
41
|
onClick={() => remove(index)}
|
|
42
42
|
>
|
|
43
43
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cn } from "../lib/cn";
|
|
2
|
+
import { ICON_GLYPHS, type IconName } from "./glyphs";
|
|
3
|
+
|
|
4
|
+
export type { IconName };
|
|
5
|
+
|
|
6
|
+
export function isIconName(value: unknown): value is IconName {
|
|
7
|
+
return typeof value === "string" && value in ICON_GLYPHS;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Icon({ name, size = 16, className }: { name: IconName; size?: number; className?: string }) {
|
|
11
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">${ICON_GLYPHS[name]}</svg>`;
|
|
12
|
+
return (
|
|
13
|
+
<span
|
|
14
|
+
aria-hidden
|
|
15
|
+
className={cn("inline-flex shrink-0 select-none text-current pointer-events-none [&_svg]:size-full", className)}
|
|
16
|
+
style={{ width: size, height: size }}
|
|
17
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: glyph markup is a fixed set shipped with the library
|
|
18
|
+
dangerouslySetInnerHTML={{ __html: svg }}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Glyphs from the Solar icon set by 480 Design, CC BY 4.0. https://creativecommons.org/licenses/by/4.0/ */
|
|
2
|
+
export const ICON_GLYPHS = {
|
|
3
|
+
"add": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M4 12L20 12\"/><path d=\"M12 4L12 20\"/></g>",
|
|
4
|
+
"arrow-down": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M19 9L12 15L5 9\"/>",
|
|
5
|
+
"arrow-left": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M15 5L9 12L15 19\"/>",
|
|
6
|
+
"arrow-right": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M9 5L15 12L9 19\"/>",
|
|
7
|
+
"arrow-up": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M12 20L12 4M6 10L12 4L18 10\"/>",
|
|
8
|
+
"book": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M4 8C4 5.17157 4 3.75736 4.87868 2.87868C5.75736 2 7.17157 2 10 2H14C16.8284 2 18.2426 2 19.1213 2.87868C20 3.75736 20 5.17157 20 8V16C20 18.8284 20 20.2426 19.1213 21.1213C18.2426 22 16.8284 22 14 22H10C7.17157 22 5.75736 22 4.87868 21.1213C4 20.2426 4 18.8284 4 16V8Z\"/><path d=\"M19.8978 16H7.89778C6.96781 16 6.50282 16 6.12132 16.1022C5.08604 16.3796 4.2774 17.1883 4 18.2235\"/><path d=\"M8 7H16\"/><path d=\"M8 10.5H13\"/></g>",
|
|
9
|
+
"check": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M5 13L9 17L19 7\"/>",
|
|
10
|
+
"chevrons-left": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M13 19L7 12L13 5\"/><path d=\"M17 19L11 12L17 5\"/></g>",
|
|
11
|
+
"chevrons-right": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M11 19L17 12L11 5\"/><path d=\"M7 19L13 12L7 5\"/></g>",
|
|
12
|
+
"clock": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path stroke-linejoin=\"round\" d=\"M12 8V12L14.5 14.5\"/></g>",
|
|
13
|
+
"close": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M19 5L5 19\"/><path d=\"M19 19L5 5\"/></g>",
|
|
14
|
+
"code": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M15.5 9L15.6716 9.17157C17.0049 10.5049 17.6716 11.1716 17.6716 12C17.6716 12.8284 17.0049 13.4951 15.6716 14.8284L15.5 15\"/><path d=\"M13.2939 7.17041L11.9998 12L10.7058 16.8297\"/><path d=\"M8.50019 9L8.32861 9.17157C6.99528 10.5049 6.32861 11.1716 6.32861 12C6.32861 12.8284 6.99528 13.4951 8.32861 14.8284L8.50019 15\"/><path d=\"M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z\"/></g>",
|
|
15
|
+
"copy": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M6 11C6 8.17157 6 6.75736 6.87868 5.87868C7.75736 5 9.17157 5 12 5H15C17.8284 5 19.2426 5 20.1213 5.87868C21 6.75736 21 8.17157 21 11V16C21 18.8284 21 20.2426 20.1213 21.1213C19.2426 22 17.8284 22 15 22H12C9.17157 22 7.75736 22 6.87868 21.1213C6 20.2426 6 18.8284 6 16V11Z\"/><path d=\"M6 19C4.34315 19 3 17.6569 3 16V10C3 6.22876 3 4.34315 4.17157 3.17157C5.34315 2 7.22876 2 11 2H15C16.6569 2 18 3.34315 18 5\"/></g>",
|
|
16
|
+
"dialog": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M16.09 6.58944C15.1281 6 13.8187 6 11.2 6H8.8C6.18126 6 4.87188 6 3.91001 6.58944C3.37178 6.91927 2.91926 7.37179 2.58944 7.91001C2 8.8719 2 10.1813 2 12.8V13.6C2 15.4638 2 16.3957 2.30448 17.1308C2.71046 18.1109 3.48915 18.8896 4.46927 19.2956C4.93479 19.4884 5.47923 19.5591 6.28931 19.585C7.15324 19.6126 7.58521 19.6264 7.91637 19.8223C8.24753 20.0182 8.45544 20.3695 8.8712 21.0719L8.87121 21.0719L9.13064 21.5102C9.51718 22.1633 10.4828 22.1633 10.8693 21.5102L11.1288 21.0719C11.5445 20.3695 11.7524 20.0182 12.0836 19.8223C12.4148 19.6264 12.8467 19.6126 13.7107 19.585C14.5208 19.5591 15.0652 19.4884 15.5307 19.2956C16.5108 18.8896 17.2895 18.1109 17.6955 17.1308C18 16.3957 18 15.4638 18 13.6V12.8C18 10.1813 18 8.8719 17.4106 7.91001C17.0807 7.37179 16.6282 6.91927 16.09 6.58944Z\"/><path d=\"M7.0332 6C7.08481 5.00787 7.2165 4.33902 7.55255 3.79064C7.86176 3.28605 8.28599 2.86181 8.79058 2.5526C9.69234 2 10.9199 2 13.3749 2H15.6249C18.08 2 19.3076 2 20.2093 2.5526C20.7139 2.86181 21.1381 3.28605 21.4473 3.79064C21.9999 4.6924 21.9999 5.91994 21.9999 8.37503V9.12503C21.9999 10.8723 21.9999 11.746 21.7145 12.4351C21.3339 13.354 20.6039 14.084 19.685 14.4646C19.2527 14.6437 18.7477 14.7104 18 14.7352\"/><path stroke-linejoin=\"round\" d=\"M6.50928 13H6.51828M10 13H10.009M13.491 13H13.5\"/></g>",
|
|
17
|
+
"document": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M3 10C3 6.22876 3 4.34315 4.17157 3.17157C5.34315 2 7.22876 2 11 2H13C16.7712 2 18.6569 2 19.8284 3.17157C21 4.34315 21 6.22876 21 10V14C21 17.7712 21 19.6569 19.8284 20.8284C18.6569 22 16.7712 22 13 22H11C7.22876 22 5.34315 22 4.17157 20.8284C3 19.6569 3 17.7712 3 14V10Z\"/><path d=\"M8 12H16\"/><path d=\"M8 8H16\"/><path d=\"M8 16H13\"/></g>",
|
|
18
|
+
"download": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M17 9.00195C19.175 9.01406 20.3529 9.11051 21.1213 9.8789C22 10.7576 22 12.1718 22 15.0002V16.0002C22 18.8286 22 20.2429 21.1213 21.1215C20.2426 22.0002 18.8284 22.0002 16 22.0002H8C5.17157 22.0002 3.75736 22.0002 2.87868 21.1215C2 20.2429 2 18.8286 2 16.0002L2 15.0002C2 12.1718 2 10.7576 2.87868 9.87889C3.64706 9.11051 4.82497 9.01406 7 9.00195\"/><path stroke-linejoin=\"round\" d=\"M12 2L12 15M15 11.5L12 15L9 11.5\"/></g>",
|
|
19
|
+
"eraser": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M13.7713 17.314L6.68596 10.2287M11.4096 5.50506C13.0796 3.83502 13.9146 3 14.9522 3C15.9899 3 16.8249 3.83502 18.4949 5.50506C20.165 7.1751 21 8.01012 21 9.04776C21 10.0854 20.165 10.9204 18.4949 12.5904L12.5904 18.4949C10.9204 20.165 10.0854 21 9.04776 21C8.01012 21 7.1751 20.165 5.50506 18.4949C3.83502 16.8249 3 15.9899 3 14.9522C3 13.9146 3.83502 13.0796 5.50506 11.4096L11.4096 5.50506Z\"/><path d=\"M9 21H21\"/></g>",
|
|
20
|
+
"error": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 7V13\"/><path stroke-linejoin=\"round\" d=\"M12 16H12.0001\"/></g>",
|
|
21
|
+
"eye": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M3.27489 15.2957C2.42496 14.1915 2 13.6394 2 12C2 10.3606 2.42496 9.80853 3.27489 8.70433C4.97196 6.49956 7.81811 4 12 4C16.1819 4 19.028 6.49956 20.7251 8.70433C21.575 9.80853 22 10.3606 22 12C22 13.6394 21.575 14.1915 20.7251 15.2957C19.028 17.5004 16.1819 20 12 20C7.81811 20 4.97196 17.5004 3.27489 15.2957Z\"/><path d=\"M15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12Z\"/></g>",
|
|
22
|
+
"globe": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><ellipse cx=\"12\" cy=\"12\" rx=\"4\" ry=\"10\"/><path d=\"M2 12H22\"/></g>",
|
|
23
|
+
"maximize": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M9 15L2 22M2 16.1429V22H7.85714\"/><path d=\"M15 9L22 2M22 7.85714V2H16.1429\"/></g>",
|
|
24
|
+
"minimize": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M2 22L9 15M9 20.8571V15H3.14286\"/><path d=\"M22 2L15 9M15 3.14286V9H20.8571\"/></g>",
|
|
25
|
+
"monitor": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M2 10C2 6.22876 2 4.34315 3.17157 3.17157C4.34315 2 6.22876 2 10 2H14C17.7712 2 19.6569 2 20.8284 3.17157C22 4.34315 22 6.22876 22 10V11C22 13.8284 22 15.2426 21.1213 16.1213C20.2426 17 18.8284 17 16 17H8C5.17157 17 3.75736 17 2.87868 16.1213C2 15.2426 2 13.8284 2 11V10Z\"/><path d=\"M16 22H8\"/><path d=\"M12 17L12 22\"/><path d=\"M22 13H2\"/></g>",
|
|
26
|
+
"moon": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" d=\"M12 22C17.5228 22 22 17.5228 22 12C22 11.5373 21.3065 11.4608 21.0672 11.8568C19.9289 13.7406 17.8615 15 15.5 15C11.9101 15 9 12.0899 9 8.5C9 6.13845 10.2594 4.07105 12.1432 2.93276C12.5392 2.69347 12.4627 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\"/>",
|
|
27
|
+
"pen": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\" d=\"M14.3601 4.07866L15.2869 3.15178C16.8226 1.61607 19.3125 1.61607 20.8482 3.15178C22.3839 4.68748 22.3839 7.17735 20.8482 8.71306L19.9213 9.63993M14.3601 4.07866C14.3601 4.07866 14.4759 6.04828 16.2138 7.78618C17.9517 9.52407 19.9213 9.63993 19.9213 9.63993M19.9213 9.63993L11.4001 18.1612C10.8229 18.7383 10.5344 19.0269 10.2162 19.2751C9.84082 19.5679 9.43469 19.8189 9.00498 20.0237C8.6407 20.1973 8.25352 20.3263 7.47918 20.5844L4.19792 21.6782L3.39584 21.9456C3.01478 22.0726 2.59466 21.9734 2.31063 21.6894C2.0266 21.4053 1.92743 20.9852 2.05445 20.6042L2.32181 19.8021L3.41556 16.5208C3.67368 15.7465 3.80273 15.3593 3.97634 14.995C4.18114 14.5653 4.43213 14.1592 4.7249 13.7838C4.97308 13.4656 5.26166 13.1771 5.83882 12.5999L14.3601 4.07866M4.19792 21.6782L2.32181 19.8021\"/>",
|
|
28
|
+
"shield-check": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M3 10.4167C3 7.21907 3 5.62028 3.37752 5.08241C3.75503 4.54454 5.25832 4.02996 8.26491 3.00079L8.83772 2.80472C10.405 2.26824 11.1886 2 12 2C12.8114 2 13.595 2.26824 15.1623 2.80472L15.7351 3.00079C18.7417 4.02996 20.245 4.54454 20.6225 5.08241C21 5.62028 21 7.21907 21 10.4167C21 10.8996 21 11.4234 21 11.9914C21 17.6294 16.761 20.3655 14.1014 21.5273C13.38 21.8424 13.0193 22 12 22C10.9807 22 10.62 21.8424 9.89856 21.5273C7.23896 20.3655 3 17.6294 3 11.9914C3 11.4234 3 10.8996 3 10.4167Z\"/><path stroke-linejoin=\"round\" d=\"M9.5 12.4L10.9286 14L14.5 10\"/></g>",
|
|
29
|
+
"stars": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><path d=\"M8.03339 3.65784C8.37932 2.78072 9.62068 2.78072 9.96661 3.65785L11.0386 6.37599C11.1442 6.64378 11.3562 6.85576 11.624 6.96137L14.3422 8.03339C15.2193 8.37932 15.2193 9.62068 14.3422 9.96661L11.624 11.0386C11.3562 11.1442 11.1442 11.3562 11.0386 11.624L9.96661 14.3422C9.62067 15.2193 8.37932 15.2193 8.03339 14.3422L6.96137 11.624C6.85575 11.3562 6.64378 11.1442 6.37599 11.0386L3.65784 9.96661C2.78072 9.62067 2.78072 8.37932 3.65785 8.03339L6.37599 6.96137C6.64378 6.85575 6.85576 6.64378 6.96137 6.37599L8.03339 3.65784Z\"/><path d=\"M16.4885 13.3481C16.6715 12.884 17.3285 12.884 17.5115 13.3481L18.3121 15.3781C18.368 15.5198 18.4802 15.632 18.6219 15.6879L20.6519 16.4885C21.116 16.6715 21.116 17.3285 20.6519 17.5115L18.6219 18.3121C18.4802 18.368 18.368 18.4802 18.3121 18.6219L17.5115 20.6519C17.3285 21.116 16.6715 21.116 16.4885 20.6519L15.6879 18.6219C15.632 18.4802 15.5198 18.368 15.3781 18.3121L13.3481 17.5115C12.884 17.3285 12.884 16.6715 13.3481 16.4885L15.3781 15.6879C15.5198 15.632 15.632 15.5198 15.6879 15.3781L16.4885 13.3481Z\"/></g>",
|
|
30
|
+
"stop": "<path fill=\"currentColor\" d=\"M2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12Z\"/>",
|
|
31
|
+
"sun": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"6\"/><path d=\"M12 2V3\"/><path d=\"M12 21V22\"/><path d=\"M22 12L21 12\"/><path d=\"M3 12L2 12\"/><path d=\"M19.0708 4.92969L18.678 5.32252\"/><path d=\"M5.32178 18.6777L4.92894 19.0706\"/><path d=\"M19.0708 19.0703L18.678 18.6775\"/><path d=\"M5.32178 5.32227L4.92894 4.92943\"/></g>",
|
|
32
|
+
"transfer": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M20 10L4 10L9.5 4\"/><path d=\"M4 14L20 14L14.5 20\"/></g>",
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
export type IconName = keyof typeof ICON_GLYPHS;
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AppProps, NonlaAppConfig } from "./app/App";
|
|
2
|
-
export { App, useApp, useAppConfig, usePopupContainer
|
|
2
|
+
export { App, useApp, useAppConfig, usePopupContainer } from "./app/App";
|
|
3
3
|
export type { ButtonColor, ButtonGroupProps, ButtonProps, ButtonSize, ButtonType, ButtonVariant } from "./button/Button";
|
|
4
4
|
export { Button } from "./button/Button";
|
|
5
5
|
export type { ButtonCopyProps } from "./button/ButtonCopy";
|
|
@@ -17,6 +17,8 @@ export type { AlertProps, AlertType } from "./alert/Alert";
|
|
|
17
17
|
export { Alert } from "./alert/Alert";
|
|
18
18
|
export type { AgentAvatarConfig, AgentAvatarEyeColor, AgentAvatarLook, AgentAvatarMotion, AgentAvatarProps } from "./avatar/AgentAvatar";
|
|
19
19
|
export { AGENT_AVATAR_PARTS, AgentAvatar } from "./avatar/AgentAvatar";
|
|
20
|
+
export type { BlobShapeAppearance, BlobShapeProps, BlobShapeVariant } from "./blob-shape/BlobShape";
|
|
21
|
+
export { BlobShape } from "./blob-shape/BlobShape";
|
|
20
22
|
export type { CalendarProps } from "./calendar/Calendar";
|
|
21
23
|
export { Calendar } from "./calendar/Calendar";
|
|
22
24
|
export type { CardFooterProps, CardItemProps, CardProps } from "./card/Card";
|
|
@@ -28,6 +30,7 @@ export type {
|
|
|
28
30
|
AgentMessageRole,
|
|
29
31
|
AgentPanelEndpoint,
|
|
30
32
|
AgentPanelProps,
|
|
33
|
+
AgentSseCallbacks,
|
|
31
34
|
AgentStreamRequest,
|
|
32
35
|
AgentToolCallEvent,
|
|
33
36
|
AgentToolHook,
|
|
@@ -134,25 +137,8 @@ export {
|
|
|
134
137
|
export type { FormLayoutItemProps, FormLayoutProps } from "./form-layout/FormLayout";
|
|
135
138
|
/** Layout-only Form + Form.Item for labeled fields. */
|
|
136
139
|
export { Form } from "./form-layout/FormLayout";
|
|
137
|
-
export {
|
|
138
|
-
export {
|
|
139
|
-
DEFAULT_ICON_NAME,
|
|
140
|
-
DEFAULT_TOOL_ICON,
|
|
141
|
-
ensureSolarIcons,
|
|
142
|
-
ensureSolarIcons as ensureFluentIcons,
|
|
143
|
-
getIconNames,
|
|
144
|
-
getSolarImgSrc,
|
|
145
|
-
getSolarImgSrc as getFluentImgSrc,
|
|
146
|
-
getSolarSvg,
|
|
147
|
-
ICON_PREFIX,
|
|
148
|
-
isSolarIcon,
|
|
149
|
-
isSolarIcon as isFluentIcon,
|
|
150
|
-
isSvgIcon,
|
|
151
|
-
solarIconName,
|
|
152
|
-
solarIconName as fluentIconName,
|
|
153
|
-
solarIconRef,
|
|
154
|
-
solarIconRef as fluentIconRef,
|
|
155
|
-
} from "./icon/solar";
|
|
140
|
+
export type { IconName } from "./icon/Icon";
|
|
141
|
+
export { Icon } from "./icon/Icon";
|
|
156
142
|
export { cn } from "./lib/cn";
|
|
157
143
|
export type { PopperPlacement } from "./lib/placement";
|
|
158
144
|
export { placementToRadix } from "./lib/placement";
|
|
@@ -163,7 +149,7 @@ export type { LogoProps, LogoVariant } from "./logo/Logo";
|
|
|
163
149
|
export { Logo } from "./logo/Logo";
|
|
164
150
|
export type { MarkdownDiffLayout, MarkdownEditorMode, MarkdownEditorProps } from "./markdown-editor/MarkdownEditor";
|
|
165
151
|
export { MarkdownEditor } from "./markdown-editor/MarkdownEditor";
|
|
166
|
-
export type {
|
|
152
|
+
export type { MarkdownViewerProps } from "./markdown-editor/MarkdownViewer";
|
|
167
153
|
export { MarkdownViewer } from "./markdown-editor/MarkdownViewer";
|
|
168
154
|
export type { MermaidBlockProps } from "./markdown-editor/MermaidBlock";
|
|
169
155
|
export { MermaidBlock } from "./markdown-editor/MermaidBlock";
|
|
@@ -217,8 +203,8 @@ export type { TabsItem, TabsProps } from "./tabs/Tabs";
|
|
|
217
203
|
export { Tabs } from "./tabs/Tabs";
|
|
218
204
|
export type { TagProps, TagVariant } from "./tag/Tag";
|
|
219
205
|
export { Tag } from "./tag/Tag";
|
|
220
|
-
export type { NonlaColorMode, NonlaColorPreference
|
|
221
|
-
export { getColorMode, getColorPreference,
|
|
206
|
+
export type { NonlaColorMode, NonlaColorPreference } from "./theme";
|
|
207
|
+
export { getColorMode, getColorPreference, initColorMode, NONLA_COLOR_MODE_KEY, setColorMode, setColorPreference } from "./theme";
|
|
222
208
|
export type { ThemeSwitcherProps } from "./theme-switcher/ThemeSwitcher";
|
|
223
209
|
export { ThemeSwitcher, useColorPreference } from "./theme-switcher/ThemeSwitcher";
|
|
224
210
|
export type { ThemeToggleProps } from "./theme-toggle/ThemeToggle";
|
|
@@ -2,9 +2,10 @@ import { type CSSProperties, cloneElement, isValidElement, type KeyboardEvent, t
|
|
|
2
2
|
import { createPortal } from "react-dom";
|
|
3
3
|
import { usePopupContainer } from "../app/context";
|
|
4
4
|
import { Button } from "../button/Button";
|
|
5
|
-
import {
|
|
5
|
+
import { Icon } from "../icon/Icon";
|
|
6
6
|
import { cn } from "../lib/cn";
|
|
7
7
|
import { type CanonicalSize, type ControlSize, controlHeightVar, controlRadiusVar, getSizeTokens, useControlSize } from "../lib/sizes";
|
|
8
|
+
import { glassSurfaceClass } from "../lib/surface";
|
|
8
9
|
import { message } from "../message/message";
|
|
9
10
|
|
|
10
11
|
const POPUP_PAD: Record<CanonicalSize, number> = { small: 12, default: 16, large: 20 };
|
|
@@ -12,7 +13,7 @@ const FIELD_INSET: Record<CanonicalSize, string> = { small: "-4px", default: "-6
|
|
|
12
13
|
const MULTILINE_MIN: Record<CanonicalSize, number> = { small: 56, default: 72, large: 96 };
|
|
13
14
|
const GLASS_BORDER = 1;
|
|
14
15
|
|
|
15
|
-
const fieldClass = (saving: boolean) => cn("relative z-1 m-0 w-full border-0 bg-transparent text-foreground placeholder:text-
|
|
16
|
+
const fieldClass = (saving: boolean) => cn("relative z-1 m-0 w-full border-0 bg-transparent text-foreground placeholder:text-quaternary-foreground focus:outline-none", saving && "opacity-60");
|
|
16
17
|
|
|
17
18
|
type Lock = {
|
|
18
19
|
top: number;
|
|
@@ -187,7 +188,7 @@ function EditorPopover({
|
|
|
187
188
|
|
|
188
189
|
return createPortal(
|
|
189
190
|
<div
|
|
190
|
-
className="nonla-popup-layer
|
|
191
|
+
className={cn(glassSurfaceClass, "nonla-popup-layer outline-none")}
|
|
191
192
|
style={{
|
|
192
193
|
position: "fixed",
|
|
193
194
|
zIndex: "var(--nonla-z-popup, 1050)",
|
|
@@ -227,7 +228,7 @@ function EditButton({ label, size, onClick }: { label: string; size: CanonicalSi
|
|
|
227
228
|
className="inline-flex shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground group-hover/edit:opacity-100 focus-visible:opacity-100"
|
|
228
229
|
style={{ width: box, height: box }}
|
|
229
230
|
>
|
|
230
|
-
<
|
|
231
|
+
<Icon name="pen" size={tok.icon} />
|
|
231
232
|
</button>
|
|
232
233
|
);
|
|
233
234
|
}
|
package/src/input/Input.tsx
CHANGED
|
@@ -15,11 +15,11 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "p
|
|
|
15
15
|
onPressEnter?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const fieldBase = cn("w-full", controlFieldSurface, "placeholder:text-
|
|
18
|
+
const fieldBase = cn("w-full", controlFieldSurface, "placeholder:text-quaternary-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45", controlFieldFocusBorder);
|
|
19
19
|
|
|
20
20
|
function variantClass(variant: InputProps["variant"]) {
|
|
21
21
|
if (variant === "borderless") return "border-transparent bg-transparent hover:bg-transparent shadow-none focus:border-transparent focus:bg-transparent focus-within:bg-transparent";
|
|
22
|
-
if (variant === "filled") return "border-transparent bg-muted focus:border-transparent focus:bg-
|
|
22
|
+
if (variant === "filled") return "border-transparent bg-muted focus:border-transparent focus:bg-muted-strong";
|
|
23
23
|
return "";
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -162,12 +162,15 @@ function roundTo(n: number, precision?: number) {
|
|
|
162
162
|
|
|
163
163
|
function HandlerChevron({ dir, size }: { dir: "up" | "down"; size: number }) {
|
|
164
164
|
return (
|
|
165
|
-
<svg width={size} height={size} viewBox="0 0 10 10" fill="none" aria-hidden
|
|
165
|
+
<svg width={size} height={size} viewBox="0 0 10 10" fill="none" aria-hidden>
|
|
166
166
|
{dir === "up" ? <path d="M2.5 6.25L5 3.75L7.5 6.25" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" /> : <path d="M2.5 3.75L5 6.25L7.5 3.75" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />}
|
|
167
167
|
</svg>
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/** Stepper reveal and press. Same ease-out and duration as the field focus. */
|
|
172
|
+
const handlerEase = "duration-[var(--nonla-dur-fast,150ms)] ease-[var(--nonla-ease-out,cubic-bezier(0.16,1,0.3,1))] motion-reduce:transition-none";
|
|
173
|
+
|
|
171
174
|
const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function InputNumber({ value, defaultValue, onChange, min, max, step = 1, controls = true, precision, parser, formatter, disabled, size, status, className, style, placeholder, onBlur, onFocus, onKeyDown, ...rest }, ref) {
|
|
172
175
|
const controlled = value !== undefined;
|
|
173
176
|
const [inner, setInner] = useState<number | null>(defaultValue ?? null);
|
|
@@ -275,7 +278,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
275
278
|
}}
|
|
276
279
|
onKeyDown={handleKeyDown}
|
|
277
280
|
className={cn(
|
|
278
|
-
"min-w-0 flex-1 border-0 bg-transparent text-foreground placeholder:text-
|
|
281
|
+
"min-w-0 flex-1 border-0 bg-transparent text-foreground placeholder:text-quaternary-foreground outline-none",
|
|
279
282
|
"disabled:cursor-not-allowed",
|
|
280
283
|
// Kill native number chrome if type ever switches
|
|
281
284
|
"[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
@@ -291,7 +294,12 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
291
294
|
|
|
292
295
|
{controls && !disabled ? (
|
|
293
296
|
<div
|
|
294
|
-
className={cn(
|
|
297
|
+
className={cn(
|
|
298
|
+
"pointer-events-none absolute top-0 right-0 bottom-0 flex flex-col overflow-hidden border-l border-input opacity-0",
|
|
299
|
+
"transition-opacity",
|
|
300
|
+
handlerEase,
|
|
301
|
+
"group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100",
|
|
302
|
+
)}
|
|
295
303
|
style={{ width: handlerW, borderTopRightRadius: `calc(${controlRadiusVar(size)} - 1px)`, borderBottomRightRadius: `calc(${controlRadiusVar(size)} - 1px)` }}
|
|
296
304
|
>
|
|
297
305
|
<button
|
|
@@ -299,7 +307,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
299
307
|
tabIndex={-1}
|
|
300
308
|
aria-label="Increase"
|
|
301
309
|
disabled={atMax}
|
|
302
|
-
className={cn("flex flex-1 items-center justify-center text-
|
|
310
|
+
className={cn("flex flex-1 items-center justify-center border-b border-input text-tertiary-foreground", "transition-colors", handlerEase, "hover:bg-ink-hover hover:text-foreground active:bg-ink-active active:duration-75", "disabled:pointer-events-none disabled:opacity-30")}
|
|
303
311
|
onMouseDown={(e) => e.preventDefault()}
|
|
304
312
|
onClick={() => stepBy(1)}
|
|
305
313
|
>
|
|
@@ -310,7 +318,7 @@ const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(function Inpu
|
|
|
310
318
|
tabIndex={-1}
|
|
311
319
|
aria-label="Decrease"
|
|
312
320
|
disabled={atMin}
|
|
313
|
-
className={cn("flex flex-1 items-center justify-center text-
|
|
321
|
+
className={cn("flex flex-1 items-center justify-center text-tertiary-foreground", "transition-colors", handlerEase, "hover:bg-ink-hover hover:text-foreground active:bg-ink-active active:duration-75", "disabled:pointer-events-none disabled:opacity-30")}
|
|
314
322
|
onMouseDown={(e) => e.preventDefault()}
|
|
315
323
|
onClick={() => stepBy(-1)}
|
|
316
324
|
>
|
package/src/lib/sizes.ts
CHANGED
|
@@ -83,10 +83,10 @@ export function controlRadiusVar(size: ControlSize | undefined): string {
|
|
|
83
83
|
return "var(--nonla-radius)";
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
/** Soft status border — keep the same color on focus so
|
|
86
|
+
/** Soft status border — keep the same color on focus so the ink focus stroke does not override. */
|
|
87
87
|
export function controlStatusClass(status?: "error" | "warning"): string {
|
|
88
|
-
if (status === "error") return "border-[color-mix(in_oklab,var(--destructive)_55%,transparent)] focus:border-destructive focus-within:border-destructive data-[state=open]:border-destructive";
|
|
89
|
-
if (status === "warning") return "border-[color-mix(in_oklab,var(--warn)_55%,transparent)] focus:border-warn focus-within:border-warn data-[state=open]:border-warn";
|
|
88
|
+
if (status === "error") return "border-[color-mix(in_oklab,var(--destructive)_55%,transparent)] focus:border-destructive! focus-within:border-destructive! data-[state=open]:border-destructive!";
|
|
89
|
+
if (status === "warning") return "border-[color-mix(in_oklab,var(--warn)_55%,transparent)] focus:border-warn! focus-within:border-warn! data-[state=open]:border-warn!";
|
|
90
90
|
return "";
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -100,11 +100,11 @@ export const controlFieldTransition = "transition-[background-color,border-color
|
|
|
100
100
|
export const controlFieldSurface = "border border-solid border-input bg-transparent text-foreground";
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Focus fill is
|
|
104
|
-
*
|
|
103
|
+
* Focus fill is the sidebar step. Focus stroke is `--nonla-input-focus`.
|
|
104
|
+
* Each theme sets those names to a concrete color. Any focus and an open menu use the stroke.
|
|
105
105
|
*/
|
|
106
106
|
export const controlFieldFocusBorder =
|
|
107
|
-
"focus:bg-
|
|
107
|
+
"focus:bg-sidebar focus-within:bg-sidebar data-[state=open]:bg-sidebar aria-expanded:bg-sidebar focus:border-input-focus focus-within:border-input-focus focus-visible:border-input-focus has-[:focus-visible]:border-input-focus data-[state=open]:border-input-focus aria-expanded:border-input-focus";
|
|
108
108
|
|
|
109
109
|
/** Shared field chrome (Input / Select / DatePicker). */
|
|
110
110
|
export function controlFieldStyle(size: ControlSize | undefined): CSSProperties {
|
package/src/lib/surface.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/** Solid panel — window, modal, popover, menu, drawer, toast. */
|
|
2
|
-
export const glassSurfaceClass =
|
|
2
|
+
export const glassSurfaceClass =
|
|
3
|
+
"nonla-glass border border-solid border-border bg-card text-foreground shadow-(--nonla-shadow)";
|
|
3
4
|
|
|
4
5
|
/** Floating overlay chrome (Popover / Dropdown / Select / pickers / Tooltip). */
|
|
5
|
-
export const glassOverlayClass =
|
|
6
|
-
|
|
6
|
+
export const glassOverlayClass = [
|
|
7
|
+
glassSurfaceClass,
|
|
8
|
+
"nonla-popup-layer nonla-popper z-[var(--nonla-z-popup,1050)] rounded-xl outline-none will-change-[transform,opacity]",
|
|
9
|
+
"[transform-origin:var(--radix-popover-content-transform-origin,var(--radix-dropdown-menu-content-transform-origin,var(--radix-select-content-transform-origin,var(--radix-tooltip-content-transform-origin,center))))]",
|
|
10
|
+
"data-[state=open]:data-[side=top]:animate-[nonla-pop-in-top_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
|
|
11
|
+
"data-[state=open]:data-[side=bottom]:animate-[nonla-pop-in-bottom_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
|
|
12
|
+
"data-[state=open]:data-[side=left]:animate-[nonla-pop-in-left_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
|
|
13
|
+
"data-[state=open]:data-[side=right]:animate-[nonla-pop-in-right_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
|
|
14
|
+
"data-[state=open]:not-data-[side]:animate-[nonla-pop-in-bottom_var(--nonla-dur-fast)_var(--nonla-ease-out)]",
|
|
15
|
+
"data-[state=closed]:animate-[nonla-pop-out_100ms_var(--nonla-ease-in)]",
|
|
16
|
+
].join(" ");
|
|
7
17
|
|
|
8
18
|
/** Meadow menus — same panel as overlays. */
|
|
9
|
-
export const meadowSurfaceClass =
|
|
19
|
+
export const meadowSurfaceClass = `rounded-xl ${glassSurfaceClass}`;
|
|
@@ -8,7 +8,7 @@ export type MarkdownDiffLayout = "inline" | "side-by-side";
|
|
|
8
8
|
function rowBg(kind: DiffLine["kind"]): string {
|
|
9
9
|
if (kind === "insert") return "bg-[color-mix(in_oklab,var(--success)_16%,var(--card))]";
|
|
10
10
|
if (kind === "delete") return "bg-[color-mix(in_oklab,var(--destructive)_14%,var(--card))]";
|
|
11
|
-
if (kind === "empty") return "bg-
|
|
11
|
+
if (kind === "empty") return "bg-muted/45";
|
|
12
12
|
return "bg-card";
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -65,7 +65,7 @@ function LineBody({ line }: { line: DiffLine }) {
|
|
|
65
65
|
|
|
66
66
|
function FoldButton({ count, onClick, span }: { count: number; onClick: () => void; span?: boolean }) {
|
|
67
67
|
return (
|
|
68
|
-
<button type="button" className={cn("flex w-full items-center justify-center border-y border-border bg-
|
|
68
|
+
<button type="button" className={cn("flex w-full items-center justify-center border-y border-border bg-muted/70 py-0.5 text-xs text-link hover:bg-muted", span && "col-span-2")} onClick={onClick}>
|
|
69
69
|
Show {count} unchanged {count === 1 ? "line" : "lines"}
|
|
70
70
|
</button>
|
|
71
71
|
);
|
|
@@ -166,8 +166,8 @@ function SplitDiff({ model, open, toggle, originalLabel, modifiedLabel }: { mode
|
|
|
166
166
|
segment += 1;
|
|
167
167
|
chunks.push(
|
|
168
168
|
<div key={`seg-${id}`} className="flex w-full items-start">
|
|
169
|
-
<div className="
|
|
170
|
-
<div className="
|
|
169
|
+
<div className="w-1/2 min-w-0 overflow-x-auto [scrollbar-color:transparent_transparent] hover:[scrollbar-color:var(--nonla-scrollbar-thumb)_transparent] [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-(--nonla-scrollbar-thumb) hover:[&::-webkit-scrollbar-thumb:hover]:bg-(--nonla-scrollbar-thumb-hover)">{left}</div>
|
|
170
|
+
<div className="w-1/2 min-w-0 overflow-x-auto border-l border-border [scrollbar-color:transparent_transparent] hover:[scrollbar-color:var(--nonla-scrollbar-thumb)_transparent] [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-(--nonla-scrollbar-thumb) hover:[&::-webkit-scrollbar-thumb:hover]:bg-(--nonla-scrollbar-thumb-hover)">{right}</div>
|
|
171
171
|
</div>,
|
|
172
172
|
);
|
|
173
173
|
left = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type MouseEvent, type ReactNode, useCallback, useMemo, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
import { Segmented } from "../segmented/Segmented";
|
|
5
5
|
import { appendTextBlock, cleanupDoc, joinMarkdownDoc, type MarkdownDoc, parseMarkdownDoc, readInlineEdit, splitListItem } from "./blocks";
|
|
@@ -268,9 +268,9 @@ export function MarkdownEditor({
|
|
|
268
268
|
value={mode}
|
|
269
269
|
onChange={changeMode}
|
|
270
270
|
options={[
|
|
271
|
-
{ label: "Preview", value: "preview", icon: <
|
|
272
|
-
{ label: "Edit", value: "edit", icon: <
|
|
273
|
-
{ label: "Diff", value: "diff", icon: <
|
|
271
|
+
{ label: "Preview", value: "preview", icon: <Icon name="eye" size={14} /> },
|
|
272
|
+
{ label: "Edit", value: "edit", icon: <Icon name="pen" size={14} /> },
|
|
273
|
+
{ label: "Diff", value: "diff", icon: <Icon name="transfer" size={14} />, disabled: original === undefined },
|
|
274
274
|
]}
|
|
275
275
|
/>
|
|
276
276
|
) : null}
|