@fluentui/web-components 3.0.0-beta.85 → 3.0.0-beta.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { attr, css, FASTElement, observable } from '@microsoft/fast-element';
3
- import { toggleState } from '../utils/element-internals.js';
4
- import { isTreeItem, TreeItemAppearance, TreeItemSize } from './tree-item.options.js';
5
- export class TreeItem extends FASTElement {
2
+ import { attr } from '@microsoft/fast-element';
3
+ import { TreeItemAppearance, TreeItemSize } from './tree-item.options.js';
4
+ import { BaseTreeItem } from './tree-item.base';
5
+ export class TreeItem extends BaseTreeItem {
6
6
  constructor() {
7
- super();
8
- /**
9
- * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
10
- *
11
- * @internal
12
- */
13
- this.elementInternals = this.attachInternals();
14
- /**
15
- * When true, the control will be appear expanded by user interaction.
16
- * @public
17
- * HTML Attribute: `expanded`
18
- */
19
- this.expanded = false;
20
- /**
21
- * When true, the control will appear selected by user interaction.
22
- * @public
23
- * @remarks
24
- * HTML Attribute: selected
25
- */
26
- this.selected = false;
27
- /**
28
- * When true, the control has no child tree items
29
- * @public
30
- * HTML Attribute: empty
31
- */
32
- this.empty = false;
7
+ super(...arguments);
33
8
  /**
34
9
  * The size of the tree item element
35
10
  * @public
@@ -40,33 +15,6 @@ export class TreeItem extends FASTElement {
40
15
  * @public
41
16
  */
42
17
  this.appearance = TreeItemAppearance.subtle;
43
- this.childTreeItems = [];
44
- this.elementInternals.role = 'treeitem';
45
- }
46
- /**
47
- * Handles changes to the expanded attribute
48
- * @param prev - the previous state
49
- * @param next - the next state
50
- *
51
- * @public
52
- */
53
- expandedChanged(prev, next) {
54
- toggleState(this.elementInternals, 'expanded', next);
55
- if (this.childTreeItems && this.childTreeItems.length > 0) {
56
- this.elementInternals.ariaExpanded = next ? 'true' : 'false';
57
- }
58
- }
59
- /**
60
- * Handles changes to the selected attribute
61
- * @param prev - the previous state
62
- * @param next - the next state
63
- *
64
- * @internal
65
- */
66
- selectedChanged(prev, next) {
67
- this.$emit('change');
68
- toggleState(this.elementInternals, 'selected', next);
69
- this.elementInternals.ariaSelected = next ? 'true' : 'false';
70
18
  }
71
19
  /**
72
20
  * Handles changes to the size attribute
@@ -74,7 +22,7 @@ export class TreeItem extends FASTElement {
74
22
  * @internal
75
23
  */
76
24
  sizeChanged() {
77
- this.updateChildTreeItems();
25
+ this.updateSizeAndAppearance();
78
26
  }
79
27
  /**
80
28
  * Handles changes to the appearance attribute
@@ -82,120 +30,36 @@ export class TreeItem extends FASTElement {
82
30
  * @internal
83
31
  */
84
32
  appearanceChanged() {
85
- this.updateChildTreeItems();
86
- }
87
- dataIndentChanged(prev, next) {
88
- if (this.styles !== undefined) {
89
- this.$fastController.removeStyles(this.styles);
90
- }
91
- this.styles = css `
92
- :host {
93
- --indent: ${next};
94
- }
95
- `;
96
- this.$fastController.addStyles(this.styles);
33
+ this.updateSizeAndAppearance();
97
34
  }
98
35
  /**
99
- * Handles changes to the child tree items
100
- *
36
+ * child tree items supered change event
101
37
  * @internal
102
38
  */
103
39
  childTreeItemsChanged() {
104
- this.empty = this.childTreeItems?.length === 0;
105
- this.updateChildTreeItems();
40
+ super.childTreeItemsChanged();
41
+ this.updateSizeAndAppearance();
106
42
  }
107
43
  /**
108
44
  * 1. Update the child items' size based on the tree's size
109
45
  * 2. Update the child items' appearance based on the tree's appearance
46
+ *
47
+ * @public
110
48
  */
111
- updateChildTreeItems() {
49
+ updateSizeAndAppearance() {
112
50
  if (!this.childTreeItems?.length) {
113
51
  return;
114
52
  }
115
53
  this.childTreeItems.forEach(item => {
116
- if (!isTreeItem(item)) {
117
- return;
118
- }
119
- this.setIndent(item);
120
54
  item.size = this.size;
121
55
  item.appearance = this.appearance;
122
56
  });
123
57
  }
124
- /**
125
- * Sets the indent for each item
126
- */
127
- setIndent(item) {
128
- const indent = this.dataIndent ?? 0;
129
- item.dataIndent = indent + 1;
130
- }
131
- /**
132
- * Handle focus events
133
- *
134
- * @public
135
- */
136
- focusHandler(e) {
137
- if (e.target === this ||
138
- // In case where the tree-item contains a focusable element, we should not set the tabindex to 0 when the focus is on its child focusable element,
139
- // so users can shift+tab to navigate to the tree-item from its child focusable element.
140
- this.contains(e.target)) {
141
- this.setAttribute('tabindex', '0');
142
- }
143
- }
144
- /**
145
- * Handle blur events
146
- *
147
- * @public
148
- */
149
- blurHandler(e) {
150
- if (e.target === this) {
151
- this.setAttribute('tabindex', '-1');
152
- }
153
- }
154
- /**
155
- * Toggle the expansion state of the tree item
156
- *
157
- * @public
158
- */
159
- toggleExpansion() {
160
- if (this.childTreeItems?.length) {
161
- this.expanded = !this.expanded;
162
- }
163
- }
164
- /**
165
- * Toggle the single selection state of the tree item
166
- *
167
- * @public
168
- */
169
- toggleSelection() {
170
- this.selected = !this.selected;
171
- }
172
- /**
173
- * Whether the tree is nested
174
- * @internal
175
- */
176
- get isNestedItem() {
177
- return isTreeItem(this.parentElement);
178
- }
179
58
  }
180
- __decorate([
181
- attr({ mode: 'boolean' })
182
- ], TreeItem.prototype, "expanded", void 0);
183
- __decorate([
184
- attr({ mode: 'boolean' })
185
- ], TreeItem.prototype, "selected", void 0);
186
- __decorate([
187
- attr({ mode: 'boolean' })
188
- ], TreeItem.prototype, "empty", void 0);
189
59
  __decorate([
190
60
  attr
191
61
  ], TreeItem.prototype, "size", void 0);
192
62
  __decorate([
193
63
  attr
194
64
  ], TreeItem.prototype, "appearance", void 0);
195
- __decorate([
196
- attr({ attribute: 'data-indent' })
197
- ], TreeItem.prototype, "dataIndent", void 0);
198
- __decorate([
199
- observable
200
- ], TreeItem.prototype, "childTreeItems", void 0);
201
65
  //# sourceMappingURL=tree-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-item.js","sourceRoot":"","sources":["../../../src/tree-item/tree-item.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE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AAE,CAAC;4CACI;AAiBvC;IADC,UAAU;gDACiC"}
1
+ {"version":3,"file":"tree-item.js","sourceRoot":"","sources":["../../../src/tree-item/tree-item.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,OAAO,QAAS,SAAQ,YAAY;IAA1C;;QACE;;;WAGG;QAEI,SAAI,GAAiB,YAAY,CAAC,KAAK,CAAC;QAW/C;;;WAGG;QAEI,eAAU,GAAuB,kBAAkB,CAAC,MAAM,CAAC;IAoCpE,CAAC;IAlDC;;;;OAIG;IACK,WAAW;QACjB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IASD;;;;OAIG;IACK,iBAAiB;QACvB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,qBAAqB;QAC1B,KAAK,CAAC,qBAAqB,EAAE,CAAC;QAC9B,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,uBAAuB;QAC5B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAChC,IAAiB,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACnC,IAAiB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApDQ;IADN,IAAI;sCAC0C;AAgBxC;IADN,IAAI;4CAC6D"}
@@ -1,11 +1,13 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { borderRadiusMedium, colorNeutralForeground2, colorNeutralForeground2Hover, colorNeutralForeground2Pressed, colorNeutralForeground2Selected, colorNeutralForeground3, colorNeutralForeground3Hover, colorNeutralForeground3Pressed, colorNeutralForeground3Selected, colorStrokeFocus2, colorSubtleBackground, colorSubtleBackgroundHover, colorSubtleBackgroundLightAlphaHover, colorSubtleBackgroundLightAlphaPressed, colorSubtleBackgroundLightAlphaSelected, colorSubtleBackgroundPressed, colorSubtleBackgroundSelected, colorTransparentBackground, colorTransparentBackgroundHover, colorTransparentBackgroundPressed, colorTransparentBackgroundSelected, curveEasyEaseMax, durationFaster, fontSizeBase300, spacingHorizontalM, spacingHorizontalXS, spacingHorizontalXXL, spacingHorizontalXXS, spacingVerticalNone, spacingVerticalS, spacingVerticalXXL, spacingVerticalXXS, spacingVerticalXXXL, } from '../theme/design-tokens.js';
2
+ import { borderRadiusMedium, colorNeutralForeground2, colorNeutralForeground2Hover, colorNeutralForeground2Pressed, colorNeutralForeground2Selected, colorNeutralForeground3Selected, colorStrokeFocus2, colorSubtleBackground, colorSubtleBackgroundHover, colorSubtleBackgroundLightAlphaHover, colorSubtleBackgroundLightAlphaPressed, colorSubtleBackgroundLightAlphaSelected, colorSubtleBackgroundPressed, colorSubtleBackgroundSelected, colorTransparentBackground, colorTransparentBackgroundHover, colorTransparentBackgroundPressed, colorTransparentBackgroundSelected, curveEasyEaseMax, durationFaster, fontSizeBase300, lineHeightBase300, spacingHorizontalM, spacingHorizontalXS, spacingHorizontalXXL, spacingHorizontalXXS, spacingVerticalNone, spacingVerticalS, spacingVerticalXXL, spacingVerticalXXS, spacingVerticalXXXL, } from '../theme/design-tokens.js';
3
3
  import { display } from '../utils/display.js';
4
4
  export const styles = css `
5
5
  ${display('block')}
6
6
 
7
7
  :host {
8
8
  outline: none;
9
+ font-size: ${fontSizeBase300};
10
+ line-height: ${lineHeightBase300};
9
11
  }
10
12
 
11
13
  :host(:focus-visible) .positioning-region {
@@ -20,7 +22,7 @@ export const styles = css `
20
22
  */
21
23
  .positioning-region {
22
24
  display: flex;
23
- align-items: stretch;
25
+ align-items: center;
24
26
  justify-content: space-between;
25
27
  cursor: pointer;
26
28
  height: ${spacingVerticalXXXL};
@@ -29,6 +31,7 @@ export const styles = css `
29
31
  border-radius: ${borderRadiusMedium};
30
32
  background-color: ${colorSubtleBackground};
31
33
  color: ${colorNeutralForeground2};
34
+ gap: ${spacingHorizontalXS};
32
35
  }
33
36
 
34
37
  @media (prefers-contrast: more) {
@@ -40,19 +43,16 @@ export const styles = css `
40
43
  .content {
41
44
  display: flex;
42
45
  align-items: center;
43
- font-size: ${fontSizeBase300};
44
- min-width: 0;
46
+ gap: ${spacingHorizontalXS};
45
47
  }
46
48
 
47
49
  .chevron {
48
50
  display: flex;
49
51
  align-items: center;
50
52
  flex-shrink: 0;
51
- min-width: 0;
52
53
  justify-content: center;
53
54
  width: ${spacingHorizontalXXL};
54
55
  height: ${spacingVerticalXXL};
55
- color: ${colorNeutralForeground3};
56
56
  transition: transform ${durationFaster} ${curveEasyEaseMax};
57
57
  transform: rotate(0deg);
58
58
  }
@@ -61,12 +61,9 @@ export const styles = css `
61
61
  transform: rotate(180deg);
62
62
  }
63
63
 
64
- .badging,
65
- .toolbar {
64
+ .aside {
66
65
  display: flex;
67
66
  align-items: center;
68
- min-width: 0;
69
- font-size: ${fontSizeBase300};
70
67
  }
71
68
 
72
69
  .positioning-region:hover {
@@ -74,22 +71,13 @@ export const styles = css `
74
71
  color: ${colorNeutralForeground2Hover};
75
72
  }
76
73
 
77
- .positioning-region:hover .content,
78
- .positioning-region:hover .chevron {
79
- color: ${colorNeutralForeground3Hover};
80
- }
81
-
82
74
  .positioning-region:active {
83
75
  background-color: ${colorSubtleBackgroundPressed};
84
76
  color: ${colorNeutralForeground2Pressed};
85
77
  }
86
78
 
87
- .positioning-region:active .content,
88
- .positioning-region:active .chevron {
89
- color: ${colorNeutralForeground3Pressed};
90
- }
91
-
92
79
  ::slotted([slot='start']),
80
+ ::slotted([slot='end']),
93
81
  ::slotted(:not([slot])) {
94
82
  display: flex;
95
83
  align-items: center;
@@ -98,7 +86,6 @@ export const styles = css `
98
86
 
99
87
  ::slotted([slot='start']) {
100
88
  flex-shrink: 0;
101
- margin-inline-end: ${spacingHorizontalXS};
102
89
  }
103
90
 
104
91
  ::slotted(:not([slot])) {
@@ -1 +1 @@
1
- {"version":3,"file":"tree-item.styles.js","sourceRoot":"","sources":["../../../src/tree-item/tree-item.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,oCAAoC,EACpC,sCAAsC,EACtC,uCAAuC,EACvC,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,EAC1B,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EAClC,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;IACrB,OAAO,CAAC,OAAO,CAAC;;;;;;;kBAOF,mBAAmB,IAAI,mBAAmB,IAAI,mBAAmB,IAAI,kBAAkB;QACjG,iBAAiB;;;;;;;;;;;;;cAaX,mBAAmB;iDACgB,oBAAoB;0BAC3C,gBAAgB;qBACrB,kBAAkB;wBACf,qBAAqB;aAChC,uBAAuB;;;;;2BAKT,iBAAiB;;;;;;;iBAO3B,eAAe;;;;;;;;;;aAUnB,oBAAoB;cACnB,kBAAkB;aACnB,uBAAuB;4BACR,cAAc,IAAI,gBAAgB;;;;;;;;;;;;;iBAa7C,eAAe;;;;wBAIR,0BAA0B;aACrC,4BAA4B;;;;;aAK5B,4BAA4B;;;;wBAIjB,4BAA4B;aACvC,8BAA8B;;;;;aAK9B,8BAA8B;;;;;;;;;;;;yBAYlB,mBAAmB;;;;sBAItB,oBAAoB;;;;;;;;;;;;;;;;;wBAiBlB,6BAA6B;aACxC,+BAA+B;;;;;aAK/B,+BAA+B;;;;cAI9B,kBAAkB;iDACiB,kBAAkB;;;;wBAI3C,oCAAoC;;;;wBAIpC,sCAAsC;;;;wBAItC,uCAAuC;aAClD,+BAA+B;;;;wBAIpB,0BAA0B;;;;wBAI1B,+BAA+B;;;;wBAI/B,iCAAiC;;;;wBAIjC,kCAAkC;aAC7C,+BAA+B;;;;;;CAM3C,CAAC"}
1
+ {"version":3,"file":"tree-item.styles.js","sourceRoot":"","sources":["../../../src/tree-item/tree-item.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAI/B,+BAA+B,EAC/B,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,oCAAoC,EACpC,sCAAsC,EACtC,uCAAuC,EACvC,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,EAC1B,+BAA+B,EAC/B,iCAAiC,EACjC,kCAAkC,EAClC,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;IACrB,OAAO,CAAC,OAAO,CAAC;;;;iBAIH,eAAe;mBACb,iBAAiB;;;;kBAIlB,mBAAmB,IAAI,mBAAmB,IAAI,mBAAmB,IAAI,kBAAkB;QACjG,iBAAiB;;;;;;;;;;;;;cAaX,mBAAmB;iDACgB,oBAAoB;0BAC3C,gBAAgB;qBACrB,kBAAkB;wBACf,qBAAqB;aAChC,uBAAuB;WACzB,mBAAmB;;;;;2BAKH,iBAAiB;;;;;;;WAOjC,mBAAmB;;;;;;;;aAQjB,oBAAoB;cACnB,kBAAkB;4BACJ,cAAc,IAAI,gBAAgB;;;;;;;;;;;;;;wBActC,0BAA0B;aACrC,4BAA4B;;;;wBAIjB,4BAA4B;aACvC,8BAA8B;;;;;;;;;;;;;;;;sBAgBrB,oBAAoB;;;;;;;;;;;;;;;;;wBAiBlB,6BAA6B;aACxC,+BAA+B;;;;;aAK/B,+BAA+B;;;;cAI9B,kBAAkB;iDACiB,kBAAkB;;;;wBAI3C,oCAAoC;;;;wBAIpC,sCAAsC;;;;wBAItC,uCAAuC;aAClD,+BAA+B;;;;wBAIpB,0BAA0B;;;;wBAI1B,+BAA+B;;;;wBAI/B,iCAAiC;;;;wBAIjC,kCAAkC;aAC7C,+BAA+B;;;;;;CAM3C,CAAC"}
@@ -1,4 +1,5 @@
1
- import { children, elements, html } from '@microsoft/fast-element';
1
+ import { children, html } from '@microsoft/fast-element';
2
+ import { isTreeItem } from './tree-item.options';
2
3
  const chevronIcon = html `
3
4
  <svg width="12" height="12" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
4
5
  <path
@@ -14,7 +15,7 @@ export const template = html `
14
15
  @focusout="${(x, c) => x.blurHandler(c.event)}"
15
16
  ${children({
16
17
  property: 'childTreeItems',
17
- filter: elements(),
18
+ filter: node => isTreeItem(node),
18
19
  })}
19
20
  >
20
21
  <div class="positioning-region" part="positioning-region">
@@ -26,11 +27,8 @@ export const template = html `
26
27
  <slot></slot>
27
28
  <slot name="end"></slot>
28
29
  </div>
29
- <div class="badging" part="badging">
30
- <slot name="badging"></slot>
31
- </div>
32
- <div class="toolbar" part="toolbar">
33
- <slot name="toolbar"></slot>
30
+ <div class="aside" part="aside">
31
+ <slot name="aside"></slot>
34
32
  </div>
35
33
  </div>
36
34
  <div role="group" class="items" part="items">
@@ -1 +1 @@
1
- {"version":3,"file":"tree-item.template.js","sourceRoot":"","sources":["../../../src/tree-item/tree-item.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGnE,MAAM,WAAW,GAAG,IAAI,CAAA;;;;;;CAMvB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAU;;;YAG1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAmB,CAAC;iBAC9C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAmB,CAAC;MACzD,QAAQ,CAAC;IACT,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,QAAQ,EAAE;CACnB,CAAC;;;;;iCAK2B,WAAW;;;;;;;;;;;;;;;;;CAiB3C,CAAC"}
1
+ {"version":3,"file":"tree-item.template.js","sourceRoot":"","sources":["../../../src/tree-item/tree-item.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,WAAW,GAAG,IAAI,CAAA;;;;;;CAMvB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAU;;;YAG1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAmB,CAAC;iBAC9C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAmB,CAAC;MACzD,QAAQ,CAAC;IACT,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;CACjC,CAAC;;;;;iCAK2B,WAAW;;;;;;;;;;;;;;CAc3C,CAAC"}
@@ -3261,6 +3261,105 @@ export declare class BaseTextInput extends FASTElement {
3261
3261
  setValidity(flags?: Partial<ValidityState>, message?: string, anchor?: HTMLElement): void;
3262
3262
  }
3263
3263
 
3264
+ declare class BaseTreeItem extends FASTElement {
3265
+ /**
3266
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
3267
+ *
3268
+ * @internal
3269
+ */
3270
+ elementInternals: ElementInternals;
3271
+ constructor();
3272
+ /**
3273
+ * When true, the control will be appear expanded by user interaction.
3274
+ * @public
3275
+ * HTML Attribute: `expanded`
3276
+ */
3277
+ expanded: boolean;
3278
+ /**
3279
+ * Handles changes to the expanded attribute
3280
+ * @param prev - the previous state
3281
+ * @param next - the next state
3282
+ *
3283
+ * @public
3284
+ */
3285
+ expandedChanged(prev: boolean, next: boolean): void;
3286
+ /**
3287
+ * When true, the control will appear selected by user interaction.
3288
+ * @public
3289
+ * @remarks
3290
+ * HTML Attribute: selected
3291
+ */
3292
+ selected: boolean;
3293
+ /**
3294
+ * Handles changes to the selected attribute
3295
+ * @param prev - the previous state
3296
+ * @param next - the next state
3297
+ *
3298
+ * @internal
3299
+ */
3300
+ protected selectedChanged(prev: boolean, next: boolean): void;
3301
+ /**
3302
+ * When true, the control has no child tree items
3303
+ * @public
3304
+ * HTML Attribute: empty
3305
+ */
3306
+ empty: boolean;
3307
+ private styles;
3308
+ /**
3309
+ * The indent of the tree item element.
3310
+ * This is not needed once css attr() is supported (--indent: attr(data-indent type(<number>)));
3311
+ * @public
3312
+ */
3313
+ dataIndent: number | undefined;
3314
+ private dataIndentChanged;
3315
+ childTreeItems: BaseTreeItem[] | undefined;
3316
+ /**
3317
+ * Handles changes to the child tree items
3318
+ *
3319
+ * @public
3320
+ */
3321
+ childTreeItemsChanged(): void;
3322
+ /**
3323
+ * Updates the childrens indent
3324
+ *
3325
+ * @public
3326
+ */
3327
+ updateChildTreeItems(): void;
3328
+ /**
3329
+ * Sets the indent for each item
3330
+ */
3331
+ private setIndent;
3332
+ /**
3333
+ * Handle focus events
3334
+ *
3335
+ * @public
3336
+ */
3337
+ focusHandler(e: FocusEvent): void;
3338
+ /**
3339
+ * Handle blur events
3340
+ *
3341
+ * @public
3342
+ */
3343
+ blurHandler(e: FocusEvent): void;
3344
+ /**
3345
+ * Toggle the expansion state of the tree item
3346
+ *
3347
+ * @public
3348
+ */
3349
+ toggleExpansion(): void;
3350
+ /**
3351
+ * Toggle the single selection state of the tree item
3352
+ *
3353
+ * @public
3354
+ */
3355
+ toggleSelection(): void;
3356
+ /**
3357
+ * Whether the tree is nested
3358
+ * @internal
3359
+ */
3360
+ get isNestedItem(): boolean;
3361
+ }
3362
+
3264
3363
  /**
3265
3364
  * CSS custom property value for the {@link @fluentui/tokens#borderRadiusCircular | `borderRadiusCircular`} design token.
3266
3365
  * @public
@@ -7379,7 +7478,7 @@ export declare function isListbox(element?: Node | null, tagName?: string): elem
7379
7478
  * @returns true if the element is a dropdown.
7380
7479
  * @public
7381
7480
  */
7382
- export declare function isTreeItem(element?: Node | null, tagName?: string): element is TreeItem;
7481
+ export declare function isTreeItem(element?: Node | null, tagName?: string): element is BaseTreeItem;
7383
7482
 
7384
7483
  /**
7385
7484
  * The base class used for constructing a fluent-label custom element
@@ -11159,49 +11258,7 @@ export declare const TooltipStyles: ElementStyles;
11159
11258
  */
11160
11259
  export declare const TooltipTemplate: ViewTemplate<Tooltip, any>;
11161
11260
 
11162
- export declare class TreeItem extends FASTElement {
11163
- /**
11164
- * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
11165
- *
11166
- * @internal
11167
- */
11168
- elementInternals: ElementInternals;
11169
- constructor();
11170
- /**
11171
- * When true, the control will be appear expanded by user interaction.
11172
- * @public
11173
- * HTML Attribute: `expanded`
11174
- */
11175
- expanded: boolean;
11176
- /**
11177
- * Handles changes to the expanded attribute
11178
- * @param prev - the previous state
11179
- * @param next - the next state
11180
- *
11181
- * @public
11182
- */
11183
- expandedChanged(prev: boolean, next: boolean): void;
11184
- /**
11185
- * When true, the control will appear selected by user interaction.
11186
- * @public
11187
- * @remarks
11188
- * HTML Attribute: selected
11189
- */
11190
- selected: boolean;
11191
- /**
11192
- * Handles changes to the selected attribute
11193
- * @param prev - the previous state
11194
- * @param next - the next state
11195
- *
11196
- * @internal
11197
- */
11198
- protected selectedChanged(prev: boolean, next: boolean): void;
11199
- /**
11200
- * When true, the control has no child tree items
11201
- * @public
11202
- * HTML Attribute: empty
11203
- */
11204
- empty: boolean;
11261
+ export declare class TreeItem extends BaseTreeItem {
11205
11262
  /**
11206
11263
  * The size of the tree item element
11207
11264
  * @public
@@ -11224,59 +11281,18 @@ export declare class TreeItem extends FASTElement {
11224
11281
  * @internal
11225
11282
  */
11226
11283
  private appearanceChanged;
11227
- private styles;
11228
- /**
11229
- * The indent of the tree item element.
11230
- * This is not needed once css attr() is supported (--indent: attr(data-indent type(<number>)));
11231
- * @public
11232
- */
11233
- dataIndent: number | undefined;
11234
- private dataIndentChanged;
11235
- childTreeItems: TreeItem[] | undefined;
11236
11284
  /**
11237
- * Handles changes to the child tree items
11238
- *
11285
+ * child tree items supered change event
11239
11286
  * @internal
11240
11287
  */
11241
- protected childTreeItemsChanged(): void;
11288
+ childTreeItemsChanged(): void;
11242
11289
  /**
11243
11290
  * 1. Update the child items' size based on the tree's size
11244
11291
  * 2. Update the child items' appearance based on the tree's appearance
11245
- */
11246
- private updateChildTreeItems;
11247
- /**
11248
- * Sets the indent for each item
11249
- */
11250
- private setIndent;
11251
- /**
11252
- * Handle focus events
11253
- *
11254
- * @public
11255
- */
11256
- focusHandler(e: FocusEvent): void;
11257
- /**
11258
- * Handle blur events
11259
- *
11260
- * @public
11261
- */
11262
- blurHandler(e: FocusEvent): void;
11263
- /**
11264
- * Toggle the expansion state of the tree item
11265
- *
11266
- * @public
11267
- */
11268
- toggleExpansion(): void;
11269
- /**
11270
- * Toggle the single selection state of the tree item
11271
11292
  *
11272
11293
  * @public
11273
11294
  */
11274
- toggleSelection(): void;
11275
- /**
11276
- * Whether the tree is nested
11277
- * @internal
11278
- */
11279
- get isNestedItem(): boolean;
11295
+ updateSizeAndAppearance(): void;
11280
11296
  }
11281
11297
 
11282
11298
  export declare const TreeItemAppearance: {