@fluentui/web-components 3.0.0-rc.10 → 3.0.0-rc.12
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 +20 -2
- package/custom-elements.json +241 -256
- package/dist/esm/accordion/accordion.d.ts +2 -1
- package/dist/esm/accordion/accordion.js +52 -49
- package/dist/esm/accordion/accordion.js.map +1 -1
- package/dist/esm/accordion-item/accordion-item.options.d.ts +11 -1
- package/dist/esm/accordion-item/accordion-item.options.js +12 -0
- package/dist/esm/accordion-item/accordion-item.options.js.map +1 -1
- package/dist/esm/anchor-button/anchor-button.base.js +1 -0
- package/dist/esm/anchor-button/anchor-button.base.js.map +1 -1
- package/dist/esm/avatar/avatar.base.d.ts +64 -10
- package/dist/esm/avatar/avatar.base.js +100 -27
- package/dist/esm/avatar/avatar.base.js.map +1 -1
- package/dist/esm/avatar/avatar.styles.js +20 -3
- package/dist/esm/avatar/avatar.styles.js.map +1 -1
- package/dist/esm/avatar/avatar.template.js +4 -3
- package/dist/esm/avatar/avatar.template.js.map +1 -1
- package/dist/esm/button/button.base.d.ts +15 -1
- package/dist/esm/button/button.base.js +27 -24
- package/dist/esm/button/button.base.js.map +1 -1
- package/dist/esm/button/button.template.d.ts +3 -3
- package/dist/esm/button/button.template.js.map +1 -1
- package/dist/esm/dialog/dialog.d.ts +8 -3
- package/dist/esm/dialog/dialog.js +26 -20
- package/dist/esm/dialog/dialog.js.map +1 -1
- package/dist/esm/drawer/drawer.js +0 -1
- package/dist/esm/drawer/drawer.js.map +1 -1
- package/dist/esm/dropdown/dropdown.base.d.ts +1 -0
- package/dist/esm/dropdown/dropdown.base.js +24 -15
- package/dist/esm/dropdown/dropdown.base.js.map +1 -1
- package/dist/esm/listbox/listbox.d.ts +12 -7
- package/dist/esm/listbox/listbox.js +27 -17
- package/dist/esm/listbox/listbox.js.map +1 -1
- package/dist/esm/listbox/listbox.template.js +2 -3
- package/dist/esm/listbox/listbox.template.js.map +1 -1
- package/dist/esm/menu/menu.d.ts +7 -0
- package/dist/esm/menu/menu.js +22 -17
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/option/option.js +1 -1
- package/dist/esm/option/option.js.map +1 -1
- package/dist/esm/progress-bar/progress-bar.base.d.ts +19 -4
- package/dist/esm/progress-bar/progress-bar.base.js +37 -19
- package/dist/esm/progress-bar/progress-bar.base.js.map +1 -1
- package/dist/esm/radio/radio.options.d.ts +9 -0
- package/dist/esm/radio/radio.options.js +12 -1
- package/dist/esm/radio/radio.options.js.map +1 -1
- package/dist/esm/radio-group/radio-group.d.ts +13 -7
- package/dist/esm/radio-group/radio-group.js +14 -21
- package/dist/esm/radio-group/radio-group.js.map +1 -1
- package/dist/esm/radio-group/radio-group.template.js +2 -2
- package/dist/esm/radio-group/radio-group.template.js.map +1 -1
- package/dist/esm/rating-display/rating-display.base.d.ts +11 -1
- package/dist/esm/rating-display/rating-display.base.js +24 -11
- package/dist/esm/rating-display/rating-display.base.js.map +1 -1
- package/dist/esm/slider/slider.d.ts +7 -3
- package/dist/esm/slider/slider.js +46 -28
- package/dist/esm/slider/slider.js.map +1 -1
- package/dist/esm/tab/tab.d.ts +13 -1
- package/dist/esm/tab/tab.js +16 -2
- package/dist/esm/tab/tab.js.map +1 -1
- package/dist/esm/tablist/tablist.base.d.ts +2 -1
- package/dist/esm/tablist/tablist.base.js +109 -95
- package/dist/esm/tablist/tablist.base.js.map +1 -1
- package/dist/esm/tablist/tablist.d.ts +2 -1
- package/dist/esm/tablist/tablist.js +2 -2
- package/dist/esm/tablist/tablist.js.map +1 -1
- package/dist/esm/text-input/text-input.base.js +12 -5
- package/dist/esm/text-input/text-input.base.js.map +1 -1
- package/dist/esm/text-input/text-input.template.d.ts +1 -1
- package/dist/esm/text-input/text-input.template.js +2 -8
- package/dist/esm/text-input/text-input.template.js.map +1 -1
- package/dist/esm/textarea/textarea.base.d.ts +7 -3
- package/dist/esm/textarea/textarea.base.js +38 -23
- package/dist/esm/textarea/textarea.base.js.map +1 -1
- package/dist/esm/tree/tree.base.d.ts +8 -0
- package/dist/esm/tree/tree.base.js +16 -2
- package/dist/esm/tree/tree.base.js.map +1 -1
- package/dist/esm/tree-item/tree-item.base.d.ts +7 -0
- package/dist/esm/tree-item/tree-item.base.js +14 -12
- package/dist/esm/tree-item/tree-item.base.js.map +1 -1
- package/dist/esm/utils/focusable-element.js +2 -1
- package/dist/esm/utils/focusable-element.js.map +1 -1
- package/dist/esm/utils/request-idle-callback.js +4 -9
- package/dist/esm/utils/request-idle-callback.js.map +1 -1
- package/dist/esm/utils/typings.d.ts +8 -0
- package/dist/esm/utils/typings.js +15 -1
- package/dist/esm/utils/typings.js.map +1 -1
- package/dist/web-components.d.ts +198 -44
- package/dist/web-components.js +605 -368
- package/dist/web-components.min.js +224 -224
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export declare class Accordion extends FASTElement {
|
|
|
21
21
|
* HTML attribute: expand-mode
|
|
22
22
|
*/
|
|
23
23
|
expandmode: AccordionExpandMode;
|
|
24
|
-
expandmodeChanged(prev: AccordionExpandMode, next: AccordionExpandMode): void;
|
|
24
|
+
expandmodeChanged(prev: AccordionExpandMode | undefined, next: AccordionExpandMode): void;
|
|
25
25
|
/**
|
|
26
26
|
* @internal
|
|
27
27
|
*/
|
|
@@ -73,4 +73,5 @@ export declare class Accordion extends FASTElement {
|
|
|
73
73
|
* @returns
|
|
74
74
|
*/
|
|
75
75
|
private expandedChangedHandler;
|
|
76
|
+
connectedCallback(): void;
|
|
76
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { Observable } from '@microsoft/fast-element';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { attr, FASTElement, Observable, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { waitForConnectedDescendants } from '../utils/request-idle-callback.js';
|
|
4
|
+
import { isAccordionItem } from '../accordion-item/accordion-item.options.js';
|
|
5
5
|
import { AccordionExpandMode } from './accordion.options.js';
|
|
6
6
|
/**
|
|
7
7
|
* An Accordion Custom HTML Element
|
|
@@ -17,15 +17,6 @@ import { AccordionExpandMode } from './accordion.options.js';
|
|
|
17
17
|
export class Accordion extends FASTElement {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
|
-
/**
|
|
21
|
-
* Controls the expand mode of the Accordion, either allowing
|
|
22
|
-
* single or multiple item expansion.
|
|
23
|
-
* @public
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* HTML attribute: expand-mode
|
|
27
|
-
*/
|
|
28
|
-
this.expandmode = AccordionExpandMode.multi;
|
|
29
20
|
this.activeItemIndex = 0;
|
|
30
21
|
/**
|
|
31
22
|
* Resets event listeners and sets the `accordionItems` property
|
|
@@ -33,25 +24,27 @@ export class Accordion extends FASTElement {
|
|
|
33
24
|
* @returns {void}
|
|
34
25
|
*/
|
|
35
26
|
this.setItems = () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
waitForConnectedDescendants(this, () => {
|
|
28
|
+
if (this.slottedAccordionItems.length === 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Get all existing children and remove event listeners
|
|
32
|
+
const children = Array.from(this.children);
|
|
33
|
+
this.removeItemListeners(children);
|
|
34
|
+
// Resubscribe to the `disabled` attribute of all children
|
|
35
|
+
children.forEach((child) => Observable.getNotifier(child).subscribe(this, 'disabled'));
|
|
36
|
+
// Add event listeners to each non-disabled AccordionItem
|
|
37
|
+
this.accordionItems = children.filter(child => !child.hasAttribute('disabled'));
|
|
38
|
+
this.accordionItems.forEach((item, index) => {
|
|
39
|
+
item.addEventListener('click', this.expandedChangedHandler);
|
|
40
|
+
// Subscribe to the expanded attribute of the item
|
|
41
|
+
Observable.getNotifier(item).subscribe(this, 'expanded');
|
|
42
|
+
});
|
|
43
|
+
if (this.isSingleExpandMode()) {
|
|
44
|
+
const expandedItem = this.findExpandedItem();
|
|
45
|
+
this.setSingleExpandMode(expandedItem);
|
|
46
|
+
}
|
|
50
47
|
});
|
|
51
|
-
if (this.isSingleExpandMode()) {
|
|
52
|
-
const expandedItem = this.findExpandedItem();
|
|
53
|
-
this.setSingleExpandMode(expandedItem);
|
|
54
|
-
}
|
|
55
48
|
};
|
|
56
49
|
/**
|
|
57
50
|
* Removes event listeners from the previous accordion items
|
|
@@ -71,7 +64,7 @@ export class Accordion extends FASTElement {
|
|
|
71
64
|
*/
|
|
72
65
|
this.expandedChangedHandler = (evt) => {
|
|
73
66
|
const item = evt.target;
|
|
74
|
-
if (item
|
|
67
|
+
if (isAccordionItem(item)) {
|
|
75
68
|
if (!this.isSingleExpandMode()) {
|
|
76
69
|
item.expanded = !item.expanded;
|
|
77
70
|
// setSingleExpandMode sets activeItemIndex on its own
|
|
@@ -128,10 +121,11 @@ export class Accordion extends FASTElement {
|
|
|
128
121
|
* @returns {void}
|
|
129
122
|
*/
|
|
130
123
|
findExpandedItem() {
|
|
131
|
-
if (this.accordionItems.length === 0) {
|
|
124
|
+
if (!this.accordionItems || this.accordionItems?.length === 0) {
|
|
132
125
|
return null;
|
|
133
126
|
}
|
|
134
|
-
return (this.accordionItems.find((item) => item
|
|
127
|
+
return (this.accordionItems.find((item) => isAccordionItem(item) && item.expanded) ??
|
|
128
|
+
this.accordionItems[0]);
|
|
135
129
|
}
|
|
136
130
|
/**
|
|
137
131
|
* Checks if the accordion is in single expand mode
|
|
@@ -146,24 +140,33 @@ export class Accordion extends FASTElement {
|
|
|
146
140
|
* @returns {void}
|
|
147
141
|
*/
|
|
148
142
|
setSingleExpandMode(expandedItem) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
item.
|
|
143
|
+
requestAnimationFrame(() => {
|
|
144
|
+
if (this.accordionItems.length === 0) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const currentItems = Array.from(this.accordionItems);
|
|
148
|
+
this.activeItemIndex = currentItems.indexOf(expandedItem);
|
|
149
|
+
currentItems.forEach((item, index) => {
|
|
150
|
+
if (isAccordionItem(item)) {
|
|
151
|
+
if (this.activeItemIndex === index) {
|
|
152
|
+
item.expanded = true;
|
|
153
|
+
item.expandbutton.setAttribute('aria-disabled', 'true');
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
item.expanded = false;
|
|
157
|
+
if (!item.hasAttribute('disabled')) {
|
|
158
|
+
item.expandbutton.removeAttribute('aria-disabled');
|
|
159
|
+
}
|
|
164
160
|
}
|
|
165
161
|
}
|
|
166
|
-
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
connectedCallback() {
|
|
166
|
+
super.connectedCallback();
|
|
167
|
+
requestAnimationFrame(() => {
|
|
168
|
+
this.expandmode = this.expandmode || AccordionExpandMode.multi;
|
|
169
|
+
this.setItems();
|
|
167
170
|
});
|
|
168
171
|
}
|
|
169
172
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../src/accordion/accordion.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../src/accordion/accordion.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAW,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACh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QAAQ,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1LQ;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;6CACK;AAyBjC;IADN,UAAU;wDACkC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ValuesOf } from '../utils/typings.js';
|
|
2
|
+
import type { BaseAccordionItem } from './accordion-item.base.js';
|
|
2
3
|
/**
|
|
3
4
|
* An Accordion Item header font size can be small, medium, large, and extra-large
|
|
4
5
|
*/
|
|
@@ -25,3 +26,12 @@ export declare const AccordionItemMarkerPosition: {
|
|
|
25
26
|
* @public
|
|
26
27
|
*/
|
|
27
28
|
export type AccordionItemMarkerPosition = ValuesOf<typeof AccordionItemMarkerPosition>;
|
|
29
|
+
/**
|
|
30
|
+
* Predicate function that determines if the element should be considered an accordion item element.
|
|
31
|
+
*
|
|
32
|
+
* @param element - The element to check.
|
|
33
|
+
* @param tagName - The tag name to check against, defaults to '-accordion-item'.
|
|
34
|
+
* @returns True if the element is an accordion item element, false otherwise.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare function isAccordionItem(element?: Node | null, tagName?: string): element is BaseAccordionItem;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isCustomElement } from '../utils/typings.js';
|
|
1
2
|
/**
|
|
2
3
|
* An Accordion Item header font size can be small, medium, large, and extra-large
|
|
3
4
|
*/
|
|
@@ -14,4 +15,15 @@ export const AccordionItemMarkerPosition = {
|
|
|
14
15
|
start: 'start',
|
|
15
16
|
end: 'end',
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Predicate function that determines if the element should be considered an accordion item element.
|
|
20
|
+
*
|
|
21
|
+
* @param element - The element to check.
|
|
22
|
+
* @param tagName - The tag name to check against, defaults to '-accordion-item'.
|
|
23
|
+
* @returns True if the element is an accordion item element, false otherwise.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export function isAccordionItem(element, tagName = '-accordion-item') {
|
|
27
|
+
return isCustomElement(tagName)(element);
|
|
28
|
+
}
|
|
17
29
|
//# sourceMappingURL=accordion-item.options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-item.options.js","sourceRoot":"","sources":["../../../src/accordion-item/accordion-item.options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accordion-item.options.js","sourceRoot":"","sources":["../../../src/accordion-item/accordion-item.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,qBAAqB,CAAC;AAGrE;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,aAAa;CACjB,CAAC;AAQX;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;CACF,CAAC;AAQX;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAqB,EACrB,UAAkB,iBAAiB;IAEnC,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -37,6 +37,7 @@ export class BaseAnchor extends FASTElement {
|
|
|
37
37
|
}
|
|
38
38
|
connectedCallback() {
|
|
39
39
|
super.connectedCallback();
|
|
40
|
+
this.tabIndex = Number(this.getAttribute('tabindex') ?? 0) < 0 ? -1 : 0;
|
|
40
41
|
Observable.getNotifier(this).subscribe(this);
|
|
41
42
|
Object.keys(this.$fastController.definition.attributeLookup).forEach(key => {
|
|
42
43
|
this.handleChange(this, key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor-button.base.js","sourceRoot":"","sources":["../../../src/anchor-button/anchor-button.base.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,I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C,CAAC;QACtE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;QAC1B,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA1LQ;IADN,IAAI;4CACoB;AAWlB;IADN,IAAI;wCACgB;AAWd;IADN,IAAI;4CACoB;AAWlB;IADN,IAAI;wCACgB;AAWd;IADN,IAAI;kDAC0B;AAWxB;IADN,IAAI;uCACe;AAWb;IADN,IAAI;0CACwB;AAWtB;IADN,IAAI;wCACgB"}
|
|
@@ -5,16 +5,50 @@ import { FASTElement } from '@microsoft/fast-element';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class BaseAvatar extends FASTElement {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Reference to the default slot element.
|
|
9
9
|
*
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
defaultSlot: HTMLSlotElement;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Handles changes to the default slot element reference.
|
|
15
|
+
*
|
|
16
|
+
* Toggles the `has-slotted` class on the slot element for browsers that do not
|
|
17
|
+
* support the `:has-slotted` CSS selector. Defers cleanup using
|
|
18
|
+
* `Updates.enqueue` to avoid DOM mutations during hydration that could
|
|
19
|
+
* corrupt binding markers.
|
|
20
|
+
*
|
|
15
21
|
* @internal
|
|
16
22
|
*/
|
|
17
|
-
|
|
23
|
+
defaultSlotChanged(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Reference to the monogram element that displays generated initials.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
monogram: HTMLElement;
|
|
30
|
+
/**
|
|
31
|
+
* Updates the monogram text content when the ref is captured.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
protected monogramChanged(): void;
|
|
36
|
+
/**
|
|
37
|
+
* The slotted content nodes assigned to the default slot.
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
slottedDefaults: Node[];
|
|
42
|
+
/**
|
|
43
|
+
* Handles changes to the slotted default content.
|
|
44
|
+
*
|
|
45
|
+
* Normalizes the DOM, toggles the `has-slotted` class on the default slot element
|
|
46
|
+
* for browsers that do not support the `:has-slotted` CSS selector, and removes
|
|
47
|
+
* empty text nodes from the default slot to keep the DOM clean.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
protected slottedDefaultsChanged(): void;
|
|
18
52
|
/**
|
|
19
53
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
20
54
|
*
|
|
@@ -29,22 +63,42 @@ export declare class BaseAvatar extends FASTElement {
|
|
|
29
63
|
* HTML Attribute: name
|
|
30
64
|
*/
|
|
31
65
|
name?: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Handles changes to the name attribute.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
protected nameChanged(): void;
|
|
32
71
|
/**
|
|
33
72
|
* Provide custom initials rather than one generated via the name
|
|
34
73
|
*
|
|
35
74
|
* @public
|
|
36
75
|
* @remarks
|
|
37
|
-
* HTML Attribute:
|
|
76
|
+
* HTML Attribute: initials
|
|
38
77
|
*/
|
|
39
78
|
initials?: string | undefined;
|
|
40
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Handles changes to the initials attribute.
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
protected initialsChanged(): void;
|
|
41
84
|
constructor();
|
|
42
|
-
disconnectedCallback(): void;
|
|
43
85
|
/**
|
|
44
|
-
*
|
|
86
|
+
* Generates and sets the initials for the template.
|
|
87
|
+
* Subclasses should override this to provide custom initials logic.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
generateInitials(): string | void;
|
|
92
|
+
/**
|
|
93
|
+
* Updates the monogram element's text content with the generated initials.
|
|
94
|
+
*
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
protected updateMonogram(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Normalizes the DOM and removes empty text nodes from the default slot.
|
|
45
100
|
*
|
|
46
|
-
* @param e - The event object
|
|
47
101
|
* @internal
|
|
48
102
|
*/
|
|
49
|
-
|
|
103
|
+
protected cleanupSlottedContent(): void;
|
|
50
104
|
}
|
|
@@ -1,16 +1,75 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { attr, FASTElement, Updates } from '@microsoft/fast-element';
|
|
2
|
+
import { attr, FASTElement, observable, Updates } from '@microsoft/fast-element';
|
|
3
|
+
import { getInitials } from '../utils/get-initials.js';
|
|
3
4
|
/**
|
|
4
5
|
* The base class used for constructing a fluent-avatar custom element
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
8
|
export class BaseAvatar extends FASTElement {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Handles changes to the default slot element reference.
|
|
11
|
+
*
|
|
12
|
+
* Toggles the `has-slotted` class on the slot element for browsers that do not
|
|
13
|
+
* support the `:has-slotted` CSS selector. Defers cleanup using
|
|
14
|
+
* `Updates.enqueue` to avoid DOM mutations during hydration that could
|
|
15
|
+
* corrupt binding markers.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
defaultSlotChanged() {
|
|
20
|
+
if (!CSS.supports('selector(:has-slotted)')) {
|
|
21
|
+
const elements = this.defaultSlot.assignedElements();
|
|
22
|
+
this.defaultSlot.classList.toggle('has-slotted', elements.length > 0);
|
|
23
|
+
}
|
|
24
|
+
Updates.enqueue(() => {
|
|
25
|
+
this.cleanupSlottedContent();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Updates the monogram text content when the ref is captured.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
monogramChanged() {
|
|
34
|
+
this.updateMonogram();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Handles changes to the slotted default content.
|
|
38
|
+
*
|
|
39
|
+
* Normalizes the DOM, toggles the `has-slotted` class on the default slot element
|
|
40
|
+
* for browsers that do not support the `:has-slotted` CSS selector, and removes
|
|
41
|
+
* empty text nodes from the default slot to keep the DOM clean.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
slottedDefaultsChanged() {
|
|
46
|
+
if (!this.defaultSlot) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.cleanupSlottedContent();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Handles changes to the name attribute.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
nameChanged() {
|
|
56
|
+
this.updateMonogram();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Handles changes to the initials attribute.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
initialsChanged() {
|
|
63
|
+
this.updateMonogram();
|
|
11
64
|
}
|
|
12
65
|
constructor() {
|
|
13
66
|
super();
|
|
67
|
+
/**
|
|
68
|
+
* The slotted content nodes assigned to the default slot.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
this.slottedDefaults = [];
|
|
14
73
|
/**
|
|
15
74
|
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
16
75
|
*
|
|
@@ -19,39 +78,53 @@ export class BaseAvatar extends FASTElement {
|
|
|
19
78
|
this.elementInternals = this.attachInternals();
|
|
20
79
|
this.elementInternals.role = 'img';
|
|
21
80
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Generates and sets the initials for the template.
|
|
83
|
+
* Subclasses should override this to provide custom initials logic.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
generateInitials() {
|
|
88
|
+
return this.initials || getInitials(this.name, window.getComputedStyle(this).direction === 'rtl');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Updates the monogram element's text content with the generated initials.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
updateMonogram() {
|
|
96
|
+
if (this.monogram) {
|
|
97
|
+
this.monogram.textContent = this.generateInitials() ?? '';
|
|
98
|
+
}
|
|
26
99
|
}
|
|
27
100
|
/**
|
|
28
|
-
*
|
|
101
|
+
* Normalizes the DOM and removes empty text nodes from the default slot.
|
|
29
102
|
*
|
|
30
|
-
* @param e - The event object
|
|
31
103
|
* @internal
|
|
32
104
|
*/
|
|
33
|
-
|
|
105
|
+
cleanupSlottedContent() {
|
|
34
106
|
this.normalize();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const nodes = this.defaultSlot.assignedNodes();
|
|
38
|
-
nodes
|
|
39
|
-
.filter(node => node.nodeType === Node.TEXT_NODE)
|
|
40
|
-
.forEach(node => {
|
|
41
|
-
this.removeChild(node);
|
|
42
|
-
});
|
|
107
|
+
if (!CSS.supports('selector(:has-slotted)')) {
|
|
108
|
+
this.defaultSlot.classList.toggle('has-slotted', !!this.slottedDefaults.length);
|
|
43
109
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
once: true,
|
|
50
|
-
signal: this.abortSignal.signal,
|
|
110
|
+
if (!this.innerText.trim()) {
|
|
111
|
+
this.slottedDefaults.forEach(node => {
|
|
112
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
113
|
+
node.remove();
|
|
114
|
+
}
|
|
51
115
|
});
|
|
52
|
-
}
|
|
116
|
+
}
|
|
53
117
|
}
|
|
54
118
|
}
|
|
119
|
+
__decorate([
|
|
120
|
+
observable
|
|
121
|
+
], BaseAvatar.prototype, "defaultSlot", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
observable
|
|
124
|
+
], BaseAvatar.prototype, "monogram", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
observable
|
|
127
|
+
], BaseAvatar.prototype, "slottedDefaults", void 0);
|
|
55
128
|
__decorate([
|
|
56
129
|
attr
|
|
57
130
|
], BaseAvatar.prototype, "name", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.base.js","sourceRoot":"","sources":["../../../src/avatar/avatar.base.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"avatar.base.js","sourceRoot":"","sources":["../../../src/avatar/avatar.base.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IASzC;;;;;;;;;OASG;IACI,kBAAkB;QACvB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;YACrD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAUD;;;;OAIG;IACO,eAAe;QACvB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAUD;;;;;;;;OAQG;IACO,sBAAs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C,IAAI,CAAC,EAAE;gBAClC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;oBACpC,IAAkB,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA1JQ;IADN,UAAU;+CAC0B;AA6B9B;IADN,UAAU;4CACmB;AAiBvB;IADN,UAAU;mDACyB;AAiC7B;IADN,IAAI;wCAC4B;AAkB1B;IADN,IAAI;4CACgC"}
|
|
@@ -16,10 +16,11 @@ const animations = {
|
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
18
|
export const styles = css `
|
|
19
|
-
${display('inline-
|
|
19
|
+
${display('inline-grid')} :host {
|
|
20
20
|
position: relative;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
place-items: center;
|
|
22
|
+
place-content: center;
|
|
23
|
+
grid-template: 1fr / 1fr;
|
|
23
24
|
flex-shrink: 0;
|
|
24
25
|
width: 32px;
|
|
25
26
|
height: 32px;
|
|
@@ -32,6 +33,22 @@ export const styles = css `
|
|
|
32
33
|
contain: layout style;
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
.monogram,
|
|
37
|
+
.default-icon {
|
|
38
|
+
grid-area: 1 / 1 / -1 / -1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.monogram:empty {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.default-slot:is(.has-slotted, :has-slotted) ~ .default-icon,
|
|
46
|
+
.default-slot:is(.has-slotted, :has-slotted) ~ .monogram,
|
|
47
|
+
:host(:is([name]):not([name=''])) .default-icon,
|
|
48
|
+
:host(:is([initials]):not([initials=''])) .default-icon {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
.default-icon,
|
|
36
53
|
::slotted(svg) {
|
|
37
54
|
width: 20px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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2BAA2B,EAC3B,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,QAAQ,EAAE,gBAAgB;IAC1B,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,WAAW;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;IACrB,OAAO,CAAC,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"avatar.styles.js","sourceRoot":"","sources":["../../../src/avatar/avatar.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,oCAAoC,EACpC,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2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AK,UAAU,CAAC,UAAU;;;;;;;2BAOlD,iBAAiB,KAAK,cAAc;wBACvC,UAAU,CAAC,gBAAgB,KAAK,UAAU,CAAC,UAAU;;;;;;;;;;;;;CAa5E,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { html, ref } from '@microsoft/fast-element';
|
|
1
|
+
import { html, ref, slotted } from '@microsoft/fast-element';
|
|
2
2
|
const defaultIconTemplate = html `<svg
|
|
3
3
|
width="1em"
|
|
4
4
|
height="1em"
|
|
5
5
|
viewBox="0 0 20 20"
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
7
6
|
class="default-icon"
|
|
8
7
|
fill="currentcolor"
|
|
9
8
|
aria-hidden="true"
|
|
@@ -18,7 +17,9 @@ const defaultIconTemplate = html `<svg
|
|
|
18
17
|
*/
|
|
19
18
|
export function avatarTemplate() {
|
|
20
19
|
return html `
|
|
21
|
-
<slot ${
|
|
20
|
+
<slot class="default-slot" ${slotted('slottedDefaults')} ${ref('defaultSlot')}></slot>
|
|
21
|
+
<span class="monogram" ${ref('monogram')}>${x => x.initials}</span>
|
|
22
|
+
${defaultIconTemplate}
|
|
22
23
|
<slot name="badge"></slot>
|
|
23
24
|
`;
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.template.js","sourceRoot":"","sources":["../../../src/avatar/avatar.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"avatar.template.js","sourceRoot":"","sources":["../../../src/avatar/avatar.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvF,MAAM,mBAAmB,GAAG,IAAI,CAAA;;;;;;;;;;;OAWzB,CAAC;AAER;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAG;iCACiB,OAAO,CAAC,iBAAiB,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC;6BACpD,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;MACzD,mBAAmB;;GAEtB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAgC,cAAc,EAAE,CAAC"}
|