@homecode/ui 5.9.2 → 5.11.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/dist/esm/index.js +2 -0
- package/dist/esm/src/components/Autocomplete/Autocomplete.js +3 -2
- package/dist/esm/src/components/Chat/ChatFormattedText.js +4 -319
- package/dist/esm/src/components/Chat/ChatPrompt.js +15 -13
- package/dist/esm/src/components/Chat/ChatPrompt.styl.js +2 -2
- package/dist/esm/src/components/Chat/ChatView.js +2 -3
- package/dist/esm/src/components/Chat/ChatView.styl.js +2 -2
- package/dist/esm/src/components/Dialogue/Dialogue.styl.js +1 -1
- package/dist/esm/src/components/Expand/Expand.styl.js +1 -1
- package/dist/esm/src/components/FormattedText/FormattedText.js +323 -0
- package/dist/esm/src/components/FormattedText/FormattedText.styl.js +7 -0
- package/dist/esm/src/components/InputFile/InputFile.js +3 -2
- package/dist/esm/src/components/Menu/Menu.styl.js +1 -1
- package/dist/esm/src/components/NestedMenu/NestedMenu.js +2 -2
- package/dist/esm/src/components/NestedMenu/NestedMenu.styl.js +2 -2
- package/dist/esm/src/components/Nudge/Nudge.js +15 -0
- package/dist/esm/src/components/Nudge/Nudge.styl.js +7 -0
- package/dist/esm/src/components/Tooltip/TooltipSimple.js +4 -4
- package/dist/esm/src/tiptap/slash-mention/SlashSuggestionList.styl.js +1 -1
- package/dist/esm/types/src/components/Chat/Chat.types.d.ts +6 -10
- package/dist/esm/types/src/components/Chat/ChatFormattedText.d.ts +1 -2
- package/dist/esm/types/src/components/Chat/ChatPrompt.d.ts +1 -1
- package/dist/esm/types/src/components/Chat/ChatView.d.ts +1 -1
- package/dist/esm/types/src/components/FormattedText/FormattedText.d.ts +3 -0
- package/dist/esm/types/src/components/FormattedText/FormattedText.types.d.ts +8 -0
- package/dist/esm/types/src/components/FormattedText/index.d.ts +2 -0
- package/dist/esm/types/src/components/NestedMenu/NestedMenu.d.ts +1 -1
- package/dist/esm/types/src/components/NestedMenu/NestedMenu.types.d.ts +2 -0
- package/dist/esm/types/src/components/Nudge/Nudge.d.ts +16 -0
- package/dist/esm/types/src/components/Nudge/index.d.ts +2 -0
- package/dist/esm/types/src/components/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/esm/src/components/Chat/ChatFormattedText.styl.js +0 -7
package/dist/esm/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { DropZone } from './src/components/DropZone/DropZone.js';
|
|
|
21
21
|
export { Expand } from './src/components/Expand/Expand.js';
|
|
22
22
|
export { Flex } from './src/components/Flex/Flex.js';
|
|
23
23
|
export { Form } from './src/components/Form/Form.js';
|
|
24
|
+
export { FormattedText } from './src/components/FormattedText/FormattedText.js';
|
|
24
25
|
export { Gap } from './src/components/Gap/Gap.js';
|
|
25
26
|
export { Gallery, normalizeGalleryItem } from './src/components/Gallery/Gallery.js';
|
|
26
27
|
export { GridLayout } from './src/components/GridLayout/GridLayout.js';
|
|
@@ -35,6 +36,7 @@ export { LightBox } from './src/components/LightBox/LightBox.js';
|
|
|
35
36
|
export { Menu } from './src/components/Menu/Menu.js';
|
|
36
37
|
export { NestedMenu, NestedMenuItemRow, NestedMenuLabel } from './src/components/NestedMenu/NestedMenu.js';
|
|
37
38
|
export { Notifications, NotificationsStore } from './src/components/Notifications/Notifications.js';
|
|
39
|
+
export { Nudge, NudgeError, NudgeText } from './src/components/Nudge/Nudge.js';
|
|
38
40
|
export { Paranja } from './src/components/Paranja/Paranja.js';
|
|
39
41
|
export { ANIMATION_DURATION, Popup } from './src/components/Popup/Popup.js';
|
|
40
42
|
export { Portal } from './src/components/Portal/Portal.js';
|
|
@@ -32,14 +32,14 @@ import '../Router/Link/Link.styl.js';
|
|
|
32
32
|
import '../Portal/Portal.js';
|
|
33
33
|
import '../Paranja/Paranja.styl.js';
|
|
34
34
|
import '../Table/Table.styl.js';
|
|
35
|
-
import '../
|
|
35
|
+
import '../FormattedText/FormattedText.styl.js';
|
|
36
36
|
import '../Expand/Expand.styl.js';
|
|
37
37
|
import '../Chat/ChatMessage.styl.js';
|
|
38
38
|
import '../PromptComposer/PromptComposer.js';
|
|
39
39
|
import '../Chat/ChatPrompt.styl.js';
|
|
40
|
+
import '../TextShimmer/TextShimmer.js';
|
|
40
41
|
import '../ThinkingOutline/ThinkingOutline.styl.js';
|
|
41
42
|
import '../Chat/ChatView.styl.js';
|
|
42
|
-
import '../TextShimmer/TextShimmer.js';
|
|
43
43
|
import '../Container/Container.js';
|
|
44
44
|
import '../DatePicker/DatePicker.styl.js';
|
|
45
45
|
import 'moment';
|
|
@@ -72,6 +72,7 @@ import '../LightBox/LightBox.styl.js';
|
|
|
72
72
|
import '../NestedMenu/NestedMenu.js';
|
|
73
73
|
import '../Notifications/store.js';
|
|
74
74
|
import '../Notifications/Notifications.styl.js';
|
|
75
|
+
import '../Nudge/Nudge.styl.js';
|
|
75
76
|
import '../PopupMenu/PopupMenu.styl.js';
|
|
76
77
|
import '../Progress/Progress.styl.js';
|
|
77
78
|
import '@tiptap/extensions';
|
|
@@ -1,323 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import
|
|
3
|
-
import { Button } from '../Button/Button.js';
|
|
4
|
-
import { Link } from '../Router/Link/Link.js';
|
|
5
|
-
import { Table } from '../Table/Table.js';
|
|
6
|
-
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
7
|
-
import S from './ChatFormattedText.styl.js';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { FormattedText } from '../FormattedText/FormattedText.js';
|
|
8
3
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
if (first !== '{' && first !== '[')
|
|
12
|
-
return -1;
|
|
13
|
-
const stack = first === '{' ? ['}'] : [']'];
|
|
14
|
-
let i = start + 1;
|
|
15
|
-
let inString = false;
|
|
16
|
-
let escape = false;
|
|
17
|
-
while (i < content.length && stack.length > 0) {
|
|
18
|
-
const c = content[i];
|
|
19
|
-
if (inString) {
|
|
20
|
-
if (escape)
|
|
21
|
-
escape = false;
|
|
22
|
-
else if (c === '\\')
|
|
23
|
-
escape = true;
|
|
24
|
-
else if (c === '"')
|
|
25
|
-
inString = false;
|
|
26
|
-
i++;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (c === '"') {
|
|
30
|
-
inString = true;
|
|
31
|
-
i++;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (c === '{') {
|
|
35
|
-
stack.push('}');
|
|
36
|
-
i++;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (c === '[') {
|
|
40
|
-
stack.push(']');
|
|
41
|
-
i++;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (c === '}' || c === ']') {
|
|
45
|
-
if (c !== stack[stack.length - 1])
|
|
46
|
-
return -1;
|
|
47
|
-
stack.pop();
|
|
48
|
-
i++;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
i++;
|
|
52
|
-
}
|
|
53
|
-
return stack.length > 0 ? -1 : i;
|
|
54
|
-
}
|
|
55
|
-
function applyInjectors(text, injectors) {
|
|
56
|
-
let result = [text];
|
|
57
|
-
injectors.forEach(fn => {
|
|
58
|
-
let i = 0;
|
|
59
|
-
while (i < result.length) {
|
|
60
|
-
const item = result[i];
|
|
61
|
-
if (typeof item === 'string') {
|
|
62
|
-
const res = fn(item);
|
|
63
|
-
if (!res) {
|
|
64
|
-
i++;
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const { elem, index, length } = res;
|
|
68
|
-
if (index >= 0) {
|
|
69
|
-
const before = item.substring(0, index);
|
|
70
|
-
const after = item.substring(index + length);
|
|
71
|
-
result.splice(i, 1, before, elem, after);
|
|
72
|
-
if (after.length > 0)
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
i++;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
function ChatFormattedText({ text, className, onButtonClick, }) {
|
|
82
|
-
const injectLines = (content) => {
|
|
83
|
-
const matches = content.match(/\n---\n/);
|
|
84
|
-
if (!matches)
|
|
85
|
-
return null;
|
|
86
|
-
return {
|
|
87
|
-
elem: jsx("div", { className: S.line }),
|
|
88
|
-
index: matches.index,
|
|
89
|
-
length: matches[0].length,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
const injectBullet = (content) => {
|
|
93
|
-
const matches = content.match(/(\n|^)([ \t]*)(-|\*|\+)\s/);
|
|
94
|
-
if (!matches)
|
|
95
|
-
return null;
|
|
96
|
-
return {
|
|
97
|
-
elem: (jsxs(Fragment, { children: [matches[1] === '\n' && jsx("br", {}), jsx("div", { className: S.bullet })] })),
|
|
98
|
-
index: matches.index,
|
|
99
|
-
length: matches[0].length,
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
const injectNumbered = (content) => {
|
|
103
|
-
const matches = content.match(/(\n|^)([ \t]*)(\d+)\.\s+/);
|
|
104
|
-
if (!matches)
|
|
105
|
-
return null;
|
|
106
|
-
return {
|
|
107
|
-
elem: (jsxs(Fragment, { children: [matches[1] === '\n' && jsx("br", {}), jsxs("span", { className: S.numberedIndex, children: [matches[3], "."] })] })),
|
|
108
|
-
index: matches.index,
|
|
109
|
-
length: matches[0].length,
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
const injectBold = (content) => {
|
|
113
|
-
const matches = content.match(/\*\*(.*?)\*\*/);
|
|
114
|
-
if (!matches)
|
|
115
|
-
return null;
|
|
116
|
-
return {
|
|
117
|
-
elem: jsx("strong", { children: matches[1] }),
|
|
118
|
-
index: matches.index,
|
|
119
|
-
length: matches[0].length,
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
const injectItalic = (content) => {
|
|
123
|
-
const matches = content.match(/\*(.*?)\*/);
|
|
124
|
-
if (!matches)
|
|
125
|
-
return null;
|
|
126
|
-
return {
|
|
127
|
-
elem: jsx("em", { children: matches[1] }),
|
|
128
|
-
index: matches.index,
|
|
129
|
-
length: matches[0].length,
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
const injectCodeBlock = (content) => {
|
|
133
|
-
const multiline = content.match(/```(\w+)?[\s\n]*([\s\S]*?)```/);
|
|
134
|
-
if (multiline) {
|
|
135
|
-
return {
|
|
136
|
-
elem: jsx("code", { className: S.codeBlock, children: multiline[2].trim() }),
|
|
137
|
-
index: multiline.index,
|
|
138
|
-
length: multiline[0].length,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
const inline = content.match(/`([^`\n]+)`/);
|
|
142
|
-
if (!inline)
|
|
143
|
-
return null;
|
|
144
|
-
return {
|
|
145
|
-
elem: jsx("code", { className: S.codeInline, children: inline[1] }),
|
|
146
|
-
index: inline.index,
|
|
147
|
-
length: inline[0].length,
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
const injectPrettyJson = (content) => {
|
|
151
|
-
let searchFrom = 0;
|
|
152
|
-
while (searchFrom < content.length) {
|
|
153
|
-
let start = -1;
|
|
154
|
-
for (let j = searchFrom; j < content.length; j++) {
|
|
155
|
-
if (content[j] === '{' || content[j] === '[') {
|
|
156
|
-
start = j;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (start < 0)
|
|
161
|
-
return null;
|
|
162
|
-
const endExclusive = findJsonEndExclusive(content, start);
|
|
163
|
-
if (endExclusive < 0) {
|
|
164
|
-
searchFrom = start + 1;
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
const slice = content.slice(start, endExclusive);
|
|
168
|
-
try {
|
|
169
|
-
const parsed = JSON.parse(slice);
|
|
170
|
-
return {
|
|
171
|
-
elem: (jsx("pre", { className: S.jsonPre, children: JSON.stringify(parsed, null, 2) })),
|
|
172
|
-
index: start,
|
|
173
|
-
length: slice.length,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
searchFrom = start + 1;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return null;
|
|
181
|
-
};
|
|
182
|
-
const injectLinks = (content) => {
|
|
183
|
-
const markdown = content.match(/\[([^\]]+)\]\(([^)]+)\)/);
|
|
184
|
-
if (markdown) {
|
|
185
|
-
let url = markdown[2];
|
|
186
|
-
if (url.startsWith('www.'))
|
|
187
|
-
url = `https://${url}`;
|
|
188
|
-
return {
|
|
189
|
-
elem: (jsx(Tooltip, { content: url, direction: "top", children: jsx(Link, { href: url, inline: true, target: "_blank", children: markdown[1] }) })),
|
|
190
|
-
index: markdown.index,
|
|
191
|
-
length: markdown[0].length,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
const bareDomainTlds = 'com|org|net|edu|gov|mil|int|info|biz|co|io|ai|app|dev|me|tv|cc|ly|sh|so|gg|fm|ws|xyz|tech|cloud|store|online|site|shop|blog|news|link|page|uk|us|ca|de|fr|jp|cn|ru|br|in|au|it|es|nl|se|no|fi|pl|ch|be|at|dk|cz|gr|hu|ie|pt|ro|tr|kr|mx|za|sg|hk|tw|nz|il|ae|ua';
|
|
195
|
-
const matches = content.match(new RegExp(`(https?:\\/\\/[^\\s<>"']+|www\\.[^\\s<>"']+|[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\\.(?:${bareDomainTlds})\\b[^\\s<>"']*)`, 'i'));
|
|
196
|
-
if (!matches)
|
|
197
|
-
return null;
|
|
198
|
-
let url = matches[0];
|
|
199
|
-
if (url.startsWith('www.'))
|
|
200
|
-
url = `https://${url}`;
|
|
201
|
-
return {
|
|
202
|
-
elem: (jsx(Tooltip, { content: url, direction: "top", children: jsx(Link, { href: url, inline: true, target: "_blank", children: matches[0] }) })),
|
|
203
|
-
index: matches.index,
|
|
204
|
-
length: matches[0].length,
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
const injectButtons = (content) => {
|
|
208
|
-
if (!onButtonClick)
|
|
209
|
-
return null;
|
|
210
|
-
const matches = content.match(/\[(.*?):(.*?)\|([^\]]+)\]/);
|
|
211
|
-
if (!matches)
|
|
212
|
-
return null;
|
|
213
|
-
const [data, label] = matches[0]
|
|
214
|
-
.replace('[', '')
|
|
215
|
-
.replace(']', '')
|
|
216
|
-
.split('|');
|
|
217
|
-
const [varName, value] = data.split(':');
|
|
218
|
-
return {
|
|
219
|
-
elem: (jsx(Button, { variant: "default", size: "s", round: true, onClick: () => onButtonClick({ text: label, [varName]: value }), children: label })),
|
|
220
|
-
index: matches.index,
|
|
221
|
-
length: matches[0].length,
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
225
|
-
const processCellContent = (value, depth = 0) => applyInjectors(value, [
|
|
226
|
-
injectCodeBlock,
|
|
227
|
-
injectPrettyJson,
|
|
228
|
-
...(depth === 0
|
|
229
|
-
? [
|
|
230
|
-
(content) => {
|
|
231
|
-
const matches = content.match(/(^|\n)(#{1,6})\s+([^\n]+)/);
|
|
232
|
-
if (!matches)
|
|
233
|
-
return null;
|
|
234
|
-
const Tag = headingTags[Math.min(matches[2].length, 6) - 1];
|
|
235
|
-
return {
|
|
236
|
-
elem: React__default.createElement(Tag, {}, ...processCellContent(matches[3], depth + 1)),
|
|
237
|
-
index: matches.index,
|
|
238
|
-
length: matches[0].length,
|
|
239
|
-
};
|
|
240
|
-
},
|
|
241
|
-
]
|
|
242
|
-
: []),
|
|
243
|
-
injectLines,
|
|
244
|
-
injectLinks,
|
|
245
|
-
injectBold,
|
|
246
|
-
injectItalic,
|
|
247
|
-
injectBullet,
|
|
248
|
-
injectNumbered,
|
|
249
|
-
injectButtons,
|
|
250
|
-
]);
|
|
251
|
-
const injectHeading = (content) => {
|
|
252
|
-
const matches = content.match(/(^|\n)(#{1,6})\s+([^\n]+)/);
|
|
253
|
-
if (!matches)
|
|
254
|
-
return null;
|
|
255
|
-
const Tag = headingTags[Math.min(matches[2].length, 6) - 1];
|
|
256
|
-
return {
|
|
257
|
-
elem: React__default.createElement(Tag, {}, ...processCellContent(matches[3], 1)),
|
|
258
|
-
index: matches.index,
|
|
259
|
-
length: matches[0].length,
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
const injectTables = (content) => {
|
|
263
|
-
const withSep = content.match(/(\n|^)(\|[^\n]+\|\s*\n)(\|[\s:-]+(?:\|[\s:-]+)*\|\s*\n)((?:\|[^\n]+\|\s*\n?)+)/);
|
|
264
|
-
const withoutSep = withSep
|
|
265
|
-
? null
|
|
266
|
-
: content.match(/(\n|^)(\|[^\n]+\|\s*\n)((?:\|[^\n]+\|\s*\n?)+)/);
|
|
267
|
-
const matches = withSep || withoutSep;
|
|
268
|
-
if (!matches)
|
|
269
|
-
return null;
|
|
270
|
-
const hasSeparator = Boolean(withSep);
|
|
271
|
-
const headerRow = matches[2].trim();
|
|
272
|
-
const dataRows = (hasSeparator ? matches[4] : matches[3]).trim();
|
|
273
|
-
const headers = headerRow.split('|').map(cell => cell.trim()).slice(1, -1);
|
|
274
|
-
if (headers.length === 0)
|
|
275
|
-
return null;
|
|
276
|
-
const rows = dataRows
|
|
277
|
-
.split('\n')
|
|
278
|
-
.map(row => row.trim())
|
|
279
|
-
.filter(row => row.startsWith('|') && row.endsWith('|'))
|
|
280
|
-
.map(row => row.split('|').map(cell => cell.trim()).slice(1, -1))
|
|
281
|
-
.filter(row => row.length > 0);
|
|
282
|
-
if (rows.length === 0)
|
|
283
|
-
return null;
|
|
284
|
-
const maxCols = Math.max(headers.length, ...rows.map(row => row.length));
|
|
285
|
-
const paddedHeaders = [
|
|
286
|
-
...headers,
|
|
287
|
-
...Array(maxCols - headers.length).fill(''),
|
|
288
|
-
];
|
|
289
|
-
const columns = paddedHeaders.map((header, idx) => ({
|
|
290
|
-
id: `col-${idx}`,
|
|
291
|
-
label: processCellContent(header),
|
|
292
|
-
dataField: `col-${idx}`,
|
|
293
|
-
render: (data) => processCellContent(data[`col-${idx}`] || ''),
|
|
294
|
-
}));
|
|
295
|
-
const tableData = rows.map((row, rowIdx) => {
|
|
296
|
-
const rowData = { id: `row-${rowIdx}` };
|
|
297
|
-
paddedHeaders.forEach((_, colIdx) => {
|
|
298
|
-
rowData[`col-${colIdx}`] = row[colIdx] || '';
|
|
299
|
-
});
|
|
300
|
-
return rowData;
|
|
301
|
-
});
|
|
302
|
-
return {
|
|
303
|
-
elem: (jsx(Table, { size: "s", variant: "plain", columns: columns, data: tableData, className: S.table })),
|
|
304
|
-
index: matches.index + (matches[1]?.length || 0),
|
|
305
|
-
length: matches[0].length - (matches[1]?.length || 0),
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
return (jsx("div", { className: className, children: applyInjectors(text, [
|
|
309
|
-
injectTables,
|
|
310
|
-
injectCodeBlock,
|
|
311
|
-
injectPrettyJson,
|
|
312
|
-
injectHeading,
|
|
313
|
-
injectLines,
|
|
314
|
-
injectLinks,
|
|
315
|
-
injectBold,
|
|
316
|
-
injectItalic,
|
|
317
|
-
injectBullet,
|
|
318
|
-
injectNumbered,
|
|
319
|
-
injectButtons,
|
|
320
|
-
]) }));
|
|
4
|
+
function ChatFormattedText(props) {
|
|
5
|
+
return jsx(FormattedText, { ...props });
|
|
321
6
|
}
|
|
322
7
|
|
|
323
8
|
export { ChatFormattedText };
|
|
@@ -5,6 +5,7 @@ import { Icon } from '../Icon/Icon.js';
|
|
|
5
5
|
import { PromptComposer } from '../PromptComposer/PromptComposer.js';
|
|
6
6
|
import S from './ChatPrompt.styl.js';
|
|
7
7
|
import { Select2 } from '../Select/Select2.js';
|
|
8
|
+
import { TextShimmer } from '../TextShimmer/TextShimmer.js';
|
|
8
9
|
import { ThinkingOutline } from '../ThinkingOutline/ThinkingOutline.js';
|
|
9
10
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
10
11
|
import cn from 'classnames';
|
|
@@ -12,12 +13,13 @@ import cn from 'classnames';
|
|
|
12
13
|
const DEFAULT_MODELS = [
|
|
13
14
|
{ id: 'auto', label: 'Auto Router' },
|
|
14
15
|
];
|
|
15
|
-
function ChatPrompt({ value, onChange, onSubmit, disabled, isPrompting, placeholder = 'Message', className, showAttach = true, onAttach, attachAccept, showModelSelector = true, models = DEFAULT_MODELS, model, onModelChange, }) {
|
|
16
|
+
function ChatPrompt({ value, onChange, onSubmit, disabled, isPrompting, status, promptingLabel = 'Thinking…', placeholder = 'Message', className, showAttach = true, onAttach, attachAccept, showModelSelector = true, models = DEFAULT_MODELS, model, onModelChange, }) {
|
|
16
17
|
const fileInputRef = useRef(null);
|
|
17
18
|
const composerRef = useRef(null);
|
|
18
19
|
const [uncontrolledModel, setUncontrolledModel] = useState(model ?? models[0]?.id ?? 'auto');
|
|
19
20
|
const modelId = model ?? uncontrolledModel;
|
|
20
21
|
const canSubmit = !disabled && Boolean(value.trim());
|
|
22
|
+
const statusNode = status || (isPrompting && promptingLabel);
|
|
21
23
|
const setModel = (id) => {
|
|
22
24
|
if (model === undefined)
|
|
23
25
|
setUncontrolledModel(id);
|
|
@@ -35,24 +37,24 @@ function ChatPrompt({ value, onChange, onSubmit, disabled, isPrompting, placehol
|
|
|
35
37
|
if (!next || disabled)
|
|
36
38
|
return;
|
|
37
39
|
onSubmit(next);
|
|
38
|
-
} }), jsxs("div", { className: S.buttons, onClick: onButtonsWrapperClick, children: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
} }), jsxs("div", { className: S.buttons, onClick: onButtonsWrapperClick, children: [showAttach && (jsxs(Fragment, { children: [jsx("input", { ref: fileInputRef, type: "file", accept: attachAccept, multiple: true, className: S.fileInput, disabled: disabled, onChange: e => {
|
|
41
|
+
const files = e.target.files;
|
|
42
|
+
if (files?.length)
|
|
43
|
+
onAttach?.(Array.from(files));
|
|
44
|
+
e.target.value = '';
|
|
45
|
+
} }), jsx(Tooltip, { content: "Attach", direction: "right", children: jsx(Button, { variant: "text", className: S.attachButton, disabled: disabled, "aria-label": "Attach", onClick: () => fileInputRef.current?.click(), children: jsx(Icon, { size: "m", type: "plus" }) }) })] })), statusNode && (jsx("div", { className: S.status, children: jsx(TextShimmer, { children: statusNode }) })), jsx("div", { className: S.gap }), showModelSelector && !isPrompting && (jsx(Select2, { className: S.promptModelSelector, label: "", size: "s", disableLabel: true, hideRequiredStar: true, round: true, options: models, value: modelId, disabled: disabled, triggerProps: { variant: 'clear' }, popupProps: {
|
|
44
46
|
direction: 'top-right',
|
|
45
47
|
round: true,
|
|
46
48
|
}, onChange: next => {
|
|
47
49
|
if (next == null || Array.isArray(next))
|
|
48
50
|
return;
|
|
49
51
|
setModel(String(next));
|
|
50
|
-
} })), jsx(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
} })), jsx(Button, { className: cn(S.button, S.submit), variant: "text", type: "submit", round: true, square: true, disabled: !canSubmit, "aria-label": "Send", onClick: () => {
|
|
53
|
+
const next = value.trim();
|
|
54
|
+
if (!next || disabled)
|
|
55
|
+
return;
|
|
56
|
+
onSubmit(next);
|
|
57
|
+
}, children: jsx(Icon, { type: "arrowUp", className: S.submitIcon }) })] })] }));
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
export { ChatPrompt };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".ChatPrompt_root__jEydp{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);background-color:var(--decent-color-alpha-500);background-color:var(--accent-color-alpha-50);border-radius:var(--p-5);box-shadow:0 0 0 1px var(--active-color-alpha-100);display:flex;flex-direction:column;flex-wrap:wrap;font-size:80%;font-size:calc(80%*var(--dialogue-text-scale, 1));margin:2px auto;max-width:600px;min-height:76px;min-height:calc(var(--prompt-height, 80px) - 4px);position:relative;transition:box-shadow .4s ease-out,border-top-left-radius .2s ease,border-top-right-radius .2s ease,background-color .5s ease;width:100%}.ChatPrompt_root__jEydp:after{border-radius:inherit;box-shadow:inset 0 0 0 1px var(--accent-color-alpha-100),0 0 0 2px var(--decent-color-alpha-800),0 0 30px 0 var(--decent-color-alpha-500);content:\"\";height:100%;left:0;pointer-events:none;position:absolute;top:0;transition:box-shadow .4s ease-out;width:100%;z-index:-2}.ChatPrompt_root__jEydp:focus-within:after,.ChatPrompt_root__jEydp:hover:after{box-shadow:0 0 0 2px var(--decent-color-alpha-500),0 0 50px 0 var(--decent-color-alpha-500)}.ChatPrompt_root__jEydp:focus-within,.ChatPrompt_root__jEydp:hover{box-shadow:inset 0 0 0 1px var(--decent-color-alpha-500)}.ChatPrompt_root__jEydp:hover{box-shadow:inset 0 0 0 1px var(--active-color-alpha-300)}.ChatPrompt_root__jEydp:focus-within{box-shadow:inset 0 0 0 1px var(--active-color-alpha-500)}.ChatPrompt_composer__uWvF4{background-color:transparent!important;position:relative;transition:opacity .2s ease-out;width:100%;z-index:1}.ChatPrompt_composer__uWvF4 .ProseMirror,.ChatPrompt_composer__uWvF4 .editorMount .promptComposerEditor{caret-color:var(--accent-color);font-size:16px!important;font-size:calc(16px*var(--dialogue-text-scale, 1))!important;min-height:1.5em!important;padding:10px var(--p-7) 0 14px!important}.ChatPrompt_composer__uWvF4 .ProseMirror:focus{box-shadow:inset 0 0 0 2px none}.ChatPrompt_composer__uWvF4 .promptComposerEmptyEditor .promptComposerEmptyNode:before{color:var(--accent-color-alpha-500)}.ChatPrompt_buttons__gm2Lm{align-items:center;cursor:text;display:flex;flex-direction:row
|
|
4
|
-
var S = {"root":"ChatPrompt_root__jEydp","composer":"ChatPrompt_composer__uWvF4","buttons":"ChatPrompt_buttons__gm2Lm","button":"ChatPrompt_button__h1lLp","submit":"ChatPrompt_submit__CICZy","submitIcon":"ChatPrompt_submitIcon__yqHzk","gap":"ChatPrompt_gap__xkA50","promptModelSelector":"ChatPrompt_promptModelSelector__RZpMR","fileInput":"ChatPrompt_fileInput__l36Lj","attachButton":"ChatPrompt_attachButton__vLVfy"};
|
|
3
|
+
var css_248z = ".ChatPrompt_root__jEydp{-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);background-color:var(--decent-color-alpha-500);background-color:var(--accent-color-alpha-50);border-radius:var(--p-5);box-shadow:0 0 0 1px var(--active-color-alpha-100);display:flex;flex-direction:column;flex-wrap:wrap;font-size:80%;font-size:calc(80%*var(--dialogue-text-scale, 1));margin:2px auto;max-width:600px;min-height:76px;min-height:calc(var(--prompt-height, 80px) - 4px);position:relative;transition:box-shadow .4s ease-out,border-top-left-radius .2s ease,border-top-right-radius .2s ease,background-color .5s ease;width:100%}.ChatPrompt_root__jEydp:after{border-radius:inherit;box-shadow:inset 0 0 0 1px var(--accent-color-alpha-100),0 0 0 2px var(--decent-color-alpha-800),0 0 30px 0 var(--decent-color-alpha-500);content:\"\";height:100%;left:0;pointer-events:none;position:absolute;top:0;transition:box-shadow .4s ease-out;width:100%;z-index:-2}.ChatPrompt_root__jEydp:focus-within:after,.ChatPrompt_root__jEydp:hover:after{box-shadow:0 0 0 2px var(--decent-color-alpha-500),0 0 50px 0 var(--decent-color-alpha-500)}.ChatPrompt_root__jEydp:focus-within,.ChatPrompt_root__jEydp:hover{box-shadow:inset 0 0 0 1px var(--decent-color-alpha-500)}.ChatPrompt_root__jEydp:hover{box-shadow:inset 0 0 0 1px var(--active-color-alpha-300)}.ChatPrompt_root__jEydp:focus-within{box-shadow:inset 0 0 0 1px var(--active-color-alpha-500)}.ChatPrompt_composer__uWvF4{background-color:transparent!important;position:relative;transition:opacity .2s ease-out;width:100%;z-index:1}.ChatPrompt_composer__uWvF4 .ProseMirror,.ChatPrompt_composer__uWvF4 .editorMount .promptComposerEditor{caret-color:var(--accent-color);font-size:16px!important;font-size:calc(16px*var(--dialogue-text-scale, 1))!important;min-height:1.5em!important;padding:10px var(--p-7) 0 14px!important}.ChatPrompt_composer__uWvF4 .ProseMirror:focus{box-shadow:inset 0 0 0 2px none}.ChatPrompt_composer__uWvF4 .promptComposerEmptyEditor .promptComposerEmptyNode:before{color:var(--accent-color-alpha-500)}.ChatPrompt_buttons__gm2Lm{align-items:center;cursor:text;display:flex;flex-direction:row;flex-shrink:0;flex-wrap:wrap;gap:6px;justify-content:flex-start;padding:0 2px 0 6px;transform:translateY(-2px);width:100%;z-index:1}.ChatPrompt_buttons__gm2Lm svg{transition:.2s ease-out;transition-property:filter,scale}.ChatPrompt_button__h1lLp{background-color:transparent!important;padding:0 var(--p-2);position:relative}.ChatPrompt_button__h1lLp:focus,.ChatPrompt_button__h1lLp:hover{opacity:1}.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy{background-color:var(--active-color)!important;box-shadow:0 1px 1px 0 rgba(0,0,0,.6);color:var(--decent-color)!important;margin-left:var(--p-2);transition:filter .2s ease-out,opacity .5s ease-out}.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy svg{color:var(--decent-color)!important}.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy:focus,.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy:focus-visible,.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy:hover{filter:drop-shadow(0 0 14px var(--active-color))}.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy[disabled]{background-color:inherit!important;box-shadow:none;filter:none;pointer-events:none}.ChatPrompt_button__h1lLp.ChatPrompt_submit__CICZy[disabled] svg{color:var(--accent-color-alpha-500)!important}.ChatPrompt_submitIcon__yqHzk{display:block}.ChatPrompt_gap__xkA50{flex-grow:1}.ChatPrompt_promptModelSelector__RZpMR{flex-shrink:0;max-width:calc(100% - 200px);opacity:.5;transition:opacity .2s ease-out}.ChatPrompt_promptModelSelector__RZpMR:hover{opacity:1}.ChatPrompt_fileInput__l36Lj{display:none}.ChatPrompt_attachButton__vLVfy{flex-shrink:0;margin-left:-8px;opacity:.5;position:relative;z-index:4}.ChatPrompt_status__RpNcl{align-items:center;display:flex;flex-shrink:0;font-size:12.8px;font-size:calc(12.8px*var(--dialogue-text-scale, 1));pointer-events:none;white-space:nowrap}.ChatPrompt_status__RpNcl:first-child{padding-left:var(--p-3)}";
|
|
4
|
+
var S = {"root":"ChatPrompt_root__jEydp","composer":"ChatPrompt_composer__uWvF4","buttons":"ChatPrompt_buttons__gm2Lm","button":"ChatPrompt_button__h1lLp","submit":"ChatPrompt_submit__CICZy","submitIcon":"ChatPrompt_submitIcon__yqHzk","gap":"ChatPrompt_gap__xkA50","promptModelSelector":"ChatPrompt_promptModelSelector__RZpMR","fileInput":"ChatPrompt_fileInput__l36Lj","attachButton":"ChatPrompt_attachButton__vLVfy","status":"ChatPrompt_status__RpNcl"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -3,12 +3,11 @@ import { useRef, useEffect } from 'react';
|
|
|
3
3
|
import { ChatMessage } from './ChatMessage.js';
|
|
4
4
|
import S from './ChatView.styl.js';
|
|
5
5
|
import { Scroll } from '../Scroll/Scroll.js';
|
|
6
|
-
import { TextShimmer } from '../TextShimmer/TextShimmer.js';
|
|
7
6
|
import cn from 'classnames';
|
|
8
7
|
import { isPlanMessageContent } from './content.js';
|
|
9
8
|
import { scrollTo } from '../../tools/scroll.js';
|
|
10
9
|
|
|
11
|
-
function ChatView({ messages, isPrompting,
|
|
10
|
+
function ChatView({ messages, isPrompting, emptyLabel = 'Start the conversation', className, messagesClassName, footer, onButtonClick, footerClassName, }) {
|
|
12
11
|
const listRef = useRef(null);
|
|
13
12
|
const visible = messages.filter(message => !isPlanMessageContent(message.content));
|
|
14
13
|
useEffect(() => {
|
|
@@ -24,7 +23,7 @@ function ChatView({ messages, isPrompting, promptingLabel = 'Thinking…', empty
|
|
|
24
23
|
prev.role === message.role &&
|
|
25
24
|
message.role !== 'SYSTEM';
|
|
26
25
|
return (jsx(ChatMessage, { data: message, isStacked: isStacked, isLastMessage: index === visible.length - 1, onButtonClick: onButtonClick }, message.id || `${message.role}-${index}`));
|
|
27
|
-
})] }), footer && (
|
|
26
|
+
})] }), footer && (jsx("div", { className: cn(S.footer, footerClassName), children: footer }))] }));
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export { ChatView };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".ChatView_root__fRLUe{--prompt-height:80px;display:flex;flex-direction:column;height:100%;min-height:0;position:relative;width:100%}.ChatView_messages__XjC53{flex:1;min-height:0}.ChatView_messagesInner__oRfmN{display:flex;flex-direction:column;height:-moz-fit-content;height:fit-content;min-height:100%;padding:var(--p-10) calc(50% - 300px) 0}.ChatView_messagesInnerWithPrompt__AuC8M{padding-bottom:20px}.ChatView_empty__5yGXV{margin:auto;opacity:.6;padding:24px;text-align:center}.
|
|
4
|
-
var S = {"root":"ChatView_root__fRLUe","messages":"ChatView_messages__XjC53","messagesInner":"ChatView_messagesInner__oRfmN","messagesInnerWithPrompt":"ChatView_messagesInnerWithPrompt__AuC8M","empty":"ChatView_empty__5yGXV","
|
|
3
|
+
var css_248z = ".ChatView_root__fRLUe{--prompt-height:80px;display:flex;flex-direction:column;height:100%;max-height:100%;min-height:0;position:relative;width:100%}.ChatView_messages__XjC53{flex:1;min-height:0}.ChatView_messagesInner__oRfmN{display:flex;flex-direction:column;height:-moz-fit-content;height:fit-content;min-height:100%;padding:var(--p-10) calc(50% - 300px) 0}.ChatView_messagesInnerWithPrompt__AuC8M{padding-bottom:20px}.ChatView_empty__5yGXV{margin:auto;opacity:.6;padding:24px;text-align:center}.ChatView_footer__huDww{height:-moz-fit-content;height:fit-content;margin-top:calc(var(--p-5)*-1);overflow:visible;padding:0;position:relative}";
|
|
4
|
+
var S = {"root":"ChatView_root__fRLUe","messages":"ChatView_messages__XjC53","messagesInner":"ChatView_messagesInner__oRfmN","messagesInnerWithPrompt":"ChatView_messagesInnerWithPrompt__AuC8M","empty":"ChatView_empty__5yGXV","footer":"ChatView_footer__huDww"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Dialogue_dialogOverlay__jjBIa{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:var(--decent-color-alpha-900);inset:0;opacity:0;position:fixed;transition:opacity .2s ease-out;z-index:50}.Dialogue_dialogOverlay__jjBIa.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_fadeIn__RSEB2;animation-timing-function:ease-out;opacity:1}.Dialogue_dialogContent__-Lxde{border-radius:var(--border-radius-l);box-shadow:0 10px 20px rgba(0,0,0,.3),0 0 0 2px var(--decent-color-alpha-800);display:flex;flex-direction:column;left:50%;max-height:calc(100% - var(--p-5));opacity:0;position:fixed;top:50%;transform:translateX(-50%) translateY(-50%) scale(.95);transition:opacity .2s ease-out,transform .2s ease-out;width:-moz-fit-content;width:fit-content;z-index:50}.Dialogue_dialogContent__-Lxde.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueIn__M0tLL;animation-timing-function:ease-out;opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}.Dialogue_dialogContent__-Lxde.Dialogue_isClosed__lHYyZ{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueOut__6bLTY;animation-timing-function:ease-in;opacity:0;pointer-events:none;transform:translateX(-50%) translateY(-50%) scale(.95)}@media (max-width:700px){.Dialogue_dialogContent__-Lxde{max-width:calc(100% - var(--p-5));width:calc(100% - var(--p-5))}}.Dialogue_dialogContent__-Lxde:has(.Dialogue_dialogClose__5q12n) [data-slot=card-header]{padding-right:calc(2rem + var(--p-3))}.Dialogue_size-default__X1sdB{max-width:40rem}.Dialogue_size-login__GyixB{max-width:24rem}.Dialogue_size-wide__HQbiX{max-width:calc(100% - var(--p-5))}@media (min-width:700px){.Dialogue_size-wide__HQbiX{max-width:80rem}}.Dialogue_dialogClose__5q12n{align-items:center;background-color:transparent;border:none;border-radius:var(--border-radius-s);box-shadow:inset 0 0 0 2px none;color:var(--accent-color);cursor:pointer;display:flex;height:2rem;justify-content:center;opacity:.
|
|
3
|
+
var css_248z = ".Dialogue_dialogOverlay__jjBIa{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:var(--decent-color-alpha-900);inset:0;opacity:0;position:fixed;transition:opacity .2s ease-out;z-index:50}.Dialogue_dialogOverlay__jjBIa.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_fadeIn__RSEB2;animation-timing-function:ease-out;opacity:1}.Dialogue_dialogContent__-Lxde{border-radius:var(--border-radius-l);box-shadow:0 10px 20px rgba(0,0,0,.3),0 0 0 2px var(--decent-color-alpha-800);display:flex;flex-direction:column;left:50%;max-height:calc(100% - var(--p-5));opacity:0;position:fixed;top:50%;transform:translateX(-50%) translateY(-50%) scale(.95);transition:opacity .2s ease-out,transform .2s ease-out;width:-moz-fit-content;width:fit-content;z-index:50}.Dialogue_dialogContent__-Lxde.Dialogue_isOpen__gISMb{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueIn__M0tLL;animation-timing-function:ease-out;opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}.Dialogue_dialogContent__-Lxde.Dialogue_isClosed__lHYyZ{animation-duration:.2s;animation-fill-mode:forwards;animation-name:Dialogue_dialogueOut__6bLTY;animation-timing-function:ease-in;opacity:0;pointer-events:none;transform:translateX(-50%) translateY(-50%) scale(.95)}@media (max-width:700px){.Dialogue_dialogContent__-Lxde{max-width:calc(100% - var(--p-5));width:calc(100% - var(--p-5))}}.Dialogue_dialogContent__-Lxde:has(.Dialogue_dialogClose__5q12n) [data-slot=card-header]{padding-right:calc(2rem + var(--p-3))}.Dialogue_size-default__X1sdB{max-width:40rem}.Dialogue_size-login__GyixB{max-width:24rem}.Dialogue_size-wide__HQbiX{max-width:calc(100% - var(--p-5))}@media (min-width:700px){.Dialogue_size-wide__HQbiX{max-width:80rem}}.Dialogue_dialogClose__5q12n{align-items:center;background-color:transparent;border:none;border-radius:var(--border-radius-s);box-shadow:inset 0 0 0 2px none;color:var(--accent-color);cursor:pointer;display:flex;height:2rem;justify-content:center;opacity:.3;position:absolute;right:var(--p-3);top:var(--p-3);transform-origin:center;transition:opacity .2s ease,transform .2s ease;width:2rem;z-index:10}.Dialogue_dialogClose__5q12n:focus-visible,.Dialogue_dialogClose__5q12n:hover{opacity:1;transform:scale(1.1)}.Dialogue_dialogClose__5q12n:focus-visible{box-shadow:0 0 0 2px var(--active-color)}.Dialogue_dialogClose__5q12n:disabled{pointer-events:none}.Dialogue_footerAlignLeft__xQUD8{justify-content:flex-start}.Dialogue_footerAlignCenter__yq9Mu{justify-content:center}.Dialogue_footerAlignRight__Yo7hG{justify-content:flex-end}@keyframes Dialogue_fadeIn__RSEB2{0%{opacity:0}to{opacity:1}}@keyframes Dialogue_dialogueIn__M0tLL{0%{opacity:0;transform:translateX(-50%) translateY(-50%) scale(.95)}to{opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}}@keyframes Dialogue_dialogueOut__6bLTY{0%{opacity:1;transform:translateX(-50%) translateY(-50%) scale(1)}to{opacity:0;transform:translateX(-50%) translateY(-50%) scale(.95)}}";
|
|
4
4
|
var S = {"dialogOverlay":"Dialogue_dialogOverlay__jjBIa","isOpen":"Dialogue_isOpen__gISMb","fadeIn":"Dialogue_fadeIn__RSEB2","dialogContent":"Dialogue_dialogContent__-Lxde","dialogueIn":"Dialogue_dialogueIn__M0tLL","isClosed":"Dialogue_isClosed__lHYyZ","dialogueOut":"Dialogue_dialogueOut__6bLTY","dialogClose":"Dialogue_dialogClose__5q12n","size-default":"Dialogue_size-default__X1sdB","size-login":"Dialogue_size-login__GyixB","size-wide":"Dialogue_size-wide__HQbiX","footerAlignLeft":"Dialogue_footerAlignLeft__xQUD8","footerAlignCenter":"Dialogue_footerAlignCenter__yq9Mu","footerAlignRight":"Dialogue_footerAlignRight__Yo7hG"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Expand_root__zxSvx{display:flex;flex-direction:column}.Expand_root__zxSvx+.Expand_root__zxSvx{margin-top:var(--p-3)}.Expand_header__LxAel{justify-content:space-between}.Expand_headerIcon__CXlwY{transition:transform .2s ease-out}.Expand_isOpen__k6lyZ .Expand_header__LxAel{background-color:var(--active-color-alpha-500)}.Expand_isOpen__k6lyZ .Expand_headerIcon__CXlwY{transform:rotate(90deg)}";
|
|
3
|
+
var css_248z = ".Expand_root__zxSvx{display:flex;flex-direction:column}.Expand_root__zxSvx+.Expand_root__zxSvx{margin-top:var(--p-3)}.Expand_header__LxAel{justify-content:space-between}.Expand_headerIcon__CXlwY{opacity:.4;transform:scale(.7);transition:transform .2s ease-out,opacity .2s ease-out}.Expand_header__LxAel:hover .Expand_headerIcon__CXlwY{opacity:1}.Expand_isOpen__k6lyZ .Expand_header__LxAel{background-color:var(--active-color-alpha-500)}.Expand_isOpen__k6lyZ .Expand_headerIcon__CXlwY{transform:scale(.7) rotate(90deg)}";
|
|
4
4
|
var S = {"root":"Expand_root__zxSvx","header":"Expand_header__LxAel","headerIcon":"Expand_headerIcon__CXlwY","isOpen":"Expand_isOpen__k6lyZ"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { Button } from '../Button/Button.js';
|
|
4
|
+
import { Link } from '../Router/Link/Link.js';
|
|
5
|
+
import { Table } from '../Table/Table.js';
|
|
6
|
+
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
7
|
+
import S from './FormattedText.styl.js';
|
|
8
|
+
|
|
9
|
+
function findJsonEndExclusive(content, start) {
|
|
10
|
+
const first = content[start];
|
|
11
|
+
if (first !== '{' && first !== '[')
|
|
12
|
+
return -1;
|
|
13
|
+
const stack = first === '{' ? ['}'] : [']'];
|
|
14
|
+
let i = start + 1;
|
|
15
|
+
let inString = false;
|
|
16
|
+
let escape = false;
|
|
17
|
+
while (i < content.length && stack.length > 0) {
|
|
18
|
+
const c = content[i];
|
|
19
|
+
if (inString) {
|
|
20
|
+
if (escape)
|
|
21
|
+
escape = false;
|
|
22
|
+
else if (c === '\\')
|
|
23
|
+
escape = true;
|
|
24
|
+
else if (c === '"')
|
|
25
|
+
inString = false;
|
|
26
|
+
i++;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (c === '"') {
|
|
30
|
+
inString = true;
|
|
31
|
+
i++;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (c === '{') {
|
|
35
|
+
stack.push('}');
|
|
36
|
+
i++;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (c === '[') {
|
|
40
|
+
stack.push(']');
|
|
41
|
+
i++;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (c === '}' || c === ']') {
|
|
45
|
+
if (c !== stack[stack.length - 1])
|
|
46
|
+
return -1;
|
|
47
|
+
stack.pop();
|
|
48
|
+
i++;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
i++;
|
|
52
|
+
}
|
|
53
|
+
return stack.length > 0 ? -1 : i;
|
|
54
|
+
}
|
|
55
|
+
function applyInjectors(text, injectors) {
|
|
56
|
+
let result = [text];
|
|
57
|
+
injectors.forEach(fn => {
|
|
58
|
+
let i = 0;
|
|
59
|
+
while (i < result.length) {
|
|
60
|
+
const item = result[i];
|
|
61
|
+
if (typeof item === 'string') {
|
|
62
|
+
const res = fn(item);
|
|
63
|
+
if (!res) {
|
|
64
|
+
i++;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const { elem, index, length } = res;
|
|
68
|
+
if (index >= 0) {
|
|
69
|
+
const before = item.substring(0, index);
|
|
70
|
+
const after = item.substring(index + length);
|
|
71
|
+
result.splice(i, 1, before, elem, after);
|
|
72
|
+
if (after.length > 0)
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
i++;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
function FormattedText({ text, className, onButtonClick, }) {
|
|
82
|
+
const injectLines = (content) => {
|
|
83
|
+
const matches = content.match(/\n---\n/);
|
|
84
|
+
if (!matches)
|
|
85
|
+
return null;
|
|
86
|
+
return {
|
|
87
|
+
elem: jsx("div", { className: S.line }),
|
|
88
|
+
index: matches.index,
|
|
89
|
+
length: matches[0].length,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
const injectBullet = (content) => {
|
|
93
|
+
const matches = content.match(/(\n|^)([ \t]*)(-|\*|\+)\s/);
|
|
94
|
+
if (!matches)
|
|
95
|
+
return null;
|
|
96
|
+
return {
|
|
97
|
+
elem: (jsxs(Fragment, { children: [matches[1] === '\n' && jsx("br", {}), jsx("div", { className: S.bullet })] })),
|
|
98
|
+
index: matches.index,
|
|
99
|
+
length: matches[0].length,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
const injectNumbered = (content) => {
|
|
103
|
+
const matches = content.match(/(\n|^)([ \t]*)(\d+)\.\s+/);
|
|
104
|
+
if (!matches)
|
|
105
|
+
return null;
|
|
106
|
+
return {
|
|
107
|
+
elem: (jsxs(Fragment, { children: [matches[1] === '\n' && jsx("br", {}), jsxs("span", { className: S.numberedIndex, children: [matches[3], "."] })] })),
|
|
108
|
+
index: matches.index,
|
|
109
|
+
length: matches[0].length,
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const injectBold = (content) => {
|
|
113
|
+
const matches = content.match(/\*\*(.*?)\*\*/);
|
|
114
|
+
if (!matches)
|
|
115
|
+
return null;
|
|
116
|
+
return {
|
|
117
|
+
elem: jsx("strong", { children: matches[1] }),
|
|
118
|
+
index: matches.index,
|
|
119
|
+
length: matches[0].length,
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
const injectItalic = (content) => {
|
|
123
|
+
const matches = content.match(/\*(.*?)\*/);
|
|
124
|
+
if (!matches)
|
|
125
|
+
return null;
|
|
126
|
+
return {
|
|
127
|
+
elem: jsx("em", { children: matches[1] }),
|
|
128
|
+
index: matches.index,
|
|
129
|
+
length: matches[0].length,
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
const injectCodeBlock = (content) => {
|
|
133
|
+
const multiline = content.match(/```(\w+)?[\s\n]*([\s\S]*?)```/);
|
|
134
|
+
if (multiline) {
|
|
135
|
+
return {
|
|
136
|
+
elem: jsx("code", { className: S.codeBlock, children: multiline[2].trim() }),
|
|
137
|
+
index: multiline.index,
|
|
138
|
+
length: multiline[0].length,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const inline = content.match(/`([^`\n]+)`/);
|
|
142
|
+
if (!inline)
|
|
143
|
+
return null;
|
|
144
|
+
return {
|
|
145
|
+
elem: jsx("code", { className: S.codeInline, children: inline[1] }),
|
|
146
|
+
index: inline.index,
|
|
147
|
+
length: inline[0].length,
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
const injectPrettyJson = (content) => {
|
|
151
|
+
let searchFrom = 0;
|
|
152
|
+
while (searchFrom < content.length) {
|
|
153
|
+
let start = -1;
|
|
154
|
+
for (let j = searchFrom; j < content.length; j++) {
|
|
155
|
+
if (content[j] === '{' || content[j] === '[') {
|
|
156
|
+
start = j;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (start < 0)
|
|
161
|
+
return null;
|
|
162
|
+
const endExclusive = findJsonEndExclusive(content, start);
|
|
163
|
+
if (endExclusive < 0) {
|
|
164
|
+
searchFrom = start + 1;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const slice = content.slice(start, endExclusive);
|
|
168
|
+
try {
|
|
169
|
+
const parsed = JSON.parse(slice);
|
|
170
|
+
return {
|
|
171
|
+
elem: (jsx("pre", { className: S.jsonPre, children: JSON.stringify(parsed, null, 2) })),
|
|
172
|
+
index: start,
|
|
173
|
+
length: slice.length,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
searchFrom = start + 1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
};
|
|
182
|
+
const injectLinks = (content) => {
|
|
183
|
+
const markdown = content.match(/\[([^\]]+)\]\(([^)]+)\)/);
|
|
184
|
+
if (markdown) {
|
|
185
|
+
let url = markdown[2];
|
|
186
|
+
if (url.startsWith('www.'))
|
|
187
|
+
url = `https://${url}`;
|
|
188
|
+
return {
|
|
189
|
+
elem: (jsx(Tooltip, { content: url, direction: "top", children: jsx(Link, { href: url, inline: true, target: "_blank", children: markdown[1] }) })),
|
|
190
|
+
index: markdown.index,
|
|
191
|
+
length: markdown[0].length,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
const bareDomainTlds = 'com|org|net|edu|gov|mil|int|info|biz|co|io|ai|app|dev|me|tv|cc|ly|sh|so|gg|fm|ws|xyz|tech|cloud|store|online|site|shop|blog|news|link|page|uk|us|ca|de|fr|jp|cn|ru|br|in|au|it|es|nl|se|no|fi|pl|ch|be|at|dk|cz|gr|hu|ie|pt|ro|tr|kr|mx|za|sg|hk|tw|nz|il|ae|ua';
|
|
195
|
+
const matches = content.match(new RegExp(`(https?:\\/\\/[^\\s<>"']+|www\\.[^\\s<>"']+|[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\\.(?:${bareDomainTlds})\\b[^\\s<>"']*)`, 'i'));
|
|
196
|
+
if (!matches)
|
|
197
|
+
return null;
|
|
198
|
+
let url = matches[0];
|
|
199
|
+
if (url.startsWith('www.'))
|
|
200
|
+
url = `https://${url}`;
|
|
201
|
+
return {
|
|
202
|
+
elem: (jsx(Tooltip, { content: url, direction: "top", children: jsx(Link, { href: url, inline: true, target: "_blank", children: matches[0] }) })),
|
|
203
|
+
index: matches.index,
|
|
204
|
+
length: matches[0].length,
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
const injectButtons = (content) => {
|
|
208
|
+
if (!onButtonClick)
|
|
209
|
+
return null;
|
|
210
|
+
const matches = content.match(/\[(.*?):(.*?)\|([^\]]+)\]/);
|
|
211
|
+
if (!matches)
|
|
212
|
+
return null;
|
|
213
|
+
const [data, label] = matches[0]
|
|
214
|
+
.replace('[', '')
|
|
215
|
+
.replace(']', '')
|
|
216
|
+
.split('|');
|
|
217
|
+
const [varName, value] = data.split(':');
|
|
218
|
+
return {
|
|
219
|
+
elem: (jsx(Button, { variant: "default", size: "s", round: true, onClick: () => onButtonClick({ text: label, [varName]: value }), children: label })),
|
|
220
|
+
index: matches.index,
|
|
221
|
+
length: matches[0].length,
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
225
|
+
const processCellContent = (value, depth = 0) => applyInjectors(value, [
|
|
226
|
+
injectCodeBlock,
|
|
227
|
+
injectPrettyJson,
|
|
228
|
+
...(depth === 0
|
|
229
|
+
? [
|
|
230
|
+
(content) => {
|
|
231
|
+
const matches = content.match(/(^|\n)(#{1,6})\s+([^\n]+)/);
|
|
232
|
+
if (!matches)
|
|
233
|
+
return null;
|
|
234
|
+
const Tag = headingTags[Math.min(matches[2].length, 6) - 1];
|
|
235
|
+
return {
|
|
236
|
+
elem: React__default.createElement(Tag, {}, ...processCellContent(matches[3], depth + 1)),
|
|
237
|
+
index: matches.index,
|
|
238
|
+
length: matches[0].length,
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
]
|
|
242
|
+
: []),
|
|
243
|
+
injectLines,
|
|
244
|
+
injectLinks,
|
|
245
|
+
injectBold,
|
|
246
|
+
injectItalic,
|
|
247
|
+
injectBullet,
|
|
248
|
+
injectNumbered,
|
|
249
|
+
injectButtons,
|
|
250
|
+
]);
|
|
251
|
+
const injectHeading = (content) => {
|
|
252
|
+
const matches = content.match(/(^|\n)(#{1,6})\s+([^\n]+)/);
|
|
253
|
+
if (!matches)
|
|
254
|
+
return null;
|
|
255
|
+
const Tag = headingTags[Math.min(matches[2].length, 6) - 1];
|
|
256
|
+
return {
|
|
257
|
+
elem: React__default.createElement(Tag, {}, ...processCellContent(matches[3], 1)),
|
|
258
|
+
index: matches.index,
|
|
259
|
+
length: matches[0].length,
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
const injectTables = (content) => {
|
|
263
|
+
const withSep = content.match(/(\n|^)(\|[^\n]+\|\s*\n)(\|[\s:-]+(?:\|[\s:-]+)*\|\s*\n)((?:\|[^\n]+\|\s*\n?)+)/);
|
|
264
|
+
const withoutSep = withSep
|
|
265
|
+
? null
|
|
266
|
+
: content.match(/(\n|^)(\|[^\n]+\|\s*\n)((?:\|[^\n]+\|\s*\n?)+)/);
|
|
267
|
+
const matches = withSep || withoutSep;
|
|
268
|
+
if (!matches)
|
|
269
|
+
return null;
|
|
270
|
+
const hasSeparator = Boolean(withSep);
|
|
271
|
+
const headerRow = matches[2].trim();
|
|
272
|
+
const dataRows = (hasSeparator ? matches[4] : matches[3]).trim();
|
|
273
|
+
const headers = headerRow.split('|').map(cell => cell.trim()).slice(1, -1);
|
|
274
|
+
if (headers.length === 0)
|
|
275
|
+
return null;
|
|
276
|
+
const rows = dataRows
|
|
277
|
+
.split('\n')
|
|
278
|
+
.map(row => row.trim())
|
|
279
|
+
.filter(row => row.startsWith('|') && row.endsWith('|'))
|
|
280
|
+
.map(row => row.split('|').map(cell => cell.trim()).slice(1, -1))
|
|
281
|
+
.filter(row => row.length > 0);
|
|
282
|
+
if (rows.length === 0)
|
|
283
|
+
return null;
|
|
284
|
+
const maxCols = Math.max(headers.length, ...rows.map(row => row.length));
|
|
285
|
+
const paddedHeaders = [
|
|
286
|
+
...headers,
|
|
287
|
+
...Array(maxCols - headers.length).fill(''),
|
|
288
|
+
];
|
|
289
|
+
const columns = paddedHeaders.map((header, idx) => ({
|
|
290
|
+
id: `col-${idx}`,
|
|
291
|
+
label: processCellContent(header),
|
|
292
|
+
dataField: `col-${idx}`,
|
|
293
|
+
render: (data) => processCellContent(data[`col-${idx}`] || ''),
|
|
294
|
+
}));
|
|
295
|
+
const tableData = rows.map((row, rowIdx) => {
|
|
296
|
+
const rowData = { id: `row-${rowIdx}` };
|
|
297
|
+
paddedHeaders.forEach((_, colIdx) => {
|
|
298
|
+
rowData[`col-${colIdx}`] = row[colIdx] || '';
|
|
299
|
+
});
|
|
300
|
+
return rowData;
|
|
301
|
+
});
|
|
302
|
+
return {
|
|
303
|
+
elem: (jsx(Table, { size: "s", variant: "plain", columns: columns, data: tableData, className: S.table })),
|
|
304
|
+
index: matches.index + (matches[1]?.length || 0),
|
|
305
|
+
length: matches[0].length - (matches[1]?.length || 0),
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
return (jsx("div", { className: className, children: applyInjectors(text, [
|
|
309
|
+
injectTables,
|
|
310
|
+
injectCodeBlock,
|
|
311
|
+
injectPrettyJson,
|
|
312
|
+
injectHeading,
|
|
313
|
+
injectLines,
|
|
314
|
+
injectLinks,
|
|
315
|
+
injectBold,
|
|
316
|
+
injectItalic,
|
|
317
|
+
injectBullet,
|
|
318
|
+
injectNumbered,
|
|
319
|
+
injectButtons,
|
|
320
|
+
]) }));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export { FormattedText };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".FormattedText_bullet__vbqlq{display:inline-block;margin-bottom:2px;margin-left:var(--p-2);margin-right:2px}.FormattedText_bullet__vbqlq:before{background-color:var(--accent-color);border-radius:50%;content:\"\";display:block;height:6px;margin:0 4px;width:6px}.FormattedText_numberedIndex__rZ6Kt{font-feature-settings:\"tnum\";color:var(--accent-color);display:inline-block;font-variant-numeric:tabular-nums;margin-left:var(--p-2);margin-right:6px;min-width:1.25em}.FormattedText_line__c2bmE{background-color:var(--accent-color-alpha-200);border-radius:2px;height:2px;margin:var(--p-2) 0;width:100%}.FormattedText_codeBlock__Xrbvn,.FormattedText_codeInline__jCbNL{background-color:var(--decent-color-alpha-400);border-radius:var(--p-2);box-shadow:0 1px 1px var(--accent-color-alpha-50),inset 0 1px 1px var(--decent-color-alpha-500);font-family:monospace;-webkit-user-select:text;-moz-user-select:text;user-select:text}.FormattedText_codeInline__jCbNL{border-radius:3px;display:inline;font-size:90%;padding:0 4px}.FormattedText_codeBlock__Xrbvn,.FormattedText_jsonPre__qOGmo{display:block;font-size:90%;margin:var(--p-2) 0;overflow-x:auto;padding:var(--p-2);white-space:pre-wrap}.FormattedText_jsonPre__qOGmo{background-color:var(--decent-color-alpha-300);border-radius:var(--p-2);box-shadow:0 1px 1px var(--accent-color-alpha-50),inset 0 1px 1px var(--accent-color-alpha-50);font-family:monospace;max-width:100%;-webkit-user-select:text;-moz-user-select:text;user-select:text}.FormattedText_table__ipMMS{margin-bottom:10px}";
|
|
4
|
+
var S = {"bullet":"FormattedText_bullet__vbqlq","numberedIndex":"FormattedText_numberedIndex__rZ6Kt","line":"FormattedText_line__c2bmE","codeInline":"FormattedText_codeInline__jCbNL","codeBlock":"FormattedText_codeBlock__Xrbvn","jsonPre":"FormattedText_jsonPre__qOGmo","table":"FormattedText_table__ipMMS"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -35,14 +35,14 @@ import '../Card/Card.js';
|
|
|
35
35
|
import '../Router/context.js';
|
|
36
36
|
import '../Router/Link/Link.styl.js';
|
|
37
37
|
import '../Table/Table.styl.js';
|
|
38
|
-
import '../
|
|
38
|
+
import '../FormattedText/FormattedText.styl.js';
|
|
39
39
|
import '../Expand/Expand.styl.js';
|
|
40
40
|
import '../Chat/ChatMessage.styl.js';
|
|
41
41
|
import '../PromptComposer/PromptComposer.js';
|
|
42
42
|
import '../Chat/ChatPrompt.styl.js';
|
|
43
|
+
import '../TextShimmer/TextShimmer.js';
|
|
43
44
|
import '../ThinkingOutline/ThinkingOutline.styl.js';
|
|
44
45
|
import '../Chat/ChatView.styl.js';
|
|
45
|
-
import '../TextShimmer/TextShimmer.js';
|
|
46
46
|
import '../Container/Container.js';
|
|
47
47
|
import '../DatePicker/DatePicker.styl.js';
|
|
48
48
|
import 'moment';
|
|
@@ -67,6 +67,7 @@ import '../Menu/Menu.js';
|
|
|
67
67
|
import '../NestedMenu/NestedMenu.js';
|
|
68
68
|
import '../Notifications/store.js';
|
|
69
69
|
import '../Notifications/Notifications.styl.js';
|
|
70
|
+
import '../Nudge/Nudge.styl.js';
|
|
70
71
|
import '../PopupMenu/PopupMenu.styl.js';
|
|
71
72
|
import '../Progress/Progress.styl.js';
|
|
72
73
|
import '@tiptap/extensions';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Menu_root__xhtlo{max-height:200px;width:100%}.keyboard .Menu_root__xhtlo{pointer-events:none}.Menu_item__VtmwS{align-items:center;animation:Menu_fadeIn__XRZkT .3s ease-out;cursor:pointer;display:flex;overflow:hidden;padding-bottom:0!important;padding-top:0!important;position:relative;text-align:left;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;width:100%}.Menu_item__VtmwS:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.Menu_item__VtmwS:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.Menu_size-xs__MSbRQ .Menu_item__VtmwS{font-size:14px;height:24px;padding:0 8px}.Menu_size-s__DA0r3 .Menu_item__VtmwS{font-size:16px;height:32px;padding:0 12px}.Menu_size-m__0EI47 .Menu_item__VtmwS{font-size:18px;height:40px;padding:0 16px}.Menu_size-l__PXpIm .Menu_item__VtmwS{font-size:22px;height:48px;padding:0 20px}.Menu_size-xl__U1WW8 .Menu_item__VtmwS{font-size:26px;height:56px;padding:0 24px}.Menu_item__VtmwS.Menu_selected__V71xy{background-color:var(--active-color-alpha-500)}.Menu_item__VtmwS.Menu_disabled__5afRm{cursor:not-allowed;opacity:.4}.keyboard .Menu_item__VtmwS.Menu_focused__FLWqW,.pointer .Menu_item__VtmwS:hover{box-shadow:inset 100vw 0 0 0 var(--
|
|
3
|
+
var css_248z = ".Menu_root__xhtlo{max-height:200px;width:100%}.keyboard .Menu_root__xhtlo{pointer-events:none}.Menu_item__VtmwS{align-items:center;animation:Menu_fadeIn__XRZkT .3s ease-out;cursor:pointer;display:flex;overflow:hidden;padding-bottom:0!important;padding-top:0!important;position:relative;text-align:left;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;width:100%}.Menu_item__VtmwS:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.Menu_item__VtmwS:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.Menu_size-xs__MSbRQ .Menu_item__VtmwS{font-size:14px;height:24px;padding:0 8px}.Menu_size-s__DA0r3 .Menu_item__VtmwS{font-size:16px;height:32px;padding:0 12px}.Menu_size-m__0EI47 .Menu_item__VtmwS{font-size:18px;height:40px;padding:0 16px}.Menu_size-l__PXpIm .Menu_item__VtmwS{font-size:22px;height:48px;padding:0 20px}.Menu_size-xl__U1WW8 .Menu_item__VtmwS{font-size:26px;height:56px;padding:0 24px}.Menu_item__VtmwS.Menu_selected__V71xy{background-color:var(--active-color-alpha-500)}.Menu_item__VtmwS.Menu_disabled__5afRm{cursor:not-allowed;opacity:.4}.keyboard .Menu_item__VtmwS.Menu_focused__FLWqW,.pointer .Menu_item__VtmwS:hover{box-shadow:inset 100vw 0 0 0 var(--active-color-alpha-200)}.Menu_textOverflow__udsHR .Menu_item__VtmwS>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Menu_group__6e-Ef{background-color:var(--decent-color);color:var(--accent-color);font-size:14px;font-weight:500;padding:8px 12px;pointer-events:none;position:sticky;top:0;z-index:1}.Menu_levelIndent__S6HXJ{--menu-indent-size:var(--p-3)}.Menu_levelIndent__S6HXJ.Menu_level-1__kueO2{padding-left:calc(var(--menu-indent-size)*2)}.Menu_levelIndent__S6HXJ.Menu_level-2__JZGkJ{padding-left:calc(var(--menu-indent-size)*3)}.Menu_levelIndent__S6HXJ.Menu_level-3__LFd-F{padding-left:calc(var(--menu-indent-size)*4)}.Menu_levelIndent__S6HXJ.Menu_level-4__2DUMl{padding-left:calc(var(--menu-indent-size)*5)}.Menu_levelIndent__S6HXJ.Menu_level-5__xpgvQ{padding-left:calc(var(--menu-indent-size)*6)}@keyframes Menu_fadeIn__XRZkT{0%{opacity:0}10%{opacity:0}to{opacity:1}}";
|
|
4
4
|
var S = {"root":"Menu_root__xhtlo","item":"Menu_item__VtmwS","fadeIn":"Menu_fadeIn__XRZkT","size-xs":"Menu_size-xs__MSbRQ","size-s":"Menu_size-s__DA0r3","size-m":"Menu_size-m__0EI47","size-l":"Menu_size-l__PXpIm","size-xl":"Menu_size-xl__U1WW8","selected":"Menu_selected__V71xy","disabled":"Menu_disabled__5afRm","focused":"Menu_focused__FLWqW","textOverflow":"Menu_textOverflow__udsHR","group":"Menu_group__6e-Ef","levelIndent":"Menu_levelIndent__S6HXJ","level-1":"Menu_level-1__kueO2","level-2":"Menu_level-2__JZGkJ","level-3":"Menu_level-3__LFd-F","level-4":"Menu_level-4__2DUMl","level-5":"Menu_level-5__xpgvQ"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ function useMedia(query) {
|
|
|
17
17
|
}, [query]);
|
|
18
18
|
return matches;
|
|
19
19
|
}
|
|
20
|
-
function NestedMenuLabel({ children, className }) {
|
|
20
|
+
function NestedMenuLabel({ children, className, }) {
|
|
21
21
|
return jsx("span", { className: cn(S.label, className), children: children });
|
|
22
22
|
}
|
|
23
23
|
function NestedMenuItemRow({ children, className, danger, disabled, href, target, rel, onClick, }) {
|
|
@@ -104,7 +104,7 @@ function NestedMenuComponent({ trigger, items, open, onOpenChange, align = 'end'
|
|
|
104
104
|
openSub(id, true);
|
|
105
105
|
}
|
|
106
106
|
function renderItems() {
|
|
107
|
-
return items.map(item => (jsxs("div", { className: S.itemWrap, onMouseEnter: () => onItemEnter(item.id), onMouseLeave: onItemLeave, children: [jsxs("button", { type: "button", className: cn(S.item, activeId === item.id && S.itemActive, item.danger && S.itemDanger, item.disabled && S.itemDisabled, item.className), role: "menuitem", disabled: item.disabled, "aria-haspopup": item.submenu ? 'menu' : undefined, "aria-expanded": item.submenu ? activeId === item.id : undefined, onClick: () => onItemClick(item.id), children: [item.icon && (jsx("span", { className: S.icon, "aria-hidden": true, children: item.icon })), jsx("span", { className: S.label, children: item.label }), item.hint != null && item.hint !== '' && (jsx("span", { className: S.hint, children: item.hint })), item.submenu && (jsx(Icon, { className: S.chevron, type: "chevronRight", size: "xs" }))] }), !stacked && activeId === item.id && item.submenu && (jsx("div", { className: cn(S.submenu, flipLeft && S.submenuLeft), role: "menu", onMouseEnter: () => {
|
|
107
|
+
return items.map(item => (jsxs("div", { className: S.itemWrap, onMouseEnter: () => onItemEnter(item.id), onMouseLeave: onItemLeave, children: [jsxs("button", { type: "button", className: cn(S.item, activeId === item.id && S.itemActive, item.danger && S.itemDanger, item.disabled && S.itemDisabled, item.wrap && S.multiline, item.className), role: "menuitem", disabled: item.disabled, "aria-haspopup": item.submenu ? 'menu' : undefined, "aria-expanded": item.submenu ? activeId === item.id : undefined, onClick: () => onItemClick(item.id), children: [item.icon && (jsx("span", { className: S.icon, "aria-hidden": true, children: item.icon })), jsx("span", { className: S.label, children: item.label }), item.hint != null && item.hint !== '' && (jsx("span", { className: S.hint, children: item.hint })), item.submenu && (jsx(Icon, { className: S.chevron, type: "chevronRight", size: "xs" }))] }), !stacked && activeId === item.id && item.submenu && (jsx("div", { className: cn(S.submenu, flipLeft && S.submenuLeft), role: "menu", onMouseEnter: () => {
|
|
108
108
|
window.clearTimeout(hoverTimer.current);
|
|
109
109
|
}, children: item.submenu }))] }, item.id)));
|
|
110
110
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".NestedMenu_root__ybyGA{display:inline-flex;position:relative}.NestedMenu_trigger__zBeNI{display:inline-flex}.NestedMenu_popup__q0uYO{background:var(--decent-color);border:1px solid var(--accent-color-alpha-200);border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.45);left:0;max-width:
|
|
4
|
-
var S = {"root":"NestedMenu_root__ybyGA","trigger":"NestedMenu_trigger__zBeNI","popup":"NestedMenu_popup__q0uYO","alignEnd":"NestedMenu_alignEnd__L4AZi","itemWrap":"NestedMenu_itemWrap__Qmc0B","item":"NestedMenu_item__tgbZm","row":"NestedMenu_row__48g5c","back":"NestedMenu_back__dNsDV","itemActive":"NestedMenu_itemActive__RfPZH","itemDisabled":"NestedMenu_itemDisabled__evVk1","itemDanger":"NestedMenu_itemDanger__oAJbP","icon":"NestedMenu_icon__4g2Yp","label":"NestedMenu_label__Jnm6l","hint":"NestedMenu_hint__hotNP","chevron":"NestedMenu_chevron__8i-Po","submenu":"NestedMenu_submenu__Tx1Ll","submenuLeft":"NestedMenu_submenuLeft__y18Nb","stacked":"NestedMenu_stacked__rMiOi","stackedBody":"NestedMenu_stackedBody__Fbkma"};
|
|
3
|
+
var css_248z = ".NestedMenu_root__ybyGA{display:inline-flex;position:relative}.NestedMenu_trigger__zBeNI{display:inline-flex}.NestedMenu_popup__q0uYO{background:var(--decent-color);border:1px solid var(--accent-color-alpha-200);border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.45);display:flex;flex-direction:column;gap:1px;left:0;max-width:280px;min-width:200px;padding:4px;position:absolute;top:calc(100% + 6px);z-index:20}.NestedMenu_alignEnd__L4AZi{left:auto;right:0}.NestedMenu_itemWrap__Qmc0B{position:relative}.NestedMenu_back__dNsDV,.NestedMenu_item__tgbZm,.NestedMenu_row__48g5c{align-items:center;background:none;border:none;border-radius:6px;color:inherit;cursor:pointer;display:flex;font:inherit;font-size:13px;font-weight:500;gap:8px;letter-spacing:.01em;line-height:1.3;padding:6px 10px;text-align:left;text-decoration:none;width:100%}.NestedMenu_back__dNsDV:hover,.NestedMenu_item__tgbZm:hover,.NestedMenu_row__48g5c:hover{background:var(--accent-color-alpha-50)}.NestedMenu_back__dNsDV.NestedMenu_itemActive__RfPZH,.NestedMenu_item__tgbZm.NestedMenu_itemActive__RfPZH,.NestedMenu_row__48g5c.NestedMenu_itemActive__RfPZH{background:var(--accent-color-alpha-100)}.NestedMenu_back__dNsDV.NestedMenu_itemDisabled__evVk1,.NestedMenu_back__dNsDV:disabled,.NestedMenu_item__tgbZm.NestedMenu_itemDisabled__evVk1,.NestedMenu_item__tgbZm:disabled,.NestedMenu_row__48g5c.NestedMenu_itemDisabled__evVk1,.NestedMenu_row__48g5c:disabled{cursor:default;opacity:.55;pointer-events:none}.NestedMenu_itemDanger__oAJbP{color:var(--active-color)}.NestedMenu_itemDanger__oAJbP .NestedMenu_icon__4g2Yp{color:inherit;opacity:1}.NestedMenu_icon__4g2Yp{display:inline-flex;flex-shrink:0;opacity:.55}.NestedMenu_icon__4g2Yp svg{display:block}.NestedMenu_label__Jnm6l{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.NestedMenu_hint__hotNP{flex-shrink:0;font-weight:400;opacity:.5}.NestedMenu_multiline__MDdk-{grid-row-gap:2px;align-items:start;display:grid;grid-template-columns:auto minmax(0,1fr);min-width:252px;row-gap:2px}.NestedMenu_multiline__MDdk- .NestedMenu_label__Jnm6l{overflow:visible;text-overflow:clip}.NestedMenu_multiline__MDdk- .NestedMenu_hint__hotNP{grid-column:2;min-width:0;white-space:normal}.NestedMenu_chevron__8i-Po{flex-shrink:0;opacity:.45}.NestedMenu_row__48g5c svg{color:var(--active-color);flex-shrink:0}.NestedMenu_submenu__Tx1Ll{background:var(--decent-color);border:1px solid var(--accent-color-alpha-200);border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.45);left:calc(100% + 6px);max-height:min(360px,calc(100vh - 24px));max-width:280px;min-width:220px;overflow-x:hidden;overflow-y:auto;padding:4px;position:absolute;top:-4px;z-index:21}.NestedMenu_submenu__Tx1Ll:before{bottom:0;content:\"\";left:-6px;position:absolute;top:0;width:6px}.NestedMenu_submenuLeft__y18Nb{left:auto;right:calc(100% + 6px)}.NestedMenu_submenuLeft__y18Nb:before{left:auto;right:-6px}.NestedMenu_stacked__rMiOi{display:flex;flex-direction:column;max-height:min(360px,calc(100vh - 24px));overflow-y:auto}.NestedMenu_back__dNsDV{font-weight:650;margin-bottom:2px}.NestedMenu_stackedBody__Fbkma{min-width:0}";
|
|
4
|
+
var S = {"root":"NestedMenu_root__ybyGA","trigger":"NestedMenu_trigger__zBeNI","popup":"NestedMenu_popup__q0uYO","alignEnd":"NestedMenu_alignEnd__L4AZi","itemWrap":"NestedMenu_itemWrap__Qmc0B","item":"NestedMenu_item__tgbZm","row":"NestedMenu_row__48g5c","back":"NestedMenu_back__dNsDV","itemActive":"NestedMenu_itemActive__RfPZH","itemDisabled":"NestedMenu_itemDisabled__evVk1","itemDanger":"NestedMenu_itemDanger__oAJbP","icon":"NestedMenu_icon__4g2Yp","label":"NestedMenu_label__Jnm6l","hint":"NestedMenu_hint__hotNP","multiline":"NestedMenu_multiline__MDdk-","chevron":"NestedMenu_chevron__8i-Po","submenu":"NestedMenu_submenu__Tx1Ll","submenuLeft":"NestedMenu_submenuLeft__y18Nb","stacked":"NestedMenu_stacked__rMiOi","stackedBody":"NestedMenu_stackedBody__Fbkma"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import S from './Nudge.styl.js';
|
|
4
|
+
|
|
5
|
+
function Nudge({ className, children, ...props }) {
|
|
6
|
+
return (jsx("div", { className: cn(S.root, className), ...props, children: children }));
|
|
7
|
+
}
|
|
8
|
+
function NudgeText({ className, children, ...props }) {
|
|
9
|
+
return (jsx("p", { className: cn(S.text, className), ...props, children: children }));
|
|
10
|
+
}
|
|
11
|
+
function NudgeError({ className, children, ...props }) {
|
|
12
|
+
return (jsx("p", { className: cn(S.error, className), ...props, children: children }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { Nudge, NudgeError, NudgeText };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".Nudge_root__cOnE-{align-items:flex-start;background:var(--decent-color-alpha-600);background-image:linear-gradient(to right,var(--active-color-alpha-100) 0,transparent 30%);border-bottom-right-radius:var(--p-2);border-top-right-radius:var(--p-2);display:flex;flex-direction:column;gap:12px;padding:14px 16px;position:relative}.Nudge_root__cOnE-:before{background:var(--active-color-alpha-600);border-radius:10px;bottom:0;content:\"\";left:0;position:absolute;top:0;width:5px}.Nudge_text__8IF7l{font-size:14px;line-height:1.45;margin:0;opacity:.85}.Nudge_error__qotmj{color:var(--active-color);font-size:14px;margin:0}";
|
|
4
|
+
var S = {"root":"Nudge_root__cOnE-","text":"Nudge_text__8IF7l","error":"Nudge_error__qotmj"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -53,15 +53,15 @@ const useSimplePositionSetup = ({ triggerRef, tooltipRef, content, delay, direct
|
|
|
53
53
|
};
|
|
54
54
|
trigger.addEventListener('mouseenter', showTooltip);
|
|
55
55
|
trigger.addEventListener('mouseleave', hideTooltip);
|
|
56
|
-
trigger.addEventListener('
|
|
57
|
-
trigger.addEventListener('
|
|
56
|
+
trigger.addEventListener('focusin', showTooltip);
|
|
57
|
+
trigger.addEventListener('focusout', hideTooltip);
|
|
58
58
|
return () => {
|
|
59
59
|
clearTimeout(timeoutRef.current);
|
|
60
60
|
clearTriggerTextStyles(tooltip);
|
|
61
61
|
trigger.removeEventListener('mouseenter', showTooltip);
|
|
62
62
|
trigger.removeEventListener('mouseleave', hideTooltip);
|
|
63
|
-
trigger.removeEventListener('
|
|
64
|
-
trigger.removeEventListener('
|
|
63
|
+
trigger.removeEventListener('focusin', showTooltip);
|
|
64
|
+
trigger.removeEventListener('focusout', hideTooltip);
|
|
65
65
|
};
|
|
66
66
|
}, [content, delay, direction, tooltipRef, triggerRef]);
|
|
67
67
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".SlashSuggestionList_root__9KCb1{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--decent-color-alpha-700);border-radius:8px;border-radius:var(--radius-lg,8px);box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.2);color:var(--foreground);max-width:90vw;min-width:220px;overflow:hidden;position:relative}.SlashSuggestionList_root__9KCb1:before{background-color:var(--accent-color-alpha-50);bottom:0;content:\"\";left:0;pointer-events:none;position:absolute;right:0;top:0}.dark .SlashSuggestionList_root__9KCb1{box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.5)}.SlashSuggestionList_menu__s-jK3{margin:0;max-height:40vh}.SlashSuggestionList_item__9JBeY{align-items:center;border-radius:var(--p-2);display:flex;flex-direction:row;gap:var(--p-2);height:auto!important;justify-content:flex-start;min-height:0;overflow:visible!important;padding:var(--p-1) var(--p-2)!important;position:relative;text-overflow:clip!important;white-space:normal!important;width:100%}.SlashSuggestionList_itemHighlighted__cStZr{box-shadow:inset 100vw 0 0 0 var(--
|
|
3
|
+
var css_248z = ".SlashSuggestionList_root__9KCb1{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--decent-color-alpha-700);border-radius:8px;border-radius:var(--radius-lg,8px);box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.2);color:var(--foreground);max-width:90vw;min-width:220px;overflow:hidden;position:relative}.SlashSuggestionList_root__9KCb1:before{background-color:var(--accent-color-alpha-50);bottom:0;content:\"\";left:0;pointer-events:none;position:absolute;right:0;top:0}.dark .SlashSuggestionList_root__9KCb1{box-shadow:inset 0 0 0 1px var(--accent-color-alpha-50),0 8px 24px rgba(0,0,0,.5)}.SlashSuggestionList_menu__s-jK3{margin:0;max-height:40vh}.SlashSuggestionList_item__9JBeY{align-items:center;border-radius:var(--p-2);display:flex;flex-direction:row;gap:var(--p-2);height:auto!important;justify-content:flex-start;min-height:0;overflow:visible!important;padding:var(--p-1) var(--p-2)!important;position:relative;text-overflow:clip!important;white-space:normal!important;width:100%}.SlashSuggestionList_itemHighlighted__cStZr{box-shadow:inset 100vw 0 0 0 var(--active-color-alpha-200)}.SlashSuggestionList_itemIcon__hTtxe{color:var(--accent-color-alpha-800);flex-shrink:0}.SlashSuggestionList_itemText__uwNbZ{align-items:flex-start;display:flex;flex-direction:column;min-width:0}.SlashSuggestionList_itemLabel__OMaov{font-weight:600}.SlashSuggestionList_itemDesc__fAdcA{color:var(--accent-color-alpha-600);font-size:80%;white-space:normal}.SlashSuggestionList_mention__aT45p{align-items:center;background:var(--muted);border-radius:var(--p-1);display:inline-flex;line-height:1.4;margin:0 var(--p-1);padding:0 var(--p-1);transition:background-color .1s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:baseline;white-space:nowrap}.SlashSuggestionList_mention__aT45p:hover{background-color:var(--active-color-alpha-200)}";
|
|
4
4
|
var S = {"root":"SlashSuggestionList_root__9KCb1","menu":"SlashSuggestionList_menu__s-jK3","item":"SlashSuggestionList_item__9JBeY","itemHighlighted":"SlashSuggestionList_itemHighlighted__cStZr","itemIcon":"SlashSuggestionList_itemIcon__hTtxe","itemText":"SlashSuggestionList_itemText__uwNbZ","itemLabel":"SlashSuggestionList_itemLabel__OMaov","itemDesc":"SlashSuggestionList_itemDesc__fAdcA","mention":"SlashSuggestionList_mention__aT45p"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FormattedTextProps } from '../FormattedText/FormattedText.types';
|
|
2
3
|
export type ChatRole = 'USER' | 'AGENT' | 'SYSTEM';
|
|
3
4
|
export type ChatContentPart = {
|
|
4
5
|
type: string;
|
|
@@ -28,14 +29,7 @@ export type ChatMessageData = {
|
|
|
28
29
|
content: string;
|
|
29
30
|
createdAt?: string | Date;
|
|
30
31
|
};
|
|
31
|
-
export type ChatFormattedTextProps =
|
|
32
|
-
text: string;
|
|
33
|
-
className?: string;
|
|
34
|
-
onButtonClick?: (params: {
|
|
35
|
-
text: string;
|
|
36
|
-
[name: string]: string;
|
|
37
|
-
}) => void;
|
|
38
|
-
};
|
|
32
|
+
export type ChatFormattedTextProps = FormattedTextProps;
|
|
39
33
|
export type ChatMessageProps = {
|
|
40
34
|
data: ChatMessageData;
|
|
41
35
|
isStacked?: boolean;
|
|
@@ -46,7 +40,6 @@ export type ChatMessageProps = {
|
|
|
46
40
|
export type ChatViewProps = {
|
|
47
41
|
messages: ChatMessageData[];
|
|
48
42
|
isPrompting?: boolean;
|
|
49
|
-
promptingLabel?: ReactNode;
|
|
50
43
|
emptyLabel?: ReactNode;
|
|
51
44
|
className?: string;
|
|
52
45
|
messagesClassName?: string;
|
|
@@ -63,8 +56,11 @@ export type ChatPromptProps = {
|
|
|
63
56
|
onChange: (value: string) => void;
|
|
64
57
|
onSubmit: (value: string) => void;
|
|
65
58
|
disabled?: boolean;
|
|
66
|
-
/** Orbiting glow on the prompt while the agent is generating. */
|
|
59
|
+
/** Orbiting glow on the prompt while the agent is generating. Hides the model selector. */
|
|
67
60
|
isPrompting?: boolean;
|
|
61
|
+
/** Shown after the attach button. Falls back to `promptingLabel` while `isPrompting`. */
|
|
62
|
+
status?: ReactNode;
|
|
63
|
+
promptingLabel?: ReactNode;
|
|
68
64
|
placeholder?: string;
|
|
69
65
|
className?: string;
|
|
70
66
|
/** Default true. Hidden file input + plus button (no STT / live voice). */
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { ChatFormattedTextProps } from './types';
|
|
3
|
-
export declare function ChatFormattedText(
|
|
2
|
+
export declare function ChatFormattedText(props: ChatFormattedTextProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ChatPromptProps } from './types';
|
|
2
|
-
export declare function ChatPrompt({ value, onChange, onSubmit, disabled, isPrompting, placeholder, className, showAttach, onAttach, attachAccept, showModelSelector, models, model, onModelChange, }: ChatPromptProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ChatPrompt({ value, onChange, onSubmit, disabled, isPrompting, status, promptingLabel, placeholder, className, showAttach, onAttach, attachAccept, showModelSelector, models, model, onModelChange, }: ChatPromptProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ChatViewProps } from './types';
|
|
2
|
-
export declare function ChatView({ messages, isPrompting,
|
|
2
|
+
export declare function ChatView({ messages, isPrompting, emptyLabel, className, messagesClassName, footer, onButtonClick, footerClassName, }: ChatViewProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as T from './NestedMenu.types';
|
|
2
|
-
export declare function NestedMenuLabel({ children, className }: T.NestedMenuLabelProps): import("react").JSX.Element;
|
|
2
|
+
export declare function NestedMenuLabel({ children, className, }: T.NestedMenuLabelProps): import("react").JSX.Element;
|
|
3
3
|
export declare function NestedMenuItemRow({ children, className, danger, disabled, href, target, rel, onClick, }: T.NestedMenuRowProps): import("react").JSX.Element;
|
|
4
4
|
declare function NestedMenuComponent({ trigger, items, open, onOpenChange, align, className, }: T.Props): import("react").JSX.Element;
|
|
5
5
|
export declare const NestedMenu: typeof NestedMenuComponent & {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type NudgeProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
className?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export type NudgeTextProps = HTMLAttributes<HTMLParagraphElement> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export type NudgeErrorProps = HTMLAttributes<HTMLParagraphElement> & {
|
|
11
|
+
className?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare function Nudge({ className, children, ...props }: NudgeProps): import("react").JSX.Element;
|
|
15
|
+
export declare function NudgeText({ className, children, ...props }: NudgeTextProps): import("react").JSX.Element;
|
|
16
|
+
export declare function NudgeError({ className, children, ...props }: NudgeErrorProps): import("react").JSX.Element;
|
|
@@ -17,6 +17,7 @@ export * from './DropZone/DropZone';
|
|
|
17
17
|
export * from './Expand/Expand';
|
|
18
18
|
export * from './Flex/Flex';
|
|
19
19
|
export * from './Form/Form';
|
|
20
|
+
export * from './FormattedText';
|
|
20
21
|
export * from './Gap/Gap';
|
|
21
22
|
export * from './Gallery/Gallery';
|
|
22
23
|
export * from './GridLayout/GridLayout';
|
|
@@ -32,6 +33,7 @@ export * from './Menu/Menu';
|
|
|
32
33
|
export * from './NestedMenu/NestedMenu';
|
|
33
34
|
export type { NestedMenuItem, NestedMenuProps, } from './NestedMenu/NestedMenu.types';
|
|
34
35
|
export * from './Notifications/Notifications';
|
|
36
|
+
export * from './Nudge';
|
|
35
37
|
export * from './Paranja/Paranja';
|
|
36
38
|
export * from './Popup/Popup';
|
|
37
39
|
export * from './Portal/Portal';
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
-
|
|
3
|
-
var css_248z = ".ChatFormattedText_bullet__CdKe7{display:inline-block;margin-bottom:2px;margin-left:var(--p-2);margin-right:2px}.ChatFormattedText_bullet__CdKe7:before{background-color:var(--accent-color);border-radius:50%;content:\"\";display:block;height:6px;margin:0 4px;width:6px}.ChatFormattedText_numberedIndex__bejS0{font-feature-settings:\"tnum\";color:var(--accent-color);display:inline-block;font-variant-numeric:tabular-nums;margin-left:var(--p-2);margin-right:6px;min-width:1.25em}.ChatFormattedText_line__1j8Sx{background-color:var(--accent-color-alpha-200);border-radius:2px;height:2px;margin:var(--p-2) 0;width:100%}.ChatFormattedText_codeBlock__Mm7Um,.ChatFormattedText_codeInline__gqRjp{background-color:var(--decent-color-alpha-400);border-radius:var(--p-2);box-shadow:0 1px 1px var(--accent-color-alpha-50),inset 0 1px 1px var(--decent-color-alpha-500);font-family:monospace;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ChatFormattedText_codeInline__gqRjp{border-radius:3px;display:inline;font-size:90%;padding:0 4px}.ChatFormattedText_codeBlock__Mm7Um,.ChatFormattedText_jsonPre__m4NwI{display:block;font-size:90%;margin:var(--p-2) 0;overflow-x:auto;padding:var(--p-2);white-space:pre-wrap}.ChatFormattedText_jsonPre__m4NwI{background-color:var(--decent-color-alpha-300);border-radius:var(--p-2);box-shadow:0 1px 1px var(--accent-color-alpha-50),inset 0 1px 1px var(--accent-color-alpha-50);font-family:monospace;max-width:100%;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ChatFormattedText_table__1rTGx{margin-bottom:10px}";
|
|
4
|
-
var S = {"bullet":"ChatFormattedText_bullet__CdKe7","numberedIndex":"ChatFormattedText_numberedIndex__bejS0","line":"ChatFormattedText_line__1j8Sx","codeInline":"ChatFormattedText_codeInline__gqRjp","codeBlock":"ChatFormattedText_codeBlock__Mm7Um","jsonPre":"ChatFormattedText_jsonPre__m4NwI","table":"ChatFormattedText_table__1rTGx"};
|
|
5
|
-
styleInject(css_248z);
|
|
6
|
-
|
|
7
|
-
export { S as default };
|