Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fix-chat-token-alignment.md
Original file line number Diff line number Diff line change
@@ -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`.

@athz
6 changes: 5 additions & 1 deletion packages/core/src/Chat/ChatComposerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ const styles = stylex.create({
opacity: 0.5,
pointerEvents: 'none' as const,
},
tokenSpan: {
display: 'inline-flex',
verticalAlign: 'middle',
},
});

// =============================================================================
Expand Down Expand Up @@ -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()
) : (
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Chat/useChatComposerTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading