@@ -55,6 +55,26 @@ const generateStyle = (
5555 condensedMedium : componentTheme . gapButtonContentSm
5656 }
5757
58+ // Outer height token per size, keyed like `sizeVariants`. Used to compensate
59+ // the ai-secondary gradient-border padding.
60+ const heightForSize = {
61+ small : componentTheme . smallHeight ,
62+ medium : componentTheme . mediumHeight ,
63+ large : componentTheme . largeHeight ,
64+ condensedSmall : componentTheme . heightXxs ,
65+ condensedMedium : componentTheme . heightXs
66+ }
67+
68+ // ai-secondary draws its gradient "border" as a ::before ring whose space is
69+ // reserved by padding on the button wrapper (see the `&&&&&&&&&&` block below).
70+ // That padding is additive to the content box, so an ai-secondary button ends
71+ // up 2 × borderWidth taller — and, when icon-only, wider — than the same button
72+ // in any other color. Shrink the content box by the same amount to compensate.
73+ const aiSecondaryContentSize =
74+ color === 'ai-secondary'
75+ ? `calc(${ heightForSize [ size ! ] } - ${ componentTheme . borderWidth } * 2)`
76+ : undefined
77+
5878 const shapeVariants = {
5979 circle : { borderRadius : componentTheme . borderRadiusFull } ,
6080 rectangle : { }
@@ -560,6 +580,14 @@ const generateStyle = (
560580 } ) ,
561581 ...( ! withBorder && {
562582 borderStyle : 'none'
583+ } ) ,
584+ // ai-secondary uses padding to render its gradient border, which increases
585+ // the outer size. Reduce the content size to keep dimensions consistent.
586+ ...( aiSecondaryContentSize && {
587+ ...( size === 'condensedSmall' || size === 'condensedMedium'
588+ ? { height : aiSecondaryContentSize }
589+ : { minHeight : aiSecondaryContentSize } ) ,
590+ ...( hasOnlyIconVisible && { width : aiSecondaryContentSize } )
563591 } )
564592 } ,
565593
0 commit comments