@wallarm-org/design-system 3.2.0 → 3.3.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 (169) hide show
  1. package/dist/components/AnimatedBackground/blur/BlurBackground.d.ts +6 -0
  2. package/dist/components/AnimatedBackground/blur/BlurBackground.js +176 -76
  3. package/dist/components/AnimatedBackground/blur/index.d.ts +1 -1
  4. package/dist/components/AnimatedBackground/index.d.ts +1 -1
  5. package/dist/components/ApprovalCard/ApprovalCard.d.ts +13 -0
  6. package/dist/components/ApprovalCard/ApprovalCard.js +249 -0
  7. package/dist/components/ApprovalCard/ApprovalCardActions.d.ts +6 -0
  8. package/dist/components/ApprovalCard/ApprovalCardActions.js +50 -0
  9. package/dist/components/ApprovalCard/ApprovalCardContent.d.ts +6 -0
  10. package/dist/components/ApprovalCard/ApprovalCardContent.js +50 -0
  11. package/dist/components/ApprovalCard/classes.d.ts +10 -0
  12. package/dist/components/ApprovalCard/classes.js +26 -0
  13. package/dist/components/ApprovalCard/index.d.ts +3 -0
  14. package/dist/components/ApprovalCard/index.js +3 -0
  15. package/dist/components/AssistantMessage/AssistantMessage.d.ts +12 -0
  16. package/dist/components/AssistantMessage/AssistantMessage.js +66 -0
  17. package/dist/components/AssistantMessage/AssistantMessageContent.d.ts +10 -0
  18. package/dist/components/AssistantMessage/AssistantMessageContent.js +50 -0
  19. package/dist/components/AssistantMessage/AssistantMessageError.d.ts +13 -0
  20. package/dist/components/AssistantMessage/AssistantMessageError.js +93 -0
  21. package/dist/components/AssistantMessage/AssistantMessageLoader.d.ts +13 -0
  22. package/dist/components/AssistantMessage/AssistantMessageLoader.js +88 -0
  23. package/dist/components/AssistantMessage/AssistantMessageMarkdown.d.ts +71 -0
  24. package/dist/components/AssistantMessage/AssistantMessageMarkdown.js +278 -0
  25. package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.d.ts +17 -0
  26. package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.js +94 -0
  27. package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.d.ts +10 -0
  28. package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.js +59 -0
  29. package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.d.ts +14 -0
  30. package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.js +65 -0
  31. package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.d.ts +7 -0
  32. package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.js +70 -0
  33. package/dist/components/AssistantMessage/classes.d.ts +38 -0
  34. package/dist/components/AssistantMessage/classes.js +46 -0
  35. package/dist/components/AssistantMessage/index.d.ts +9 -0
  36. package/dist/components/AssistantMessage/index.js +9 -0
  37. package/dist/components/AssistantMessage/lib/markdown.d.ts +20 -0
  38. package/dist/components/AssistantMessage/lib/markdown.js +51 -0
  39. package/dist/components/ChainOfThought/ChainOfThought.d.ts +10 -0
  40. package/dist/components/ChainOfThought/ChainOfThought.js +66 -0
  41. package/dist/components/ChainOfThought/ChainOfThoughtStep.d.ts +31 -0
  42. package/dist/components/ChainOfThought/ChainOfThoughtStep.js +312 -0
  43. package/dist/components/ChainOfThought/classes.d.ts +20 -0
  44. package/dist/components/ChainOfThought/classes.js +84 -0
  45. package/dist/components/ChainOfThought/index.d.ts +2 -0
  46. package/dist/components/ChainOfThought/index.js +2 -0
  47. package/dist/components/Chat/Chat.d.ts +12 -0
  48. package/dist/components/Chat/Chat.js +90 -0
  49. package/dist/components/Chat/ChatBody.d.ts +12 -0
  50. package/dist/components/Chat/ChatBody.js +52 -0
  51. package/dist/components/Chat/ChatFooter.d.ts +7 -0
  52. package/dist/components/Chat/ChatFooter.js +50 -0
  53. package/dist/components/Chat/ChatGreeting.d.ts +8 -0
  54. package/dist/components/Chat/ChatGreeting.js +94 -0
  55. package/dist/components/Chat/ChatHeader.d.ts +6 -0
  56. package/dist/components/Chat/ChatHeader.js +50 -0
  57. package/dist/components/Chat/ChatHeaderActions.d.ts +7 -0
  58. package/dist/components/Chat/ChatHeaderActions.js +50 -0
  59. package/dist/components/Chat/ChatHeaderTitle.d.ts +12 -0
  60. package/dist/components/Chat/ChatHeaderTitle.js +99 -0
  61. package/dist/components/Chat/ChatSuggestion.d.ts +7 -0
  62. package/dist/components/Chat/ChatSuggestion.js +56 -0
  63. package/dist/components/Chat/ChatSuggestions.d.ts +14 -0
  64. package/dist/components/Chat/ChatSuggestions.js +111 -0
  65. package/dist/components/Chat/ChatSuggestionsContext.d.ts +7 -0
  66. package/dist/components/Chat/ChatSuggestionsContext.js +7 -0
  67. package/dist/components/Chat/ChatTrigger.d.ts +13 -0
  68. package/dist/components/Chat/ChatTrigger.js +101 -0
  69. package/dist/components/Chat/classes.d.ts +17 -0
  70. package/dist/components/Chat/classes.js +44 -0
  71. package/dist/components/Chat/index.d.ts +10 -0
  72. package/dist/components/Chat/index.js +10 -0
  73. package/dist/components/ChatInput/ChatInput.d.ts +30 -0
  74. package/dist/components/ChatInput/ChatInput.js +230 -0
  75. package/dist/components/ChatInput/ChatInputContext.d.ts +11 -0
  76. package/dist/components/ChatInput/ChatInputContext.js +8 -0
  77. package/dist/components/ChatInput/ChatInputSubmit.d.ts +10 -0
  78. package/dist/components/ChatInput/ChatInputSubmit.js +175 -0
  79. package/dist/components/ChatInput/ChatInputTextarea.d.ts +6 -0
  80. package/dist/components/ChatInput/ChatInputTextarea.js +155 -0
  81. package/dist/components/ChatInput/classes.d.ts +9 -0
  82. package/dist/components/ChatInput/classes.js +22 -0
  83. package/dist/components/ChatInput/index.d.ts +3 -0
  84. package/dist/components/ChatInput/index.js +3 -0
  85. package/dist/components/ChatPermissions/ChatPermissions.d.ts +12 -0
  86. package/dist/components/ChatPermissions/ChatPermissions.js +66 -0
  87. package/dist/components/ChatPermissions/ChatPermissionsContent.d.ts +7 -0
  88. package/dist/components/ChatPermissions/ChatPermissionsContent.js +73 -0
  89. package/dist/components/ChatPermissions/ChatPermissionsContext.d.ts +7 -0
  90. package/dist/components/ChatPermissions/ChatPermissionsContext.js +8 -0
  91. package/dist/components/ChatPermissions/ChatPermissionsItem.d.ts +17 -0
  92. package/dist/components/ChatPermissions/ChatPermissionsItem.js +115 -0
  93. package/dist/components/ChatPermissions/ChatPermissionsTrigger.d.ts +6 -0
  94. package/dist/components/ChatPermissions/ChatPermissionsTrigger.js +110 -0
  95. package/dist/components/ChatPermissions/classes.d.ts +3 -0
  96. package/dist/components/ChatPermissions/classes.js +5 -0
  97. package/dist/components/ChatPermissions/index.d.ts +4 -0
  98. package/dist/components/ChatPermissions/index.js +4 -0
  99. package/dist/components/Conversation/Conversation.d.ts +19 -0
  100. package/dist/components/Conversation/Conversation.js +102 -0
  101. package/dist/components/Conversation/ConversationContent.d.ts +11 -0
  102. package/dist/components/Conversation/ConversationContent.js +103 -0
  103. package/dist/components/Conversation/ConversationContext.d.ts +14 -0
  104. package/dist/components/Conversation/ConversationContext.js +8 -0
  105. package/dist/components/Conversation/ConversationEmptyState.d.ts +15 -0
  106. package/dist/components/Conversation/ConversationEmptyState.js +70 -0
  107. package/dist/components/Conversation/ConversationScrollButton.d.ts +13 -0
  108. package/dist/components/Conversation/ConversationScrollButton.js +138 -0
  109. package/dist/components/Conversation/classes.d.ts +13 -0
  110. package/dist/components/Conversation/classes.js +8 -0
  111. package/dist/components/Conversation/index.d.ts +4 -0
  112. package/dist/components/Conversation/index.js +4 -0
  113. package/dist/components/Conversation/useStickToBottom.d.ts +9 -0
  114. package/dist/components/Conversation/useStickToBottom.js +203 -0
  115. package/dist/components/MessageActions/MessageAction.d.ts +18 -0
  116. package/dist/components/MessageActions/MessageAction.js +109 -0
  117. package/dist/components/MessageActions/MessageActions.d.ts +12 -0
  118. package/dist/components/MessageActions/MessageActions.js +74 -0
  119. package/dist/components/MessageActions/MessageTimestamp.d.ts +7 -0
  120. package/dist/components/MessageActions/MessageTimestamp.js +50 -0
  121. package/dist/components/MessageActions/classes.d.ts +5 -0
  122. package/dist/components/MessageActions/classes.js +15 -0
  123. package/dist/components/MessageActions/index.d.ts +3 -0
  124. package/dist/components/MessageActions/index.js +3 -0
  125. package/dist/components/Popover/PopoverContent.d.ts +2 -1
  126. package/dist/components/Popover/PopoverContent.js +42 -39
  127. package/dist/components/UserMessage/UserMessage.d.ts +10 -0
  128. package/dist/components/UserMessage/UserMessage.js +66 -0
  129. package/dist/components/UserMessage/UserMessageBubble.d.ts +16 -0
  130. package/dist/components/UserMessage/UserMessageBubble.js +175 -0
  131. package/dist/components/UserMessage/UserMessageContext.d.ts +9 -0
  132. package/dist/components/UserMessage/UserMessageContext.js +4 -0
  133. package/dist/components/UserMessage/UserMessageShowMore.d.ts +15 -0
  134. package/dist/components/UserMessage/UserMessageShowMore.js +87 -0
  135. package/dist/components/UserMessage/classes.d.ts +11 -0
  136. package/dist/components/UserMessage/classes.js +32 -0
  137. package/dist/components/UserMessage/index.d.ts +3 -0
  138. package/dist/components/UserMessage/index.js +3 -0
  139. package/dist/components/WallyAssistant/WallyAssistant.d.ts +56 -0
  140. package/dist/components/WallyAssistant/WallyAssistant.js +541 -0
  141. package/dist/components/WallyAssistant/index.d.ts +10 -0
  142. package/dist/components/WallyAssistant/index.js +8 -0
  143. package/dist/components/WallyAssistant/model/deriveChatState.d.ts +33 -0
  144. package/dist/components/WallyAssistant/model/deriveChatState.js +54 -0
  145. package/dist/components/WallyAssistant/model/labels.d.ts +43 -0
  146. package/dist/components/WallyAssistant/model/labels.js +33 -0
  147. package/dist/components/WallyAssistant/model/model.d.ts +184 -0
  148. package/dist/components/WallyAssistant/model/model.js +0 -0
  149. package/dist/components/WallyAssistant/views/ApprovalCardView.d.ts +20 -0
  150. package/dist/components/WallyAssistant/views/ApprovalCardView.js +274 -0
  151. package/dist/components/WallyAssistant/views/ChainOfThoughtView.d.ts +18 -0
  152. package/dist/components/WallyAssistant/views/ChainOfThoughtView.js +301 -0
  153. package/dist/components/WallyAssistant/views/ChatMessageView.d.ts +15 -0
  154. package/dist/components/WallyAssistant/views/ChatMessageView.js +372 -0
  155. package/dist/components/WallyAssistant/views/ChatPartView.d.ts +16 -0
  156. package/dist/components/WallyAssistant/views/ChatPartView.js +171 -0
  157. package/dist/components/WallyAssistant/views/ChatViewContext.d.ts +98 -0
  158. package/dist/components/WallyAssistant/views/ChatViewContext.js +44 -0
  159. package/dist/components/WallyAssistant/views/ChatViewProvider.d.ts +18 -0
  160. package/dist/components/WallyAssistant/views/ChatViewProvider.js +96 -0
  161. package/dist/components/WallyAssistant/views/stepIcons.d.ts +8 -0
  162. package/dist/components/WallyAssistant/views/stepIcons.js +47 -0
  163. package/dist/index.d.ts +10 -0
  164. package/dist/index.js +10 -0
  165. package/dist/metadata/components.json +30786 -15960
  166. package/dist/theme/components/animated-background.css +6 -1
  167. package/dist/theme/index.css +1 -0
  168. package/dist/theme/utilities/shimmer-text.css +27 -0
  169. package/package.json +3 -1
@@ -0,0 +1,278 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, memo } from "react";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { Checkmark } from "../Checkmark/index.js";
5
+ import { Separator } from "../Separator/index.js";
6
+ import { tableBodyCellVariants, tableHeadCellVariants } from "../Table/classes.js";
7
+ import { AssistantMessageMarkdownCodeBlock } from "./AssistantMessageMarkdownCodeBlock.js";
8
+ import { AssistantMessageMarkdownInlineCode } from "./AssistantMessageMarkdownInlineCode.js";
9
+ import { AssistantMessageMarkdownLink } from "./AssistantMessageMarkdownLink.js";
10
+ import { AssistantMessageMarkdownTable } from "./AssistantMessageMarkdownTable.js";
11
+ import { assistantMessageMarkdownBlockquoteVariants, assistantMessageMarkdownCellVariants, assistantMessageMarkdownListVariants, assistantMessageMarkdownTaskItemVariants } from "./classes.js";
12
+ import { asTokens, decodeEntities, isClosedFence, lexMarkdown, safeHref } from "./lib/markdown.js";
13
+ const HEADINGS = [
14
+ 'h1',
15
+ 'h2',
16
+ 'h3',
17
+ 'h4',
18
+ 'h5',
19
+ 'h6'
20
+ ];
21
+ const cell = (base, align)=>cn(base, assistantMessageMarkdownCellVariants({
22
+ align
23
+ }));
24
+ const DEFAULTS = {
25
+ p: ({ children })=>/*#__PURE__*/ jsx("p", {
26
+ children: children
27
+ }),
28
+ h1: ({ children })=>/*#__PURE__*/ jsx("h1", {
29
+ children: children
30
+ }),
31
+ h2: ({ children })=>/*#__PURE__*/ jsx("h2", {
32
+ children: children
33
+ }),
34
+ h3: ({ children })=>/*#__PURE__*/ jsx("h3", {
35
+ children: children
36
+ }),
37
+ h4: ({ children })=>/*#__PURE__*/ jsx("h4", {
38
+ children: children
39
+ }),
40
+ h5: ({ children })=>/*#__PURE__*/ jsx("h5", {
41
+ children: children
42
+ }),
43
+ h6: ({ children })=>/*#__PURE__*/ jsx("h6", {
44
+ children: children
45
+ }),
46
+ strong: ({ children })=>/*#__PURE__*/ jsx("strong", {
47
+ className: "font-semibold",
48
+ children: children
49
+ }),
50
+ em: ({ children })=>/*#__PURE__*/ jsx("em", {
51
+ children: children
52
+ }),
53
+ del: ({ children })=>/*#__PURE__*/ jsx("del", {
54
+ children: children
55
+ }),
56
+ blockquote: ({ children })=>/*#__PURE__*/ jsx("blockquote", {
57
+ className: assistantMessageMarkdownBlockquoteVariants(),
58
+ children: children
59
+ }),
60
+ ul: ({ children })=>/*#__PURE__*/ jsx("ul", {
61
+ className: assistantMessageMarkdownListVariants(),
62
+ children: children
63
+ }),
64
+ ol: ({ start, children })=>/*#__PURE__*/ jsx("ol", {
65
+ start: start,
66
+ className: assistantMessageMarkdownListVariants({
67
+ ordered: true
68
+ }),
69
+ children: children
70
+ }),
71
+ li: ({ checked, children })=>void 0 === checked ? /*#__PURE__*/ jsx("li", {
72
+ children: children
73
+ }) : /*#__PURE__*/ jsxs("li", {
74
+ className: assistantMessageMarkdownTaskItemVariants(),
75
+ children: [
76
+ /*#__PURE__*/ jsx("input", {
77
+ type: "checkbox",
78
+ checked: checked,
79
+ disabled: true,
80
+ readOnly: true,
81
+ className: "sr-only"
82
+ }),
83
+ /*#__PURE__*/ jsx(Checkmark, {
84
+ checkedState: checked,
85
+ "aria-hidden": "true"
86
+ }),
87
+ /*#__PURE__*/ jsx("div", {
88
+ className: "min-w-0",
89
+ children: children
90
+ })
91
+ ]
92
+ }),
93
+ hr: ()=>/*#__PURE__*/ jsx(Separator, {
94
+ decorative: false
95
+ }),
96
+ table: AssistantMessageMarkdownTable,
97
+ thead: ({ children })=>/*#__PURE__*/ jsx("thead", {
98
+ children: children
99
+ }),
100
+ tbody: ({ children })=>/*#__PURE__*/ jsx("tbody", {
101
+ children: children
102
+ }),
103
+ tr: ({ children })=>/*#__PURE__*/ jsx("tr", {
104
+ children: children
105
+ }),
106
+ th: ({ align, children })=>/*#__PURE__*/ jsx("th", {
107
+ scope: "col",
108
+ className: cell(tableHeadCellVariants(), align),
109
+ children: children
110
+ }),
111
+ td: ({ align, children })=>/*#__PURE__*/ jsx("td", {
112
+ className: cell(tableBodyCellVariants(), align),
113
+ children: children
114
+ }),
115
+ a: AssistantMessageMarkdownLink,
116
+ inlineCode: AssistantMessageMarkdownInlineCode,
117
+ codeBlock: AssistantMessageMarkdownCodeBlock,
118
+ img: ({ alt })=>alt
119
+ };
120
+ const renderInline = (tokens, w)=>asTokens(tokens).map((t, i)=>{
121
+ const { c } = w;
122
+ switch(t.type){
123
+ case 'text':
124
+ return t.tokens ? /*#__PURE__*/ jsx(Fragment, {
125
+ children: renderInline(t.tokens, w)
126
+ }, i) : decodeEntities(t.text);
127
+ case 'escape':
128
+ return t.text;
129
+ case 'strong':
130
+ return /*#__PURE__*/ jsx(c.strong, {
131
+ children: renderInline(t.tokens, w)
132
+ }, i);
133
+ case 'em':
134
+ return /*#__PURE__*/ jsx(c.em, {
135
+ children: renderInline(t.tokens, w)
136
+ }, i);
137
+ case 'del':
138
+ return /*#__PURE__*/ jsx(c.del, {
139
+ children: renderInline(t.tokens, w)
140
+ }, i);
141
+ case 'codespan':
142
+ return /*#__PURE__*/ jsx(c.inlineCode, {
143
+ code: t.text,
144
+ variant: w.variant,
145
+ copyable: !w.inLink && 'chain-of-thought' !== w.variant
146
+ }, i);
147
+ case 'br':
148
+ return /*#__PURE__*/ jsx("br", {}, i);
149
+ case 'link':
150
+ {
151
+ const href = safeHref(t.href);
152
+ const children = renderInline(t.tokens, {
153
+ ...w,
154
+ inLink: true
155
+ });
156
+ return href ? /*#__PURE__*/ jsx(c.a, {
157
+ href: href,
158
+ title: t.title ?? void 0,
159
+ variant: w.variant,
160
+ children: children
161
+ }, i) : /*#__PURE__*/ jsx(Fragment, {
162
+ children: children
163
+ }, i);
164
+ }
165
+ case 'image':
166
+ {
167
+ const src = safeHref(t.href);
168
+ return src ? /*#__PURE__*/ jsx(c.img, {
169
+ src: src,
170
+ alt: t.text,
171
+ title: t.title ?? void 0
172
+ }, i) : t.text;
173
+ }
174
+ case 'html':
175
+ return /^<br\s*\/?>$/i.test(t.raw) ? /*#__PURE__*/ jsx("br", {}, i) : t.raw;
176
+ case 'checkbox':
177
+ return null;
178
+ default:
179
+ return t.raw;
180
+ }
181
+ });
182
+ const renderBlocks = (tokens, w)=>asTokens(tokens).map((t, i)=>renderBlock(t, i, w));
183
+ const renderBlock = (t, key, w)=>{
184
+ const { c } = w;
185
+ switch(t.type){
186
+ case 'paragraph':
187
+ return /*#__PURE__*/ jsx(c.p, {
188
+ children: renderInline(t.tokens, w)
189
+ }, key);
190
+ case 'text':
191
+ return /*#__PURE__*/ jsx(Fragment, {
192
+ children: t.tokens ? renderInline(t.tokens, w) : decodeEntities(t.text)
193
+ }, key);
194
+ case 'heading':
195
+ {
196
+ const H = c[HEADINGS[t.depth - 1] ?? 'h6'];
197
+ return /*#__PURE__*/ jsx(H, {
198
+ children: renderInline(t.tokens, w)
199
+ }, key);
200
+ }
201
+ case 'code':
202
+ return /*#__PURE__*/ jsx(c.codeBlock, {
203
+ code: t.text,
204
+ language: t.lang || void 0,
205
+ complete: !w.streaming || isClosedFence(t.raw)
206
+ }, key);
207
+ case 'blockquote':
208
+ return /*#__PURE__*/ jsx(c.blockquote, {
209
+ children: renderBlocks(t.tokens, w)
210
+ }, key);
211
+ case 'list':
212
+ {
213
+ const items = t.items.map((item, j)=>/*#__PURE__*/ jsx(c.li, {
214
+ checked: item.task ? item.checked : void 0,
215
+ children: renderBlocks(item.tokens, w)
216
+ }, j));
217
+ return t.ordered ? /*#__PURE__*/ jsx(c.ol, {
218
+ start: '' === t.start || 1 === t.start ? void 0 : t.start,
219
+ children: items
220
+ }, key) : /*#__PURE__*/ jsx(c.ul, {
221
+ children: items
222
+ }, key);
223
+ }
224
+ case 'table':
225
+ return /*#__PURE__*/ jsxs(c.table, {
226
+ children: [
227
+ /*#__PURE__*/ jsx(c.thead, {
228
+ children: /*#__PURE__*/ jsx(c.tr, {
229
+ children: t.header.map((h, j)=>/*#__PURE__*/ jsx(c.th, {
230
+ align: h.align ?? void 0,
231
+ children: renderInline(h.tokens, w)
232
+ }, j))
233
+ })
234
+ }),
235
+ /*#__PURE__*/ jsx(c.tbody, {
236
+ children: t.rows.map((row, j)=>/*#__PURE__*/ jsx(c.tr, {
237
+ children: row.map((d, k)=>/*#__PURE__*/ jsx(c.td, {
238
+ align: d.align ?? void 0,
239
+ children: renderInline(d.tokens, w)
240
+ }, k))
241
+ }, j))
242
+ })
243
+ ]
244
+ }, key);
245
+ case 'hr':
246
+ return /*#__PURE__*/ jsx(c.hr, {}, key);
247
+ case 'html':
248
+ return t.raw.trim() ? /*#__PURE__*/ jsx(c.p, {
249
+ children: t.raw.trim()
250
+ }, key) : null;
251
+ case 'space':
252
+ case 'def':
253
+ case 'checkbox':
254
+ return null;
255
+ default:
256
+ return /*#__PURE__*/ jsx(c.p, {
257
+ children: t.raw
258
+ }, key);
259
+ }
260
+ };
261
+ const Block = /*#__PURE__*/ memo(({ token, streaming, variant, components })=>renderBlock(token, 0, {
262
+ c: components ? {
263
+ ...DEFAULTS,
264
+ ...components
265
+ } : DEFAULTS,
266
+ variant,
267
+ streaming,
268
+ inLink: false
269
+ }), (a, b)=>a.token.raw === b.token.raw && a.streaming === b.streaming && a.variant === b.variant && a.components === b.components);
270
+ Block.displayName = 'AssistantMessageMarkdownBlock';
271
+ const AssistantMessageMarkdown = ({ text, streaming = false, variant = 'answer', components })=>lexMarkdown(text, streaming).map((token, i)=>/*#__PURE__*/ jsx(Block, {
272
+ token: token,
273
+ streaming: streaming,
274
+ variant: variant,
275
+ components: components
276
+ }, i));
277
+ AssistantMessageMarkdown.displayName = 'AssistantMessageMarkdown';
278
+ export { AssistantMessageMarkdown };
@@ -0,0 +1,17 @@
1
+ import type { FC, HTMLAttributes, Ref } from 'react';
2
+ import { type TestableProps } from '../../utils/testId.js';
3
+ export interface AssistantMessageMarkdownCodeBlockProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
4
+ ref?: Ref<HTMLDivElement>;
5
+ code: string;
6
+ /** The fence info string (`yaml`, `json`, `bash`, `http`…). The app's adapter resolves aliases; unknown → plain. */
7
+ language?: string;
8
+ /** false while the fence is still open in a streaming answer: plain text (no re-highlight per token) and no
9
+ * copy button. Default true. */
10
+ complete?: boolean;
11
+ }
12
+ /**
13
+ * Markdown fenced code (Figma 181:3500: no header, no line numbers, mono 12/20) with a floating copy button.
14
+ * Highlighting follows the app's `CodeSnippetAdapterProvider`; without one the code is plain.
15
+ * The test id goes on the snippet, so its parts cascade: `…--code-block--copy-button`.
16
+ */
17
+ export declare const AssistantMessageMarkdownCodeBlock: FC<AssistantMessageMarkdownCodeBlockProps>;
@@ -0,0 +1,94 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { useTestId } from "../../utils/testId.js";
5
+ import { CodeSnippetActions, CodeSnippetCode, CodeSnippetContent, CodeSnippetCopyButton, CodeSnippetRoot } from "../CodeSnippet/index.js";
6
+ import { assistantMessageMarkdownCodeBlockVariants } from "./classes.js";
7
+ const AssistantMessageMarkdownCodeBlock = (t0)=>{
8
+ const $ = c(23);
9
+ let className;
10
+ let code;
11
+ let language;
12
+ let props;
13
+ let ref;
14
+ let t1;
15
+ let testIdProp;
16
+ if ($[0] !== t0) {
17
+ ({ ref, code, language, complete: t1, className, "data-testid": testIdProp, ...props } = t0);
18
+ $[0] = t0;
19
+ $[1] = className;
20
+ $[2] = code;
21
+ $[3] = language;
22
+ $[4] = props;
23
+ $[5] = ref;
24
+ $[6] = t1;
25
+ $[7] = testIdProp;
26
+ } else {
27
+ className = $[1];
28
+ code = $[2];
29
+ language = $[3];
30
+ props = $[4];
31
+ ref = $[5];
32
+ t1 = $[6];
33
+ testIdProp = $[7];
34
+ }
35
+ const complete = void 0 === t1 ? true : t1;
36
+ let t2;
37
+ if ($[8] !== className) {
38
+ t2 = cn(assistantMessageMarkdownCodeBlockVariants(), className);
39
+ $[8] = className;
40
+ $[9] = t2;
41
+ } else t2 = $[9];
42
+ const t3 = complete && language ? language : "text";
43
+ const t4 = useTestId("code-block", testIdProp);
44
+ let t5;
45
+ if ($[10] !== complete) {
46
+ t5 = complete && /*#__PURE__*/ jsx(CodeSnippetActions, {
47
+ children: /*#__PURE__*/ jsx(CodeSnippetCopyButton, {})
48
+ });
49
+ $[10] = complete;
50
+ $[11] = t5;
51
+ } else t5 = $[11];
52
+ let t6;
53
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
54
+ t6 = /*#__PURE__*/ jsx(CodeSnippetContent, {
55
+ children: /*#__PURE__*/ jsx(CodeSnippetCode, {})
56
+ });
57
+ $[12] = t6;
58
+ } else t6 = $[12];
59
+ let t7;
60
+ if ($[13] !== code || $[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
61
+ t7 = /*#__PURE__*/ jsxs(CodeSnippetRoot, {
62
+ code: code,
63
+ language: t3,
64
+ "data-testid": t4,
65
+ children: [
66
+ t5,
67
+ t6
68
+ ]
69
+ });
70
+ $[13] = code;
71
+ $[14] = t3;
72
+ $[15] = t4;
73
+ $[16] = t5;
74
+ $[17] = t7;
75
+ } else t7 = $[17];
76
+ let t8;
77
+ if ($[18] !== props || $[19] !== ref || $[20] !== t2 || $[21] !== t7) {
78
+ t8 = /*#__PURE__*/ jsx("div", {
79
+ ...props,
80
+ ref: ref,
81
+ "data-slot": "assistant-message-markdown-code-block",
82
+ className: t2,
83
+ children: t7
84
+ });
85
+ $[18] = props;
86
+ $[19] = ref;
87
+ $[20] = t2;
88
+ $[21] = t7;
89
+ $[22] = t8;
90
+ } else t8 = $[22];
91
+ return t8;
92
+ };
93
+ AssistantMessageMarkdownCodeBlock.displayName = "AssistantMessageMarkdownCodeBlock";
94
+ export { AssistantMessageMarkdownCodeBlock };
@@ -0,0 +1,10 @@
1
+ import type { FC } from 'react';
2
+ import { type TestableProps } from '../../utils/testId.js';
3
+ import { type InlineCodeSnippetProps } from '../CodeSnippet/index.js';
4
+ import type { AssistantMessageMarkdownVariant } from './AssistantMessageMarkdown.js';
5
+ export interface AssistantMessageMarkdownInlineCodeProps extends Omit<InlineCodeSnippetProps, 'size' | 'asChild' | 'children'>, TestableProps {
6
+ /** 'chain-of-thought' mutes the colour and turns copy off (Figma 494:4292). Default 'answer'. */
7
+ variant?: AssistantMessageMarkdownVariant;
8
+ }
9
+ /** Markdown inline code: `InlineCodeSnippet size='sm'`. The renderer also turns copy off inside a link. */
10
+ export declare const AssistantMessageMarkdownInlineCode: FC<AssistantMessageMarkdownInlineCodeProps>;
@@ -0,0 +1,59 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { useTestId } from "../../utils/testId.js";
5
+ import { InlineCodeSnippet } from "../CodeSnippet/index.js";
6
+ import { assistantMessageMarkdownInlineCodeVariants } from "./classes.js";
7
+ const AssistantMessageMarkdownInlineCode = (t0)=>{
8
+ const $ = c(14);
9
+ let className;
10
+ let copyable;
11
+ let props;
12
+ let t1;
13
+ let testIdProp;
14
+ if ($[0] !== t0) {
15
+ ({ variant: t1, copyable, className, "data-testid": testIdProp, ...props } = t0);
16
+ $[0] = t0;
17
+ $[1] = className;
18
+ $[2] = copyable;
19
+ $[3] = props;
20
+ $[4] = t1;
21
+ $[5] = testIdProp;
22
+ } else {
23
+ className = $[1];
24
+ copyable = $[2];
25
+ props = $[3];
26
+ t1 = $[4];
27
+ testIdProp = $[5];
28
+ }
29
+ const variant = void 0 === t1 ? "answer" : t1;
30
+ const t2 = copyable ?? "chain-of-thought" !== variant;
31
+ const t3 = useTestId("inline-code", testIdProp);
32
+ let t4;
33
+ if ($[6] !== className || $[7] !== variant) {
34
+ t4 = cn(assistantMessageMarkdownInlineCodeVariants({
35
+ muted: "chain-of-thought" === variant
36
+ }), className);
37
+ $[6] = className;
38
+ $[7] = variant;
39
+ $[8] = t4;
40
+ } else t4 = $[8];
41
+ let t5;
42
+ if ($[9] !== props || $[10] !== t2 || $[11] !== t3 || $[12] !== t4) {
43
+ t5 = /*#__PURE__*/ jsx(InlineCodeSnippet, {
44
+ ...props,
45
+ size: "sm",
46
+ copyable: t2,
47
+ "data-testid": t3,
48
+ className: t4
49
+ });
50
+ $[9] = props;
51
+ $[10] = t2;
52
+ $[11] = t3;
53
+ $[12] = t4;
54
+ $[13] = t5;
55
+ } else t5 = $[13];
56
+ return t5;
57
+ };
58
+ AssistantMessageMarkdownInlineCode.displayName = "AssistantMessageMarkdownInlineCode";
59
+ export { AssistantMessageMarkdownInlineCode };
@@ -0,0 +1,14 @@
1
+ import type { FC } from 'react';
2
+ import { type LinkProps } from '../Link/index.js';
3
+ import type { AssistantMessageMarkdownVariant } from './AssistantMessageMarkdown.js';
4
+ export interface AssistantMessageMarkdownLinkProps extends Omit<LinkProps, 'href' | 'size' | 'asChild'> {
5
+ /** Already allow-listed by the renderer: http(s), mailto or relative. */
6
+ href: string;
7
+ /** 'chain-of-thought' → 12px, otherwise 14px. Default 'answer'. */
8
+ variant?: AssistantMessageMarkdownVariant;
9
+ }
10
+ /**
11
+ * Markdown link: the DS `Link`, inline so it wraps. Absolute URLs open in a new tab without opener or referrer.
12
+ * For in-app paths override `a` with your router's link: a plain href reloads the page.
13
+ */
14
+ export declare const AssistantMessageMarkdownLink: FC<AssistantMessageMarkdownLinkProps>;
@@ -0,0 +1,65 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { useTestId } from "../../utils/testId.js";
5
+ import { Link } from "../Link/index.js";
6
+ import { assistantMessageMarkdownLinkVariants } from "./classes.js";
7
+ const AssistantMessageMarkdownLink = (t0)=>{
8
+ const $ = c(16);
9
+ let className;
10
+ let href;
11
+ let props;
12
+ let t1;
13
+ let testIdProp;
14
+ if ($[0] !== t0) {
15
+ ({ href, variant: t1, className, "data-testid": testIdProp, ...props } = t0);
16
+ $[0] = t0;
17
+ $[1] = className;
18
+ $[2] = href;
19
+ $[3] = props;
20
+ $[4] = t1;
21
+ $[5] = testIdProp;
22
+ } else {
23
+ className = $[1];
24
+ href = $[2];
25
+ props = $[3];
26
+ t1 = $[4];
27
+ testIdProp = $[5];
28
+ }
29
+ const variant = void 0 === t1 ? "answer" : t1;
30
+ const external = /^(?:https?:)?\/\//i.test(href);
31
+ const t2 = external ? "_blank" : void 0;
32
+ const t3 = external ? "noopener noreferrer" : void 0;
33
+ const t4 = "chain-of-thought" === variant ? "sm" : "md";
34
+ const t5 = useTestId("link", testIdProp);
35
+ let t6;
36
+ if ($[6] !== className) {
37
+ t6 = cn(assistantMessageMarkdownLinkVariants(), className);
38
+ $[6] = className;
39
+ $[7] = t6;
40
+ } else t6 = $[7];
41
+ let t7;
42
+ if ($[8] !== href || $[9] !== props || $[10] !== t2 || $[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6) {
43
+ t7 = /*#__PURE__*/ jsx(Link, {
44
+ target: t2,
45
+ rel: t3,
46
+ ...props,
47
+ href: href,
48
+ size: t4,
49
+ "data-slot": "assistant-message-markdown-link",
50
+ "data-testid": t5,
51
+ className: t6
52
+ });
53
+ $[8] = href;
54
+ $[9] = props;
55
+ $[10] = t2;
56
+ $[11] = t3;
57
+ $[12] = t4;
58
+ $[13] = t5;
59
+ $[14] = t6;
60
+ $[15] = t7;
61
+ } else t7 = $[15];
62
+ return t7;
63
+ };
64
+ AssistantMessageMarkdownLink.displayName = "AssistantMessageMarkdownLink";
65
+ export { AssistantMessageMarkdownLink };
@@ -0,0 +1,7 @@
1
+ import type { FC, HTMLAttributes, Ref } from 'react';
2
+ import { type TestableProps } from '../../utils/testId.js';
3
+ export interface AssistantMessageMarkdownTableProps extends HTMLAttributes<HTMLDivElement>, TestableProps {
4
+ ref?: Ref<HTMLDivElement>;
5
+ }
6
+ /** Markdown table: the DS table frame and cells (`Table/classes`) on a plain `<table>`. Not in Figma. */
7
+ export declare const AssistantMessageMarkdownTable: FC<AssistantMessageMarkdownTableProps>;
@@ -0,0 +1,70 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { useTestId } from "../../utils/testId.js";
5
+ import { tableContainerVariants } from "../Table/classes.js";
6
+ import { assistantMessageMarkdownTableGridVariants, assistantMessageMarkdownTableVariants } from "./classes.js";
7
+ const AssistantMessageMarkdownTable = (t0)=>{
8
+ const $ = c(17);
9
+ let children;
10
+ let className;
11
+ let props;
12
+ let ref;
13
+ let testIdProp;
14
+ if ($[0] !== t0) {
15
+ ({ ref, className, children, "data-testid": testIdProp, ...props } = t0);
16
+ $[0] = t0;
17
+ $[1] = children;
18
+ $[2] = className;
19
+ $[3] = props;
20
+ $[4] = ref;
21
+ $[5] = testIdProp;
22
+ } else {
23
+ children = $[1];
24
+ className = $[2];
25
+ props = $[3];
26
+ ref = $[4];
27
+ testIdProp = $[5];
28
+ }
29
+ const t1 = useTestId("table", testIdProp);
30
+ let t2;
31
+ if ($[6] !== className) {
32
+ t2 = cn(tableContainerVariants(), assistantMessageMarkdownTableVariants(), className);
33
+ $[6] = className;
34
+ $[7] = t2;
35
+ } else t2 = $[7];
36
+ let t3;
37
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
38
+ t3 = assistantMessageMarkdownTableGridVariants();
39
+ $[8] = t3;
40
+ } else t3 = $[8];
41
+ let t4;
42
+ if ($[9] !== children) {
43
+ t4 = /*#__PURE__*/ jsx("table", {
44
+ className: t3,
45
+ children: children
46
+ });
47
+ $[9] = children;
48
+ $[10] = t4;
49
+ } else t4 = $[10];
50
+ let t5;
51
+ if ($[11] !== props || $[12] !== ref || $[13] !== t1 || $[14] !== t2 || $[15] !== t4) {
52
+ t5 = /*#__PURE__*/ jsx("div", {
53
+ ...props,
54
+ ref: ref,
55
+ "data-slot": "assistant-message-markdown-table",
56
+ "data-testid": t1,
57
+ className: t2,
58
+ children: t4
59
+ });
60
+ $[11] = props;
61
+ $[12] = ref;
62
+ $[13] = t1;
63
+ $[14] = t2;
64
+ $[15] = t4;
65
+ $[16] = t5;
66
+ } else t5 = $[16];
67
+ return t5;
68
+ };
69
+ AssistantMessageMarkdownTable.displayName = "AssistantMessageMarkdownTable";
70
+ export { AssistantMessageMarkdownTable };
@@ -0,0 +1,38 @@
1
+ /** Chain of thought / approval card → next part is 12px (4 gap + 8 margin); answer → actions
2
+ * is 4px. The approval card stretches to the full width (the root is `items-start`). The
3
+ * actions row is pulled 4px left so the 24px button's icon lines up with the text. */
4
+ export declare const assistantMessageVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
5
+ /** Prose for markdown blocks (`AssistantMessageMarkdown` or your renderer): paragraphs 14/24, headings 16/24
6
+ * medium, lists 14/20 indented 21px. */
7
+ export declare const assistantMessageContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ /** The Figma "Working..." row (469:341): the ChainOfThought icon cell and shimmering label, without list semantics. */
9
+ export declare const assistantMessageLoaderVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
10
+ /** Not in Figma yet (flagged for design review): danger text with a leading OctagonAlert and a trailing action.
11
+ * The action (children after the icon and text) is pulled 2px up and down so a 24px Button centres on
12
+ * the first 20px text line instead of growing the row; `items-start` keeps multi-line text top-aligned. */
13
+ export declare const assistantMessageErrorVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
14
+ /** Not in Figma (provisional): a muted rule on the start edge. */
15
+ export declare const assistantMessageMarkdownBlockquoteVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
16
+ /** Lists carry their own markers: the chain-of-thought body only styles `ul` (its nested chains are `ol`s) and
17
+ * ApprovalCardContent styles none. 18px = the CoT indent; AssistantMessageContent's `ps-21` wins in answers. */
18
+ export declare const assistantMessageMarkdownListVariants: (props?: ({
19
+ ordered?: boolean | null | undefined;
20
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
21
+ /** GFM task item: the Checkmark takes the bullet's place (provisional). */
22
+ export declare const assistantMessageMarkdownTaskItemVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
23
+ /** GFM column alignment. Unaligned columns, headers included, sit at the end (user decision). */
24
+ export declare const assistantMessageMarkdownCellVariants: (props?: ({
25
+ align?: "center" | "left" | "right" | null | undefined;
26
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
27
+ /** Long hashes and tokens wrap instead of overflowing the 444px column; muted in the chain of thought
28
+ * (Figma 494:4292: color → text-secondary). */
29
+ export declare const assistantMessageMarkdownInlineCodeVariants: (props?: ({
30
+ muted?: boolean | null | undefined;
31
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
32
+ /** `Link` is inline-flex (a long link wouldn't wrap) and has outline-none with no ring. */
33
+ export declare const assistantMessageMarkdownLinkVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
34
+ /** A real block for the prose margins (CodeSnippetRoot's outer node is display: contents). */
35
+ export declare const assistantMessageMarkdownCodeBlockVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
36
+ /** Scrolls sideways in the narrow panel; the frame is `tableContainerVariants`. */
37
+ export declare const assistantMessageMarkdownTableVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
38
+ export declare const assistantMessageMarkdownTableGridVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;