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
|
@@ -2,7 +2,7 @@ import { type MouseEvent, useLayoutEffect, useRef } from "react";
|
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
3
|
import { OverlayScroll } from "../scroll/OverlayScroll";
|
|
4
4
|
import { type MarkdownDoc, readInlineEdit, writeInlineEdit } from "./blocks";
|
|
5
|
-
import { BlockBody, headingClass, ListItem,
|
|
5
|
+
import { BlockBody, headingClass, ListItem, markdownScaleStyle, spaceBefore } from "./MarkdownViewer";
|
|
6
6
|
|
|
7
7
|
function BlockEditor({ value, mono, className, caret = "end", onChange, onBlur, onEnter }: { value: string; mono?: boolean; className?: string; caret?: "start" | "end"; onChange: (value: string) => void; onBlur: () => void; onEnter?: (before: string, after: string) => void }) {
|
|
8
8
|
const ref = useRef<HTMLTextAreaElement>(null);
|
|
@@ -57,8 +57,8 @@ function BlockEditor({ value, mono, className, caret = "end", onChange, onBlur,
|
|
|
57
57
|
});
|
|
58
58
|
}}
|
|
59
59
|
className={cn(
|
|
60
|
-
"block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-(length:--md-body-size,16px) leading-(--md-body-leading,
|
|
61
|
-
mono && "font-mono text-
|
|
60
|
+
"block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-(length:--md-body-size,var(--nonla-md-text-size,16px)) leading-(--md-body-leading,calc(var(--nonla-md-text-size,16px)*1.6)) text-foreground shadow-none outline-none ring-0 placeholder:text-quaternary-foreground focus:outline-none focus:ring-0",
|
|
61
|
+
mono && "font-mono text-(length:--md-code-size,var(--nonla-mono-text-size)) leading-(--md-code-leading,calc(var(--nonla-mono-text-size)*1.6))",
|
|
62
62
|
className,
|
|
63
63
|
)}
|
|
64
64
|
aria-label="Edit markdown"
|
|
@@ -88,7 +88,7 @@ export type MarkdownPreviewProps = {
|
|
|
88
88
|
export function MarkdownPreview({ doc, editingIndex, readOnly, placeholder = "Write markdown…", onStartEdit, onEditMouseDown, onChangeBody, onBlurBlock, onEnterList, caret = "end", onAppend }: MarkdownPreviewProps) {
|
|
89
89
|
return (
|
|
90
90
|
<OverlayScroll className="h-full bg-card">
|
|
91
|
-
<div className="mx-auto flex w-full max-w-3xl flex-col px-8 py-6" style={
|
|
91
|
+
<div className="mx-auto flex w-full max-w-3xl flex-col px-8 py-6" style={markdownScaleStyle}>
|
|
92
92
|
{doc.blocks.map((block, index) => {
|
|
93
93
|
const editing = editingIndex === index;
|
|
94
94
|
const locked = block.kind === "mermaid" || readOnly;
|
|
@@ -142,9 +142,9 @@ export function MarkdownPreview({ doc, editingIndex, readOnly, placeholder = "Wr
|
|
|
142
142
|
);
|
|
143
143
|
})}
|
|
144
144
|
{readOnly ? (
|
|
145
|
-
doc.blocks.length === 0 ? <p className="m-0 text-sm text-
|
|
145
|
+
doc.blocks.length === 0 ? <p className="m-0 text-sm text-quaternary-foreground">{placeholder}</p> : null
|
|
146
146
|
) : (
|
|
147
|
-
<button type="button" className="mt-3 min-h-16 text-left text-sm text-
|
|
147
|
+
<button type="button" className="mt-3 min-h-16 text-left text-sm text-quaternary-foreground" onClick={onAppend} aria-label="Add paragraph">
|
|
148
148
|
{doc.blocks.length === 0 ? placeholder : ""}
|
|
149
149
|
</button>
|
|
150
150
|
)}
|
|
@@ -63,7 +63,7 @@ export function MarkdownSource({ value, onChange, readOnly, placeholder = "Write
|
|
|
63
63
|
setCursor(pos);
|
|
64
64
|
});
|
|
65
65
|
}}
|
|
66
|
-
className="relative z-10 block w-full resize-none overflow-hidden bg-transparent py-2 pr-4 font-mono text-[13px] leading-5 text-foreground outline-none placeholder:text-
|
|
66
|
+
className="relative z-10 block w-full resize-none overflow-hidden bg-transparent py-2 pr-4 font-mono text-[13px] leading-5 text-foreground outline-none placeholder:text-quaternary-foreground"
|
|
67
67
|
style={{ height: Math.max(lines.length, 1) * LINE + PAD * 2 }}
|
|
68
68
|
/>
|
|
69
69
|
</div>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type ReactNode, useCallback, useRef } from "react";
|
|
2
|
+
import { Button } from "../button/Button";
|
|
2
3
|
import { ButtonCopy } from "../button/ButtonCopy";
|
|
4
|
+
import { Icon } from "../icon/Icon";
|
|
5
|
+
import { OverlayScroll } from "../scroll/OverlayScroll";
|
|
3
6
|
|
|
4
7
|
function escapeCell(text: string): string {
|
|
5
8
|
return text.replace(/\|/g, "\\|").replace(/\n+/g, "").trim();
|
|
@@ -20,26 +23,60 @@ function tableToMarkdown(table: HTMLTableElement): string {
|
|
|
20
23
|
return [`| ${header.join(" | ")} |`, `| ${separator.join(" | ")} |`, ...body.map((row) => `| ${row.join(" | ")} |`)].join("\n");
|
|
21
24
|
}
|
|
22
25
|
|
|
26
|
+
const tableClass =
|
|
27
|
+
"w-max min-w-full border-separate border-spacing-0 text-base [&_th]:whitespace-normal [&_td]:whitespace-normal [&_th]:wrap-normal [&_td]:wrap-normal [&_th]:border-b [&_th]:border-border-secondary [&_th]:px-4 [&_th]:py-1.5 [&_th]:text-left [&_th]:align-top [&_th]:font-medium [&_td]:border-b [&_td]:border-border-secondary [&_td]:px-4 [&_td]:py-1.5 [&_td]:align-top";
|
|
28
|
+
|
|
23
29
|
export function MarkdownTable({ children }: { children: ReactNode }) {
|
|
24
30
|
const tableRef = useRef<HTMLTableElement>(null);
|
|
31
|
+
const dialogRef = useRef<HTMLDialogElement>(null);
|
|
25
32
|
|
|
26
33
|
const getText = useCallback(() => {
|
|
27
34
|
const table = tableRef.current;
|
|
28
35
|
return table ? tableToMarkdown(table) : "";
|
|
29
36
|
}, []);
|
|
30
37
|
|
|
38
|
+
const openFullscreen = () => {
|
|
39
|
+
dialogRef.current?.showModal();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const closeFullscreen = () => {
|
|
43
|
+
dialogRef.current?.close();
|
|
44
|
+
};
|
|
45
|
+
|
|
31
46
|
return (
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
>
|
|
40
|
-
{
|
|
41
|
-
|
|
47
|
+
<>
|
|
48
|
+
<div className="group relative my-(--md-table-my,16px) max-w-full">
|
|
49
|
+
<div className="absolute top-1 right-1 z-10 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100">
|
|
50
|
+
<ButtonCopy getText={getText} label="Copy as Markdown" />
|
|
51
|
+
<Button size="small" icon={<Icon name="maximize" size={12} />} title="Fullscreen" aria-label="Fullscreen" onClick={openFullscreen} />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<OverlayScroll autoHeight visibility="hover" scope="table" innerClassName="overflow-x-auto">
|
|
55
|
+
<table ref={tableRef} className={`${tableClass} [&_th]:max-w-[360px] [&_td]:max-w-[360px] [&_th:first-child]:pl-0 [&_th:last-child]:pr-0 [&_td:first-child]:pl-0 [&_td:last-child]:pr-0`}>
|
|
56
|
+
{children}
|
|
57
|
+
</table>
|
|
58
|
+
</OverlayScroll>
|
|
42
59
|
</div>
|
|
43
|
-
|
|
60
|
+
|
|
61
|
+
<dialog
|
|
62
|
+
ref={dialogRef}
|
|
63
|
+
className="inset-2.5 m-0 h-auto w-auto max-h-none max-w-none overflow-hidden rounded-xl border border-foreground/25 bg-card p-0 shadow-xl backdrop:bg-black/40 open:flex open:flex-col"
|
|
64
|
+
onKeyDown={(e) => {
|
|
65
|
+
if (e.key !== "Escape") return;
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
closeFullscreen();
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<div className="absolute top-5 right-5 z-50 flex items-center gap-1.5">
|
|
72
|
+
<ButtonCopy getText={getText} label="Copy as Markdown" />
|
|
73
|
+
<Button size="small" icon={<Icon name="minimize" size={12} />} title="Exit fullscreen" aria-label="Exit fullscreen" onClick={closeFullscreen} />
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div className="min-h-0 flex-1 overflow-auto p-8">
|
|
77
|
+
<table className={tableClass}>{children}</table>
|
|
78
|
+
</div>
|
|
79
|
+
</dialog>
|
|
80
|
+
</>
|
|
44
81
|
);
|
|
45
82
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode, useMemo } from "react";
|
|
1
|
+
import { type CSSProperties, type ReactNode, useMemo } from "react";
|
|
2
2
|
import ReactMarkdown, { type Components } from "react-markdown";
|
|
3
3
|
import remarkGfm from "remark-gfm";
|
|
4
4
|
import { Checkbox } from "../checkbox/Checkbox";
|
|
@@ -7,37 +7,35 @@ import { cn } from "../lib/cn";
|
|
|
7
7
|
import { type InlineEdit, type MarkdownBlock, parseMarkdownDoc, readFence, readInlineEdit } from "./blocks";
|
|
8
8
|
import { MarkdownTable } from "./MarkdownTable";
|
|
9
9
|
import { MermaidBlock } from "./MermaidBlock";
|
|
10
|
-
import { headingClass,
|
|
10
|
+
import { headingClass, markdownScaleStyle } from "./markdownScale";
|
|
11
11
|
import { ReactCode } from "./ReactCode";
|
|
12
12
|
import { ReactCodeSandbox } from "./ReactCodeSandbox";
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
export { headingClass, markdownVariantStyle };
|
|
14
|
+
export { headingClass, markdownScaleStyle };
|
|
16
15
|
|
|
17
16
|
/** Task checks use the body ink, so a checked box sits with the text instead of the brand fill. */
|
|
18
17
|
const taskCheckClass =
|
|
19
|
-
"data-[state=checked]:border-
|
|
18
|
+
"data-[state=checked]:border-foreground! data-[state=checked]:bg-foreground! data-[state=checked]:text-background! data-[state=indeterminate]:border-foreground! data-[state=indeterminate]:bg-foreground! data-[state=indeterminate]:text-background!";
|
|
20
19
|
|
|
21
20
|
const documentClass = cn(
|
|
22
|
-
"min-w-0 wrap-anywhere text-(length:--md-body-size,16px) leading-(--md-body-leading,
|
|
23
|
-
"[&_:is(h1,h2,h3,h4,h5,h6)]:text-
|
|
24
|
-
"[&_:is(h1,h2)]:mt-(--md-h2-mt,24px) [&_h1]:mb-(--md-h1-mb,12px) [&_h2]:mb-(--md-h2-mb,
|
|
25
|
-
"[&_h3]:mt-(--md-h3-mt,22px) [&_h3]:mb-(--md-h3-mb,
|
|
26
|
-
"[&
|
|
27
|
-
"[&
|
|
28
|
-
"[&_h6]:mt-(--md-h6-mt,0px) [&_h6]:mb-(--md-h6-mb,0px) [&_h6]:text-(length:--md-h6-size,14px) [&_h6]:leading-(--md-h6-leading,1.375) [&_h6]:font-(--md-h6-weight,700)",
|
|
29
|
-
"[&_p]:my-(--md-p-my,1px) [&_p]:py-(--md-p-py,4px) [&_p]:leading-(--md-p-leading,1.5)",
|
|
21
|
+
"min-w-0 wrap-anywhere text-(length:--md-body-size,var(--nonla-md-text-size,16px)) leading-(--md-body-leading,calc(var(--nonla-md-text-size,16px)*1.6)) text-foreground",
|
|
22
|
+
"[&_:is(h1,h2,h3,h4,h5,h6)]:text-foreground",
|
|
23
|
+
"[&_:is(h1,h2)]:mt-(--md-h2-mt,24px) [&_h1]:mb-(--md-h1-mb,12px) [&_h2]:mb-(--md-h2-mb,8px) [&_:is(h1,h2)]:pt-(--md-h2-py,3px) [&_:is(h1,h2)]:pb-(--md-h2-py,3px) [&_:is(h1,h2)]:text-(length:--md-h2-size,26px) [&_:is(h1,h2)]:leading-(--md-h2-leading,32px) [&_:is(h1,h2)]:font-(--md-h2-weight,600) [&_:is(h1,h2)]:tracking-normal",
|
|
24
|
+
"[&_h3]:mt-(--md-h3-mt,22px) [&_h3]:mb-(--md-h3-mb,8px) [&_h3]:text-(length:--md-h3-size,24px) [&_h3]:leading-(--md-h3-leading,32px) [&_h3]:font-(--md-h3-weight,600)",
|
|
25
|
+
"[&_:is(h4,h5,h6)]:mt-(--md-h4-mt,16px) [&_:is(h4,h5,h6)]:mb-(--md-h4-mb,1px) [&_:is(h4,h5,h6)]:text-(length:--md-h4-size,20px) [&_:is(h4,h5,h6)]:leading-(--md-h4-leading,26px) [&_:is(h4,h5,h6)]:font-(--md-h4-weight,700)",
|
|
26
|
+
"[&_p]:my-(--md-p-my,1px) [&_p]:py-(--md-p-py,4px) [&_p]:leading-(--md-p-leading,1.6)",
|
|
30
27
|
"[&_ul]:my-(--md-list-my,8px) [&_ul]:list-disc [&_ul]:pl-(--md-ul-pl,4px)",
|
|
31
28
|
"[&_ol]:my-(--md-list-my,8px) [&_ol]:list-decimal [&_ol]:pl-(--md-ol-pl,4px)",
|
|
32
29
|
"[&_li>ul]:mt-1 [&_li>ol]:mt-1 [&_li>ol]:pl-(--md-nest,1.25rem)",
|
|
33
30
|
"[&_th_ul]:my-0 [&_td_ul]:my-0 [&_th_ol]:my-0 [&_td_ol]:my-0 [&_th_li]:mt-0 [&_td_li]:mt-0 [&_th_li>ul]:mt-0.5 [&_td_li>ul]:mt-0.5 [&_th_li>ol]:mt-0.5 [&_td_li>ol]:mt-0.5 [&_th_li>p]:my-0 [&_td_li>p]:my-0",
|
|
34
31
|
"[&_ul.contains-task-list]:list-none",
|
|
35
|
-
"[&_li]:mt-(--md-li-mt,4px) [&_li]:leading-[1.
|
|
32
|
+
"[&_li]:mt-(--md-li-mt,4px) [&_li]:leading-[1.6]",
|
|
36
33
|
"[&_li.task-list-item]:relative",
|
|
37
34
|
"[&_li.task-list-item>.nonla-md-task-check]:absolute [&_li.task-list-item>.nonla-md-task-check]:top-1 [&_li.task-list-item>.nonla-md-task-check]:-left-5",
|
|
38
|
-
|
|
35
|
+
/* Body paragraphs sit in separate blocks, so their margins do not collapse. Quote paragraphs share one block, so the next paragraph's top margin is doubled to land on that same gap. */
|
|
36
|
+
"[&_blockquote]:my-(--md-quote-my,0px) [&_blockquote>p:not(:first-child)]:mt-[calc(var(--md-p-my,1px)*2)] [&_blockquote>p:not(:last-child)]:mb-0 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-foreground",
|
|
39
37
|
"[&_a]:text-link [&_a]:underline-offset-[3px] hover:[&_a]:underline",
|
|
40
|
-
"[&_hr]:
|
|
38
|
+
"[&_hr]:hidden",
|
|
41
39
|
"[&_strong]:font-(--md-strong-weight,600)",
|
|
42
40
|
"[&_img]:my-(--md-img-my,4px) [&_img]:max-w-full [&_img]:rounded-lg",
|
|
43
41
|
);
|
|
@@ -49,7 +47,7 @@ const previewComponents: Components = {
|
|
|
49
47
|
const codeText = String(children).replace(/\n$/, "");
|
|
50
48
|
const isBlock = codeText.includes("\n") || !!match;
|
|
51
49
|
if (!isBlock) {
|
|
52
|
-
return <code className="nonla-inline-code">{children}</code>;
|
|
50
|
+
return <code className="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]">{children}</code>;
|
|
53
51
|
}
|
|
54
52
|
if (lang.toLowerCase() === "mermaid") return <MermaidView code={codeText} />;
|
|
55
53
|
return <CodeBlock code={codeText} language={lang || undefined} className="my-(--md-code-my,8px)" />;
|
|
@@ -67,7 +65,7 @@ const previewComponents: Components = {
|
|
|
67
65
|
input({ type, checked }) {
|
|
68
66
|
if (type !== "checkbox") return <input type={type} checked={checked} readOnly />;
|
|
69
67
|
return (
|
|
70
|
-
<span className="nonla-md-task-check pointer-events-none inline-flex h-(--md-body-leading,
|
|
68
|
+
<span className="nonla-md-task-check pointer-events-none inline-flex h-(--md-body-leading,calc(var(--nonla-md-text-size,16px)*1.6)) items-center">
|
|
71
69
|
<Checkbox checked={Boolean(checked)} tabIndex={-1} className={taskCheckClass} />
|
|
72
70
|
</span>
|
|
73
71
|
);
|
|
@@ -137,7 +135,7 @@ function RichText({ source }: { source: string }) {
|
|
|
137
135
|
export function ListItem({ view, children }: { view: Extract<InlineEdit, { kind: "list" }>; children: ReactNode }) {
|
|
138
136
|
const level = Math.floor(view.indent.length / 2);
|
|
139
137
|
const ordinal = Number(/^(\d+)/.exec(view.marker)?.[1] ?? "1");
|
|
140
|
-
const marker = "w-6 shrink-0 pt-0.5 text-(length:--md-body-size,16px) leading-(--md-p-leading,1.
|
|
138
|
+
const marker = "w-6 shrink-0 pt-0.5 text-(length:--md-body-size,var(--nonla-md-text-size,16px)) leading-(--md-p-leading,1.6)";
|
|
141
139
|
return (
|
|
142
140
|
<div className="flex items-start gap-1.5 pl-(--md-item-pl,4px)" style={level > 0 ? { marginLeft: `calc(${level} * var(--md-nest, 1.25rem))` } : undefined}>
|
|
143
141
|
{view.task ? (
|
|
@@ -162,14 +160,13 @@ function isListBlock(block: MarkdownBlock): boolean {
|
|
|
162
160
|
return block.kind === "text" && readInlineEdit(block.body).kind === "list";
|
|
163
161
|
}
|
|
164
162
|
|
|
165
|
-
export function spaceBefore(block: MarkdownBlock, prev?: MarkdownBlock
|
|
166
|
-
const chat = variant === "chat";
|
|
163
|
+
export function spaceBefore(block: MarkdownBlock, prev?: MarkdownBlock): string {
|
|
167
164
|
if (!prev) return "";
|
|
168
|
-
if (isListBlock(block) && isListBlock(prev)) return
|
|
169
|
-
if (prev.kind === "text" && readInlineEdit(prev.body).kind === "heading") return "[&_p]:mt-0! [&_p]:pt-0.5!";
|
|
170
|
-
if (isListBlock(block) && prev.kind === "text") return
|
|
165
|
+
if (isListBlock(block) && isListBlock(prev)) return "mt-0.5";
|
|
166
|
+
if (prev.kind === "text" && readInlineEdit(prev.body).kind === "heading") return "[&_p:first-child]:mt-0! [&_p:first-child]:pt-0.5!";
|
|
167
|
+
if (isListBlock(block) && prev.kind === "text") return "mt-1";
|
|
171
168
|
if (block.kind === "text" && prev.kind === "text") return "";
|
|
172
|
-
return
|
|
169
|
+
return "mt-3";
|
|
173
170
|
}
|
|
174
171
|
|
|
175
172
|
function fenceClosed(body: string): boolean {
|
|
@@ -235,24 +232,24 @@ export type MarkdownViewerProps = {
|
|
|
235
232
|
showHeader?: boolean;
|
|
236
233
|
/** Switch that opens the source of a `live-react` preview. Needs `showHeader`. Default `true`. */
|
|
237
234
|
showCode?: boolean;
|
|
238
|
-
/**
|
|
239
|
-
|
|
235
|
+
/** Overrides scale variables from `markdownScaleStyle`, such as heading size. */
|
|
236
|
+
style?: CSSProperties;
|
|
240
237
|
};
|
|
241
238
|
|
|
242
239
|
/** Read-only markdown. Same blocks as the editor preview, without editing. */
|
|
243
|
-
export function MarkdownViewer({ value = "", streaming = false, sandboxSrc, trustedModules, showHeader = true, showCode = true, placeholder, className,
|
|
240
|
+
export function MarkdownViewer({ value = "", streaming = false, sandboxSrc, trustedModules, showHeader = true, showCode = true, placeholder, className, style }: MarkdownViewerProps) {
|
|
244
241
|
const doc = useMemo(() => parseMarkdownDoc(value), [value]);
|
|
245
242
|
if (doc.blocks.length === 0) {
|
|
246
|
-
return placeholder ? <p className={cn("m-0 text-sm text-
|
|
243
|
+
return placeholder ? <p className={cn("m-0 text-sm text-quaternary-foreground", className)}>{placeholder}</p> : null;
|
|
247
244
|
}
|
|
248
245
|
return (
|
|
249
|
-
<div
|
|
246
|
+
<div className={cn("nonla-markdown-viewer flex min-w-0 flex-col text-foreground", className)} style={{ ...markdownScaleStyle, ...style }}>
|
|
250
247
|
{doc.blocks.map((block, index) => (
|
|
251
248
|
<div
|
|
252
249
|
// biome-ignore lint/suspicious/noArrayIndexKey: block position is the document identity
|
|
253
250
|
key={`${index}:${block.kind}`}
|
|
254
251
|
data-md-block={block.kind}
|
|
255
|
-
className={cn("outline-none", spaceBefore(block, doc.blocks[index - 1]
|
|
252
|
+
className={cn("outline-none", spaceBefore(block, doc.blocks[index - 1]))}
|
|
256
253
|
>
|
|
257
254
|
<BlockBody block={block} streaming={streaming} trustedModules={trustedModules} sandboxSrc={sandboxSrc} showHeader={showHeader} showCode={showCode} />
|
|
258
255
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
|
|
2
2
|
import { Button } from "../button/Button";
|
|
3
3
|
import { CodeBlock } from "../codeblock/CodeBlock";
|
|
4
|
-
import {
|
|
4
|
+
import { Icon } from "../icon/Icon";
|
|
5
5
|
import { cn } from "../lib/cn";
|
|
6
6
|
import { getColorMode, subscribeColorMode } from "../theme";
|
|
7
7
|
import { sanitizeMermaid } from "./sanitizeMermaid";
|
|
@@ -176,7 +176,7 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
176
176
|
|
|
177
177
|
if (error) {
|
|
178
178
|
return (
|
|
179
|
-
<div className={cn("my-3 rounded-lg bg-
|
|
179
|
+
<div className={cn("my-3 rounded-lg bg-brand/14 border border-destructive/30 p-4 text-xs text-destructive", className)}>
|
|
180
180
|
<p className="font-medium mb-1">Mermaid render error</p>
|
|
181
181
|
<pre className="whitespace-pre-wrap text-[11px] opacity-70">{error}</pre>
|
|
182
182
|
</div>
|
|
@@ -191,7 +191,7 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
191
191
|
<>
|
|
192
192
|
<div className={cn("my-3 last:mb-0 group relative overflow-hidden rounded-xl bg-card", className)}>
|
|
193
193
|
<div className="absolute top-2 right-2 z-10 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
194
|
-
<Button size="small" icon={<
|
|
194
|
+
<Button size="small" icon={<Icon name="maximize" size={12} />} title="Fullscreen" aria-label="Fullscreen" onClick={openFullscreen} />
|
|
195
195
|
</div>
|
|
196
196
|
<div ref={containerRef} className="flex justify-center p-6 overflow-x-auto [&_svg]:max-w-full" />
|
|
197
197
|
</div>
|
|
@@ -208,8 +208,8 @@ export function MermaidBlock({ children, className }: MermaidBlockProps) {
|
|
|
208
208
|
}}
|
|
209
209
|
>
|
|
210
210
|
<div className="absolute top-5 right-5 z-50 flex items-center gap-1.5">
|
|
211
|
-
<Button size="small" icon={<
|
|
212
|
-
<Button size="small" icon={<
|
|
211
|
+
<Button size="small" icon={<Icon name="download" size={12} />} title="Download SVG" aria-label="Download SVG" onClick={downloadSvg} disabled={!svgContent} />
|
|
212
|
+
<Button size="small" icon={<Icon name="minimize" size={12} />} title="Exit fullscreen" onClick={closeFullscreen}>
|
|
213
213
|
Exit
|
|
214
214
|
</Button>
|
|
215
215
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode, useState } from "react";
|
|
2
2
|
import { CodeBlock } from "../codeblock/CodeBlock";
|
|
3
|
-
import {
|
|
3
|
+
import { Icon } from "../icon/Icon";
|
|
4
4
|
import { cn } from "../lib/cn";
|
|
5
5
|
import { Segmented } from "../segmented/Segmented";
|
|
6
6
|
import { Tooltip } from "../tooltip/Tooltip";
|
|
@@ -46,8 +46,8 @@ export function ReactCodeFrame({ title, icon, showHeader = true, code, className
|
|
|
46
46
|
{hasCode ? <Segmented<Tab> size="small" options={TABS} value={tab} onChange={setTab} /> : null}
|
|
47
47
|
</div>
|
|
48
48
|
) : null}
|
|
49
|
-
{/* Stays mounted
|
|
50
|
-
<div className={cn("min-w-0 px-6 py-8", showingCode && "hidden")}>{children}</div>
|
|
49
|
+
{/* Stays mounted when the Code tab replaces it, so an iframe keeps its state. The code button keeps this and opens the source under it. */}
|
|
50
|
+
<div className={cn("min-w-0 px-6 py-8", hasLabel && showingCode && "hidden")}>{children}</div>
|
|
51
51
|
{hasCode && !hasLabel ? (
|
|
52
52
|
<div className="flex h-10 items-center justify-end border-t border-border pr-1.5">
|
|
53
53
|
<Tooltip title={codeLabel}>
|
|
@@ -56,17 +56,21 @@ export function ReactCodeFrame({ title, icon, showHeader = true, code, className
|
|
|
56
56
|
aria-expanded={open}
|
|
57
57
|
aria-label={codeLabel}
|
|
58
58
|
className={cn(
|
|
59
|
-
"inline-flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
59
|
+
"inline-flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/55",
|
|
60
60
|
open ? "bg-muted text-foreground" : "text-muted-foreground",
|
|
61
61
|
)}
|
|
62
62
|
onClick={() => setOpen((value) => !value)}
|
|
63
63
|
>
|
|
64
|
-
<
|
|
64
|
+
<Icon name="code" size={16} />
|
|
65
65
|
</button>
|
|
66
66
|
</Tooltip>
|
|
67
67
|
</div>
|
|
68
68
|
) : null}
|
|
69
|
-
{hasCode && showingCode ?
|
|
69
|
+
{hasCode && showingCode ? (
|
|
70
|
+
<div className={cn(!hasLabel && "border-t border-border")}>
|
|
71
|
+
<CodeBlock code={code} language="tsx" className="my-0 rounded-none border-0" />
|
|
72
|
+
</div>
|
|
73
|
+
) : null}
|
|
70
74
|
</div>
|
|
71
75
|
);
|
|
72
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
import { getColorMode, type NonlaColorMode, subscribeColorMode } from "../theme";
|
|
5
5
|
import { ReactCodeFrame } from "./ReactCodeFrame";
|
|
@@ -136,7 +136,7 @@ export function ReactCodeSandbox({ code, src, showHeader = true, showCode = true
|
|
|
136
136
|
return (
|
|
137
137
|
<ReactCodeFrame
|
|
138
138
|
title={title}
|
|
139
|
-
icon={icon === undefined ? <
|
|
139
|
+
icon={icon === undefined ? <Icon name="shield-check" size={16} className="text-success" /> : icon}
|
|
140
140
|
showHeader={showHeader}
|
|
141
141
|
code={showCode ? code : undefined}
|
|
142
142
|
className={className}
|
|
@@ -1,144 +1,83 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
2
|
|
|
3
|
-
/** `docs` is the article scale. `chat` is the tighter thread scale. */
|
|
4
|
-
export type MarkdownVariant = "docs" | "chat";
|
|
5
|
-
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* One markdown scale. Body reads `text-md` (`--nonla-md-text-size`). Leading is 1.6.
|
|
5
|
+
* Tables always use `text-base`.
|
|
6
|
+
* Inline code and fenced code read `--nonla-mono-text-size`.
|
|
7
|
+
* Class fallbacks match these values when the variables are not set.
|
|
10
8
|
*/
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
chat: {
|
|
66
|
-
"--md-body-size": "15px",
|
|
67
|
-
"--md-body-leading": "24px",
|
|
68
|
-
"--md-h1-size": "15px",
|
|
69
|
-
"--md-h1-leading": "24px",
|
|
70
|
-
"--md-h1-weight": "600",
|
|
71
|
-
"--md-h1-mt": "0px",
|
|
72
|
-
"--md-h1-mb": "2px",
|
|
73
|
-
"--md-h1-py": "0px",
|
|
74
|
-
"--md-h2-size": "15px",
|
|
75
|
-
"--md-h2-leading": "24px",
|
|
76
|
-
"--md-h2-weight": "600",
|
|
77
|
-
"--md-h2-mt": "12px",
|
|
78
|
-
"--md-h2-mb": "2px",
|
|
79
|
-
"--md-h2-py": "0px",
|
|
80
|
-
"--md-h3-size": "15px",
|
|
81
|
-
"--md-h3-leading": "24px",
|
|
82
|
-
"--md-h3-weight": "600",
|
|
83
|
-
"--md-h3-mt": "10px",
|
|
84
|
-
"--md-h3-mb": "2px",
|
|
85
|
-
"--md-h4-size": "15px",
|
|
86
|
-
"--md-h4-leading": "24px",
|
|
87
|
-
"--md-h4-weight": "600",
|
|
88
|
-
"--md-h4-mt": "8px",
|
|
89
|
-
"--md-h4-mb": "2px",
|
|
90
|
-
"--md-h5-size": "14px",
|
|
91
|
-
"--md-h5-leading": "22px",
|
|
92
|
-
"--md-h5-weight": "600",
|
|
93
|
-
"--md-h5-mt": "6px",
|
|
94
|
-
"--md-h5-mb": "0px",
|
|
95
|
-
"--md-h6-size": "14px",
|
|
96
|
-
"--md-h6-leading": "22px",
|
|
97
|
-
"--md-h6-weight": "600",
|
|
98
|
-
"--md-h6-mt": "6px",
|
|
99
|
-
"--md-h6-mb": "0px",
|
|
100
|
-
"--md-strong-weight": "400",
|
|
101
|
-
"--md-p-my": "0px",
|
|
102
|
-
"--md-p-py": "1px",
|
|
103
|
-
"--md-p-leading": "1.5",
|
|
104
|
-
"--md-list-my": "4px",
|
|
105
|
-
"--md-ul-pl": "4px",
|
|
106
|
-
"--md-ol-pl": "4px",
|
|
107
|
-
"--md-li-mt": "2px",
|
|
108
|
-
"--md-quote-my": "2px",
|
|
109
|
-
"--md-rule-my": "6px",
|
|
110
|
-
"--md-img-my": "4px",
|
|
111
|
-
"--md-table-my": "8px",
|
|
112
|
-
"--md-table-size": "15px",
|
|
113
|
-
"--md-code-my": "6px",
|
|
114
|
-
"--md-inline-size": "13px",
|
|
115
|
-
"--md-item-pl": "4px",
|
|
116
|
-
"--md-nest": "1rem",
|
|
117
|
-
},
|
|
118
|
-
} as const;
|
|
119
|
-
|
|
120
|
-
export function markdownVariantStyle(variant: MarkdownVariant = "docs"): CSSProperties {
|
|
121
|
-
return MARKDOWN_PRESETS[variant] as CSSProperties;
|
|
122
|
-
}
|
|
9
|
+
export const markdownScaleStyle = {
|
|
10
|
+
"--md-body-size": "var(--nonla-md-text-size)",
|
|
11
|
+
"--md-body-leading": "calc(var(--nonla-md-text-size) * 1.6)",
|
|
12
|
+
"--md-h1-size": "32px",
|
|
13
|
+
"--md-h1-leading": "1.25",
|
|
14
|
+
"--md-h1-weight": "800",
|
|
15
|
+
"--md-h1-mt": "0px",
|
|
16
|
+
"--md-h1-mb": "12px",
|
|
17
|
+
"--md-h1-py": "3px",
|
|
18
|
+
"--md-h2-size": "26px",
|
|
19
|
+
"--md-h2-leading": "32px",
|
|
20
|
+
"--md-h2-weight": "600",
|
|
21
|
+
"--md-h2-mt": "24px",
|
|
22
|
+
"--md-h2-mb": "8px",
|
|
23
|
+
"--md-h2-py": "3px",
|
|
24
|
+
"--md-h3-size": "24px",
|
|
25
|
+
"--md-h3-leading": "32px",
|
|
26
|
+
"--md-h3-weight": "600",
|
|
27
|
+
"--md-h3-mt": "22px",
|
|
28
|
+
"--md-h3-mb": "8px",
|
|
29
|
+
"--md-h4-size": "20px",
|
|
30
|
+
"--md-h4-leading": "26px",
|
|
31
|
+
"--md-h4-weight": "700",
|
|
32
|
+
"--md-h4-mt": "16px",
|
|
33
|
+
"--md-h4-mb": "1px",
|
|
34
|
+
"--md-h5-size": "20px",
|
|
35
|
+
"--md-h5-leading": "26px",
|
|
36
|
+
"--md-h5-weight": "700",
|
|
37
|
+
"--md-h5-mt": "16px",
|
|
38
|
+
"--md-h5-mb": "1px",
|
|
39
|
+
"--md-h6-size": "20px",
|
|
40
|
+
"--md-h6-leading": "26px",
|
|
41
|
+
"--md-h6-weight": "700",
|
|
42
|
+
"--md-h6-mt": "16px",
|
|
43
|
+
"--md-h6-mb": "1px",
|
|
44
|
+
"--md-strong-weight": "600",
|
|
45
|
+
"--md-p-my": "1px",
|
|
46
|
+
"--md-p-py": "4px",
|
|
47
|
+
"--md-p-leading": "1.6",
|
|
48
|
+
"--md-list-my": "8px",
|
|
49
|
+
"--md-ul-pl": "4px",
|
|
50
|
+
"--md-ol-pl": "4px",
|
|
51
|
+
"--md-li-mt": "4px",
|
|
52
|
+
"--md-quote-my": "0px",
|
|
53
|
+
"--md-rule-my": "8px",
|
|
54
|
+
"--md-img-my": "4px",
|
|
55
|
+
"--md-table-my": "16px",
|
|
56
|
+
"--md-code-my": "8px",
|
|
57
|
+
"--md-code-size": "var(--nonla-mono-text-size)",
|
|
58
|
+
"--md-code-leading": "calc(var(--nonla-mono-text-size) * 1.6)",
|
|
59
|
+
"--md-inline-size": "var(--nonla-mono-text-size)",
|
|
60
|
+
"--md-item-pl": "4px",
|
|
61
|
+
"--md-nest": "1.25rem",
|
|
62
|
+
} as CSSProperties;
|
|
123
63
|
|
|
124
64
|
/**
|
|
125
65
|
* Article headings. A markdown `#` paints the same as `##`.
|
|
66
|
+
* `#####` and `######` paint the same as `####`.
|
|
126
67
|
* The large page title is `pageTitleClass`, used by Typography only.
|
|
127
68
|
*/
|
|
128
69
|
export function headingClass(level: number): string {
|
|
129
|
-
if (level <= 1) return "text-
|
|
130
|
-
if (level === 2) return "text-
|
|
131
|
-
if (level === 3) return "text-
|
|
132
|
-
|
|
133
|
-
if (level === 5) return "text-(--md-heading) mt-(--md-h5-mt,0px) mb-(--md-h5-mb,0px) text-(length:--md-h5-size,16px) leading-(--md-h5-leading,1.375) font-(--md-h5-weight,700)";
|
|
134
|
-
return "text-(--md-heading) mt-(--md-h6-mt,0px) mb-(--md-h6-mb,0px) text-(length:--md-h6-size,14px) leading-(--md-h6-leading,1.375) font-(--md-h6-weight,700)";
|
|
70
|
+
if (level <= 1) return "text-foreground mt-(--md-h2-mt,24px) mb-(--md-h1-mb,12px) pt-(--md-h2-py,3px) pb-(--md-h2-py,3px) text-(length:--md-h2-size,26px) leading-(--md-h2-leading,32px) font-(--md-h2-weight,600)";
|
|
71
|
+
if (level === 2) return "text-foreground mt-(--md-h2-mt,24px) mb-(--md-h2-mb,8px) pt-(--md-h2-py,3px) pb-(--md-h2-py,3px) text-(length:--md-h2-size,26px) leading-(--md-h2-leading,32px) font-(--md-h2-weight,600)";
|
|
72
|
+
if (level === 3) return "text-foreground mt-(--md-h3-mt,22px) mb-(--md-h3-mb,8px) text-(length:--md-h3-size,24px) leading-(--md-h3-leading,32px) font-(--md-h3-weight,600)";
|
|
73
|
+
return "text-foreground mt-(--md-h4-mt,16px) mb-(--md-h4-mb,1px) text-(length:--md-h4-size,20px) leading-(--md-h4-leading,26px) font-(--md-h4-weight,700)";
|
|
135
74
|
}
|
|
136
75
|
|
|
137
76
|
/** Landing and page title. Not used inside markdown. */
|
|
138
|
-
export const pageTitleClass = "text-
|
|
77
|
+
export const pageTitleClass = "text-foreground mt-(--md-h1-mt,0px) mb-(--md-h1-mb,1px) pt-(--md-h1-py,3px) pb-(--md-h1-py,3px) text-(length:--md-h1-size,32px) leading-(--md-h1-leading,1.25) font-(--md-h1-weight,800) tracking-tight";
|
|
139
78
|
|
|
140
79
|
/** Body line. Same size and color as a markdown paragraph. */
|
|
141
|
-
export const markdownBodyClass = "text-(length:--md-body-size,16px) leading-(--md-body-leading,
|
|
80
|
+
export const markdownBodyClass = "text-(length:--md-body-size,var(--nonla-md-text-size,16px)) leading-(--md-body-leading,calc(var(--nonla-md-text-size,16px)*1.6)) text-foreground";
|
|
142
81
|
|
|
143
82
|
/** Paragraph box. Same rhythm as `MarkdownViewer` `p`. */
|
|
144
|
-
export const markdownParagraphClass = "nonla-typo m-0 my-(--md-p-my,1px) py-(--md-p-py,4px) text-(length:--md-body-size,16px) leading-(--md-p-leading,1.
|
|
83
|
+
export const markdownParagraphClass = "nonla-typo m-0 my-(--md-p-my,1px) py-(--md-p-py,4px) text-(length:--md-body-size,var(--nonla-md-text-size,16px)) leading-(--md-p-leading,1.6) text-foreground";
|
package/src/menu/Menu.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Icon } from "../icon/Icon";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
import type { PopperPlacement } from "../lib/placement";
|
|
5
5
|
import { Popover } from "../popover/Popover";
|
|
@@ -48,7 +48,7 @@ export function MenuTrigger({ active, open, className, children, ...rest }: Menu
|
|
|
48
48
|
{...rest}
|
|
49
49
|
>
|
|
50
50
|
<span className="min-w-0 truncate leading-5">{children}</span>
|
|
51
|
-
<
|
|
51
|
+
<Icon name="arrow-down" size={12} className={cn("shrink-0 transition-transform duration-150", open && "rotate-180")} />
|
|
52
52
|
</button>
|
|
53
53
|
);
|
|
54
54
|
}
|
|
@@ -89,7 +89,7 @@ export function MenuAction({ className, ...rest }: ButtonHTMLAttributes<HTMLButt
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export function MenuDivider({ className }: { className?: string }) {
|
|
92
|
-
return <div className={cn("mx-2.5 my-1 h-px bg-
|
|
92
|
+
return <div className={cn("mx-2.5 my-1 h-px bg-border", className)} />;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
Menu.Trigger = MenuTrigger;
|