@astryxdesign/core 0.6.3-canary.7482949 → 0.6.3-canary.7ada42e
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/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +33 -12
- package/dist/Chat/ChatMessageBubble.d.ts +2 -0
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +5 -3
- package/dist/Chat/ChatMessageList.d.ts +2 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +4 -3
- package/dist/Chat/ChatMessageMetadata.d.ts +5 -4
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +12 -9
- package/dist/Chat/ChatSendButton.d.ts +2 -1
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +5 -3
- package/dist/Chat/ChatSystemMessage.d.ts +3 -3
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +2 -2
- package/dist/Chat/ChatTokenizedText.d.ts +6 -6
- package/dist/Chat/ChatTokenizedText.js +10 -6
- package/dist/Chat/ChatToolCalls.d.ts +7 -9
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +43 -26
- package/dist/DateInput/DateInput.d.ts +25 -5
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +25 -13
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts +32 -15
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +47 -22
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Item/Item.d.ts +1 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +4 -3
- package/dist/List/List.d.ts +19 -1
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +9 -2
- package/dist/List/ListContext.d.ts +1 -0
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +2 -1
- package/dist/List/ListItem.d.ts +1 -1
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +9 -2
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +15 -15
- package/dist/Markdown/plugins/index.d.ts +1 -0
- package/dist/Markdown/plugins/index.d.ts.map +1 -1
- package/dist/Markdown/plugins/index.js +2 -1
- package/dist/Markdown/plugins/softBreaks.d.ts +3 -0
- package/dist/Markdown/plugins/softBreaks.d.ts.map +1 -0
- package/dist/Markdown/plugins/softBreaks.js +172 -0
- package/dist/MetadataList/MetadataList.js +3 -3
- package/dist/ScrollableArea/ScrollableArea.d.ts +1 -0
- package/dist/ScrollableArea/ScrollableArea.d.ts.map +1 -1
- package/dist/ScrollableArea/ScrollableArea.js +1 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +1 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +9 -2
- package/dist/TimeInput/TimeInput.d.ts +30 -14
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +57 -9
- package/dist/TimeInput/TouchTimeField.d.ts +11 -0
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -0
- package/dist/TimeInput/TouchTimeField.js +417 -0
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.d.ts.map +1 -1
- package/dist/astryx.css +7 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +4 -0
- package/dist/utils/inputPresentation.d.ts +55 -0
- package/dist/utils/inputPresentation.d.ts.map +1 -0
- package/dist/utils/inputPresentation.js +108 -0
- package/package.json +3 -3
- package/src/Avatar/Avatar.doc.mjs +1 -1
- package/src/Avatar/Avatar.test.tsx +30 -0
- package/src/Avatar/Avatar.tsx +38 -14
- package/src/Chat/ChatMessageBubble.doc.mjs +28 -15
- package/src/Chat/ChatMessageBubble.spec.md +263 -0
- package/src/Chat/ChatMessageBubble.test.tsx +93 -0
- package/src/Chat/ChatMessageBubble.tsx +8 -3
- package/src/Chat/ChatMessageList.spec.md +222 -0
- package/src/Chat/ChatMessageList.test.tsx +64 -2
- package/src/Chat/ChatMessageList.tsx +4 -3
- package/src/Chat/ChatMessageMetadata.doc.mjs +57 -3
- package/src/Chat/ChatMessageMetadata.spec.md +220 -0
- package/src/Chat/ChatMessageMetadata.test.tsx +34 -0
- package/src/Chat/ChatMessageMetadata.tsx +13 -13
- package/src/Chat/ChatSendButton.doc.mjs +32 -0
- package/src/Chat/ChatSendButton.spec.md +227 -0
- package/src/Chat/ChatSendButton.test.tsx +127 -4
- package/src/Chat/ChatSendButton.tsx +5 -3
- package/src/Chat/ChatSystemMessage.doc.mjs +115 -12
- package/src/Chat/ChatSystemMessage.spec.md +225 -0
- package/src/Chat/ChatSystemMessage.test.tsx +112 -20
- package/src/Chat/ChatSystemMessage.tsx +4 -6
- package/src/Chat/ChatTokenizedText.doc.mjs +96 -9
- package/src/Chat/ChatTokenizedText.spec.md +190 -0
- package/src/Chat/ChatTokenizedText.test.tsx +60 -1
- package/src/Chat/ChatTokenizedText.tsx +14 -8
- package/src/Chat/ChatToolCalls.doc.mjs +4 -1
- package/src/Chat/ChatToolCalls.spec.md +194 -0
- package/src/Chat/ChatToolCalls.test.tsx +83 -0
- package/src/Chat/ChatToolCalls.tsx +46 -21
- package/src/Chat/__tests__/ChatMessageBubble.a11y.chromium.spec.ts +457 -0
- package/src/Chat/__tests__/ChatMessageBubble.auditProvenance.test.ts +91 -0
- package/src/Chat/__tests__/ChatMessageBubble.auditProvenance.ts +91 -0
- package/src/Chat/__tests__/ChatMessageList.a11y.chromium.spec.ts +456 -0
- package/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts +413 -0
- package/src/Chat/__tests__/ChatSendButton.a11y.chromium.spec.ts +1522 -0
- package/src/Chat/__tests__/ChatSystemMessage.a11y.chromium.spec.ts +1004 -0
- package/src/Chat/__tests__/ChatTokenizedText.a11y.chromium.spec.ts +573 -0
- package/src/DateInput/DateInput.doc.mjs +38 -9
- package/src/DateInput/DateInput.tsx +53 -16
- package/src/DateInput/Presentation.test.tsx +121 -0
- package/src/DateInput/index.ts +1 -0
- package/src/DateTimeInput/DateTimeInput.doc.mjs +28 -12
- package/src/DateTimeInput/DateTimeInput.tsx +87 -36
- package/src/DateTimeInput/Presentation.test.tsx +89 -0
- package/src/DateTimeInput/index.ts +1 -0
- package/src/DropdownMenu/DropdownMenu.test.tsx +5 -2
- package/src/Item/Item.doc.mjs +4 -0
- package/src/Item/Item.tsx +9 -3
- package/src/List/List.doc.mjs +6 -0
- package/src/List/List.test.tsx +117 -1
- package/src/List/List.tsx +22 -2
- package/src/List/ListContext.tsx +3 -1
- package/src/List/ListItem.source-build.test.mjs +41 -0
- package/src/List/ListItem.tsx +26 -2
- package/src/Markdown/Markdown.doc.mjs +26 -0
- package/src/Markdown/Markdown.public.test.ts +4 -0
- package/src/Markdown/Markdown.spec.md +12 -4
- package/src/Markdown/Markdown.test.tsx +24 -3
- package/src/Markdown/incremental.test.ts +31 -0
- package/src/Markdown/modules/softBreaks.spec.md +137 -0
- package/src/Markdown/parser.test.ts +18 -6
- package/src/Markdown/parser.ts +45 -11
- package/src/Markdown/plugins/index.ts +1 -0
- package/src/Markdown/plugins/softBreaks.test.tsx +172 -0
- package/src/Markdown/plugins/softBreaks.ts +169 -0
- package/src/MetadataList/MetadataList.test.tsx +4 -2
- package/src/MetadataList/MetadataList.tsx +3 -3
- package/src/ScrollableArea/ScrollableArea.tsx +1 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +30 -0
- package/src/SegmentedControl/SegmentedControl.tsx +2 -1
- package/src/Selector/Selector.doc.mjs +1 -1
- package/src/Selector/Selector.tsx +11 -1
- package/src/Selector/__tests__/Selector.a11y.chromium.spec.ts +45 -0
- package/src/TimeInput/NativeTimeInput.test.tsx +36 -3
- package/src/TimeInput/Presentation.test.tsx +148 -0
- package/src/TimeInput/TimeInput.doc.mjs +21 -5
- package/src/TimeInput/TimeInput.tsx +96 -10
- package/src/TimeInput/TouchTimeField.tsx +572 -0
- package/src/TimeInput/index.ts +1 -0
- package/src/theme/derivedVarRegistry.test.ts +7 -0
- package/src/theme/derivedVarRegistry.ts +1 -0
- package/src/theme/generateThemeRules.test.ts +27 -0
- package/src/utils/inputPresentation.ts +143 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAqB3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AA4BrD;;;;;;GAMG;AACH,KAAK,eAAe,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD;;GAEG;AACH,KAAK,iBAAiB,GACpB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG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CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD;AA6ID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,WAAW,EACX,IAAI,EACJ,IAAW,EACX,KAAgB,EAChB,GAAG,EACH,MAAM,EACN,OAAc,EACd,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BAyVb;yBA7We,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -230,23 +230,41 @@ const groupDynamicStyles = {
|
|
|
230
230
|
}]
|
|
231
231
|
};
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
233
|
+
* A character that can stand for a word in initials: a letter, a digit, or an
|
|
234
|
+
* emoji. Punctuation and other symbols, such as `(`, `"` or `-`, cannot.
|
|
235
|
+
*/
|
|
236
|
+
const INITIAL_CHARACTER = /[\p{L}\p{N}\p{Extended_Pictographic}\p{Regional_Indicator}]/u;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The first character of a word that can stand for it in initials, skipping
|
|
240
|
+
* leading punctuation, or '' when the word has none (a lone `-` or `()`).
|
|
241
|
+
*/
|
|
242
|
+
function initialCharacter(word) {
|
|
243
|
+
const index = word.search(INITIAL_CHARACTER);
|
|
244
|
+
return index === -1 ? '' : firstCharacter(word.slice(index));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Generates initials from a name string: the first letter, digit or emoji of
|
|
249
|
+
* the first and last words. Words with none of those, such as a lone `-`, are
|
|
250
|
+
* skipped, and leading punctuation within a word is ignored. Returns '' when
|
|
251
|
+
* no word yields an initial.
|
|
235
252
|
* @example
|
|
236
253
|
* ```
|
|
237
|
-
* getInitials('John Doe')
|
|
238
|
-
* getInitials('Alice')
|
|
254
|
+
* getInitials('John Doe') // 'JD'
|
|
255
|
+
* getInitials('Alice') // 'A'
|
|
256
|
+
* getInitials('Northwind Workbench (automation)') // 'NA'
|
|
239
257
|
* ```
|
|
240
258
|
*/
|
|
241
259
|
function getInitials(name) {
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
260
|
+
const initials = name.trim().split(/\s+/).map(initialCharacter).filter(initial => initial !== '');
|
|
261
|
+
if (initials.length === 0) {
|
|
244
262
|
return '';
|
|
245
263
|
}
|
|
246
|
-
if (
|
|
247
|
-
return
|
|
264
|
+
if (initials.length === 1) {
|
|
265
|
+
return initials[0].toUpperCase();
|
|
248
266
|
}
|
|
249
|
-
return (
|
|
267
|
+
return (initials[0] + initials[initials.length - 1]).toUpperCase();
|
|
250
268
|
}
|
|
251
269
|
|
|
252
270
|
/**
|
|
@@ -390,8 +408,11 @@ export function Avatar({
|
|
|
390
408
|
// truthy), leaving an empty plate behind a blank accessible name.
|
|
391
409
|
const meaningfulName = meaningful(name);
|
|
392
410
|
const meaningfulAlt = meaningful(alt);
|
|
393
|
-
|
|
394
|
-
|
|
411
|
+
// A name made only of punctuation ("—", "()") still names the avatar, but
|
|
412
|
+
// yields no initials; it falls back to the default icon, not an empty plate.
|
|
413
|
+
const initials = meaningfulName ? getInitials(meaningfulName) : '';
|
|
414
|
+
const showInitials = !showImage && !showFallbackImage && initials !== '';
|
|
415
|
+
const showIcon = !showImage && !showFallbackImage && initials === '';
|
|
395
416
|
|
|
396
417
|
// A meaningful accessible name comes from `alt`/`name`, composed with the
|
|
397
418
|
// status element's `label` when one is present ("Jane Doe, Online") — the
|
|
@@ -540,7 +561,7 @@ export function Avatar({
|
|
|
540
561
|
...mergeProps(themeProps('avatar-fallback', {
|
|
541
562
|
size: resolvedSize
|
|
542
563
|
}), stylex.props(styles.fallback, dynamicStyles.fontSize(numericSize))),
|
|
543
|
-
children:
|
|
564
|
+
children: initials
|
|
544
565
|
}), showIcon && /*#__PURE__*/_jsx("div", {
|
|
545
566
|
...mergeProps(themeProps('avatar-fallback', {
|
|
546
567
|
size: resolvedSize
|
|
@@ -43,6 +43,7 @@ export interface ChatMessageBubbleProps extends BaseProps<HTMLDivElement> {
|
|
|
43
43
|
variant?: ChatMessageBubbleVariant;
|
|
44
44
|
/**
|
|
45
45
|
* Sender name rendered above the bubble, aligned with bubble text padding.
|
|
46
|
+
* Non-rendering scalar values omit the aligned wrapper; numeric zero remains.
|
|
46
47
|
* Use when the first content in a message is a bubble.
|
|
47
48
|
* If the first content is raw (no bubble), use ChatMessage's `name`
|
|
48
49
|
* prop instead.
|
|
@@ -50,6 +51,7 @@ export interface ChatMessageBubbleProps extends BaseProps<HTMLDivElement> {
|
|
|
50
51
|
name?: ReactNode;
|
|
51
52
|
/**
|
|
52
53
|
* Metadata content rendered below the bubble, aligned with bubble text padding.
|
|
54
|
+
* Non-rendering scalar values omit the aligned wrapper; numeric zero remains.
|
|
53
55
|
* Use when the last content in a message is a bubble.
|
|
54
56
|
* If the last content is raw (no bubble), use ChatMessage's `metadata`
|
|
55
57
|
* prop instead.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageBubble.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageBubble.tsx"],"names":[],"mappings":"AAIA;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;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEpC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAwHD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,OAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,sBAAsB,+BA6FxB;yBA1Ge,iBAAiB"}
|
|
@@ -31,7 +31,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
31
31
|
import "../theme/tokens.stylex.js";
|
|
32
32
|
import { colorVars, spacingVars, radiusVars, typeScaleVars, typographyVars } from "../theme/tokens.stylex.js";
|
|
33
33
|
import { useChatMessageContext } from "./ChatContext.js";
|
|
34
|
-
import { mergeProps } from "../utils/index.js";
|
|
34
|
+
import { isRenderable, mergeProps } from "../utils/index.js";
|
|
35
35
|
import { themeProps } from "../utils/themeProps.js";
|
|
36
36
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
37
|
// =============================================================================
|
|
@@ -204,8 +204,10 @@ export function ChatMessageBubble({
|
|
|
204
204
|
const senderStyle = variant === 'ghost' ? styles.ghost : isUser ? styles.user : styles.assistant;
|
|
205
205
|
const groupStyle = group === 'first' ? isUser ? styles.groupFirstUser : styles.groupFirstAssistant : group === 'middle' ? isUser ? styles.groupMiddleUser : styles.groupMiddleAssistant : group === 'last' ? isUser ? styles.groupLastUser : styles.groupLastAssistant : null;
|
|
206
206
|
const metadataPaddingStyle = density === 'compact' ? styles.metadataPaddingCompact : density === 'spacious' ? styles.metadataPaddingSpacious : styles.metadataPaddingBalanced;
|
|
207
|
+
const hasName = isRenderable(name);
|
|
208
|
+
const hasMetadata = isRenderable(metadata);
|
|
207
209
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
208
|
-
children: [
|
|
210
|
+
children: [hasName && /*#__PURE__*/_jsx("div", {
|
|
209
211
|
"data-chat-name": true,
|
|
210
212
|
...stylex.props(metadataPaddingStyle, styles.nameRow, styles.headerReducedGap, isUser && styles.alignEnd),
|
|
211
213
|
children: name
|
|
@@ -219,7 +221,7 @@ export function ChatMessageBubble({
|
|
|
219
221
|
density
|
|
220
222
|
}), stylex.props(styles.content, density === 'compact' && styles.radiusCompact, senderStyle, paddingStyle, variant === 'ghost' && styles.paddingBlockNone, groupStyle, width != null && dynamicStyles.sizing(width), xstyle), className, styleProp),
|
|
221
223
|
children: children
|
|
222
|
-
}),
|
|
224
|
+
}), hasMetadata && /*#__PURE__*/_jsx("div", {
|
|
223
225
|
...stylex.props(metadataPaddingStyle, styles.metadataReducedGap, isUser && styles.alignEnd),
|
|
224
226
|
children: metadata
|
|
225
227
|
})]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file ChatMessageList.tsx
|
|
3
|
-
* @input Uses React, StyleX, ChatListContext, theme tokens, spacing step utilities
|
|
3
|
+
* @input Uses React, StyleX, ChatListContext, theme tokens, spacing step utilities,
|
|
4
|
+
* and isRenderable to preserve accepted empty-state content
|
|
4
5
|
* @output Exports ChatMessageList component and ChatMessageListProps
|
|
5
6
|
* @position Presentational message container — holds ChatMessage children
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageList.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageList.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"ChatMessageList.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAC,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAC;AAGhF,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAGhD,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAElB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAEzB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA4FD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,OAAoB,EACpB,GAAG,EACH,KAAgB,EAChB,WAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,oBAAoB,+BAgGtB;yBA9Ge,eAAe"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file ChatMessageList.tsx
|
|
7
|
-
* @input Uses React, StyleX, ChatListContext, theme tokens, spacing step utilities
|
|
7
|
+
* @input Uses React, StyleX, ChatListContext, theme tokens, spacing step utilities,
|
|
8
|
+
* and isRenderable to preserve accepted empty-state content
|
|
8
9
|
* @output Exports ChatMessageList component and ChatMessageListProps
|
|
9
10
|
* @position Presentational message container — holds ChatMessage children
|
|
10
11
|
*
|
|
@@ -27,7 +28,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
27
28
|
import "../theme/tokens.stylex.js";
|
|
28
29
|
import { spacingVars } from "../theme/tokens.stylex.js";
|
|
29
30
|
import { ChatListContext, useChatLayoutContext } from "./ChatContext.js";
|
|
30
|
-
import { mergeProps } from "../utils/index.js";
|
|
31
|
+
import { isRenderable, mergeProps } from "../utils/index.js";
|
|
31
32
|
import { Spinner } from "../Spinner/index.js";
|
|
32
33
|
import { themeProps } from "../utils/themeProps.js";
|
|
33
34
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -225,7 +226,7 @@ export function ChatMessageList({
|
|
|
225
226
|
className: "x98rzlu x2lwn1j"
|
|
226
227
|
},
|
|
227
228
|
"aria-hidden": true
|
|
228
|
-
}), hasChildren ? children : emptyState ? /*#__PURE__*/_jsx("div", {
|
|
229
|
+
}), hasChildren ? children : isRenderable(emptyState) ? /*#__PURE__*/_jsx("div", {
|
|
229
230
|
...{
|
|
230
231
|
className: "x78zum5 x6s0dn4 xl56j7k x98rzlu x2lwn1j"
|
|
231
232
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file ChatMessageMetadata.tsx
|
|
3
|
-
* @input Uses React, StyleX, ChatContext, Icon, theme tokens
|
|
3
|
+
* @input Uses React, StyleX, ChatContext, Icon, theme tokens, and isRenderable
|
|
4
4
|
* @output Exports ChatMessageMetadata component
|
|
5
5
|
* @position Shared metadata row used by composing inside ChatMessage
|
|
6
6
|
*
|
|
7
|
-
* Renders
|
|
8
|
-
* Direction reverses for user sender.
|
|
7
|
+
* Renders timestamp, footer, and status values with separators determined by
|
|
8
|
+
* scalar presence. Direction reverses for user sender.
|
|
9
9
|
*/
|
|
10
10
|
import React, { type ReactNode } from 'react';
|
|
11
11
|
import type { BaseProps } from '../BaseProps';
|
|
@@ -23,7 +23,8 @@ export interface ChatMessageMetadataProps extends BaseProps<HTMLDivElement> {
|
|
|
23
23
|
* Composable metadata row for chat messages.
|
|
24
24
|
*
|
|
25
25
|
* Renders: timestamp · footer · status
|
|
26
|
-
* Renders nothing
|
|
26
|
+
* Renders nothing when neither slot passes the scalar-presence check and no
|
|
27
|
+
* status is set. Composite React nodes remain caller-owned.
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
29
30
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageMetadata.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageMetadata.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAY5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,MAAM,iBAAiB,GAC3B,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAsDtD,MAAM,WAAW,wBAAyB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACzE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,gEAAgE;IAChE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED
|
|
1
|
+
{"version":3,"file":"ChatMessageMetadata.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageMetadata.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAY5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,MAAM,iBAAiB,GAC3B,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAsDtD,MAAM,WAAW,wBAAyB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACzE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,gEAAgE;IAChE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,wBAAwB,4BAkD1B;yBA3De,mBAAmB"}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file ChatMessageMetadata.tsx
|
|
7
|
-
* @input Uses React, StyleX, ChatContext, Icon, theme tokens
|
|
7
|
+
* @input Uses React, StyleX, ChatContext, Icon, theme tokens, and isRenderable
|
|
8
8
|
* @output Exports ChatMessageMetadata component
|
|
9
9
|
* @position Shared metadata row used by composing inside ChatMessage
|
|
10
10
|
*
|
|
11
|
-
* Renders
|
|
12
|
-
* Direction reverses for user sender.
|
|
11
|
+
* Renders timestamp, footer, and status values with separators determined by
|
|
12
|
+
* scalar presence. Direction reverses for user sender.
|
|
13
13
|
*/
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -17,7 +17,7 @@ import "../theme/tokens.stylex.js";
|
|
|
17
17
|
import { colorVars, spacingVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
18
18
|
import { useChatMessageContext } from "./ChatContext.js";
|
|
19
19
|
import { Icon } from "../Icon/index.js";
|
|
20
|
-
import { mergeProps } from "../utils/index.js";
|
|
20
|
+
import { isRenderable, mergeProps } from "../utils/index.js";
|
|
21
21
|
import { themeProps } from "../utils/themeProps.js";
|
|
22
22
|
import { useTranslator } from "../i18n/index.js";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -69,7 +69,8 @@ const styles = {
|
|
|
69
69
|
* Composable metadata row for chat messages.
|
|
70
70
|
*
|
|
71
71
|
* Renders: timestamp · footer · status
|
|
72
|
-
* Renders nothing
|
|
72
|
+
* Renders nothing when neither slot passes the scalar-presence check and no
|
|
73
|
+
* status is set. Composite React nodes remain caller-owned.
|
|
73
74
|
*
|
|
74
75
|
* @example
|
|
75
76
|
* ```
|
|
@@ -94,7 +95,9 @@ export function ChatMessageMetadata({
|
|
|
94
95
|
const sender = msgContext?.sender ?? 'assistant';
|
|
95
96
|
const statusConfig = status != null ? STATUS_CONFIG[status] : null;
|
|
96
97
|
const statusLabel = statusConfig != null ? t(statusConfig.i18nKey) : '';
|
|
97
|
-
const
|
|
98
|
+
const hasTimestamp = isRenderable(timestamp);
|
|
99
|
+
const hasFooter = isRenderable(footer);
|
|
100
|
+
const hasContent = hasTimestamp || hasFooter || statusConfig != null;
|
|
98
101
|
if (!hasContent) {
|
|
99
102
|
return null;
|
|
100
103
|
}
|
|
@@ -102,11 +105,11 @@ export function ChatMessageMetadata({
|
|
|
102
105
|
ref: ref,
|
|
103
106
|
...mergeProps(themeProps('chat-message-metadata'), stylex.props(styles.meta, sender === 'user' ? styles.metaUser : styles.metaAssistant, xstyle), className, style),
|
|
104
107
|
...rest,
|
|
105
|
-
children: [
|
|
108
|
+
children: [hasTimestamp && /*#__PURE__*/_jsx("span", {
|
|
106
109
|
children: timestamp
|
|
107
|
-
}),
|
|
110
|
+
}), hasTimestamp && (hasFooter || statusConfig != null) && /*#__PURE__*/_jsx("span", {
|
|
108
111
|
children: "\xB7"
|
|
109
|
-
}),
|
|
112
|
+
}), hasFooter && footer, hasFooter && statusConfig != null && /*#__PURE__*/_jsx("span", {
|
|
110
113
|
children: "\xB7"
|
|
111
114
|
}), statusConfig != null && /*#__PURE__*/_jsxs("span", {
|
|
112
115
|
title: statusLabel,
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Reads composer state from ChatComposerContext by default so it "just
|
|
8
8
|
* works" inside ChatComposer. All context-derived values can be
|
|
9
|
-
* overridden via props for standalone usage.
|
|
9
|
+
* overridden via props for standalone usage. Accepted `onClick` handlers
|
|
10
|
+
* compose after the selected send or stop action.
|
|
10
11
|
*
|
|
11
12
|
* States:
|
|
12
13
|
* - **Send** — accent/primary, arrowUp icon, disabled when nothing to send.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSendButton.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatSendButton.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"ChatSendButton.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatSendButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAM5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,MAAM,WAAW,mBAAoB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACvE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gFAAgF;IAChF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iCAAiC;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAiBD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CA+CpE;yBA/Ce,cAAc"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Reads composer state from ChatComposerContext by default so it "just
|
|
12
12
|
* works" inside ChatComposer. All context-derived values can be
|
|
13
|
-
* overridden via props for standalone usage.
|
|
13
|
+
* overridden via props for standalone usage. Accepted `onClick` handlers
|
|
14
|
+
* compose after the selected send or stop action.
|
|
14
15
|
*
|
|
15
16
|
* States:
|
|
16
17
|
* - **Send** — accent/primary, arrowUp icon, disabled when nothing to send.
|
|
@@ -21,7 +22,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
21
22
|
import { Button } from "../Button/index.js";
|
|
22
23
|
import { useIcon } from "../Icon/index.js";
|
|
23
24
|
import { useChatComposerContext } from "./ChatContext.js";
|
|
24
|
-
import { mergeProps } from "../utils/index.js";
|
|
25
|
+
import { composeEventHandlers, mergeProps } from "../utils/index.js";
|
|
25
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
27
|
import { useTranslator } from "../i18n/index.js";
|
|
27
28
|
|
|
@@ -64,6 +65,7 @@ export function ChatSendButton(props) {
|
|
|
64
65
|
isDisabled = !(context?.canSend ?? false),
|
|
65
66
|
onSend,
|
|
66
67
|
onStop = context?.onStop,
|
|
68
|
+
onClick,
|
|
67
69
|
sendIcon,
|
|
68
70
|
stopIcon,
|
|
69
71
|
size = 'md',
|
|
@@ -84,7 +86,7 @@ export function ChatSendButton(props) {
|
|
|
84
86
|
icon: isStopShown ? stopIcon ?? defaultStopIcon : sendIcon ?? defaultSendIcon,
|
|
85
87
|
isIconOnly: true,
|
|
86
88
|
isDisabled: !isStopShown && isDisabled,
|
|
87
|
-
onClick: isStopShown ? onStop : handleSend,
|
|
89
|
+
onClick: composeEventHandlers(isStopShown ? onStop : handleSend, onClick),
|
|
88
90
|
...rest,
|
|
89
91
|
...mergeProps(themeProps('chat-send-button'), {
|
|
90
92
|
className
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file ChatSystemMessage.tsx
|
|
3
3
|
* @input Uses React, StyleX, theme tokens
|
|
4
4
|
* @output Exports ChatSystemMessage component and ChatSystemMessageProps
|
|
5
|
-
* @position Centered system/notice message in a chat thread
|
|
5
|
+
* @position Centered, wrapping system/notice message in a chat thread
|
|
6
6
|
*
|
|
7
7
|
* Renders centered, muted system messages like "conversation started",
|
|
8
8
|
* date separators, or status updates. Not a sender message — no avatar,
|
|
@@ -32,8 +32,8 @@ export interface ChatSystemMessageProps extends BaseProps<HTMLDivElement> {
|
|
|
32
32
|
*/
|
|
33
33
|
variant?: ChatSystemMessageVariant;
|
|
34
34
|
/**
|
|
35
|
-
* Optional icon
|
|
36
|
-
* Accepts any ReactNode
|
|
35
|
+
* Optional caller-provided icon content associated with the message.
|
|
36
|
+
* Accepts any ReactNode, typically an Icon.
|
|
37
37
|
*/
|
|
38
38
|
icon?: ReactNode;
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSystemMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatSystemMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACvE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"ChatSystemMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatSystemMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACvE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAwCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,OAAmB,EACnB,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,sBAAsB,+BAmCxB;yBA5Ce,iBAAiB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @file ChatSystemMessage.tsx
|
|
7
7
|
* @input Uses React, StyleX, theme tokens
|
|
8
8
|
* @output Exports ChatSystemMessage component and ChatSystemMessageProps
|
|
9
|
-
* @position Centered system/notice message in a chat thread
|
|
9
|
+
* @position Centered, wrapping system/notice message in a chat thread
|
|
10
10
|
*
|
|
11
11
|
* Renders centered, muted system messages like "conversation started",
|
|
12
12
|
* date separators, or status updates. Not a sender message — no avatar,
|
|
@@ -99,7 +99,7 @@ export function ChatSystemMessage({
|
|
|
99
99
|
role: "status",
|
|
100
100
|
children: /*#__PURE__*/_jsxs("span", {
|
|
101
101
|
...{
|
|
102
|
-
className: "x3nfvp2 x6s0dn4 x1s4dlld
|
|
102
|
+
className: "x3nfvp2 x6s0dn4 x1s4dlld"
|
|
103
103
|
},
|
|
104
104
|
children: [icon != null && /*#__PURE__*/_jsx("span", {
|
|
105
105
|
...{
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @output Exports ChatTokenizedText component
|
|
5
5
|
* @position Utility component for rendering tokenized text in message bubbles
|
|
6
6
|
*
|
|
7
|
-
* Parses a plain text string and replaces token values with inline
|
|
8
|
-
* Accepts the same ChatComposerToken type used by the input
|
|
9
|
-
* so the same token definitions work for both input and display.
|
|
7
|
+
* Parses a plain text string and replaces non-empty token values with inline
|
|
8
|
+
* token content. Accepts the same ChatComposerToken type used by the input
|
|
9
|
+
* triggers, so the same token definitions work for both input and display.
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update:
|
|
12
12
|
* - /packages/core/src/Chat/index.ts
|
|
@@ -23,8 +23,8 @@ export interface ChatTokenizedTextProps extends BaseProps<HTMLSpanElement> {
|
|
|
23
23
|
children: string;
|
|
24
24
|
/**
|
|
25
25
|
* Token definitions — same type returned by trigger onSelect.
|
|
26
|
-
* Each token
|
|
27
|
-
* with its
|
|
26
|
+
* Each non-empty token `value` is matched literally against the text and
|
|
27
|
+
* replaced with its Badge or custom representation. Empty values are ignored.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```
|
|
@@ -41,7 +41,7 @@ export interface ChatTokenizedTextProps extends BaseProps<HTMLSpanElement> {
|
|
|
41
41
|
tokens?: ChatComposerToken[];
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Renders text with token values replaced by inline
|
|
44
|
+
* Renders text with token values replaced by inline token content.
|
|
45
45
|
*
|
|
46
46
|
* Accepts the same `ChatComposerToken` type used by input triggers,
|
|
47
47
|
* so you can share a single token definition between input and display.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @output Exports ChatTokenizedText component
|
|
9
9
|
* @position Utility component for rendering tokenized text in message bubbles
|
|
10
10
|
*
|
|
11
|
-
* Parses a plain text string and replaces token values with inline
|
|
12
|
-
* Accepts the same ChatComposerToken type used by the input
|
|
13
|
-
* so the same token definitions work for both input and display.
|
|
11
|
+
* Parses a plain text string and replaces non-empty token values with inline
|
|
12
|
+
* token content. Accepts the same ChatComposerToken type used by the input
|
|
13
|
+
* triggers, so the same token definitions work for both input and display.
|
|
14
14
|
*
|
|
15
15
|
* SYNC: When modified, update:
|
|
16
16
|
* - /packages/core/src/Chat/index.ts
|
|
@@ -55,7 +55,7 @@ function escapeRegExp(str) {
|
|
|
55
55
|
// =============================================================================
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Renders text with token values replaced by inline
|
|
58
|
+
* Renders text with token values replaced by inline token content.
|
|
59
59
|
*
|
|
60
60
|
* Accepts the same `ChatComposerToken` type used by input triggers,
|
|
61
61
|
* so you can share a single token definition between input and display.
|
|
@@ -92,10 +92,14 @@ ChatTokenizedText.displayName = 'ChatTokenizedText';
|
|
|
92
92
|
// =============================================================================
|
|
93
93
|
|
|
94
94
|
function renderTokens(text, tokens) {
|
|
95
|
-
const
|
|
95
|
+
const matchableTokens = tokens.filter(token => token.value.length > 0);
|
|
96
|
+
if (matchableTokens.length === 0) {
|
|
97
|
+
return [text];
|
|
98
|
+
}
|
|
99
|
+
const pattern = matchableTokens.map(t => escapeRegExp(t.value)).join('|');
|
|
96
100
|
const regex = new RegExp(`(${pattern})`, 'g');
|
|
97
101
|
const tokenMap = new Map();
|
|
98
|
-
for (const t of
|
|
102
|
+
for (const t of matchableTokens) {
|
|
99
103
|
tokenMap.set(t.value, t);
|
|
100
104
|
}
|
|
101
105
|
const parts = [];
|
|
@@ -34,14 +34,14 @@ export interface ChatToolCallItem {
|
|
|
34
34
|
/** Additional info rendered after the label. Free-form ReactNode. */
|
|
35
35
|
stats?: ReactNode;
|
|
36
36
|
/**
|
|
37
|
-
* Error message when status is 'error'.
|
|
38
|
-
* the row
|
|
39
|
-
*
|
|
37
|
+
* Error message when status is 'error'. Exposed as visually hidden text in
|
|
38
|
+
* the row for assistive technology and echoed in a hover tooltip on the
|
|
39
|
+
* status icon.
|
|
40
40
|
*/
|
|
41
41
|
errorMessage?: string;
|
|
42
42
|
/** Unique key for React list rendering. Derived from stable metadata if omitted. */
|
|
43
43
|
key?: string;
|
|
44
|
-
/** Arbitrary data
|
|
44
|
+
/** Arbitrary caller data retained with the call item. */
|
|
45
45
|
data?: unknown;
|
|
46
46
|
/** Inline detail content shown when the row is expanded (e.g. code diff, command output). */
|
|
47
47
|
resultDetail?: ReactNode;
|
|
@@ -50,11 +50,11 @@ export interface ChatToolCallsProps extends BaseProps<HTMLDivElement> {
|
|
|
50
50
|
ref?: React.Ref<HTMLDivElement>;
|
|
51
51
|
/** Array of tool call data. */
|
|
52
52
|
calls: ChatToolCallItem[];
|
|
53
|
-
/** Custom summary label for
|
|
53
|
+
/** Custom summary label shown for an expanded group. */
|
|
54
54
|
label?: string;
|
|
55
55
|
/** Whether the group is expanded. Uncontrolled by default. */
|
|
56
56
|
isExpanded?: boolean;
|
|
57
|
-
/** Default expanded state. @default
|
|
57
|
+
/** Default expanded state when uncontrolled. @default false */
|
|
58
58
|
defaultIsExpanded?: boolean;
|
|
59
59
|
/** Callback when expanded state changes. */
|
|
60
60
|
onExpandedChange?: (isExpanded: boolean) => void;
|
|
@@ -73,10 +73,8 @@ export interface ChatToolCallsProps extends BaseProps<HTMLDivElement> {
|
|
|
73
73
|
* name: tc.toolName,
|
|
74
74
|
* status: tc.state,
|
|
75
75
|
* duration: tc.duration,
|
|
76
|
+
* resultDetail: <CodeBlock code={tc.args} language="json" />,
|
|
76
77
|
* }))}
|
|
77
|
-
* renderDetail={(call) => (
|
|
78
|
-
* <CodeBlock code={call.args} language="json" />
|
|
79
|
-
* )}
|
|
80
78
|
* />
|
|
81
79
|
* ```
|
|
82
80
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatToolCalls.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatToolCalls.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAA+B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatToolCalls.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatToolCalls.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAA+B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0B5C,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6FAA6F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