@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.
@@ -1,3 +1,5 @@
1
+ /// <reference types="web" />
2
+
1
3
  import type { Constructable } from '@microsoft/fast-element';
2
4
  import { CSSDirective } from '@microsoft/fast-element';
3
5
  import { Direction } from '@microsoft/fast-web-utilities';
@@ -5538,7 +5540,42 @@ export declare class MatchMediaStyleSheetBehavior extends MatchMediaBehavior {
5538
5540
  export declare type MediaQueryListListener = (this: MediaQueryList, ev?: MediaQueryListEvent) => void;
5539
5541
 
5540
5542
  /**
5541
- * The Menu class represents a menu component.
5543
+ * A Menu component that provides a customizable menu element.
5544
+ * @class Menu
5545
+ * @extends FASTElement
5546
+ *
5547
+ * @attr open-on-hover - Determines if the menu should open on hover.
5548
+ * @attr open-on-context - Determines if the menu should open on right click.
5549
+ * @attr close-on-scroll - Determines if the menu should close on scroll.
5550
+ * @attr persist-on-item-click - Determines if the menu open state should persist on click of menu item.
5551
+ *
5552
+ * @cssproperty --menu-max-height - The max-height of the menu.
5553
+ *
5554
+ * @slot trigger - Slot for the trigger elements.
5555
+ * @slot - Default slot for the menu list.
5556
+ *
5557
+ * @method connectedCallback - Called when the element is connected to the DOM. Sets up the component.
5558
+ * @method disconnectedCallback - Called when the element is disconnected from the DOM. Removes event listeners.
5559
+ * @method setComponent - Sets the component state.
5560
+ * @method toggleMenu - Toggles the open state of the menu.
5561
+ * @method closeMenu - Closes the menu.
5562
+ * @method openMenu - Opens the menu.
5563
+ * @method focusMenuList - Focuses on the menu list.
5564
+ * @method focusTrigger - Focuses on the menu trigger.
5565
+ * @method openOnHoverChanged - Called whenever the 'openOnHover' property changes.
5566
+ * @method persistOnItemClickChanged - Called whenever the 'persistOnItemClick' property changes.
5567
+ * @method openOnContextChanged - Called whenever the 'openOnContext' property changes.
5568
+ * @method closeOnScrollChanged - Called whenever the 'closeOnScroll' property changes.
5569
+ * @method addListeners - Adds event listeners.
5570
+ * @method removeListeners - Removes event listeners.
5571
+ * @method menuKeydownHandler - Handles keyboard interaction for the menu.
5572
+ * @method triggerKeydownHandler - Handles keyboard interaction for the trigger.
5573
+ * @method documentClickHandler - Handles document click events to close the menu when a click occurs outside of the menu or the trigger.
5574
+ *
5575
+ * @summary The Menu component functions as a customizable menu element.
5576
+ *
5577
+ * @tag fluent-menu
5578
+ *
5542
5579
  * @public
5543
5580
  */
5544
5581
  export declare class Menu extends FASTElement {
@@ -5562,11 +5599,6 @@ export declare class Menu extends FASTElement {
5562
5599
  * @public
5563
5600
  */
5564
5601
  persistOnItemClick?: boolean;
5565
- /**
5566
- * Defines whether the menu is open or not.
5567
- * @public
5568
- */
5569
- open: boolean;
5570
5602
  /**
5571
5603
  * Holds the slotted menu list.
5572
5604
  * @public
@@ -5578,25 +5610,20 @@ export declare class Menu extends FASTElement {
5578
5610
  */
5579
5611
  slottedTriggers: HTMLElement[];
5580
5612
  /**
5581
- * The positioning container of the menu.
5613
+ * Defines whether the menu is open or not.
5582
5614
  * @internal
5583
5615
  */
5584
- positioningContainer?: HTMLElement;
5616
+ private _open;
5585
5617
  /**
5586
5618
  * The trigger element of the menu.
5587
5619
  * @internal
5588
5620
  */
5589
5621
  private _trigger?;
5590
5622
  /**
5591
- * The menu list element of the menu.
5623
+ * The menu list element of the menu which has the popover behavior.
5592
5624
  * @internal
5593
5625
  */
5594
5626
  private _menuList?;
5595
- /**
5596
- * Holds a reference to a function that is used to cleanup resources.
5597
- * @public
5598
- */
5599
- cleanup?: () => void;
5600
5627
  /**
5601
5628
  * Called when the element is connected to the DOM.
5602
5629
  * Sets up the component.
@@ -5641,16 +5668,12 @@ export declare class Menu extends FASTElement {
5641
5668
  */
5642
5669
  focusTrigger(): void;
5643
5670
  /**
5644
- * Called whenever the open state changes.
5645
- * Updates the 'aria-expanded' attribute and sets the positioning of the menu.
5646
- * Sets menu list position
5647
- * emits openChanged event
5648
- *
5649
- * @param oldValue - The previous value of 'open'.
5650
- * @param newValue - The new value of 'open'.
5671
+ * Handles the 'toggle' event on the popover.
5651
5672
  * @public
5673
+ * @param e - the event
5674
+ * @returns void
5652
5675
  */
5653
- openChanged(oldValue: boolean, newValue: boolean): void;
5676
+ toggleHandler: (e: Event | ToggleEvent) => void;
5654
5677
  /**
5655
5678
  * Called whenever the 'openOnHover' property changes.
5656
5679
  * Adds or removes a 'mouseover' event listener to the trigger based on the new value.
@@ -5684,27 +5707,21 @@ export declare class Menu extends FASTElement {
5684
5707
  * @param newValue - The new value of 'closeOnScroll'.
5685
5708
  */
5686
5709
  closeOnScrollChanged(oldValue: boolean, newValue: boolean): void;
5687
- /**
5688
- * The task to set the positioning of the menu.
5689
- * @internal
5690
- */
5691
- protected setPositioningTask: () => void;
5692
- /**
5693
- * Sets the positioning of the menu.
5694
- * @internal
5695
- */
5696
- protected setPositioning(): void;
5697
5710
  /**
5698
5711
  * Adds event listeners.
5699
- * Adds click and keydown event listeners to the trigger and a click event listener to the document.
5712
+ * Adds click and keydown event listeners to the trigger.
5713
+ * Adds a 'toggle' event listener to the menu list.
5700
5714
  * If 'openOnHover' is true, adds a 'mouseover' event listener to the trigger.
5701
- * @public
5715
+ * If 'openOnContext' is true, adds a 'contextmenu' event listener to the trigger and a document 'click' event listener.
5716
+ * @internal
5702
5717
  */
5703
5718
  private addListeners;
5704
5719
  /**
5705
5720
  * Removes event listeners.
5706
- * Removes click and keydown event listeners from the trigger and a click event listener from the document.
5721
+ * Removes click and keydown event listeners from the trigger.
5722
+ * Also removes toggle event listener from the menu list.
5707
5723
  * Also removes 'mouseover' event listeners from the trigger.
5724
+ * Also removes 'contextmenu' event listeners from the trigger and document 'click' event listeners.
5708
5725
  * @internal
5709
5726
  */
5710
5727
  private removeListeners;
@@ -5715,7 +5732,7 @@ export declare class Menu extends FASTElement {
5715
5732
  * @param e - the keyboard event
5716
5733
  * @public
5717
5734
  */
5718
- handleMenuKeydown(e: KeyboardEvent): boolean | void;
5735
+ menuKeydownHandler(e: KeyboardEvent): boolean | void;
5719
5736
  /**
5720
5737
  * Handles keyboard interaction for the trigger. Toggles the menu when the Space or Enter key is pressed. If the menu
5721
5738
  * is open, focuses on the menu list.
@@ -5723,13 +5740,13 @@ export declare class Menu extends FASTElement {
5723
5740
  * @param e - the keyboard event
5724
5741
  * @public
5725
5742
  */
5726
- handleTriggerKeydown: (e: KeyboardEvent) => boolean | void;
5743
+ triggerKeydownHandler: (e: KeyboardEvent) => boolean | void;
5727
5744
  /**
5728
- * Handles document click events to close the menu when a click occurs outside of the menu or the trigger.
5745
+ * Handles document click events to close a menu opened with contextmenu in popover="manual" mode.
5729
5746
  * @internal
5730
5747
  * @param e - The event triggered on document click.
5731
5748
  */
5732
- private handleDocumentClick;
5749
+ private documentClickHandler;
5733
5750
  }
5734
5751
 
5735
5752
  /**
@@ -5814,21 +5831,13 @@ export declare const MenuDefinition: FASTElementDefinition<typeof Menu>;
5814
5831
  * A Switch Custom HTML Element.
5815
5832
  * 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 }.
5816
5833
  *
5817
- * @slot checked-indicator - The checked indicator
5818
- * @slot radio-indicator - The radio indicator
5834
+ * @slot indicator - The checkbox or radio indicator
5819
5835
  * @slot start - Content which can be provided before the menu item content
5820
- * @slot end - Content which can be provided after the menu item content
5821
5836
  * @slot - The default slot for menu item content
5822
- * @slot expand-collapse-indicator - The expand/collapse indicator
5837
+ * @slot end - Content which can be provided after the menu item content
5838
+ * @slot submenu-glyph - The submenu expand/collapse indicator
5823
5839
  * @slot submenu - Used to nest menu's within menu items
5824
- * @csspart input-container - The element representing the visual checked or radio indicator
5825
- * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
5826
- * @csspart radio - The element wrapping the `menuitemradio` indicator
5827
5840
  * @csspart content - The element wrapping the menu item content
5828
- * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
5829
- * @csspart expand-collapse - The expand/collapse element
5830
- * @csspart submenu-region - The container for the submenu, used for positioning
5831
- * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
5832
5841
  * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
5833
5842
  *
5834
5843
  * @public
@@ -5842,15 +5851,6 @@ export declare class MenuItem extends FASTElement {
5842
5851
  * HTML Attribute: disabled
5843
5852
  */
5844
5853
  disabled: boolean;
5845
- /**
5846
- * The expanded state of the element.
5847
- *
5848
- * @public
5849
- * @remarks
5850
- * HTML Attribute: expanded
5851
- */
5852
- expanded: boolean;
5853
- protected expandedChanged(prev: boolean | undefined, next: boolean): void;
5854
5854
  /**
5855
5855
  * The role of the element.
5856
5856
  *
@@ -5859,12 +5859,6 @@ export declare class MenuItem extends FASTElement {
5859
5859
  * HTML Attribute: role
5860
5860
  */
5861
5861
  role: MenuItemRole;
5862
- /**
5863
- * Cleanup function for the submenu positioner.
5864
- *
5865
- * @public
5866
- */
5867
- cleanup: () => void;
5868
5862
  /**
5869
5863
  * The checked value of the element.
5870
5864
  *
@@ -5888,31 +5882,16 @@ export declare class MenuItem extends FASTElement {
5888
5882
  * @internal
5889
5883
  */
5890
5884
  slottedSubmenu: HTMLElement[];
5891
- /**
5892
- * @internal
5893
- */
5894
- get hasSubmenu(): boolean;
5895
5885
  /**
5896
5886
  * Sets the submenu and updates its position.
5897
5887
  *
5898
5888
  * @internal
5899
5889
  */
5900
5890
  protected slottedSubmenuChanged(prev: HTMLElement[] | undefined, next: HTMLElement[]): void;
5901
- /**
5902
- * The container for the submenu.
5903
- *
5904
- * @internal
5905
- */
5906
- submenuContainer: HTMLDivElement;
5907
5891
  /**
5908
5892
  * @internal
5909
5893
  */
5910
5894
  submenu: HTMLElement | undefined;
5911
- private focusSubmenuOnLoad;
5912
- /**
5913
- * @internal
5914
- */
5915
- disconnectedCallback(): void;
5916
5895
  /**
5917
5896
  * @internal
5918
5897
  */
@@ -5921,10 +5900,6 @@ export declare class MenuItem extends FASTElement {
5921
5900
  * @internal
5922
5901
  */
5923
5902
  handleMenuItemClick: (e: MouseEvent) => boolean;
5924
- /**
5925
- * @internal
5926
- */
5927
- submenuLoaded: () => void;
5928
5903
  /**
5929
5904
  * @internal
5930
5905
  */
@@ -5934,23 +5909,19 @@ export declare class MenuItem extends FASTElement {
5934
5909
  */
5935
5910
  handleMouseOut: (e: MouseEvent) => boolean;
5936
5911
  /**
5912
+ * Setup required ARIA on open/close
5937
5913
  * @internal
5938
5914
  */
5939
- private closeSubMenu;
5940
- /**
5941
- * @internal
5942
- */
5943
- private expandAndFocus;
5915
+ toggleHandler: (e: ToggleEvent | Event) => void;
5944
5916
  /**
5945
5917
  * @internal
5946
5918
  */
5947
5919
  private invoke;
5948
5920
  /**
5949
- * Calculate and apply submenu positioning.
5950
- *
5951
- * @public
5921
+ * Set fallback position of menu on open when CSS anchor not supported
5922
+ * @internal
5952
5923
  */
5953
- updateSubmenu(): void;
5924
+ setSubmenuPosition: () => void;
5954
5925
  }
5955
5926
 
5956
5927
  /**
@@ -5976,9 +5947,8 @@ export declare const MenuItemDefinition: FASTElementDefinition<typeof MenuItem>;
5976
5947
  * @public
5977
5948
  */
5978
5949
  export declare type MenuItemOptions = StartEndOptions<MenuItem> & {
5979
- checkboxIndicator?: StaticallyComposableHTML<MenuItem>;
5980
- expandCollapseGlyph?: StaticallyComposableHTML<MenuItem>;
5981
- radioIndicator?: StaticallyComposableHTML<MenuItem>;
5950
+ indicator?: StaticallyComposableHTML<MenuItem>;
5951
+ submenuGlyph?: StaticallyComposableHTML<MenuItem>;
5982
5952
  };
5983
5953
 
5984
5954
  /**
@@ -6028,7 +5998,6 @@ export declare class MenuList extends FASTElement {
6028
5998
  items: HTMLElement[];
6029
5999
  protected itemsChanged(oldValue: HTMLElement[], newValue: HTMLElement[]): void;
6030
6000
  protected menuItems: Element[] | undefined;
6031
- private expandedItem;
6032
6001
  /**
6033
6002
  * The index of the focusable element in the items array
6034
6003
  * defaults to -1
@@ -6053,12 +6022,6 @@ export declare class MenuList extends FASTElement {
6053
6022
  * @public
6054
6023
  */
6055
6024
  focus(): void;
6056
- /**
6057
- * Collapses any expanded menu items.
6058
- *
6059
- * @public
6060
- */
6061
- collapseExpandedItem(): void;
6062
6025
  /**
6063
6026
  * @internal
6064
6027
  */
@@ -6069,15 +6032,17 @@ export declare class MenuList extends FASTElement {
6069
6032
  */
6070
6033
  handleFocusOut: (e: FocusEvent) => void;
6071
6034
  private handleItemFocus;
6072
- private handleExpandedChanged;
6073
6035
  private removeItemListeners;
6074
6036
  private static elementIndent;
6075
6037
  protected setItems(): void;
6038
+ /**
6039
+ * Method for Observable changes to the hidden attribute of child elements
6040
+ */
6076
6041
  handleChange(source: any, propertyName: string): void;
6077
6042
  /**
6078
- * handle change from child element
6043
+ * Handle change from child MenuItem element and set radio group behavior
6079
6044
  */
6080
- private changeHandler;
6045
+ private changedMenuItemHandler;
6081
6046
  /**
6082
6047
  * check if the item is a menu item
6083
6048
  */
@@ -7384,6 +7349,12 @@ export declare const TabTemplate: ElementViewTemplate<Tab, any>;
7384
7349
  * @public
7385
7350
  */
7386
7351
  declare class Text_2 extends FASTElement {
7352
+ /**
7353
+ * The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
7354
+ *
7355
+ * @internal
7356
+ */
7357
+ elementInternals: ElementInternals;
7387
7358
  /**
7388
7359
  * The text will not wrap
7389
7360
  * NOTE: In Fluent UI React v9 this is "wrap"
@@ -7443,6 +7414,12 @@ declare class Text_2 extends FASTElement {
7443
7414
  *
7444
7415
  */
7445
7416
  size?: TextSize;
7417
+ /**
7418
+ * Handles changes to size attribute custom states
7419
+ * @param prev - the previous state
7420
+ * @param next - the next state
7421
+ */
7422
+ sizeChanged(prev: TextSize | undefined, next: TextSize | undefined): void;
7446
7423
  /**
7447
7424
  * THe Text font
7448
7425
  *
@@ -7452,13 +7429,25 @@ declare class Text_2 extends FASTElement {
7452
7429
  */
7453
7430
  font?: TextFont;
7454
7431
  /**
7455
- * THe Text weight
7432
+ * Handles changes to font attribute custom states
7433
+ * @param prev - the previous state
7434
+ * @param next - the next state
7435
+ */
7436
+ fontChanged(prev: TextFont | undefined, next: TextFont | undefined): void;
7437
+ /**
7438
+ * The Text weight
7456
7439
  *
7457
7440
  * @public
7458
7441
  * @remarks
7459
7442
  * HTML Attribute: weight
7460
7443
  */
7461
7444
  weight?: TextWeight;
7445
+ /**
7446
+ * Handles changes to weight attribute custom states
7447
+ * @param prev - the previous state
7448
+ * @param next - the next state
7449
+ */
7450
+ weightChanged(prev: TextWeight | undefined, next: TextWeight | undefined): void;
7462
7451
  /**
7463
7452
  * THe Text align
7464
7453
  *
@@ -7467,6 +7456,21 @@ declare class Text_2 extends FASTElement {
7467
7456
  * HTML Attribute: align
7468
7457
  */
7469
7458
  align?: TextAlign;
7459
+ /**
7460
+ * Handles changes to align attribute custom states
7461
+ * @param prev - the previous state
7462
+ * @param next - the next state
7463
+ */
7464
+ alignChanged(prev: TextAlign | undefined, next: TextAlign | undefined): void;
7465
+ connectedCallback(): void;
7466
+ disconnectedCallback(): void;
7467
+ /**
7468
+ * Handles changes to observable properties
7469
+ * @internal
7470
+ * @param source - the source of the change
7471
+ * @param propertyName - the property name being changed
7472
+ */
7473
+ handleChange(source: any, propertyName: string): void;
7470
7474
  }
7471
7475
  export { Text_2 as Text }
7472
7476