@@ -44,14 +44,25 @@ import {
4444 heightNumber
4545} from '../styles/index.js' ;
4646
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+
4753const ltr = css `
4854 .expand-collapse-glyph {
4955 transform : rotate (0deg );
5056 }
5157 : host (.nested ) .expand-collapse-button {
5258 left : var(
5359 --expand-collapse-button-nested-width ,
54- calc (${ heightNumber } * -1px )
60+ calc (
61+ (
62+ ${ expandCollapseButtonSize } +
63+ ((${ baseHeightMultiplier } + ${ density } ) * 1.25 )
64+ ) * -1px
65+ )
5566 );
5667 }
5768 : host ([selected ])::after {
@@ -69,7 +80,12 @@ const rtl = css`
6980 : host (.nested ) .expand-collapse-button {
7081 right : var(
7182 --expand-collapse-button-nested-width ,
72- calc (${ heightNumber } * -1px )
83+ calc (
84+ (
85+ ${ expandCollapseButtonSize } +
86+ ((${ baseHeightMultiplier } + ${ density } ) * 1.25 )
87+ ) * -1px
88+ )
7389 );
7490 }
7591 : host ([selected ])::after {
@@ -80,12 +96,6 @@ const rtl = css`
8096 }
8197` ;
8298
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-
8999const expandCollapseHoverBehavior = DesignToken . create < Swatch > (
90100 'tree-item-expand-collapse-hover'
91101) . withDefault ( ( target : HTMLElement ) => {
@@ -132,7 +142,6 @@ export const treeItemStyles: FoundationElementTemplate<
132142 background: ${ neutralFillStealthRest } ;
133143 cursor : pointer;
134144 font- family: ${ bodyFont } ;
135- - - expand - collapse- butto n- size: calc(${ heightNumber } * 1px);
136145 - - tree- item- nested- width: 0;
137146 }
138147
@@ -199,8 +208,8 @@ export const treeItemStyles: FoundationElementTemplate<
199208 border : none;
200209 outline : none;
201210 /* 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 );
204213 padding : 0 ;
205214 display : flex;
206215 justify-content : center;
@@ -261,7 +270,13 @@ export const treeItemStyles: FoundationElementTemplate<
261270
262271 : host (.nested ) .content-region {
263272 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+ );
265280 }
266281
267282 : host (.nested ) .expand-collapse-button {
@@ -304,7 +319,12 @@ export const treeItemStyles: FoundationElementTemplate<
304319
305320 ::slotted (${ context . tagFor ( TreeItem ) } ) {
306321 --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+ );
308328 }
309329 ` . withBehaviors (
310330 new DirectionalStyleSheetBehavior ( ltr , rtl ) ,
0 commit comments