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

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +11 -2
  2. package/dist/dts/anchor-button/index.d.ts +1 -0
  3. package/dist/dts/index-rollup.d.ts +2 -0
  4. package/dist/dts/index.d.ts +7 -8
  5. package/dist/dts/tree/define.d.ts +1 -0
  6. package/dist/dts/tree/index.d.ts +4 -0
  7. package/dist/dts/tree/tree.bench.d.ts +3 -0
  8. package/dist/dts/tree/tree.d.ts +88 -0
  9. package/dist/dts/tree/tree.definition.d.ts +8 -0
  10. package/dist/dts/tree/tree.styles.d.ts +1 -0
  11. package/dist/dts/tree/tree.template.d.ts +2 -0
  12. package/dist/dts/tree-item/define.d.ts +1 -0
  13. package/dist/dts/tree-item/index.d.ts +5 -0
  14. package/dist/dts/tree-item/tree-item.bench.d.ts +3 -0
  15. package/dist/dts/tree-item/tree-item.d.ts +121 -0
  16. package/dist/dts/tree-item/tree-item.definition.d.ts +8 -0
  17. package/dist/dts/tree-item/tree-item.options.d.ts +22 -0
  18. package/dist/dts/tree-item/tree-item.styles.d.ts +1 -0
  19. package/dist/dts/tree-item/tree-item.template.d.ts +2 -0
  20. package/dist/esm/anchor-button/index.js +1 -0
  21. package/dist/esm/anchor-button/index.js.map +1 -1
  22. package/dist/esm/index-rollup.js +2 -0
  23. package/dist/esm/index-rollup.js.map +1 -1
  24. package/dist/esm/index.js +6 -5
  25. package/dist/esm/index.js.map +1 -1
  26. package/dist/esm/tree/define.js +4 -0
  27. package/dist/esm/tree/define.js.map +1 -0
  28. package/dist/esm/tree/index.js +5 -0
  29. package/dist/esm/tree/index.js.map +1 -0
  30. package/dist/esm/tree/tree.bench.js +10 -0
  31. package/dist/esm/tree/tree.bench.js.map +1 -0
  32. package/dist/esm/tree/tree.definition.js +16 -0
  33. package/dist/esm/tree/tree.definition.js.map +1 -0
  34. package/dist/esm/tree/tree.js +274 -0
  35. package/dist/esm/tree/tree.js.map +1 -0
  36. package/dist/esm/tree/tree.styles.js +9 -0
  37. package/dist/esm/tree/tree.styles.js.map +1 -0
  38. package/dist/esm/tree/tree.template.js +18 -0
  39. package/dist/esm/tree/tree.template.js.map +1 -0
  40. package/dist/esm/tree-item/define.js +4 -0
  41. package/dist/esm/tree-item/define.js.map +1 -0
  42. package/dist/esm/tree-item/index.js +5 -0
  43. package/dist/esm/tree-item/index.js.map +1 -0
  44. package/dist/esm/tree-item/tree-item.bench.js +10 -0
  45. package/dist/esm/tree-item/tree-item.bench.js.map +1 -0
  46. package/dist/esm/tree-item/tree-item.definition.js +16 -0
  47. package/dist/esm/tree-item/tree-item.definition.js.map +1 -0
  48. package/dist/esm/tree-item/tree-item.js +201 -0
  49. package/dist/esm/tree-item/tree-item.js.map +1 -0
  50. package/dist/esm/tree-item/tree-item.options.js +24 -0
  51. package/dist/esm/tree-item/tree-item.options.js.map +1 -0
  52. package/dist/esm/tree-item/tree-item.styles.js +170 -0
  53. package/dist/esm/tree-item/tree-item.styles.js.map +1 -0
  54. package/dist/esm/tree-item/tree-item.template.js +41 -0
  55. package/dist/esm/tree-item/tree-item.template.js.map +1 -0
  56. package/dist/web-components.d.ts +157 -0
  57. package/dist/web-components.js +1278 -802
  58. package/dist/web-components.min.js +298 -291
  59. package/package.json +1 -1
@@ -0,0 +1,170 @@
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';
3
+ import { display } from '../utils/display.js';
4
+ export const styles = css `
5
+ ${display('block')}
6
+
7
+ :host {
8
+ outline: none;
9
+ }
10
+
11
+ :host(:focus-visible) .positioning-region {
12
+ box-shadow: ${spacingVerticalNone} ${spacingVerticalNone} ${spacingVerticalNone} ${spacingVerticalXXS}
13
+ ${colorStrokeFocus2} inset;
14
+ }
15
+
16
+ /**
17
+ * Default variants:
18
+ * Size - medium
19
+ * Appearance - subtle
20
+ */
21
+ .positioning-region {
22
+ display: flex;
23
+ align-items: stretch;
24
+ justify-content: space-between;
25
+ cursor: pointer;
26
+ height: ${spacingVerticalXXXL};
27
+ padding-inline-start: calc(var(--indent) * ${spacingHorizontalXXL});
28
+ padding-inline-end: ${spacingVerticalS};
29
+ border-radius: ${borderRadiusMedium};
30
+ background-color: ${colorSubtleBackground};
31
+ color: ${colorNeutralForeground2};
32
+ }
33
+
34
+ @media (prefers-contrast: more) {
35
+ :host(:focus-visible) .positioning-region {
36
+ outline: 1px solid ${colorStrokeFocus2};
37
+ }
38
+ }
39
+
40
+ .content {
41
+ display: flex;
42
+ align-items: center;
43
+ font-size: ${fontSizeBase300};
44
+ min-width: 0;
45
+ }
46
+
47
+ .chevron {
48
+ display: flex;
49
+ align-items: center;
50
+ flex-shrink: 0;
51
+ min-width: 0;
52
+ justify-content: center;
53
+ width: ${spacingHorizontalXXL};
54
+ height: ${spacingVerticalXXL};
55
+ color: ${colorNeutralForeground3};
56
+ transition: transform ${durationFaster} ${curveEasyEaseMax};
57
+ transform: rotate(0deg);
58
+ }
59
+
60
+ .chevron:dir(rtl) {
61
+ transform: rotate(180deg);
62
+ }
63
+
64
+ .badging,
65
+ .toolbar {
66
+ display: flex;
67
+ align-items: center;
68
+ min-width: 0;
69
+ font-size: ${fontSizeBase300};
70
+ }
71
+
72
+ .positioning-region:hover {
73
+ background-color: ${colorSubtleBackgroundHover};
74
+ color: ${colorNeutralForeground2Hover};
75
+ }
76
+
77
+ .positioning-region:hover .content,
78
+ .positioning-region:hover .chevron {
79
+ color: ${colorNeutralForeground3Hover};
80
+ }
81
+
82
+ .positioning-region:active {
83
+ background-color: ${colorSubtleBackgroundPressed};
84
+ color: ${colorNeutralForeground2Pressed};
85
+ }
86
+
87
+ .positioning-region:active .content,
88
+ .positioning-region:active .chevron {
89
+ color: ${colorNeutralForeground3Pressed};
90
+ }
91
+
92
+ ::slotted([slot='start']),
93
+ ::slotted(:not([slot])) {
94
+ display: flex;
95
+ align-items: center;
96
+ min-width: 0;
97
+ }
98
+
99
+ ::slotted([slot='start']) {
100
+ flex-shrink: 0;
101
+ margin-inline-end: ${spacingHorizontalXS};
102
+ }
103
+
104
+ ::slotted(:not([slot])) {
105
+ padding-inline: ${spacingHorizontalXXS};
106
+ }
107
+
108
+ .items {
109
+ display: none;
110
+ }
111
+
112
+ :host([expanded]) .items {
113
+ display: block;
114
+ }
115
+
116
+ :host([empty]) .chevron,
117
+ :host([empty]) .items {
118
+ visibility: hidden;
119
+ }
120
+
121
+ :host([selected]) .positioning-region {
122
+ background-color: ${colorSubtleBackgroundSelected};
123
+ color: ${colorNeutralForeground2Selected};
124
+ }
125
+
126
+ :host([selected]) .content,
127
+ :host([selected]) .chevron {
128
+ color: ${colorNeutralForeground3Selected};
129
+ }
130
+
131
+ :host([size='small']) .positioning-region {
132
+ height: ${spacingVerticalXXL};
133
+ padding-inline-start: calc(var(--indent) * ${spacingHorizontalM});
134
+ }
135
+
136
+ :host([appearance='subtle-alpha']) .positioning-region:hover {
137
+ background-color: ${colorSubtleBackgroundLightAlphaHover};
138
+ }
139
+
140
+ :host([appearance='subtle-alpha']) .positioning-region:active {
141
+ background-color: ${colorSubtleBackgroundLightAlphaPressed};
142
+ }
143
+
144
+ :host([appearance='subtle-alpha'][selected]) .positioning-region {
145
+ background-color: ${colorSubtleBackgroundLightAlphaSelected};
146
+ color: ${colorNeutralForeground2Selected};
147
+ }
148
+
149
+ :host([appearance='transparent']) .positioning-region {
150
+ background-color: ${colorTransparentBackground};
151
+ }
152
+
153
+ :host([appearance='transparent']) .positioning-region:hover {
154
+ background-color: ${colorTransparentBackgroundHover};
155
+ }
156
+
157
+ :host([appearance='transparent']) .positioning-region:active {
158
+ background-color: ${colorTransparentBackgroundPressed};
159
+ }
160
+
161
+ :host([appearance='transparent'][selected]) .positioning-region {
162
+ background-color: ${colorTransparentBackgroundSelected};
163
+ color: ${colorNeutralForeground2Selected};
164
+ }
165
+
166
+ :host([expanded]) .chevron {
167
+ transform: rotate(90deg);
168
+ }
169
+ `;
170
+ //# sourceMappingURL=tree-item.styles.js.map
@@ -0,0 +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"}
@@ -0,0 +1,41 @@
1
+ import { children, elements, html } from '@microsoft/fast-element';
2
+ const chevronIcon = html `
3
+ <svg width="12" height="12" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
4
+ <path
5
+ 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"
6
+ ></path>
7
+ </svg>
8
+ `;
9
+ export const template = html `
10
+ <template
11
+ tabindex="-1"
12
+ slot="${x => (x.isNestedItem ? 'item' : void 0)}"
13
+ @focusin="${(x, c) => x.focusHandler(c.event)}"
14
+ @focusout="${(x, c) => x.blurHandler(c.event)}"
15
+ ${children({
16
+ property: 'childTreeItems',
17
+ filter: elements(),
18
+ })}
19
+ >
20
+ <div class="positioning-region" part="positioning-region">
21
+ <div class="content" part="content">
22
+ <span class="chevron" part="chevron">
23
+ <slot name="chevron">${chevronIcon}</slot>
24
+ </span>
25
+ <slot name="start"></slot>
26
+ <slot></slot>
27
+ <slot name="end"></slot>
28
+ </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>
34
+ </div>
35
+ </div>
36
+ <div role="group" class="items" part="items">
37
+ <slot name="item"></slot>
38
+ </div>
39
+ </template>
40
+ `;
41
+ //# sourceMappingURL=tree-item.template.js.map
@@ -0,0 +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"}
@@ -7371,6 +7371,16 @@ export declare function isDropdownOption(value: Node | null, tagName?: string):
7371
7371
  */
7372
7372
  export declare function isListbox(element?: Node | null, tagName?: string): element is Listbox;
7373
7373
 
7374
+ /**
7375
+ * Predicate function that determines if the element should be considered an tree-item.
7376
+ *
7377
+ * @param element - The element to check.
7378
+ * @param tagName - The tag name to check.
7379
+ * @returns true if the element is a dropdown.
7380
+ * @public
7381
+ */
7382
+ export declare function isTreeItem(element?: Node | null, tagName?: string): element is TreeItem;
7383
+
7374
7384
  /**
7375
7385
  * The base class used for constructing a fluent-label custom element
7376
7386
  * @public
@@ -11149,6 +11159,153 @@ export declare const TooltipStyles: ElementStyles;
11149
11159
  */
11150
11160
  export declare const TooltipTemplate: ViewTemplate<Tooltip, any>;
11151
11161
 
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;
11205
+ /**
11206
+ * The size of the tree item element
11207
+ * @public
11208
+ */
11209
+ size: TreeItemSize;
11210
+ /**
11211
+ * Handles changes to the size attribute
11212
+ * we update the child tree items' size based on the size
11213
+ * @internal
11214
+ */
11215
+ private sizeChanged;
11216
+ /**
11217
+ * The size of the tree item element
11218
+ * @public
11219
+ */
11220
+ appearance: TreeItemAppearance;
11221
+ /**
11222
+ * Handles changes to the appearance attribute
11223
+ *
11224
+ * @internal
11225
+ */
11226
+ 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
+ /**
11237
+ * Handles changes to the child tree items
11238
+ *
11239
+ * @internal
11240
+ */
11241
+ protected childTreeItemsChanged(): void;
11242
+ /**
11243
+ * 1. Update the child items' size based on the tree's size
11244
+ * 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
+ *
11272
+ * @public
11273
+ */
11274
+ toggleSelection(): void;
11275
+ /**
11276
+ * Whether the tree is nested
11277
+ * @internal
11278
+ */
11279
+ get isNestedItem(): boolean;
11280
+ }
11281
+
11282
+ export declare const TreeItemAppearance: {
11283
+ readonly subtle: "subtle";
11284
+ readonly subtleAlpha: "subtle-alpha";
11285
+ readonly transparent: "transparent";
11286
+ };
11287
+
11288
+ export declare type TreeItemAppearance = ValuesOf<typeof TreeItemAppearance>;
11289
+
11290
+ /**
11291
+ *
11292
+ * @public
11293
+ * @remarks
11294
+ * HTML Element: \<fluent-tree-item\>
11295
+ */
11296
+ export declare const TreeItemDefinition: FASTElementDefinition<typeof TreeItem>;
11297
+
11298
+ export declare const TreeItemSize: {
11299
+ readonly small: "small";
11300
+ readonly medium: "medium";
11301
+ };
11302
+
11303
+ export declare type TreeItemSize = ValuesOf<typeof TreeItemSize>;
11304
+
11305
+ export declare const TreeItemStyles: ElementStyles;
11306
+
11307
+ export declare const TreeItemTemplate: ViewTemplate<TreeItem, any>;
11308
+
11152
11309
  export declare const typographyBody1StrongerStyles: CSSDirective;
11153
11310
 
11154
11311
  export declare const typographyBody1StrongStyles: CSSDirective;