@@ -197,7 +197,15 @@ const treeRowOutline = style({
197197 position : 'absolute' ,
198198 insetStart : 0 ,
199199 insetEnd : 0 ,
200- top : 0 ,
200+ top : {
201+ default : 0 ,
202+ isFocusVisible : '[-2px]' ,
203+ isSelected : {
204+ default : '[-1px]' ,
205+ isFocusVisible : '[-2px]'
206+ } ,
207+ isFirst : 0
208+ } ,
201209 bottom : 0 ,
202210 pointerEvents : 'none' ,
203211 forcedColorAdjust : 'none' ,
@@ -246,41 +254,44 @@ export const TreeViewItemContent = (props: SpectrumTreeViewItemContentProps) =>
246254
247255 return (
248256 < TreeItemContent >
249- { ( { isExpanded, hasChildItems, level, selectionMode, selectionBehavior, isDisabled, isSelected, isFocusVisible} ) => (
250- < div className = { treeCellGrid ( { isDisabled} ) } >
251- { selectionMode !== 'none' && selectionBehavior === 'toggle' && (
257+ { ( { isExpanded, hasChildItems, level, selectionMode, selectionBehavior, isDisabled, isSelected, isFocusVisible, state, id} ) => {
258+ let isFirst = state . collection . getFirstKey ( ) === id ;
259+ return (
260+ < div className = { treeCellGrid ( { isDisabled} ) } >
261+ { selectionMode !== 'none' && selectionBehavior === 'toggle' && (
252262 // TODO: add transition?
253- < Checkbox
254- isEmphasized
255- UNSAFE_className = { treeCheckbox ( ) }
256- UNSAFE_style = { { paddingInlineEnd : '0px' } }
257- slot = "selection" />
258- ) }
259- < div style = { { gridArea : 'level-padding' , marginInlineEnd : `calc(${ level - 1 } * var(--spectrum-global-dimension-size-200))` } } />
260- { /* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */ }
261- { hasChildItems && < ExpandableRowChevron isDisabled = { isDisabled } isExpanded = { isExpanded } /> }
262- < SlotProvider
263- slots = { {
264- text : { UNSAFE_className : treeContent ( { isDisabled} ) } ,
265- // Note there is also an issue here where these icon props are making into the action menu's icon. Resolved by 8ab0ffb276ff437a65b365c9a3be0323a1b24656
266- // but could crop up later for other components
267- icon : { UNSAFE_className : treeIcon ( ) , size : 'S' } ,
268- actionButton : { UNSAFE_className : treeActions ( ) , isQuiet : true } ,
269- actionGroup : {
270- UNSAFE_className : treeActions ( ) ,
271- isQuiet : true ,
272- density : 'compact' ,
273- buttonLabelBehavior : 'hide' ,
274- isDisabled,
275- overflowMode : 'collapse'
276- } ,
277- actionMenu : { UNSAFE_className : treeActionMenu ( ) , UNSAFE_style : { marginInlineEnd : '.5rem' } , isQuiet : true }
278- } } >
279- { children }
280- </ SlotProvider >
281- < div className = { treeRowOutline ( { isFocusVisible, isSelected} ) } />
282- </ div >
283- ) }
263+ < Checkbox
264+ isEmphasized
265+ UNSAFE_className = { treeCheckbox ( ) }
266+ UNSAFE_style = { { paddingInlineEnd : '0px' } }
267+ slot = "selection" />
268+ ) }
269+ < div style = { { gridArea : 'level-padding' , marginInlineEnd : `calc(${ level - 1 } * var(--spectrum-global-dimension-size-200))` } } />
270+ { /* TODO: revisit when we do async loading, at the moment hasChildItems will only cause the chevron to be rendered, no aria/data attributes indicating the row's expandability are added */ }
271+ { hasChildItems && < ExpandableRowChevron isDisabled = { isDisabled } isExpanded = { isExpanded } /> }
272+ < SlotProvider
273+ slots = { {
274+ text : { UNSAFE_className : treeContent ( { isDisabled} ) } ,
275+ // Note there is also an issue here where these icon props are making into the action menu's icon. Resolved by 8ab0ffb276ff437a65b365c9a3be0323a1b24656
276+ // but could crop up later for other components
277+ icon : { UNSAFE_className : treeIcon ( ) , size : 'S' } ,
278+ actionButton : { UNSAFE_className : treeActions ( ) , isQuiet : true } ,
279+ actionGroup : {
280+ UNSAFE_className : treeActions ( ) ,
281+ isQuiet : true ,
282+ density : 'compact' ,
283+ buttonLabelBehavior : 'hide' ,
284+ isDisabled,
285+ overflowMode : 'collapse'
286+ } ,
287+ actionMenu : { UNSAFE_className : treeActionMenu ( ) , UNSAFE_style : { marginInlineEnd : '.5rem' } , isQuiet : true }
288+ } } >
289+ { children }
290+ </ SlotProvider >
291+ < div className = { treeRowOutline ( { isFocusVisible, isSelected, isFirst} ) } />
292+ </ div >
293+ ) ;
294+ } }
284295 </ TreeItemContent >
285296 ) ;
286297} ;
0 commit comments