@@ -44,14 +44,25 @@ import {
44
44
heightNumber
45
45
} from '../styles/index.js' ;
46
46
47
+ /**
48
+ * Tree item expand collapse button size CSS Partial
49
+ * @public
50
+ */
51
+ export const expandCollapseButtonSize = cssPartial `(((${ baseHeightMultiplier } + ${ density } ) * 0.5 + 2) * ${ designUnit } )` ;
52
+
47
53
const ltr = css `
48
54
.expand-collapse-glyph {
49
55
transform : rotate (0deg );
50
56
}
51
57
: host (.nested ) .expand-collapse-button {
52
58
left : var(
53
59
--expand-collapse-button-nested-width ,
54
- calc (${ heightNumber } * -1px )
60
+ calc (
61
+ (
62
+ ${ expandCollapseButtonSize } +
63
+ ((${ baseHeightMultiplier } + ${ density } ) * 1.25 )
64
+ ) * -1px
65
+ )
55
66
);
56
67
}
57
68
: host ([selected ])::after {
@@ -69,7 +80,12 @@ const rtl = css`
69
80
: host (.nested ) .expand-collapse-button {
70
81
right : var(
71
82
--expand-collapse-button-nested-width ,
72
- calc (${ heightNumber } * -1px )
83
+ calc (
84
+ (
85
+ ${ expandCollapseButtonSize } +
86
+ ((${ baseHeightMultiplier } + ${ density } ) * 1.25 )
87
+ ) * -1px
88
+ )
73
89
);
74
90
}
75
91
: host ([selected ])::after {
@@ -80,12 +96,6 @@ const rtl = css`
80
96
}
81
97
` ;
82
98
83
- /**
84
- * Tree item expand collapse button size CSS Partial
85
- * @public
86
- */
87
- export const expandCollapseButtonSize = cssPartial `((${ baseHeightMultiplier } / 2) * ${ designUnit } ) + ((${ designUnit } * ${ density } ) / 2)` ;
88
-
89
99
const expandCollapseHoverBehavior = DesignToken . create < Swatch > (
90
100
'tree-item-expand-collapse-hover'
91
101
) . withDefault ( ( target : HTMLElement ) => {
@@ -132,7 +142,6 @@ export const treeItemStyles: FoundationElementTemplate<
132
142
background: ${ neutralFillStealthRest } ;
133
143
cursor : pointer;
134
144
font- family: ${ bodyFont } ;
135
- - - expand - collapse- butto n- size: calc(${ heightNumber } * 1px);
136
145
- - tree- item- nested- width: 0;
137
146
}
138
147
@@ -199,8 +208,8 @@ export const treeItemStyles: FoundationElementTemplate<
199
208
border : none;
200
209
outline : none;
201
210
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
202
- width : calc (( ${ expandCollapseButtonSize } + ( ${ designUnit } * 2 )) * 1px );
203
- height : calc (( ${ expandCollapseButtonSize } + ( ${ designUnit } * 2 )) * 1px );
211
+ width : calc (${ expandCollapseButtonSize } * 1px );
212
+ height : calc (${ expandCollapseButtonSize } * 1px );
204
213
padding : 0 ;
205
214
display : flex;
206
215
justify-content : center;
@@ -261,7 +270,13 @@ export const treeItemStyles: FoundationElementTemplate<
261
270
262
271
: host (.nested ) .content-region {
263
272
position : relative;
264
- margin-inline-start : var (--expand-collapse-button-size );
273
+ /* Add left margin to collapse button size */
274
+ margin-inline-start : calc(
275
+ (
276
+ ${ expandCollapseButtonSize } +
277
+ ((${ baseHeightMultiplier } + ${ density } ) * 1.25 )
278
+ ) * 1px
279
+ );
265
280
}
266
281
267
282
: host (.nested ) .expand-collapse-button {
@@ -304,7 +319,12 @@ export const treeItemStyles: FoundationElementTemplate<
304
319
305
320
::slotted (${ context . tagFor ( TreeItem ) } ) {
306
321
--tree-item-nested-width : 1em ;
307
- --expand-collapse-button-nested-width : calc (${ heightNumber } * -1px );
322
+ --expand-collapse-button-nested-width : calc(
323
+ (
324
+ ${ expandCollapseButtonSize } +
325
+ ((${ baseHeightMultiplier } + ${ density } ) * 1.25 )
326
+ ) * -1px
327
+ );
308
328
}
309
329
` . withBehaviors (
310
330
new DirectionalStyleSheetBehavior ( ltr , rtl ) ,
0 commit comments