@majapisoftwares/ui 6.3.0 → 6.5.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.
Files changed (81) hide show
  1. package/AGENTS.md +27 -27
  2. package/README.md +79 -79
  3. package/THIRD_PARTY_NOTICES.md +39 -39
  4. package/components.json +25 -25
  5. package/docs/MIGRATION-0.2.md +20 -20
  6. package/docs/MIGRATION-6.0.md +33 -33
  7. package/docs/NEXT-STARTER-VALIDATION.md +14 -14
  8. package/docs/STANDARDS.md +65 -51
  9. package/docs/VALIDATION.md +11 -11
  10. package/docs/VERSIONING.md +32 -28
  11. package/docs/validation/preference-titles.md +22 -22
  12. package/package.json +91 -89
  13. package/scripts/check-standards.mjs +41 -41
  14. package/src/components/ui/accordion.tsx +82 -82
  15. package/src/components/ui/alert-dialog.tsx +187 -187
  16. package/src/components/ui/alert.tsx +77 -77
  17. package/src/components/ui/attachment.tsx +209 -0
  18. package/src/components/ui/avatar.tsx +108 -108
  19. package/src/components/ui/badge.tsx +55 -55
  20. package/src/components/ui/breadcrumb.tsx +125 -125
  21. package/src/components/ui/bubble.tsx +129 -0
  22. package/src/components/ui/button-group.tsx +89 -89
  23. package/src/components/ui/button.tsx +59 -59
  24. package/src/components/ui/card.tsx +101 -101
  25. package/src/components/ui/checkbox.tsx +27 -27
  26. package/src/components/ui/collapsible.tsx +21 -21
  27. package/src/components/ui/context-menu.tsx +271 -271
  28. package/src/components/ui/dialog.tsx +161 -161
  29. package/src/components/ui/dropdown-menu.tsx +271 -271
  30. package/src/components/ui/empty.tsx +105 -105
  31. package/src/components/ui/field.tsx +238 -238
  32. package/src/components/ui/hover-card.tsx +50 -50
  33. package/src/components/ui/input-group.tsx +155 -155
  34. package/src/components/ui/input.tsx +21 -21
  35. package/src/components/ui/item.tsx +203 -0
  36. package/src/components/ui/kbd.tsx +28 -28
  37. package/src/components/ui/label.tsx +19 -19
  38. package/src/components/ui/message-scroller.tsx +166 -0
  39. package/src/components/ui/message.tsx +93 -0
  40. package/src/components/ui/orb.css +1002 -1002
  41. package/src/components/ui/orb.tsx +752 -752
  42. package/src/components/ui/popover.tsx +89 -89
  43. package/src/components/ui/progress.tsx +82 -82
  44. package/src/components/ui/radio-group.tsx +37 -37
  45. package/src/components/ui/scroll-area.tsx +54 -54
  46. package/src/components/ui/select.tsx +204 -204
  47. package/src/components/ui/separator.tsx +24 -24
  48. package/src/components/ui/sheet.tsx +139 -139
  49. package/src/components/ui/sidebar.tsx +1048 -1048
  50. package/src/components/ui/skeleton.tsx +15 -15
  51. package/src/components/ui/slider.tsx +53 -53
  52. package/src/components/ui/sonner.tsx +44 -44
  53. package/src/components/ui/spinner.tsx +32 -32
  54. package/src/components/ui/switch.tsx +31 -31
  55. package/src/components/ui/table.tsx +121 -121
  56. package/src/components/ui/tabs.tsx +81 -81
  57. package/src/components/ui/textarea.tsx +19 -19
  58. package/src/components/ui/toggle-group.tsx +89 -89
  59. package/src/components/ui/toggle.tsx +44 -44
  60. package/src/components/ui/tooltip.tsx +65 -65
  61. package/src/components/ui/trace.tsx +163 -0
  62. package/src/hooks/use-mobile.ts +20 -20
  63. package/src/hooks/use-streamed-text.ts +64 -0
  64. package/src/lib/i18n.tsx +151 -109
  65. package/src/lib/utils.ts +1 -1
  66. package/src/patterns/app-shell.tsx +237 -237
  67. package/src/patterns/chat-markdown.tsx +72 -0
  68. package/src/patterns/chat-trace.tsx +200 -0
  69. package/src/patterns/chat.tsx +317 -0
  70. package/src/patterns/data-table.tsx +2492 -2492
  71. package/src/patterns/filter-tabs.tsx +53 -53
  72. package/src/patterns/majapi-logo.tsx +32 -32
  73. package/src/patterns/page-header.tsx +62 -62
  74. package/src/patterns/prompt-input.tsx +374 -0
  75. package/src/patterns/status-badge.tsx +24 -24
  76. package/src/patterns/user-menu.tsx +218 -218
  77. package/src/patterns/workspace-switcher.tsx +176 -176
  78. package/src/styles.css +170 -165
  79. package/src/templates/admin-dashboard.tsx +44 -44
  80. package/src/templates/auth-layout.tsx +30 -30
  81. package/src/templates/signup-form.tsx +177 -177
@@ -1,237 +1,237 @@
1
- "use client";
2
-
3
- import type { MouseEvent, ReactNode } from "react";
4
- import { cn } from "cn";
5
- import {
6
- Sidebar,
7
- SidebarCollapse,
8
- SidebarContent,
9
- SidebarFooter,
10
- SidebarGroup,
11
- SidebarGroupLabel,
12
- SidebarInset,
13
- SidebarMenu,
14
- SidebarMenuBadge,
15
- SidebarMenuButton,
16
- SidebarMenuItem,
17
- SidebarMenuSub,
18
- SidebarMenuSubItem,
19
- SidebarMenuSubButton,
20
- useSidebar,
21
- SidebarProvider,
22
- SidebarRail,
23
- SidebarTrigger,
24
- type SidebarMode,
25
- } from "../components/ui/sidebar";
26
- import { Separator } from "../components/ui/separator";
27
- import { TooltipProvider } from "../components/ui/tooltip";
28
-
29
- export interface NavigationItem {
30
- id: string;
31
- label: string;
32
- icon?: ReactNode;
33
- count?: number;
34
- /** Native destination; preserves open-in-new-tab and modified clicks. */
35
- href?: string;
36
- /** Related views shown under the active tool. One level of contextual navigation. */
37
- children?: (Omit<NavigationItem, "children"> & { href: string })[];
38
- }
39
- export interface NavigationGroup {
40
- label?: string;
41
- items: NavigationItem[];
42
- }
43
-
44
- export interface AppShellProps {
45
- /** Square logo; stays in place in every sidebar mode. */
46
- logo: ReactNode;
47
- /** App name next to the logo; fades out when the sidebar is compact. */
48
- name: string;
49
- navigation: NavigationGroup[];
50
- activeId: string;
51
- onNavigate: (id: string) => void;
52
- /** Rendered in the header next to the sidebar trigger, e.g. breadcrumbs. */
53
- header?: ReactNode;
54
- /** Rendered at the end of the header, e.g. locale or theme switchers. */
55
- actions?: ReactNode;
56
- /** Below the logo in the sidebar header, e.g. `WorkspaceSwitcher`. */
57
- sidebarHeader?: ReactNode;
58
- /** Sidebar footer, e.g. `UserMenu`. */
59
- footer?: ReactNode;
60
- defaultMode?: SidebarMode;
61
- defaultWidth?: number;
62
- /**
63
- * Locks the shell to the viewport height so content (e.g. a `DataTable
64
- * fillHeight`) fills the remaining space and scrolls internally.
65
- */
66
- fillHeight?: boolean;
67
- children: ReactNode;
68
- }
69
-
70
- // Items without an icon still need something to show in compact mode.
71
- function ItemIcon({ item }: { item: NavigationItem }) {
72
- return (
73
- item.icon ?? (
74
- <span
75
- aria-hidden="true"
76
- className="flex size-4 items-center justify-center text-xs font-semibold"
77
- >
78
- {item.label.charAt(0).toUpperCase()}
79
- </span>
80
- )
81
- );
82
- }
83
-
84
- // The collapse control lives inside the sidebar; reopening needs one outside.
85
- // Shown on mobile and, on desktop, only while the sidebar is hidden (CSS, so
86
- // it is right from the first paint).
87
- function HeaderTrigger() {
88
- return (
89
- <div className="flex items-center md:hidden md:group-has-data-[collapsible=offcanvas]/sidebar-wrapper:flex">
90
- <SidebarTrigger className="-ml-1" />
91
- <Separator
92
- orientation="vertical"
93
- className="mr-2 ml-2 h-4 self-center!"
94
- />
95
- </div>
96
- );
97
- }
98
-
99
- function ShellNavigation({
100
- navigation,
101
- activeId,
102
- onNavigate,
103
- }: Pick<AppShellProps, "navigation" | "activeId" | "onNavigate">) {
104
- const { isMobile, setOpenMobile } = useSidebar();
105
- const navigate = (id: string, event: MouseEvent<HTMLElement>) => {
106
- if (
107
- event.button !== 0 ||
108
- event.metaKey ||
109
- event.ctrlKey ||
110
- event.shiftKey ||
111
- event.altKey
112
- )
113
- return;
114
- event.preventDefault();
115
- onNavigate(id);
116
- if (isMobile) setOpenMobile(false);
117
- };
118
- return navigation.map((group, index) => (
119
- <SidebarGroup key={group.label ?? index}>
120
- {group.label ? (
121
- <SidebarGroupLabel>{group.label}</SidebarGroupLabel>
122
- ) : null}
123
- <SidebarMenu>
124
- {group.items.map((item) => {
125
- const active =
126
- item.id === activeId ||
127
- Boolean(item.children?.some((child) => child.id === activeId));
128
- return (
129
- <SidebarMenuItem key={item.id}>
130
- <div className="relative">
131
- <SidebarMenuButton
132
- isActive={active}
133
- tooltip={item.label}
134
- aria-current={item.id === activeId ? "page" : undefined}
135
- render={item.href ? <a href={item.href} /> : undefined}
136
- onClick={(event) => navigate(item.id, event)}
137
- >
138
- <ItemIcon item={item} />
139
- <span>{item.label}</span>
140
- </SidebarMenuButton>
141
- {item.count !== undefined ? (
142
- <SidebarMenuBadge>{item.count}</SidebarMenuBadge>
143
- ) : null}
144
- </div>
145
- {active && item.children?.length ? (
146
- <SidebarMenuSub aria-label={item.label}>
147
- {item.children.map((child) => (
148
- <SidebarMenuSubItem key={child.id}>
149
- <SidebarMenuSubButton
150
- href={child.href}
151
- isActive={child.id === activeId}
152
- aria-current={
153
- child.id === activeId ? "page" : undefined
154
- }
155
- onClick={(event) => navigate(child.id, event)}
156
- >
157
- <span>{child.label}</span>
158
- </SidebarMenuSubButton>
159
- </SidebarMenuSubItem>
160
- ))}
161
- </SidebarMenuSub>
162
- ) : null}
163
- </SidebarMenuItem>
164
- );
165
- })}
166
- </SidebarMenu>
167
- </SidebarGroup>
168
- ));
169
- }
170
-
171
- export function AppShell({
172
- logo,
173
- name,
174
- navigation,
175
- activeId,
176
- onNavigate,
177
- header,
178
- actions,
179
- footer,
180
- sidebarHeader,
181
- defaultMode,
182
- defaultWidth,
183
- fillHeight = false,
184
- children,
185
- }: AppShellProps) {
186
- return (
187
- <TooltipProvider delay={600}>
188
- <SidebarProvider defaultMode={defaultMode} defaultWidth={defaultWidth}>
189
- <Sidebar>
190
- {/* Top row: fixed h-14 to match the page header with identical vertical alignment in all apps */}
191
- {/* Keep the mark anchored to the left while the sidebar width animates. */}
192
- <div className="flex h-14 shrink-0 items-center gap-2 px-2 overflow-hidden">
193
- <div className="flex size-8 shrink-0 items-center justify-center [&>*]:shrink-0">
194
- {logo}
195
- </div>
196
- <span className="flex-1 truncate font-semibold whitespace-nowrap transition-opacity duration-200 ease-linear group-data-[collapsible=icon]:hidden">
197
- {name}
198
- </span>
199
- <SidebarCollapse className="group-data-[collapsible=icon]:hidden" />
200
- </div>
201
- <div className="hidden group-data-[collapsible=icon]:flex justify-center pb-2">
202
- <SidebarCollapse />
203
- </div>
204
- {sidebarHeader ? (
205
- <div className="p-2 pt-0">{sidebarHeader}</div>
206
- ) : null}
207
- <SidebarContent>
208
- <ShellNavigation
209
- navigation={navigation}
210
- activeId={activeId}
211
- onNavigate={onNavigate}
212
- />
213
- </SidebarContent>
214
- {footer ? <SidebarFooter>{footer}</SidebarFooter> : null}
215
- <SidebarRail />
216
- </Sidebar>
217
- <SidebarInset className={fillHeight ? "h-svh min-h-0" : undefined}>
218
- <header className="sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4 md:px-6">
219
- <HeaderTrigger />
220
- <div className="min-w-0 flex-1">{header}</div>
221
- {actions ? (
222
- <div className="flex items-center gap-2">{actions}</div>
223
- ) : null}
224
- </header>
225
- <div
226
- className={cn(
227
- "flex flex-1 flex-col gap-4 p-4 md:gap-6 md:p-6",
228
- fillHeight && "min-h-0 overflow-hidden",
229
- )}
230
- >
231
- {children}
232
- </div>
233
- </SidebarInset>
234
- </SidebarProvider>
235
- </TooltipProvider>
236
- );
237
- }
1
+ "use client";
2
+
3
+ import type { MouseEvent, ReactNode } from "react";
4
+ import { cn } from "cn";
5
+ import {
6
+ Sidebar,
7
+ SidebarCollapse,
8
+ SidebarContent,
9
+ SidebarFooter,
10
+ SidebarGroup,
11
+ SidebarGroupLabel,
12
+ SidebarInset,
13
+ SidebarMenu,
14
+ SidebarMenuBadge,
15
+ SidebarMenuButton,
16
+ SidebarMenuItem,
17
+ SidebarMenuSub,
18
+ SidebarMenuSubItem,
19
+ SidebarMenuSubButton,
20
+ useSidebar,
21
+ SidebarProvider,
22
+ SidebarRail,
23
+ SidebarTrigger,
24
+ type SidebarMode,
25
+ } from "../components/ui/sidebar";
26
+ import { Separator } from "../components/ui/separator";
27
+ import { TooltipProvider } from "../components/ui/tooltip";
28
+
29
+ export interface NavigationItem {
30
+ id: string;
31
+ label: string;
32
+ icon?: ReactNode;
33
+ count?: number;
34
+ /** Native destination; preserves open-in-new-tab and modified clicks. */
35
+ href?: string;
36
+ /** Related views shown under the active tool. One level of contextual navigation. */
37
+ children?: (Omit<NavigationItem, "children"> & { href: string })[];
38
+ }
39
+ export interface NavigationGroup {
40
+ label?: string;
41
+ items: NavigationItem[];
42
+ }
43
+
44
+ export interface AppShellProps {
45
+ /** Square logo; stays in place in every sidebar mode. */
46
+ logo: ReactNode;
47
+ /** App name next to the logo; fades out when the sidebar is compact. */
48
+ name: string;
49
+ navigation: NavigationGroup[];
50
+ activeId: string;
51
+ onNavigate: (id: string) => void;
52
+ /** Rendered in the header next to the sidebar trigger, e.g. breadcrumbs. */
53
+ header?: ReactNode;
54
+ /** Rendered at the end of the header, e.g. locale or theme switchers. */
55
+ actions?: ReactNode;
56
+ /** Below the logo in the sidebar header, e.g. `WorkspaceSwitcher`. */
57
+ sidebarHeader?: ReactNode;
58
+ /** Sidebar footer, e.g. `UserMenu`. */
59
+ footer?: ReactNode;
60
+ defaultMode?: SidebarMode;
61
+ defaultWidth?: number;
62
+ /**
63
+ * Locks the shell to the viewport height so content (e.g. a `DataTable
64
+ * fillHeight`) fills the remaining space and scrolls internally.
65
+ */
66
+ fillHeight?: boolean;
67
+ children: ReactNode;
68
+ }
69
+
70
+ // Items without an icon still need something to show in compact mode.
71
+ function ItemIcon({ item }: { item: NavigationItem }) {
72
+ return (
73
+ item.icon ?? (
74
+ <span
75
+ aria-hidden="true"
76
+ className="flex size-4 items-center justify-center text-xs font-semibold"
77
+ >
78
+ {item.label.charAt(0).toUpperCase()}
79
+ </span>
80
+ )
81
+ );
82
+ }
83
+
84
+ // The collapse control lives inside the sidebar; reopening needs one outside.
85
+ // Shown on mobile and, on desktop, only while the sidebar is hidden (CSS, so
86
+ // it is right from the first paint).
87
+ function HeaderTrigger() {
88
+ return (
89
+ <div className="flex items-center md:hidden md:group-has-data-[collapsible=offcanvas]/sidebar-wrapper:flex">
90
+ <SidebarTrigger className="-ml-1" />
91
+ <Separator
92
+ orientation="vertical"
93
+ className="mr-2 ml-2 h-4 self-center!"
94
+ />
95
+ </div>
96
+ );
97
+ }
98
+
99
+ function ShellNavigation({
100
+ navigation,
101
+ activeId,
102
+ onNavigate,
103
+ }: Pick<AppShellProps, "navigation" | "activeId" | "onNavigate">) {
104
+ const { isMobile, setOpenMobile } = useSidebar();
105
+ const navigate = (id: string, event: MouseEvent<HTMLElement>) => {
106
+ if (
107
+ event.button !== 0 ||
108
+ event.metaKey ||
109
+ event.ctrlKey ||
110
+ event.shiftKey ||
111
+ event.altKey
112
+ )
113
+ return;
114
+ event.preventDefault();
115
+ onNavigate(id);
116
+ if (isMobile) setOpenMobile(false);
117
+ };
118
+ return navigation.map((group, index) => (
119
+ <SidebarGroup key={group.label ?? index}>
120
+ {group.label ? (
121
+ <SidebarGroupLabel>{group.label}</SidebarGroupLabel>
122
+ ) : null}
123
+ <SidebarMenu>
124
+ {group.items.map((item) => {
125
+ const active =
126
+ item.id === activeId ||
127
+ Boolean(item.children?.some((child) => child.id === activeId));
128
+ return (
129
+ <SidebarMenuItem key={item.id}>
130
+ <div className="relative">
131
+ <SidebarMenuButton
132
+ isActive={active}
133
+ tooltip={item.label}
134
+ aria-current={item.id === activeId ? "page" : undefined}
135
+ render={item.href ? <a href={item.href} /> : undefined}
136
+ onClick={(event) => navigate(item.id, event)}
137
+ >
138
+ <ItemIcon item={item} />
139
+ <span>{item.label}</span>
140
+ </SidebarMenuButton>
141
+ {item.count !== undefined ? (
142
+ <SidebarMenuBadge>{item.count}</SidebarMenuBadge>
143
+ ) : null}
144
+ </div>
145
+ {active && item.children?.length ? (
146
+ <SidebarMenuSub aria-label={item.label}>
147
+ {item.children.map((child) => (
148
+ <SidebarMenuSubItem key={child.id}>
149
+ <SidebarMenuSubButton
150
+ href={child.href}
151
+ isActive={child.id === activeId}
152
+ aria-current={
153
+ child.id === activeId ? "page" : undefined
154
+ }
155
+ onClick={(event) => navigate(child.id, event)}
156
+ >
157
+ <span>{child.label}</span>
158
+ </SidebarMenuSubButton>
159
+ </SidebarMenuSubItem>
160
+ ))}
161
+ </SidebarMenuSub>
162
+ ) : null}
163
+ </SidebarMenuItem>
164
+ );
165
+ })}
166
+ </SidebarMenu>
167
+ </SidebarGroup>
168
+ ));
169
+ }
170
+
171
+ export function AppShell({
172
+ logo,
173
+ name,
174
+ navigation,
175
+ activeId,
176
+ onNavigate,
177
+ header,
178
+ actions,
179
+ footer,
180
+ sidebarHeader,
181
+ defaultMode,
182
+ defaultWidth,
183
+ fillHeight = false,
184
+ children,
185
+ }: AppShellProps) {
186
+ return (
187
+ <TooltipProvider delay={600}>
188
+ <SidebarProvider defaultMode={defaultMode} defaultWidth={defaultWidth}>
189
+ <Sidebar>
190
+ {/* Top row: fixed h-14 to match the page header with identical vertical alignment in all apps */}
191
+ {/* Keep the mark anchored to the left while the sidebar width animates. */}
192
+ <div className="flex h-14 shrink-0 items-center gap-2 px-2 overflow-hidden">
193
+ <div className="flex size-8 shrink-0 items-center justify-center [&>*]:shrink-0">
194
+ {logo}
195
+ </div>
196
+ <span className="flex-1 truncate font-semibold whitespace-nowrap transition-opacity duration-200 ease-linear group-data-[collapsible=icon]:hidden">
197
+ {name}
198
+ </span>
199
+ <SidebarCollapse className="group-data-[collapsible=icon]:hidden" />
200
+ </div>
201
+ <div className="hidden group-data-[collapsible=icon]:flex justify-center pb-2">
202
+ <SidebarCollapse />
203
+ </div>
204
+ {sidebarHeader ? (
205
+ <div className="p-2 pt-0">{sidebarHeader}</div>
206
+ ) : null}
207
+ <SidebarContent>
208
+ <ShellNavigation
209
+ navigation={navigation}
210
+ activeId={activeId}
211
+ onNavigate={onNavigate}
212
+ />
213
+ </SidebarContent>
214
+ {footer ? <SidebarFooter>{footer}</SidebarFooter> : null}
215
+ <SidebarRail />
216
+ </Sidebar>
217
+ <SidebarInset className={fillHeight ? "h-svh min-h-0" : undefined}>
218
+ <header className="sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4 md:px-6">
219
+ <HeaderTrigger />
220
+ <div className="min-w-0 flex-1">{header}</div>
221
+ {actions ? (
222
+ <div className="flex items-center gap-2">{actions}</div>
223
+ ) : null}
224
+ </header>
225
+ <div
226
+ className={cn(
227
+ "flex flex-1 flex-col gap-4 p-4 md:gap-6 md:p-6",
228
+ fillHeight && "min-h-0 overflow-hidden",
229
+ )}
230
+ >
231
+ {children}
232
+ </div>
233
+ </SidebarInset>
234
+ </SidebarProvider>
235
+ </TooltipProvider>
236
+ );
237
+ }
@@ -0,0 +1,72 @@
1
+ "use client";
2
+
3
+ import { Streamdown, type StreamdownProps } from "streamdown";
4
+ import { cn } from "../lib/utils";
5
+ import { defineMessages, useMessages } from "../lib/i18n";
6
+
7
+ // Streamdown ships English labels; the rest follow the active locale.
8
+ const translations = defineMessages<StreamdownProps["translations"]>({
9
+ en: {},
10
+ "pt-BR": {
11
+ close: "Fechar",
12
+ copied: "Copiado",
13
+ copyCode: "Copiar código",
14
+ copyLink: "Copiar link",
15
+ copyTable: "Copiar tabela",
16
+ copyTableAsCsv: "Copiar como CSV",
17
+ copyTableAsMarkdown: "Copiar como Markdown",
18
+ copyTableAsTsv: "Copiar como TSV",
19
+ downloadFile: "Baixar arquivo",
20
+ downloadImage: "Baixar imagem",
21
+ downloadTable: "Baixar tabela",
22
+ downloadTableAsCsv: "Baixar como CSV",
23
+ downloadTableAsMarkdown: "Baixar como Markdown",
24
+ exitFullscreen: "Sair da tela cheia",
25
+ externalLinkWarning: "Você vai abrir um site externo.",
26
+ imageNotAvailable: "Imagem indisponível",
27
+ openExternalLink: "Abrir link externo?",
28
+ openLink: "Abrir link",
29
+ resetView: "Redefinir visualização",
30
+ tableFormatCsv: "CSV",
31
+ tableFormatMarkdown: "Markdown",
32
+ tableFormatTsv: "TSV",
33
+ viewFullscreen: "Tela cheia",
34
+ zoomIn: "Aumentar zoom",
35
+ zoomOut: "Diminuir zoom",
36
+ },
37
+ });
38
+
39
+ export interface ChatMarkdownProps
40
+ extends Omit<StreamdownProps, "children" | "isAnimating"> {
41
+ children: string;
42
+ /** True while the text is still arriving: unfinished markdown is completed and new words fade in. */
43
+ streaming?: boolean;
44
+ }
45
+
46
+ /**
47
+ * Agent reply as markdown (Streamdown, as in shadcn AI Elements Message).
48
+ * Sanitizes model output, renders GFM tables and code with copy controls, and
49
+ * tolerates half-streamed syntax.
50
+ */
51
+ export function ChatMarkdown({
52
+ children,
53
+ streaming = false,
54
+ className,
55
+ ...props
56
+ }: ChatMarkdownProps) {
57
+ const t = useMessages(translations);
58
+ return (
59
+ <Streamdown
60
+ isAnimating={streaming}
61
+ animated
62
+ translations={t}
63
+ className={cn(
64
+ "min-w-0 text-sm leading-relaxed wrap-break-word *:first:mt-0 *:last:mb-0",
65
+ className,
66
+ )}
67
+ {...props}
68
+ >
69
+ {children}
70
+ </Streamdown>
71
+ );
72
+ }