@fluentui/web-components 3.0.0-beta.118 → 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 +11 -2
- package/custom-elements.json +19 -5
- 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 +22 -76
- package/dist/web-components.min.js +187 -186
- package/package.json +1 -1
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
|
/**
|
|
@@ -13581,6 +13513,9 @@ class BaseTree extends FASTElement {
|
|
|
13581
13513
|
}
|
|
13582
13514
|
if (e.target === this) {
|
|
13583
13515
|
this.currentFocused = this.getValidFocusableItem();
|
|
13516
|
+
if (this.currentFocused && this.currentFocused.tabIndex < 0) {
|
|
13517
|
+
this.currentFocused.tabIndex = 0;
|
|
13518
|
+
}
|
|
13584
13519
|
this.currentFocused?.focus();
|
|
13585
13520
|
return;
|
|
13586
13521
|
}
|
|
@@ -13719,12 +13654,13 @@ __decorateClass$2([attr], Tree.prototype, "appearance", 2);
|
|
|
13719
13654
|
|
|
13720
13655
|
const styles$1 = css`
|
|
13721
13656
|
${display("block")}
|
|
13657
|
+
|
|
13722
13658
|
:host{outline:none}`;
|
|
13723
13659
|
|
|
13724
|
-
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({
|
|
13725
13661
|
property: "childTreeItems",
|
|
13726
|
-
filter:
|
|
13727
|
-
})}
|
|
13662
|
+
filter: elements(`${FluentDesignSystem.prefix}-tree-item`)
|
|
13663
|
+
})}></slot></template>`;
|
|
13728
13664
|
|
|
13729
13665
|
const definition$1 = Tree.compose({
|
|
13730
13666
|
name: `${FluentDesignSystem.prefix}-tree`,
|
|
@@ -13782,6 +13718,7 @@ class BaseTreeItem extends FASTElement {
|
|
|
13782
13718
|
* @internal
|
|
13783
13719
|
*/
|
|
13784
13720
|
selectedChanged(prev, next) {
|
|
13721
|
+
this.updateTabindexBySelected();
|
|
13785
13722
|
this.$emit("change");
|
|
13786
13723
|
toggleState(this.elementInternals, "selected", next);
|
|
13787
13724
|
this.elementInternals.ariaSelected = next ? "true" : "false";
|
|
@@ -13803,6 +13740,10 @@ class BaseTreeItem extends FASTElement {
|
|
|
13803
13740
|
this.empty = this.childTreeItems?.length === 0;
|
|
13804
13741
|
this.updateChildTreeItems();
|
|
13805
13742
|
}
|
|
13743
|
+
connectedCallback() {
|
|
13744
|
+
super.connectedCallback();
|
|
13745
|
+
this.updateTabindexBySelected();
|
|
13746
|
+
}
|
|
13806
13747
|
/**
|
|
13807
13748
|
* Updates the childrens indent
|
|
13808
13749
|
*
|
|
@@ -13843,6 +13784,11 @@ class BaseTreeItem extends FASTElement {
|
|
|
13843
13784
|
get isNestedItem() {
|
|
13844
13785
|
return isTreeItem(this.parentElement);
|
|
13845
13786
|
}
|
|
13787
|
+
updateTabindexBySelected() {
|
|
13788
|
+
if (this.$fastController.isConnected) {
|
|
13789
|
+
this.tabIndex = this.selected ? 0 : -1;
|
|
13790
|
+
}
|
|
13791
|
+
}
|
|
13846
13792
|
}
|
|
13847
13793
|
__decorateClass$1([attr({
|
|
13848
13794
|
mode: "boolean"
|
|
@@ -13919,13 +13865,13 @@ const styles = css`
|
|
|
13919
13865
|
${display("block")}
|
|
13920
13866
|
|
|
13921
13867
|
:host{outline:none;font-size:${fontSizeBase300};line-height:${lineHeightBase300}}:host(:focus-visible) .positioning-region{box-shadow:${spacingVerticalNone} ${spacingVerticalNone} ${spacingVerticalNone} ${spacingVerticalXXS}
|
|
13922
|
-
${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)}`;
|
|
13923
13869
|
|
|
13924
|
-
const chevronIcon = html`<svg
|
|
13925
|
-
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({
|
|
13926
13872
|
property: "childTreeItems",
|
|
13927
|
-
filter:
|
|
13928
|
-
})}
|
|
13873
|
+
filter: elements(`${FluentDesignSystem.prefix}-tree-item`)
|
|
13874
|
+
})}></slot></div></template>`;
|
|
13929
13875
|
|
|
13930
13876
|
const definition = TreeItem.compose({
|
|
13931
13877
|
name: `${FluentDesignSystem.prefix}-tree-item`,
|