Skip to content

Commit 26fb687

Browse files
authored
fix(chat): fix secret-input chat widget reshaping after submit (#5346)
SecretReveal (the post-submit redacted state) used bespoke h-9/rounded-md/px-2.5 chrome with an absolutely-positioned copy button, instead of the canonical chip-field chrome (h-[30px]/rounded-lg/px-2) that SecretInput (the pre-submit state) uses. That mismatch made the credential-paste widget visibly resize right after saving. Rebuilt SecretReveal on the same chipFieldSurfaceClass tokens as ChipInput, with the copy button as an inline trailing adornment.
1 parent 577b402 commit 26fb687

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

‎packages/emcn/src/components/secret-reveal/secret-reveal.tsx‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import { useCopyToClipboard } from '../../hooks/use-copy-to-clipboard'
2222
import { Button, Check, Duplicate } from '../../index'
2323
import { cn } from '../../lib/cn'
24+
import { chipFieldSurfaceClass, chipFieldTextClass } from '../chip/chip-chrome'
2425

2526
const REDACTED_DOTS = '••••••••••••••••••••••••••••••••'
2627

@@ -42,26 +43,26 @@ export function SecretReveal({ value, className, redacted = false }: SecretRevea
4243
}
4344

4445
return (
45-
<div className={cn('relative', className)}>
46-
<div
46+
<div
47+
className={cn(
48+
'flex h-[30px] w-full items-center gap-1.5 px-2',
49+
chipFieldSurfaceClass,
50+
className
51+
)}
52+
>
53+
<code
4754
className={cn(
48-
'flex h-9 items-center rounded-md border bg-[var(--surface-1)] px-2.5',
49-
!isHidden && 'pr-10'
55+
chipFieldTextClass,
56+
'flex-1 truncate font-mono',
57+
isHidden && 'text-[var(--text-muted)]'
5058
)}
5159
>
52-
<code
53-
className={cn(
54-
'flex-1 truncate font-mono text-sm',
55-
isHidden ? 'text-[var(--text-muted)]' : 'text-[var(--text-primary)]'
56-
)}
57-
>
58-
{isHidden ? REDACTED_DOTS : value}
59-
</code>
60-
</div>
60+
{isHidden ? REDACTED_DOTS : value}
61+
</code>
6162
{!isHidden && (
6263
<Button
6364
variant='ghost'
64-
className='-translate-y-1/2 absolute top-1/2 right-[4px] size-[28px] rounded-sm text-[var(--text-muted)] hover-hover:text-[var(--text-primary)]'
65+
className='size-[18px] flex-shrink-0 rounded-sm p-0 text-[var(--text-muted)] hover-hover:text-[var(--text-primary)]'
6566
onClick={handleCopy}
6667
>
6768
{copied ? <Check className='size-[14px]' /> : <Duplicate className='size-[14px]' />}

0 commit comments

Comments
 (0)