@fluentui/web-components 3.0.0-beta.117 → 3.0.0-beta.119
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 +21 -2
- package/custom-elements.json +19 -5
- package/dist/esm/menu-item/menu-item.options.d.ts +10 -0
- package/dist/esm/menu-item/menu-item.options.js +14 -0
- package/dist/esm/menu-item/menu-item.options.js.map +1 -1
- package/dist/esm/menu-list/menu-list.js +3 -7
- package/dist/esm/menu-list/menu-list.js.map +1 -1
- package/dist/esm/tablist/tablist.base.js +1 -1
- package/dist/esm/tablist/tablist.base.js.map +1 -1
- package/dist/esm/tree/tree.base.d.ts +1 -1
- package/dist/esm/tree/tree.base.js +3 -0
- package/dist/esm/tree/tree.base.js.map +1 -1
- package/dist/esm/tree/tree.d.ts +4 -4
- package/dist/esm/tree/tree.js +2 -2
- package/dist/esm/tree/tree.js.map +1 -1
- package/dist/esm/tree/tree.styles.js +2 -1
- package/dist/esm/tree/tree.styles.js.map +1 -1
- package/dist/esm/tree/tree.template.js +7 -6
- package/dist/esm/tree/tree.template.js.map +1 -1
- package/dist/esm/tree-item/tree-item.base.d.ts +3 -1
- package/dist/esm/tree-item/tree-item.base.js +10 -0
- package/dist/esm/tree-item/tree-item.base.js.map +1 -1
- package/dist/esm/tree-item/tree-item.d.ts +3 -3
- package/dist/esm/tree-item/tree-item.js +1 -1
- package/dist/esm/tree-item/tree-item.js.map +1 -1
- package/dist/esm/tree-item/tree-item.styles.js +5 -0
- package/dist/esm/tree-item/tree-item.styles.js.map +1 -1
- package/dist/esm/tree-item/tree-item.template.js +12 -13
- package/dist/esm/tree-item/tree-item.template.js.map +1 -1
- package/dist/web-components.d.ts +7 -5
- package/dist/web-components.js +31 -81
- package/dist/web-components.min.js +176 -175
- package/package.json +1 -1
package/dist/web-components.d.ts
CHANGED
|
@@ -3431,7 +3431,7 @@ declare class BaseTreeItem extends FASTElement {
|
|
|
3431
3431
|
* @public
|
|
3432
3432
|
*/
|
|
3433
3433
|
dataIndent: number | undefined;
|
|
3434
|
-
|
|
3434
|
+
protected dataIndentChanged(prev: number, next: number): void;
|
|
3435
3435
|
childTreeItems: BaseTreeItem[] | undefined;
|
|
3436
3436
|
/**
|
|
3437
3437
|
* Handles changes to the child tree items
|
|
@@ -3439,6 +3439,7 @@ declare class BaseTreeItem extends FASTElement {
|
|
|
3439
3439
|
* @public
|
|
3440
3440
|
*/
|
|
3441
3441
|
childTreeItemsChanged(): void;
|
|
3442
|
+
connectedCallback(): void;
|
|
3442
3443
|
/**
|
|
3443
3444
|
* Updates the childrens indent
|
|
3444
3445
|
*
|
|
@@ -3460,6 +3461,7 @@ declare class BaseTreeItem extends FASTElement {
|
|
|
3460
3461
|
* @internal
|
|
3461
3462
|
*/
|
|
3462
3463
|
get isNestedItem(): boolean;
|
|
3464
|
+
protected updateTabindexBySelected(): void;
|
|
3463
3465
|
}
|
|
3464
3466
|
|
|
3465
3467
|
/**
|
|
@@ -11199,14 +11201,14 @@ export declare class Tree extends BaseTree {
|
|
|
11199
11201
|
* HTML Attribute: size
|
|
11200
11202
|
*/
|
|
11201
11203
|
size: TreeItemSize;
|
|
11202
|
-
|
|
11204
|
+
protected sizeChanged(): void;
|
|
11203
11205
|
/**
|
|
11204
11206
|
* The appearance variants of the tree item element
|
|
11205
11207
|
* @public
|
|
11206
11208
|
* HTML Attribute: appearance
|
|
11207
11209
|
*/
|
|
11208
11210
|
appearance: TreeItemAppearance;
|
|
11209
|
-
|
|
11211
|
+
protected appearanceChanged(): void;
|
|
11210
11212
|
/**
|
|
11211
11213
|
* child tree items supered change event
|
|
11212
11214
|
* @internal
|
|
@@ -11244,7 +11246,7 @@ export declare class TreeItem extends BaseTreeItem {
|
|
|
11244
11246
|
* we update the child tree items' size based on the size
|
|
11245
11247
|
* @internal
|
|
11246
11248
|
*/
|
|
11247
|
-
|
|
11249
|
+
protected sizeChanged(): void;
|
|
11248
11250
|
/**
|
|
11249
11251
|
* The size of the tree item element
|
|
11250
11252
|
* @public
|
|
@@ -11255,7 +11257,7 @@ export declare class TreeItem extends BaseTreeItem {
|
|
|
11255
11257
|
*
|
|
11256
11258
|
* @internal
|
|
11257
11259
|
*/
|
|
11258
|
-
|
|
11260
|
+
protected appearanceChanged(): void;
|
|
11259
11261
|
/**
|
|
11260
11262
|
* child tree items supered change event
|
|
11261
11263
|
* @internal
|
package/dist/web-components.js
CHANGED
|
@@ -2872,74 +2872,6 @@ function slotted(propertyOrOptions) {
|
|
|
2872
2872
|
return new SlottedDirective(propertyOrOptions);
|
|
2873
2873
|
}
|
|
2874
2874
|
|
|
2875
|
-
/**
|
|
2876
|
-
* The runtime behavior for child node observation.
|
|
2877
|
-
* @public
|
|
2878
|
-
*/
|
|
2879
|
-
class ChildrenDirective extends NodeObservationDirective {
|
|
2880
|
-
/**
|
|
2881
|
-
* Creates an instance of ChildrenDirective.
|
|
2882
|
-
* @param options - The options to use in configuring the child observation behavior.
|
|
2883
|
-
*/
|
|
2884
|
-
constructor(options) {
|
|
2885
|
-
super(options);
|
|
2886
|
-
this.observerProperty = Symbol();
|
|
2887
|
-
this.handleEvent = (mutations, observer) => {
|
|
2888
|
-
const target = observer.target;
|
|
2889
|
-
this.updateTarget(this.getSource(target), this.computeNodes(target));
|
|
2890
|
-
};
|
|
2891
|
-
options.childList = true;
|
|
2892
|
-
}
|
|
2893
|
-
/**
|
|
2894
|
-
* Begins observation of the nodes.
|
|
2895
|
-
* @param target - The target to observe.
|
|
2896
|
-
*/
|
|
2897
|
-
observe(target) {
|
|
2898
|
-
let observer = target[this.observerProperty];
|
|
2899
|
-
if (!observer) {
|
|
2900
|
-
observer = new MutationObserver(this.handleEvent);
|
|
2901
|
-
observer.toJSON = noop;
|
|
2902
|
-
target[this.observerProperty] = observer;
|
|
2903
|
-
}
|
|
2904
|
-
observer.target = target;
|
|
2905
|
-
observer.observe(target, this.options);
|
|
2906
|
-
}
|
|
2907
|
-
/**
|
|
2908
|
-
* Disconnects observation of the nodes.
|
|
2909
|
-
* @param target - The target to unobserve.
|
|
2910
|
-
*/
|
|
2911
|
-
disconnect(target) {
|
|
2912
|
-
const observer = target[this.observerProperty];
|
|
2913
|
-
observer.target = null;
|
|
2914
|
-
observer.disconnect();
|
|
2915
|
-
}
|
|
2916
|
-
/**
|
|
2917
|
-
* Retrieves the raw nodes that should be assigned to the source property.
|
|
2918
|
-
* @param target - The target to get the node to.
|
|
2919
|
-
*/
|
|
2920
|
-
getNodes(target) {
|
|
2921
|
-
if ("selector" in this.options) {
|
|
2922
|
-
return Array.from(target.querySelectorAll(this.options.selector));
|
|
2923
|
-
}
|
|
2924
|
-
return Array.from(target.childNodes);
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
HTMLDirective.define(ChildrenDirective);
|
|
2928
|
-
/**
|
|
2929
|
-
* A directive that observes the `childNodes` of an element and updates a property
|
|
2930
|
-
* whenever they change.
|
|
2931
|
-
* @param propertyOrOptions - The options used to configure child node observation.
|
|
2932
|
-
* @public
|
|
2933
|
-
*/
|
|
2934
|
-
function children(propertyOrOptions) {
|
|
2935
|
-
if (isString(propertyOrOptions)) {
|
|
2936
|
-
propertyOrOptions = {
|
|
2937
|
-
property: propertyOrOptions
|
|
2938
|
-
};
|
|
2939
|
-
}
|
|
2940
|
-
return new ChildrenDirective(propertyOrOptions);
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
2875
|
const booleanMode = "boolean";
|
|
2944
2876
|
const reflectMode = "reflect";
|
|
2945
2877
|
/**
|
|
@@ -8547,6 +8479,12 @@ const MenuItemRole = {
|
|
|
8547
8479
|
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
8548
8480
|
[MenuItemRole.menuitemradio]: "menuitemradio"
|
|
8549
8481
|
});
|
|
8482
|
+
function isMenuItem(element, tagName = "-menu-item") {
|
|
8483
|
+
if (element?.nodeType !== Node.ELEMENT_NODE) {
|
|
8484
|
+
return false;
|
|
8485
|
+
}
|
|
8486
|
+
return element.tagName.toLowerCase().endsWith(tagName);
|
|
8487
|
+
}
|
|
8550
8488
|
|
|
8551
8489
|
var __defProp$r = Object.defineProperty;
|
|
8552
8490
|
var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
|
|
@@ -8870,7 +8808,7 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8870
8808
|
* check if the item is a menu item
|
|
8871
8809
|
*/
|
|
8872
8810
|
this.isMenuItemElement = el => {
|
|
8873
|
-
return el
|
|
8811
|
+
return isMenuItem(el) || isHTMLElement(el) && el.getAttribute("role") in _MenuList.focusableElementRoles;
|
|
8874
8812
|
};
|
|
8875
8813
|
/**
|
|
8876
8814
|
* check if the item is focusable
|
|
@@ -8970,9 +8908,7 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8970
8908
|
return Math.max(accum, elementValue);
|
|
8971
8909
|
}, 0);
|
|
8972
8910
|
filteredMenuListItems?.forEach(item => {
|
|
8973
|
-
|
|
8974
|
-
item.setAttribute("data-indent", `${indent}`);
|
|
8975
|
-
}
|
|
8911
|
+
item.dataset.indent = `${indent}`;
|
|
8976
8912
|
});
|
|
8977
8913
|
}
|
|
8978
8914
|
/**
|
|
@@ -11901,7 +11837,7 @@ class BaseTablist extends FASTElement {
|
|
|
11901
11837
|
*/
|
|
11902
11838
|
setTabs() {
|
|
11903
11839
|
this.activeTabIndex = this.getActiveIndex();
|
|
11904
|
-
const hasStartSlot = this.tabs.some(tab => tab.start
|
|
11840
|
+
const hasStartSlot = this.tabs.some(tab => !!tab.querySelector("[slot='start']"));
|
|
11905
11841
|
this.tabs.forEach((tab, index) => {
|
|
11906
11842
|
if (tab.slot === "tab") {
|
|
11907
11843
|
const isActiveTab = this.activeTabIndex === index && isFocusableElement(tab);
|
|
@@ -13577,6 +13513,9 @@ class BaseTree extends FASTElement {
|
|
|
13577
13513
|
}
|
|
13578
13514
|
if (e.target === this) {
|
|
13579
13515
|
this.currentFocused = this.getValidFocusableItem();
|
|
13516
|
+
if (this.currentFocused && this.currentFocused.tabIndex < 0) {
|
|
13517
|
+
this.currentFocused.tabIndex = 0;
|
|
13518
|
+
}
|
|
13580
13519
|
this.currentFocused?.focus();
|
|
13581
13520
|
return;
|
|
13582
13521
|
}
|
|
@@ -13715,12 +13654,13 @@ __decorateClass$2([attr], Tree.prototype, "appearance", 2);
|
|
|
13715
13654
|
|
|
13716
13655
|
const styles$1 = css`
|
|
13717
13656
|
${display("block")}
|
|
13657
|
+
|
|
13718
13658
|
:host{outline:none}`;
|
|
13719
13659
|
|
|
13720
|
-
const template$1 = html`<template tabindex="0" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusHandler(c.event)}" @focusout="${(x, c) => x.blurHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}" ${
|
|
13660
|
+
const template$1 = html`<template tabindex="0" @click="${(x, c) => x.clickHandler(c.event)}" @focusin="${(x, c) => x.focusHandler(c.event)}" @focusout="${(x, c) => x.blurHandler(c.event)}" @keydown="${(x, c) => x.keydownHandler(c.event)}" @change="${(x, c) => x.changeHandler(c.event)}"><slot ${slotted({
|
|
13721
13661
|
property: "childTreeItems",
|
|
13722
|
-
filter:
|
|
13723
|
-
})}
|
|
13662
|
+
filter: elements(`${FluentDesignSystem.prefix}-tree-item`)
|
|
13663
|
+
})}></slot></template>`;
|
|
13724
13664
|
|
|
13725
13665
|
const definition$1 = Tree.compose({
|
|
13726
13666
|
name: `${FluentDesignSystem.prefix}-tree`,
|
|
@@ -13778,6 +13718,7 @@ class BaseTreeItem extends FASTElement {
|
|
|
13778
13718
|
* @internal
|
|
13779
13719
|
*/
|
|
13780
13720
|
selectedChanged(prev, next) {
|
|
13721
|
+
this.updateTabindexBySelected();
|
|
13781
13722
|
this.$emit("change");
|
|
13782
13723
|
toggleState(this.elementInternals, "selected", next);
|
|
13783
13724
|
this.elementInternals.ariaSelected = next ? "true" : "false";
|
|
@@ -13799,6 +13740,10 @@ class BaseTreeItem extends FASTElement {
|
|
|
13799
13740
|
this.empty = this.childTreeItems?.length === 0;
|
|
13800
13741
|
this.updateChildTreeItems();
|
|
13801
13742
|
}
|
|
13743
|
+
connectedCallback() {
|
|
13744
|
+
super.connectedCallback();
|
|
13745
|
+
this.updateTabindexBySelected();
|
|
13746
|
+
}
|
|
13802
13747
|
/**
|
|
13803
13748
|
* Updates the childrens indent
|
|
13804
13749
|
*
|
|
@@ -13839,6 +13784,11 @@ class BaseTreeItem extends FASTElement {
|
|
|
13839
13784
|
get isNestedItem() {
|
|
13840
13785
|
return isTreeItem(this.parentElement);
|
|
13841
13786
|
}
|
|
13787
|
+
updateTabindexBySelected() {
|
|
13788
|
+
if (this.$fastController.isConnected) {
|
|
13789
|
+
this.tabIndex = this.selected ? 0 : -1;
|
|
13790
|
+
}
|
|
13791
|
+
}
|
|
13842
13792
|
}
|
|
13843
13793
|
__decorateClass$1([attr({
|
|
13844
13794
|
mode: "boolean"
|
|
@@ -13915,13 +13865,13 @@ const styles = css`
|
|
|
13915
13865
|
${display("block")}
|
|
13916
13866
|
|
|
13917
13867
|
:host{outline:none;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}:host(:focus-visible) .positioning-region{box-shadow:${spacingVerticalNone} ${spacingVerticalNone} ${spacingVerticalNone} ${spacingVerticalXXS}
|
|
13918
|
-
${colorStrokeFocus2} inset}.positioning-region{display:flex;align-items:center;justify-content:space-between;cursor:pointer;height:${spacingVerticalXXXL};padding-inline-start:calc(var(--indent) * ${spacingHorizontalXXL});padding-inline-end:${spacingVerticalS};border-radius:${borderRadiusMedium};background-color:${colorSubtleBackground};color:${colorNeutralForeground2};gap:${spacingHorizontalXS}}@media (prefers-contrast:more){:host(:focus-visible) .positioning-region{outline:1px solid ${colorStrokeFocus2}}}.content{display:flex;align-items:center;gap:${spacingHorizontalXS}}.chevron{display:flex;align-items:center;flex-shrink:0;justify-content:center;width:${spacingHorizontalXXL};height:${spacingVerticalXXL};transition:transform ${durationFaster} ${curveEasyEaseMax};transform:rotate(0deg)}.chevron:dir(rtl){transform:rotate(180deg)}.aside{display:flex;align-items:center}.positioning-region:hover{background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover}}.positioning-region:active{background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed}}::slotted([slot='start']),::slotted([slot='end']),::slotted(:not([slot])){display:flex;align-items:center;min-width:0}::slotted([slot='start']){flex-shrink:0}::slotted(:not([slot])){padding-inline:${spacingHorizontalXXS}}.items{display:none}:host([expanded]) .items{display:block}:host([empty]) .chevron,:host([empty]) .items{visibility:hidden}:host([selected]) .positioning-region{background-color:${colorSubtleBackgroundSelected};color:${colorNeutralForeground2Selected}}:host([selected]) .content,:host([selected]) .chevron{color:${colorNeutralForeground3Selected}}:host([size='small']) .positioning-region{height:${spacingVerticalXXL};padding-inline-start:calc(var(--indent) * ${spacingHorizontalM})}:host([appearance='subtle-alpha']) .positioning-region:hover{background-color:${colorSubtleBackgroundLightAlphaHover}}:host([appearance='subtle-alpha']) .positioning-region:active{background-color:${colorSubtleBackgroundLightAlphaPressed}}:host([appearance='subtle-alpha'][selected]) .positioning-region{background-color:${colorSubtleBackgroundLightAlphaSelected};color:${colorNeutralForeground2Selected}}:host([appearance='transparent']) .positioning-region{background-color:${colorTransparentBackground}}:host([appearance='transparent']) .positioning-region:hover{background-color:${colorTransparentBackgroundHover}}:host([appearance='transparent']) .positioning-region:active{background-color:${colorTransparentBackgroundPressed}}:host([appearance='transparent'][selected]) .positioning-region{background-color:${colorTransparentBackgroundSelected};color:${colorNeutralForeground2Selected}}:host([expanded]) .chevron{transform:rotate(90deg)}`;
|
|
13868
|
+
${colorStrokeFocus2} inset}.positioning-region{display:flex;align-items:center;justify-content:space-between;cursor:pointer;height:${spacingVerticalXXXL};padding-inline-start:calc(var(--indent) * ${spacingHorizontalXXL});padding-inline-end:${spacingVerticalS};border-radius:${borderRadiusMedium};background-color:${colorSubtleBackground};color:${colorNeutralForeground2};gap:${spacingHorizontalXS}}@media (prefers-contrast:more){:host(:focus-visible) .positioning-region{outline:1px solid ${colorStrokeFocus2}}}.content{display:flex;align-items:center;gap:${spacingHorizontalXS}}.chevron{display:flex;align-items:center;flex-shrink:0;justify-content:center;width:${spacingHorizontalXXL};height:${spacingVerticalXXL};transition:transform ${durationFaster} ${curveEasyEaseMax};transform:rotate(0deg)}.chevron:dir(rtl){transform:rotate(180deg)}.chevron svg{inline-size:12px;block-size:12px}.aside{display:flex;align-items:center}.positioning-region:hover{background-color:${colorSubtleBackgroundHover};color:${colorNeutralForeground2Hover}}.positioning-region:active{background-color:${colorSubtleBackgroundPressed};color:${colorNeutralForeground2Pressed}}::slotted([slot='start']),::slotted([slot='end']),::slotted(:not([slot])){display:flex;align-items:center;min-width:0}::slotted([slot='start']){flex-shrink:0}::slotted(:not([slot])){padding-inline:${spacingHorizontalXXS}}.items{display:none}:host([expanded]) .items{display:block}:host([empty]) .chevron,:host([empty]) .items{visibility:hidden}:host([selected]) .positioning-region{background-color:${colorSubtleBackgroundSelected};color:${colorNeutralForeground2Selected}}:host([selected]) .content,:host([selected]) .chevron{color:${colorNeutralForeground3Selected}}:host([size='small']) .positioning-region{height:${spacingVerticalXXL};padding-inline-start:calc(var(--indent) * ${spacingHorizontalM})}:host([appearance='subtle-alpha']) .positioning-region:hover{background-color:${colorSubtleBackgroundLightAlphaHover}}:host([appearance='subtle-alpha']) .positioning-region:active{background-color:${colorSubtleBackgroundLightAlphaPressed}}:host([appearance='subtle-alpha'][selected]) .positioning-region{background-color:${colorSubtleBackgroundLightAlphaSelected};color:${colorNeutralForeground2Selected}}:host([appearance='transparent']) .positioning-region{background-color:${colorTransparentBackground}}:host([appearance='transparent']) .positioning-region:hover{background-color:${colorTransparentBackgroundHover}}:host([appearance='transparent']) .positioning-region:active{background-color:${colorTransparentBackgroundPressed}}:host([appearance='transparent'][selected]) .positioning-region{background-color:${colorTransparentBackgroundSelected};color:${colorNeutralForeground2Selected}}:host([expanded]) .chevron{transform:rotate(90deg)}`;
|
|
13919
13869
|
|
|
13920
|
-
const chevronIcon = html`<svg
|
|
13921
|
-
const template = html`<template
|
|
13870
|
+
const chevronIcon = html`<svg viewBox="0 0 12 12" fill="currentColor"><path 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"></path></svg>`;
|
|
13871
|
+
const template = html`<template slot="${x => x.isNestedItem ? "item" : void 0}"><div class="positioning-region" part="positioning-region"><div class="content" part="content"><span class="chevron" part="chevron" aria-hidden="true"><slot name="chevron">${chevronIcon}</slot></span><slot name="start"></slot><slot></slot><slot name="end"></slot></div><div class="aside" part="aside"><slot name="aside"></slot></div></div><div role="group" class="items" part="items"><slot name="item" ${slotted({
|
|
13922
13872
|
property: "childTreeItems",
|
|
13923
|
-
filter:
|
|
13924
|
-
})}
|
|
13873
|
+
filter: elements(`${FluentDesignSystem.prefix}-tree-item`)
|
|
13874
|
+
})}></slot></div></template>`;
|
|
13925
13875
|
|
|
13926
13876
|
const definition = TreeItem.compose({
|
|
13927
13877
|
name: `${FluentDesignSystem.prefix}-tree-item`,
|