@@ -73,7 +73,7 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
7373 ...focusRing ( ) ,
7474 ...staticColor ( ) ,
7575 ...controlStyle ,
76- position : 'relative ' ,
76+ display : 'grid ' ,
7777 justifyContent : 'center' ,
7878 flexShrink : {
7979 default : 1 ,
@@ -86,9 +86,21 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
8686 isJustified : 0
8787 } ,
8888 fontWeight : 'medium' ,
89+ width : 'fit' ,
8990 userSelect : 'none' ,
9091 transition : 'default' ,
9192 forcedColorAdjust : 'none' ,
93+ position : 'relative' ,
94+ gridTemplateAreas : {
95+ default : [ 'icon text' ] ,
96+ [ iconOnly ] : [ 'icon' ] ,
97+ [ textOnly ] : [ 'text' ]
98+ } ,
99+ gridTemplateColumns : {
100+ default : [ 'auto' , 'auto' ] ,
101+ [ iconOnly ] : [ 'auto' ] ,
102+ [ textOnly ] : [ 'auto' ]
103+ } ,
92104 backgroundColor : {
93105 default : {
94106 ...baseColor ( 'gray-100' ) ,
@@ -230,8 +242,7 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
230242 '--badgePosition' : {
231243 type : 'width' ,
232244 value : {
233- default : 'calc(self(paddingStart) + var(--iconWidth))' ,
234- [ iconOnly ] : 'calc(self(minWidth)/2 + var(--iconWidth)/2)' ,
245+ default : '--iconWidth' ,
235246 [ textOnly ] : 'full'
236247 }
237248 } ,
@@ -311,19 +322,18 @@ export const ActionButton = forwardRef(function ActionButton(props: ActionButton
311322 [ SkeletonContext , null ] ,
312323 [ TextContext , { styles :
313324 style ( {
314- order : 1 ,
325+ gridArea : 'text' ,
315326 truncate : true ,
316327 visibility : {
317328 isProgressVisible : 'hidden'
318329 }
319330 } ) ( { isProgressVisible} )
320331 } ] ,
321332 [ IconContext , {
322- render : centerBaseline ( { slot : 'icon' , styles : style ( { order : 0 } ) } ) ,
333+ render : centerBaseline ( { slot : 'icon' , styles : style ( { gridArea : 'icon' } ) } ) ,
323334 styles : style ( {
324335 size : fontRelative ( 20 ) ,
325336 marginStart : '--iconMargin' ,
326- flexShrink : 0 ,
327337 visibility : {
328338 isProgressVisible : 'hidden'
329339 }
@@ -333,8 +343,7 @@ export const ActionButton = forwardRef(function ActionButton(props: ActionButton
333343 size : avatarSize [ size ] ,
334344 styles : style ( {
335345 marginStart : '--iconMargin' ,
336- flexShrink : 0 ,
337- order : 0
346+ gridArea : 'icon'
338347 } )
339348 } ] ,
340349 [ ImageContext , {
@@ -351,9 +360,10 @@ export const ActionButton = forwardRef(function ActionButton(props: ActionButton
351360 styles : style ( {
352361 position : 'absolute' ,
353362 top : '--badgeTop' ,
354- insetStart : '--badgePosition' ,
355363 marginTop : 'calc((self(height) * -1)/2)' ,
356- marginStart : 'calc((self(height) * -1)/2)' ,
364+ marginStart : 'calc(var(--iconMargin) * 2 + (self(height) * -1)/4)' ,
365+ gridColumnStart : 1 ,
366+ insetStart : '--badgePosition' ,
357367 visibility : {
358368 isProgressVisible : 'hidden'
359369 }
0 commit comments