An open source design system that's fully customizable and agent ready
TypeScript
fix(Chat): align composer tokens to middle instead of synthesized baseline (#5324)
athz51fec0ca2de6
diff --git a/.changeset/fix-chat-token-alignment.md b/.changeset/fix-chat-token-alignment.mdnew file mode 100644index 0000000000..8d42229583--- /dev/null+++ b/.changeset/fix-chat-token-alignment.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Chat: composer tokens no longer sit above surrounding text — `vertical-align` changed from `baseline` to `middle`, and `ChatComposerTokenElement` now uses a StyleX class instead of an inline style so consumers can override alignment without `!important`.++@athzdiff --git a/packages/core/src/Chat/ChatComposerInput.tsx b/packages/core/src/Chat/ChatComposerInput.tsxindex 6b8b07c780..5a6a56b94b 100644--- a/packages/core/src/Chat/ChatComposerInput.tsx+++ b/packages/core/src/Chat/ChatComposerInput.tsx@@ -255,6 +255,10 @@ const styles = stylex.create({opacity: 0.5,pointerEvents: 'none' as const,},+ tokenSpan: {+ display: 'inline-flex',+ verticalAlign: 'middle',+ },});// =============================================================================@@ -749,7 +753,7 @@ export function ChatComposerTokenElement({token}: {token: ChatComposerToken}) {data-astryx-token=""data-astryx-token-value={token.value}contentEditable={false}- style={{display: 'inline-flex', verticalAlign: 'baseline'}}>+ {...stylex.props(styles.tokenSpan)}>{isCustomToken(token) ? (token.render()) : (diff --git a/packages/core/src/Chat/useChatComposerTokens.ts b/packages/core/src/Chat/useChatComposerTokens.tsindex 9b2219eba7..071303f08b 100644--- a/packages/core/src/Chat/useChatComposerTokens.ts+++ b/packages/core/src/Chat/useChatComposerTokens.ts@@ -120,7 +120,7 @@ export function useChatComposerTokens({span.setAttribute('data-astryx-token-id', id);span.contentEditable = 'false';span.style.display = 'inline-flex';- span.style.verticalAlign = 'baseline';+ span.style.verticalAlign = 'middle';range.deleteContents();range.insertNode(span);