@@ -67,6 +67,7 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
67
67
...focusRing ( ) ,
68
68
...staticColor ( ) ,
69
69
...controlStyle ,
70
+ display : 'grid' ,
70
71
justifyContent : 'center' ,
71
72
flexShrink : {
72
73
default : 1 ,
@@ -79,9 +80,21 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
79
80
isJustified : 0
80
81
} ,
81
82
fontWeight : 'medium' ,
83
+ width : 'fit' ,
82
84
userSelect : 'none' ,
83
85
transition : 'default' ,
84
86
forcedColorAdjust : 'none' ,
87
+ position : 'relative' ,
88
+ gridTemplateAreas : {
89
+ default : [ 'icon text' ] ,
90
+ [ iconOnly ] : [ 'icon' ] ,
91
+ [ textOnly ] : [ 'text' ]
92
+ } ,
93
+ gridTemplateColumns : {
94
+ default : [ 'auto' , 'auto' ] ,
95
+ [ iconOnly ] : [ 'auto' ] ,
96
+ [ textOnly ] : [ 'auto' ]
97
+ } ,
85
98
backgroundColor : {
86
99
default : {
87
100
...baseColor ( 'gray-100' ) ,
@@ -223,8 +236,7 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
223
236
'--badgePosition' : {
224
237
type : 'width' ,
225
238
value : {
226
- default : 'calc(self(paddingStart) + var(--iconWidth))' ,
227
- [ iconOnly ] : 'calc(self(minWidth)/2 + var(--iconWidth)/2)' ,
239
+ default : '--iconWidth' ,
228
240
[ textOnly ] : 'full'
229
241
}
230
242
} ,
@@ -289,10 +301,10 @@ export const ActionButton = forwardRef(function ActionButton(props: ActionButton
289
301
< Provider
290
302
values = { [
291
303
[ SkeletonContext , null ] ,
292
- [ TextContext , { styles : style ( { order : 1 , truncate : true } ) } ] ,
304
+ [ TextContext , { styles : style ( { truncate : true , gridArea : 'text' } ) } ] ,
293
305
[ IconContext , {
294
- render : centerBaseline ( { slot : 'icon' , styles : style ( { order : 0 } ) } ) ,
295
- styles : style ( { size : fontRelative ( 20 ) , marginStart : '--iconMargin' , flexShrink : 0 } )
306
+ render : centerBaseline ( { slot : 'icon' , styles : style ( { gridArea : 'icon' } ) } ) ,
307
+ styles : style ( { size : fontRelative ( 20 ) , marginStart : '--iconMargin' } )
296
308
} ] ,
297
309
[ AvatarContext , {
298
310
size : avatarSize [ size ] ,
@@ -301,15 +313,14 @@ export const ActionButton = forwardRef(function ActionButton(props: ActionButton
301
313
default : '--iconMargin' ,
302
314
':last-child' : 0
303
315
} ,
304
- flexShrink : 0 ,
305
- order : 0
316
+ gridArea : 'icon'
306
317
} )
307
318
} ] ,
308
319
[ NotificationBadgeContext , {
309
320
staticColor : staticColor ,
310
321
size : props . size === 'XS' ? undefined : props . size ,
311
322
isDisabled : props . isDisabled ,
312
- styles : style ( { position : 'absolute' , top : '--badgeTop' , insetStart : '--badgePosition' , marginTop : 'calc((self(height) * -1)/2)' , marginStart : 'calc(( self(height) * -1)/2) ' } )
323
+ styles : style ( { position : 'absolute' , top : '--badgeTop' , marginTop : 'calc((self(height) * -1)/2)' , marginStart : 'calc(var(--iconMargin) * 2 + ( self(height) * -1)/4)' , gridColumnStart : 1 , insetStart : '--badgePosition '} )
313
324
} ]
314
325
] } >
315
326
{ typeof props . children === 'string' ? < Text > { props . children } </ Text > : props . children }
0 commit comments