@fluentui/web-components 3.0.0-beta.33 → 3.0.0-beta.35

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.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @fluentui/web-components
2
2
 
3
- This log was last generated on Fri, 21 Jun 2024 04:06:50 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 25 Jun 2024 04:06:27 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [3.0.0-beta.35](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.35)
8
+
9
+ Tue, 25 Jun 2024 04:06:27 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.34..@fluentui/web-components_v3.0.0-beta.35)
11
+
12
+ ### Changes
13
+
14
+ - updates the Text component to use Element Internals custom states for presentational attributes ([PR #31770](https://github.com/microsoft/fluentui/pull/31770) by 13071055+chrisdholt@users.noreply.github.com)
15
+
16
+ ## [3.0.0-beta.34](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.34)
17
+
18
+ Mon, 24 Jun 2024 04:06:02 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.33..@fluentui/web-components_v3.0.0-beta.34)
20
+
21
+ ### Changes
22
+
23
+ - Refactor Menu, MenuList, and MenuItem components ([PR #31674](https://github.com/microsoft/fluentui/pull/31674) by rupertdavid@microsoft.com)
24
+
7
25
  ## [3.0.0-beta.33](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.33)
8
26
 
9
- Fri, 21 Jun 2024 04:06:50 GMT
27
+ Fri, 21 Jun 2024 04:06:58 GMT
10
28
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.32..@fluentui/web-components_v3.0.0-beta.33)
11
29
 
12
30
  ### Changes
@@ -1,7 +1,43 @@
1
+ /// <reference types="web" />
1
2
  import { FASTElement } from '@microsoft/fast-element';
2
3
  import { MenuList } from '../menu-list/menu-list.js';
3
4
  /**
4
- * The Menu class represents a menu component.
5
+ * A Menu component that provides a customizable menu element.
6
+ * @class Menu
7
+ * @extends FASTElement
8
+ *
9
+ * @attr open-on-hover - Determines if the menu should open on hover.
10
+ * @attr open-on-context - Determines if the menu should open on right click.
11
+ * @attr close-on-scroll - Determines if the menu should close on scroll.
12
+ * @attr persist-on-item-click - Determines if the menu open state should persist on click of menu item.
13
+ *
14
+ * @cssproperty --menu-max-height - The max-height of the menu.
15
+ *
16
+ * @slot trigger - Slot for the trigger elements.
17
+ * @slot - Default slot for the menu list.
18
+ *
19
+ * @method connectedCallback - Called when the element is connected to the DOM. Sets up the component.
20
+ * @method disconnectedCallback - Called when the element is disconnected from the DOM. Removes event listeners.
21
+ * @method setComponent - Sets the component state.
22
+ * @method toggleMenu - Toggles the open state of the menu.
23
+ * @method closeMenu - Closes the menu.
24
+ * @method openMenu - Opens the menu.
25
+ * @method focusMenuList - Focuses on the menu list.
26
+ * @method focusTrigger - Focuses on the menu trigger.
27
+ * @method openOnHoverChanged - Called whenever the 'openOnHover' property changes.
28
+ * @method persistOnItemClickChanged - Called whenever the 'persistOnItemClick' property changes.
29
+ * @method openOnContextChanged - Called whenever the 'openOnContext' property changes.
30
+ * @method closeOnScrollChanged - Called whenever the 'closeOnScroll' property changes.
31
+ * @method addListeners - Adds event listeners.
32
+ * @method removeListeners - Removes event listeners.
33
+ * @method menuKeydownHandler - Handles keyboard interaction for the menu.
34
+ * @method triggerKeydownHandler - Handles keyboard interaction for the trigger.
35
+ * @method documentClickHandler - Handles document click events to close the menu when a click occurs outside of the menu or the trigger.
36
+ *
37
+ * @summary The Menu component functions as a customizable menu element.
38
+ *
39
+ * @tag fluent-menu
40
+ *
5
41
  * @public
6
42
  */
7
43
  export declare class Menu extends FASTElement {
@@ -25,11 +61,6 @@ export declare class Menu extends FASTElement {
25
61
  * @public
26
62
  */
27
63
  persistOnItemClick?: boolean;
28
- /**
29
- * Defines whether the menu is open or not.
30
- * @public
31
- */
32
- open: boolean;
33
64
  /**
34
65
  * Holds the slotted menu list.
35
66
  * @public
@@ -41,25 +72,20 @@ export declare class Menu extends FASTElement {
41
72
  */
42
73
  slottedTriggers: HTMLElement[];
43
74
  /**
44
- * The positioning container of the menu.
75
+ * Defines whether the menu is open or not.
45
76
  * @internal
46
77
  */
47
- positioningContainer?: HTMLElement;
78
+ private _open;
48
79
  /**
49
80
  * The trigger element of the menu.
50
81
  * @internal
51
82
  */
52
83
  private _trigger?;
53
84
  /**
54
- * The menu list element of the menu.
85
+ * The menu list element of the menu which has the popover behavior.
55
86
  * @internal
56
87
  */
57
88
  private _menuList?;
58
- /**
59
- * Holds a reference to a function that is used to cleanup resources.
60
- * @public
61
- */
62
- cleanup?: () => void;
63
89
  /**
64
90
  * Called when the element is connected to the DOM.
65
91
  * Sets up the component.
@@ -104,16 +130,12 @@ export declare class Menu extends FASTElement {
104
130
  */
105
131
  focusTrigger(): void;
106
132
  /**
107
- * Called whenever the open state changes.
108
- * Updates the 'aria-expanded' attribute and sets the positioning of the menu.
109
- * Sets menu list position
110
- * emits openChanged event
111
- *
112
- * @param oldValue - The previous value of 'open'.
113
- * @param newValue - The new value of 'open'.
133
+ * Handles the 'toggle' event on the popover.
114
134
  * @public
135
+ * @param e - the event
136
+ * @returns void
115
137
  */
116
- openChanged(oldValue: boolean, newValue: boolean): void;
138
+ toggleHandler: (e: Event | ToggleEvent) => void;
117
139
  /**
118
140
  * Called whenever the 'openOnHover' property changes.
119
141
  * Adds or removes a 'mouseover' event listener to the trigger based on the new value.
@@ -147,27 +169,21 @@ export declare class Menu extends FASTElement {
147
169
  * @param newValue - The new value of 'closeOnScroll'.
148
170
  */
149
171
  closeOnScrollChanged(oldValue: boolean, newValue: boolean): void;
150
- /**
151
- * The task to set the positioning of the menu.
152
- * @internal
153
- */
154
- protected setPositioningTask: () => void;
155
- /**
156
- * Sets the positioning of the menu.
157
- * @internal
158
- */
159
- protected setPositioning(): void;
160
172
  /**
161
173
  * Adds event listeners.
162
- * Adds click and keydown event listeners to the trigger and a click event listener to the document.
174
+ * Adds click and keydown event listeners to the trigger.
175
+ * Adds a 'toggle' event listener to the menu list.
163
176
  * If 'openOnHover' is true, adds a 'mouseover' event listener to the trigger.
164
- * @public
177
+ * If 'openOnContext' is true, adds a 'contextmenu' event listener to the trigger and a document 'click' event listener.
178
+ * @internal
165
179
  */
166
180
  private addListeners;
167
181
  /**
168
182
  * Removes event listeners.
169
- * Removes click and keydown event listeners from the trigger and a click event listener from the document.
183
+ * Removes click and keydown event listeners from the trigger.
184
+ * Also removes toggle event listener from the menu list.
170
185
  * Also removes 'mouseover' event listeners from the trigger.
186
+ * Also removes 'contextmenu' event listeners from the trigger and document 'click' event listeners.
171
187
  * @internal
172
188
  */
173
189
  private removeListeners;
@@ -178,7 +194,7 @@ export declare class Menu extends FASTElement {
178
194
  * @param e - the keyboard event
179
195
  * @public
180
196
  */
181
- handleMenuKeydown(e: KeyboardEvent): boolean | void;
197
+ menuKeydownHandler(e: KeyboardEvent): boolean | void;
182
198
  /**
183
199
  * Handles keyboard interaction for the trigger. Toggles the menu when the Space or Enter key is pressed. If the menu
184
200
  * is open, focuses on the menu list.
@@ -186,11 +202,11 @@ export declare class Menu extends FASTElement {
186
202
  * @param e - the keyboard event
187
203
  * @public
188
204
  */
189
- handleTriggerKeydown: (e: KeyboardEvent) => boolean | void;
205
+ triggerKeydownHandler: (e: KeyboardEvent) => boolean | void;
190
206
  /**
191
- * Handles document click events to close the menu when a click occurs outside of the menu or the trigger.
207
+ * Handles document click events to close a menu opened with contextmenu in popover="manual" mode.
192
208
  * @internal
193
209
  * @param e - The event triggered on document click.
194
210
  */
195
- private handleDocumentClick;
211
+ private documentClickHandler;
196
212
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="web" />
1
2
  import { FASTElement } from '@microsoft/fast-element';
2
3
  import type { StaticallyComposableHTML } from '../utils/template-helpers.js';
3
4
  import type { StartEndOptions } from '../patterns/start-end.js';
@@ -10,29 +11,20 @@ export { MenuItemRole, roleForMenuItem };
10
11
  * @public
11
12
  */
12
13
  export type MenuItemOptions = StartEndOptions<MenuItem> & {
13
- checkboxIndicator?: StaticallyComposableHTML<MenuItem>;
14
- expandCollapseGlyph?: StaticallyComposableHTML<MenuItem>;
15
- radioIndicator?: StaticallyComposableHTML<MenuItem>;
14
+ indicator?: StaticallyComposableHTML<MenuItem>;
15
+ submenuGlyph?: StaticallyComposableHTML<MenuItem>;
16
16
  };
17
17
  /**
18
18
  * A Switch Custom HTML Element.
19
19
  * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
20
20
  *
21
- * @slot checked-indicator - The checked indicator
22
- * @slot radio-indicator - The radio indicator
21
+ * @slot indicator - The checkbox or radio indicator
23
22
  * @slot start - Content which can be provided before the menu item content
24
- * @slot end - Content which can be provided after the menu item content
25
23
  * @slot - The default slot for menu item content
26
- * @slot expand-collapse-indicator - The expand/collapse indicator
24
+ * @slot end - Content which can be provided after the menu item content
25
+ * @slot submenu-glyph - The submenu expand/collapse indicator
27
26
  * @slot submenu - Used to nest menu's within menu items
28
- * @csspart input-container - The element representing the visual checked or radio indicator
29
- * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
30
- * @csspart radio - The element wrapping the `menuitemradio` indicator
31
27
  * @csspart content - The element wrapping the menu item content
32
- * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
33
- * @csspart expand-collapse - The expand/collapse element
34
- * @csspart submenu-region - The container for the submenu, used for positioning
35
- * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
36
28
  * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
37
29
  *
38
30
  * @public
@@ -46,15 +38,6 @@ export declare class MenuItem extends FASTElement {
46
38
  * HTML Attribute: disabled
47
39
  */
48
40
  disabled: boolean;
49
- /**
50
- * The expanded state of the element.
51
- *
52
- * @public
53
- * @remarks
54
- * HTML Attribute: expanded
55
- */
56
- expanded: boolean;
57
- protected expandedChanged(prev: boolean | undefined, next: boolean): void;
58
41
  /**
59
42
  * The role of the element.
60
43
  *
@@ -63,12 +46,6 @@ export declare class MenuItem extends FASTElement {
63
46
  * HTML Attribute: role
64
47
  */
65
48
  role: MenuItemRole;
66
- /**
67
- * Cleanup function for the submenu positioner.
68
- *
69
- * @public
70
- */
71
- cleanup: () => void;
72
49
  /**
73
50
  * The checked value of the element.
74
51
  *
@@ -92,31 +69,16 @@ export declare class MenuItem extends FASTElement {
92
69
  * @internal
93
70
  */
94
71
  slottedSubmenu: HTMLElement[];
95
- /**
96
- * @internal
97
- */
98
- get hasSubmenu(): boolean;
99
72
  /**
100
73
  * Sets the submenu and updates its position.
101
74
  *
102
75
  * @internal
103
76
  */
104
77
  protected slottedSubmenuChanged(prev: HTMLElement[] | undefined, next: HTMLElement[]): void;
105
- /**
106
- * The container for the submenu.
107
- *
108
- * @internal
109
- */
110
- submenuContainer: HTMLDivElement;
111
78
  /**
112
79
  * @internal
113
80
  */
114
81
  submenu: HTMLElement | undefined;
115
- private focusSubmenuOnLoad;
116
- /**
117
- * @internal
118
- */
119
- disconnectedCallback(): void;
120
82
  /**
121
83
  * @internal
122
84
  */
@@ -125,10 +87,6 @@ export declare class MenuItem extends FASTElement {
125
87
  * @internal
126
88
  */
127
89
  handleMenuItemClick: (e: MouseEvent) => boolean;
128
- /**
129
- * @internal
130
- */
131
- submenuLoaded: () => void;
132
90
  /**
133
91
  * @internal
134
92
  */
@@ -138,23 +96,19 @@ export declare class MenuItem extends FASTElement {
138
96
  */
139
97
  handleMouseOut: (e: MouseEvent) => boolean;
140
98
  /**
99
+ * Setup required ARIA on open/close
141
100
  * @internal
142
101
  */
143
- private closeSubMenu;
144
- /**
145
- * @internal
146
- */
147
- private expandAndFocus;
102
+ toggleHandler: (e: ToggleEvent | Event) => void;
148
103
  /**
149
104
  * @internal
150
105
  */
151
106
  private invoke;
152
107
  /**
153
- * Calculate and apply submenu positioning.
154
- *
155
- * @public
108
+ * Set fallback position of menu on open when CSS anchor not supported
109
+ * @internal
156
110
  */
157
- updateSubmenu(): void;
111
+ setSubmenuPosition: () => void;
158
112
  }
159
113
  /**
160
114
  * Mark internal because exporting class and interface of the same name
@@ -14,7 +14,6 @@ export declare class MenuList extends FASTElement {
14
14
  items: HTMLElement[];
15
15
  protected itemsChanged(oldValue: HTMLElement[], newValue: HTMLElement[]): void;
16
16
  protected menuItems: Element[] | undefined;
17
- private expandedItem;
18
17
  /**
19
18
  * The index of the focusable element in the items array
20
19
  * defaults to -1
@@ -39,12 +38,6 @@ export declare class MenuList extends FASTElement {
39
38
  * @public
40
39
  */
41
40
  focus(): void;
42
- /**
43
- * Collapses any expanded menu items.
44
- *
45
- * @public
46
- */
47
- collapseExpandedItem(): void;
48
41
  /**
49
42
  * @internal
50
43
  */
@@ -55,15 +48,17 @@ export declare class MenuList extends FASTElement {
55
48
  */
56
49
  handleFocusOut: (e: FocusEvent) => void;
57
50
  private handleItemFocus;
58
- private handleExpandedChanged;
59
51
  private removeItemListeners;
60
52
  private static elementIndent;
61
53
  protected setItems(): void;
54
+ /**
55
+ * Method for Observable changes to the hidden attribute of child elements
56
+ */
62
57
  handleChange(source: any, propertyName: string): void;
63
58
  /**
64
- * handle change from child element
59
+ * Handle change from child MenuItem element and set radio group behavior
65
60
  */
66
- private changeHandler;
61
+ private changedMenuItemHandler;
67
62
  /**
68
63
  * check if the item is a menu item
69
64
  */
@@ -5,6 +5,12 @@ import type { TextAlign, TextFont, TextSize, TextWeight } from './text.options.j
5
5
  * @public
6
6
  */
7
7
  export declare class Text extends FASTElement {
8
+ /**
9
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
10
+ *
11
+ * @internal
12
+ */
13
+ elementInternals: ElementInternals;
8
14
  /**
9
15
  * The text will not wrap
10
16
  * NOTE: In Fluent UI React v9 this is "wrap"
@@ -64,6 +70,12 @@ export declare class Text extends FASTElement {
64
70
  *
65
71
  */
66
72
  size?: TextSize;
73
+ /**
74
+ * Handles changes to size attribute custom states
75
+ * @param prev - the previous state
76
+ * @param next - the next state
77
+ */
78
+ sizeChanged(prev: TextSize | undefined, next: TextSize | undefined): void;
67
79
  /**
68
80
  * THe Text font
69
81
  *
@@ -73,13 +85,25 @@ export declare class Text extends FASTElement {
73
85
  */
74
86
  font?: TextFont;
75
87
  /**
76
- * THe Text weight
88
+ * Handles changes to font attribute custom states
89
+ * @param prev - the previous state
90
+ * @param next - the next state
91
+ */
92
+ fontChanged(prev: TextFont | undefined, next: TextFont | undefined): void;
93
+ /**
94
+ * The Text weight
77
95
  *
78
96
  * @public
79
97
  * @remarks
80
98
  * HTML Attribute: weight
81
99
  */
82
100
  weight?: TextWeight;
101
+ /**
102
+ * Handles changes to weight attribute custom states
103
+ * @param prev - the previous state
104
+ * @param next - the next state
105
+ */
106
+ weightChanged(prev: TextWeight | undefined, next: TextWeight | undefined): void;
83
107
  /**
84
108
  * THe Text align
85
109
  *
@@ -88,4 +112,19 @@ export declare class Text extends FASTElement {
88
112
  * HTML Attribute: align
89
113
  */
90
114
  align?: TextAlign;
115
+ /**
116
+ * Handles changes to align attribute custom states
117
+ * @param prev - the previous state
118
+ * @param next - the next state
119
+ */
120
+ alignChanged(prev: TextAlign | undefined, next: TextAlign | undefined): void;
121
+ connectedCallback(): void;
122
+ disconnectedCallback(): void;
123
+ /**
124
+ * Handles changes to observable properties
125
+ * @internal
126
+ * @param source - the source of the change
127
+ * @param propertyName - the property name being changed
128
+ */
129
+ handleChange(source: any, propertyName: string): void;
91
130
  }