1
- import { children , html } from '@microsoft/fast-element' ;
1
+ import { elements , html , slotted } from '@microsoft/fast-element' ;
2
+ import { FluentDesignSystem } from '../fluent-design-system.js' ;
2
3
import type { TreeItem } from './tree-item.js' ;
3
- import { isTreeItem } from './tree-item.options.js' ;
4
4
5
5
const chevronIcon = html `
6
- < svg width =" 12 " height =" 12 " xmlns =" http://www.w3.org/2000/svg " fill ="currentColor ">
6
+ < svg viewBox =" 0 0 12 12 " fill ="currentColor ">
7
7
< path
8
8
d ="M4.65 2.15a.5.5 0 000 .7L7.79 6 4.65 9.15a.5.5 0 10.7.7l3.5-3.5a.5.5 0 000-.7l-3.5-3.5a.5.5 0 00-.7 0z "
9
9
> </ path >
10
10
</ svg >
11
11
` ;
12
12
13
13
export const template = html < TreeItem > `
14
- <template
15
- tabindex="${ x => ( x . selected ? 0 : - 1 ) } "
16
- slot="${ x => ( x . isNestedItem ? 'item' : void 0 ) } "
17
- ${ children ( {
18
- property : 'childTreeItems' ,
19
- filter : node => isTreeItem ( node ) ,
20
- } ) }
21
- >
14
+ <template slot="${ x => ( x . isNestedItem ? 'item' : void 0 ) } ">
22
15
<div class="positioning-region" part="positioning-region">
23
16
<div class="content" part="content">
24
- <span class="chevron" part="chevron">
17
+ <span class="chevron" part="chevron" aria-hidden="true" >
25
18
<slot name="chevron">${ chevronIcon } </slot>
26
19
</span>
27
20
<slot name="start"></slot>
@@ -33,7 +26,13 @@ export const template = html<TreeItem>`
33
26
</div>
34
27
</div>
35
28
<div role="group" class="items" part="items">
36
- <slot name="item"></slot>
29
+ <slot
30
+ name="item"
31
+ ${ slotted ( {
32
+ property : 'childTreeItems' ,
33
+ filter : elements ( `${ FluentDesignSystem . prefix } -tree-item` ) ,
34
+ } ) }
35
+ ></slot>
37
36
</div>
38
37
</template>
39
38
` ;
0 commit comments