@fluentui/web-components 3.0.0-beta.29 → 3.0.0-beta.30
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/dist/dts/avatar/avatar.d.ts +22 -2
- package/dist/esm/avatar/avatar.js +42 -17
- package/dist/esm/avatar/avatar.js.map +1 -1
- package/dist/esm/avatar/avatar.styles.js +31 -31
- package/dist/esm/avatar/avatar.template.js +2 -4
- package/dist/esm/avatar/avatar.template.js.map +1 -1
- package/dist/web-components.d.ts +22 -2
- package/dist/web-components.js +52 -22
- package/dist/web-components.min.js +146 -146
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @fluentui/web-components
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 14 Jun 2024 04:06:00 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [3.0.0-beta.30](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.30)
|
|
8
|
+
|
|
9
|
+
Fri, 14 Jun 2024 04:06:00 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.29..@fluentui/web-components_v3.0.0-beta.30)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- update avatar to use ElementInternals for role and states for color ([PR #31693](https://github.com/microsoft/fluentui/pull/31693) by 13071055+chrisdholt@users.noreply.github.com)
|
|
15
|
+
|
|
7
16
|
## [3.0.0-beta.29](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.29)
|
|
8
17
|
|
|
9
|
-
Thu, 13 Jun 2024 04:06:
|
|
18
|
+
Thu, 13 Jun 2024 04:06:41 GMT
|
|
10
19
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.28..@fluentui/web-components_v3.0.0-beta.29)
|
|
11
20
|
|
|
12
21
|
### Changes
|
|
@@ -5,6 +5,12 @@ import { AvatarActive, AvatarAppearance, AvatarColor, AvatarNamedColor, AvatarSh
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export declare class Avatar 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 name of the person or entity represented by this Avatar. This should always be provided if it is available.
|
|
10
16
|
*
|
|
@@ -74,17 +80,31 @@ export declare class Avatar extends FASTElement {
|
|
|
74
80
|
* @remarks
|
|
75
81
|
* HTML Attribute: color
|
|
76
82
|
*/
|
|
77
|
-
color?: AvatarColor;
|
|
83
|
+
color?: AvatarColor | undefined;
|
|
78
84
|
/**
|
|
79
85
|
* Specify a string to be used instead of the name, to determine which color to use when color="colorful".
|
|
80
86
|
* Use this when a name is not available, but there is another unique identifier that can be used instead.
|
|
81
87
|
*/
|
|
82
88
|
colorId?: AvatarNamedColor | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Holds the current color state
|
|
91
|
+
*/
|
|
92
|
+
private currentColor;
|
|
93
|
+
constructor();
|
|
94
|
+
connectedCallback(): void;
|
|
95
|
+
disconnectedCallback(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Handles changes to observable properties
|
|
98
|
+
* @internal
|
|
99
|
+
* @param source - the source of the change
|
|
100
|
+
* @param propertyName - the property name being changed
|
|
101
|
+
*/
|
|
102
|
+
handleChange(source: any, propertyName: string): void;
|
|
83
103
|
/**
|
|
84
104
|
* Sets the data-color attribute used for the visual presentation
|
|
85
105
|
* @internal
|
|
86
106
|
*/
|
|
87
|
-
generateColor():
|
|
107
|
+
generateColor(): void;
|
|
88
108
|
/**
|
|
89
109
|
* Generates and sets the initials for the template
|
|
90
110
|
* @internal
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { attr, FASTElement, nullableNumberConverter } from '@microsoft/fast-element';
|
|
2
|
+
import { attr, FASTElement, nullableNumberConverter, Observable } from '@microsoft/fast-element';
|
|
3
3
|
import { getInitials } from '../utils/get-initials.js';
|
|
4
|
+
import { toggleState } from '../utils/element-internals.js';
|
|
4
5
|
import { AvatarColor, AvatarNamedColor, } from './avatar.options.js';
|
|
5
6
|
/**
|
|
6
7
|
* The base class used for constructing a fluent-avatar custom element
|
|
@@ -8,19 +9,39 @@ import { AvatarColor, AvatarNamedColor, } from './avatar.options.js';
|
|
|
8
9
|
*/
|
|
9
10
|
export class Avatar extends FASTElement {
|
|
10
11
|
constructor() {
|
|
11
|
-
super(
|
|
12
|
+
super();
|
|
12
13
|
/**
|
|
13
|
-
* The
|
|
14
|
-
* * neutral (default): gray
|
|
15
|
-
* * brand: color from the brand palette
|
|
16
|
-
* * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or colorId if provided)
|
|
17
|
-
* * [AvatarNamedColor]: a specific color from the theme
|
|
14
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
18
15
|
*
|
|
19
|
-
* @
|
|
20
|
-
* @remarks
|
|
21
|
-
* HTML Attribute: color
|
|
16
|
+
* @internal
|
|
22
17
|
*/
|
|
23
|
-
this.
|
|
18
|
+
this.elementInternals = this.attachInternals();
|
|
19
|
+
this.elementInternals.role = 'img';
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
super.connectedCallback();
|
|
23
|
+
Observable.getNotifier(this).subscribe(this);
|
|
24
|
+
this.generateColor();
|
|
25
|
+
}
|
|
26
|
+
disconnectedCallback() {
|
|
27
|
+
super.disconnectedCallback();
|
|
28
|
+
Observable.getNotifier(this).unsubscribe(this);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Handles changes to observable properties
|
|
32
|
+
* @internal
|
|
33
|
+
* @param source - the source of the change
|
|
34
|
+
* @param propertyName - the property name being changed
|
|
35
|
+
*/
|
|
36
|
+
handleChange(source, propertyName) {
|
|
37
|
+
switch (propertyName) {
|
|
38
|
+
case 'color':
|
|
39
|
+
case 'colorId':
|
|
40
|
+
this.generateColor();
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
24
45
|
}
|
|
25
46
|
/**
|
|
26
47
|
* Sets the data-color attribute used for the visual presentation
|
|
@@ -28,12 +49,16 @@ export class Avatar extends FASTElement {
|
|
|
28
49
|
*/
|
|
29
50
|
generateColor() {
|
|
30
51
|
var _a, _b;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
const colorful = this.color === AvatarColor.colorful;
|
|
53
|
+
const prev = this.currentColor;
|
|
54
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
55
|
+
this.currentColor =
|
|
56
|
+
colorful && this.colorId
|
|
57
|
+
? this.colorId
|
|
58
|
+
: colorful
|
|
59
|
+
? Avatar.colors[getHashCode((_a = this.name) !== null && _a !== void 0 ? _a : '') % Avatar.colors.length]
|
|
60
|
+
: (_b = this.color) !== null && _b !== void 0 ? _b : AvatarColor.neutral;
|
|
61
|
+
toggleState(this.elementInternals, `${this.currentColor}`, true);
|
|
37
62
|
}
|
|
38
63
|
/**
|
|
39
64
|
* Generates and sets the initials for the template
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/avatar/avatar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/avatar/avatar.ts"],"names":[],"mappings":"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"}
|
|
@@ -220,157 +220,157 @@ export const styles = css `
|
|
|
220
220
|
border-radius: ${borderRadiusXLarge};
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
:host([
|
|
223
|
+
:host(:is([state--brand], :state(brand))) {
|
|
224
224
|
color: ${colorNeutralForegroundStaticInverted};
|
|
225
225
|
background-color: ${colorBrandBackgroundStatic};
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
:host([
|
|
228
|
+
:host(:is([state--dark-red], :state(dark-red))) {
|
|
229
229
|
color: ${colorPaletteDarkRedForeground2};
|
|
230
230
|
background-color: ${colorPaletteDarkRedBackground2};
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
:host([
|
|
233
|
+
:host(:is([state--cranberry], :state(cranberry))) {
|
|
234
234
|
color: ${colorPaletteCranberryForeground2};
|
|
235
235
|
background-color: ${colorPaletteCranberryBackground2};
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
:host([
|
|
238
|
+
:host(:is([state--red], :state(red))) {
|
|
239
239
|
color: ${colorPaletteRedForeground2};
|
|
240
240
|
background-color: ${colorPaletteRedBackground2};
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
:host([
|
|
243
|
+
:host(:is([state--pumpkin], :state(pumpkin))) {
|
|
244
244
|
color: ${colorPalettePumpkinForeground2};
|
|
245
245
|
background-color: ${colorPalettePumpkinBackground2};
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
:host([
|
|
248
|
+
:host(:is([state--peach], :state(peach))) {
|
|
249
249
|
color: ${colorPalettePeachForeground2};
|
|
250
250
|
background-color: ${colorPalettePeachBackground2};
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
:host([
|
|
253
|
+
:host(:is([state--marigold], :state(marigold))) {
|
|
254
254
|
color: ${colorPaletteMarigoldForeground2};
|
|
255
255
|
background-color: ${colorPaletteMarigoldBackground2};
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
:host([
|
|
258
|
+
:host(:is([state--gold], :state(gold))) {
|
|
259
259
|
color: ${colorPaletteGoldForeground2};
|
|
260
260
|
background-color: ${colorPaletteGoldBackground2};
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
:host([
|
|
263
|
+
:host(:is([state--brass], :state(brass))) {
|
|
264
264
|
color: ${colorPaletteBrassForeground2};
|
|
265
265
|
background-color: ${colorPaletteBrassBackground2};
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
:host([
|
|
268
|
+
:host(:is([state--brown], :state(brown))) {
|
|
269
269
|
color: ${colorPaletteBrownForeground2};
|
|
270
270
|
background-color: ${colorPaletteBrownBackground2};
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
:host([
|
|
273
|
+
:host(:is([state--forest], :state(forest))) {
|
|
274
274
|
color: ${colorPaletteForestForeground2};
|
|
275
275
|
background-color: ${colorPaletteForestBackground2};
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
:host([
|
|
278
|
+
:host(:is([state--seafoam], :state(seafoam))) {
|
|
279
279
|
color: ${colorPaletteSeafoamForeground2};
|
|
280
280
|
background-color: ${colorPaletteSeafoamBackground2};
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
:host([
|
|
283
|
+
:host(:is([state--dark-green], :state(dark-green))) {
|
|
284
284
|
color: ${colorPaletteDarkGreenForeground2};
|
|
285
285
|
background-color: ${colorPaletteDarkGreenBackground2};
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
:host([
|
|
288
|
+
:host(:is([state--light-teal], :state(light-teal))) {
|
|
289
289
|
color: ${colorPaletteLightTealForeground2};
|
|
290
290
|
background-color: ${colorPaletteLightTealBackground2};
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
:host([
|
|
293
|
+
:host(:is([state--teal], :state(teal))) {
|
|
294
294
|
color: ${colorPaletteTealForeground2};
|
|
295
295
|
background-color: ${colorPaletteTealBackground2};
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
:host([
|
|
298
|
+
:host(:is([state--steel], :state(steel))) {
|
|
299
299
|
color: ${colorPaletteSteelForeground2};
|
|
300
300
|
background-color: ${colorPaletteSteelBackground2};
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
:host([
|
|
303
|
+
:host(:is([state--blue], :state(blue))) {
|
|
304
304
|
color: ${colorPaletteBlueForeground2};
|
|
305
305
|
background-color: ${colorPaletteBlueBackground2};
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
:host([
|
|
308
|
+
:host(:is([state--royal-blue], :state(royal-blue))) {
|
|
309
309
|
color: ${colorPaletteRoyalBlueForeground2};
|
|
310
310
|
background-color: ${colorPaletteRoyalBlueBackground2};
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
:host([
|
|
313
|
+
:host(:is([state--cornflower], :state(cornflower))) {
|
|
314
314
|
color: ${colorPaletteCornflowerForeground2};
|
|
315
315
|
background-color: ${colorPaletteCornflowerBackground2};
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
:host([
|
|
318
|
+
:host(:is([state--navy], :state(navy))) {
|
|
319
319
|
color: ${colorPaletteNavyForeground2};
|
|
320
320
|
background-color: ${colorPaletteNavyBackground2};
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
:host([
|
|
323
|
+
:host(:is([state--lavender], :state(lavender))) {
|
|
324
324
|
color: ${colorPaletteLavenderForeground2};
|
|
325
325
|
background-color: ${colorPaletteLavenderBackground2};
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
:host([
|
|
328
|
+
:host(:is([state--purple], :state(purple))) {
|
|
329
329
|
color: ${colorPalettePurpleForeground2};
|
|
330
330
|
background-color: ${colorPalettePurpleBackground2};
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
:host([
|
|
333
|
+
:host(:is([state--grape], :state(grape))) {
|
|
334
334
|
color: ${colorPaletteGrapeForeground2};
|
|
335
335
|
background-color: ${colorPaletteGrapeBackground2};
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
:host([
|
|
338
|
+
:host(:is([state--lilac], :state(lilac))) {
|
|
339
339
|
color: ${colorPaletteLilacForeground2};
|
|
340
340
|
background-color: ${colorPaletteLilacBackground2};
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
:host([
|
|
343
|
+
:host(:is([state--pink], :state(pink))) {
|
|
344
344
|
color: ${colorPalettePinkForeground2};
|
|
345
345
|
background-color: ${colorPalettePinkBackground2};
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
:host([
|
|
348
|
+
:host(:is([state--magenta], :state(magenta))) {
|
|
349
349
|
color: ${colorPaletteMagentaForeground2};
|
|
350
350
|
background-color: ${colorPaletteMagentaBackground2};
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
:host([
|
|
353
|
+
:host(:is([state--plum], :state(plum))) {
|
|
354
354
|
color: ${colorPalettePlumForeground2};
|
|
355
355
|
background-color: ${colorPalettePlumBackground2};
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
:host([
|
|
358
|
+
:host(:is([state--beige], :state(beige))) {
|
|
359
359
|
color: ${colorPaletteBeigeForeground2};
|
|
360
360
|
background-color: ${colorPaletteBeigeBackground2};
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
:host([
|
|
363
|
+
:host(:is([state--mink], :state(mink))) {
|
|
364
364
|
color: ${colorPaletteMinkForeground2};
|
|
365
365
|
background-color: ${colorPaletteMinkBackground2};
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
:host([
|
|
368
|
+
:host(:is([state--platinum], :state(platinum))) {
|
|
369
369
|
color: ${colorPalettePlatinumForeground2};
|
|
370
370
|
background-color: ${colorPalettePlatinumBackground2};
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
:host([
|
|
373
|
+
:host(:is([state--anchor], :state(anchor))) {
|
|
374
374
|
color: ${colorPaletteAnchorForeground2};
|
|
375
375
|
background-color: ${colorPaletteAnchorBackground2};
|
|
376
376
|
}
|
|
@@ -18,10 +18,8 @@ const defaultIconTemplate = html `<svg
|
|
|
18
18
|
*/
|
|
19
19
|
export function avatarTemplate() {
|
|
20
20
|
return html `
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
<slot name="badge"></slot>
|
|
24
|
-
</template>
|
|
21
|
+
<slot>${x => (x.name || x.initials ? x.generateInitials() : defaultIconTemplate)}</slot>
|
|
22
|
+
<slot name="badge"></slot>
|
|
25
23
|
`;
|
|
26
24
|
}
|
|
27
25
|
export const template = avatarTemplate();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.template.js","sourceRoot":"","sources":["../../../src/avatar/avatar.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpE,MAAM,mBAAmB,GAAG,IAAI,CAAA;;;;;;;;;;;;OAYzB,CAAC;AAER;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAG;
|
|
1
|
+
{"version":3,"file":"avatar.template.js","sourceRoot":"","sources":["../../../src/avatar/avatar.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpE,MAAM,mBAAmB,GAAG,IAAI,CAAA;;;;;;;;;;;;OAYzB,CAAC;AAER;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,CAAG;YACJ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC;;GAEjF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAgC,cAAc,EAAE,CAAC"}
|
package/dist/web-components.d.ts
CHANGED
|
@@ -369,6 +369,12 @@ export declare type AnchorTarget = ValuesOf<typeof AnchorTarget>;
|
|
|
369
369
|
* @public
|
|
370
370
|
*/
|
|
371
371
|
export declare class Avatar extends FASTElement {
|
|
372
|
+
/**
|
|
373
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
374
|
+
*
|
|
375
|
+
* @internal
|
|
376
|
+
*/
|
|
377
|
+
elementInternals: ElementInternals;
|
|
372
378
|
/**
|
|
373
379
|
* The name of the person or entity represented by this Avatar. This should always be provided if it is available.
|
|
374
380
|
*
|
|
@@ -438,17 +444,31 @@ export declare class Avatar extends FASTElement {
|
|
|
438
444
|
* @remarks
|
|
439
445
|
* HTML Attribute: color
|
|
440
446
|
*/
|
|
441
|
-
color?: AvatarColor;
|
|
447
|
+
color?: AvatarColor | undefined;
|
|
442
448
|
/**
|
|
443
449
|
* Specify a string to be used instead of the name, to determine which color to use when color="colorful".
|
|
444
450
|
* Use this when a name is not available, but there is another unique identifier that can be used instead.
|
|
445
451
|
*/
|
|
446
452
|
colorId?: AvatarNamedColor | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* Holds the current color state
|
|
455
|
+
*/
|
|
456
|
+
private currentColor;
|
|
457
|
+
constructor();
|
|
458
|
+
connectedCallback(): void;
|
|
459
|
+
disconnectedCallback(): void;
|
|
460
|
+
/**
|
|
461
|
+
* Handles changes to observable properties
|
|
462
|
+
* @internal
|
|
463
|
+
* @param source - the source of the change
|
|
464
|
+
* @param propertyName - the property name being changed
|
|
465
|
+
*/
|
|
466
|
+
handleChange(source: any, propertyName: string): void;
|
|
447
467
|
/**
|
|
448
468
|
* Sets the data-color attribute used for the visual presentation
|
|
449
469
|
* @internal
|
|
450
470
|
*/
|
|
451
|
-
generateColor():
|
|
471
|
+
generateColor(): void;
|
|
452
472
|
/**
|
|
453
473
|
* Generates and sets the initials for the template
|
|
454
474
|
* @internal
|
package/dist/web-components.js
CHANGED
|
@@ -4377,6 +4377,20 @@ function getInitials(displayName, isRtl, options) {
|
|
|
4377
4377
|
return getInitialsLatin(displayName, isRtl, options?.firstInitialOnly);
|
|
4378
4378
|
}
|
|
4379
4379
|
|
|
4380
|
+
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
4381
|
+
function toggleState(elementInternals, state, force) {
|
|
4382
|
+
if (!CustomStatesSetSupported) {
|
|
4383
|
+
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
4384
|
+
return;
|
|
4385
|
+
}
|
|
4386
|
+
force = force ?? !elementInternals.states.has(state);
|
|
4387
|
+
if (force) {
|
|
4388
|
+
elementInternals.states.add(state);
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
elementInternals.states.delete(state);
|
|
4392
|
+
}
|
|
4393
|
+
|
|
4380
4394
|
const AvatarNamedColor = {
|
|
4381
4395
|
darkRed: "dark-red",
|
|
4382
4396
|
cranberry: "cranberry",
|
|
@@ -4426,18 +4440,48 @@ var __decorateClass$o = (decorators, target, key, kind) => {
|
|
|
4426
4440
|
};
|
|
4427
4441
|
const _Avatar = class _Avatar extends FASTElement {
|
|
4428
4442
|
constructor() {
|
|
4429
|
-
super(
|
|
4430
|
-
|
|
4443
|
+
super();
|
|
4444
|
+
/**
|
|
4445
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
4446
|
+
*
|
|
4447
|
+
* @internal
|
|
4448
|
+
*/
|
|
4449
|
+
this.elementInternals = this.attachInternals();
|
|
4450
|
+
this.elementInternals.role = "img";
|
|
4451
|
+
}
|
|
4452
|
+
connectedCallback() {
|
|
4453
|
+
super.connectedCallback();
|
|
4454
|
+
Observable.getNotifier(this).subscribe(this);
|
|
4455
|
+
this.generateColor();
|
|
4456
|
+
}
|
|
4457
|
+
disconnectedCallback() {
|
|
4458
|
+
super.disconnectedCallback();
|
|
4459
|
+
Observable.getNotifier(this).unsubscribe(this);
|
|
4460
|
+
}
|
|
4461
|
+
/**
|
|
4462
|
+
* Handles changes to observable properties
|
|
4463
|
+
* @internal
|
|
4464
|
+
* @param source - the source of the change
|
|
4465
|
+
* @param propertyName - the property name being changed
|
|
4466
|
+
*/
|
|
4467
|
+
handleChange(source, propertyName) {
|
|
4468
|
+
switch (propertyName) {
|
|
4469
|
+
case "color":
|
|
4470
|
+
case "colorId":
|
|
4471
|
+
this.generateColor();
|
|
4472
|
+
break;
|
|
4473
|
+
}
|
|
4431
4474
|
}
|
|
4432
4475
|
/**
|
|
4433
4476
|
* Sets the data-color attribute used for the visual presentation
|
|
4434
4477
|
* @internal
|
|
4435
4478
|
*/
|
|
4436
4479
|
generateColor() {
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
}
|
|
4440
|
-
|
|
4480
|
+
const colorful = this.color === AvatarColor.colorful;
|
|
4481
|
+
const prev = this.currentColor;
|
|
4482
|
+
toggleState(this.elementInternals, `${prev}`, false);
|
|
4483
|
+
this.currentColor = colorful && this.colorId ? this.colorId : colorful ? _Avatar.colors[getHashCode(this.name ?? "") % _Avatar.colors.length] : this.color ?? AvatarColor.neutral;
|
|
4484
|
+
toggleState(this.elementInternals, `${this.currentColor}`, true);
|
|
4441
4485
|
}
|
|
4442
4486
|
/**
|
|
4443
4487
|
* Generates and sets the initials for the template
|
|
@@ -4492,11 +4536,11 @@ const animations = {
|
|
|
4492
4536
|
nullEasing: curveLinear
|
|
4493
4537
|
};
|
|
4494
4538
|
const styles$q = css`
|
|
4495
|
-
${display("inline-flex")} :host{position:relative;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};font-size:${fontSizeBase300};border-radius:${borderRadiusCircular};color:${colorNeutralForeground3};background-color:${colorNeutralBackground6};contain:layout style}.default-icon,::slotted(svg){width:20px;height:20px;font-size:20px}::slotted(img){box-sizing:border-box;width:100%;height:100%;border-radius:${borderRadiusCircular}}::slotted([slot='badge']){position:absolute;bottom:0;right:0;box-shadow:0 0 0 ${strokeWidthThin}) ${colorNeutralBackground1}}:host([size='64']) ::slotted([slot='badge']),:host([size='72']) ::slotted([slot='badge']),:host([size='96']) ::slotted([slot='badge']),:host([size='120']) ::slotted([slot='badge']),:host([size='128']) ::slotted([slot='badge']){box-shadow:0 0 0 ${strokeWidthThick}) ${colorNeutralBackground1}}:host([size='16']),:host([size='20']),:host([size='24']){font-size:${fontSizeBase100};font-weight:${fontWeightRegular}}:host([size='16']){width:16px;height:16px}:host([size='20']){width:20px;height:20px}:host([size='24']){width:24px;height:24px}:host([size='16']) .default-icon,:host([size='16']) ::slotted(svg){width:12px;height:12px;font-size:12px}:host([size='20']) .default-icon,:host([size='24']) .default-icon,:host([size='20']) ::slotted(svg),:host([size='24']) ::slotted(svg){width:16px;height:16px;font-size:16px}:host([size='28']){width:28px;height:28px;font-size:${fontSizeBase200}}:host([size='36']){width:36px;height:36px}:host([size='40']){width:40px;height:40px}:host([size='48']),:host([size='56']){font-size:${fontSizeBase400}}:host([size='48']){width:48px;height:48px}:host([size='48']) .default-icon,:host([size='48']) ::slotted(svg){width:24px;height:24px;font-size:24px}:host([size='56']){width:56px;height:56px}:host([size='56']) .default-icon,:host([size='56']) ::slotted(svg){width:28px;height:28px;font-size:28px}:host([size='64']),:host([size='72']),:host([size='96']){font-size:${fontSizeBase500}}:host([size='64']) .default-icon,:host([size='72']) .default-icon,:host([size='64']) ::slotted(svg),:host([size='72']) ::slotted(svg){width:32px;height:32px;font-size:32px}:host([size='64']){width:64px;height:64px}:host([size='72']){width:72px;height:72px}:host([size='96']){width:96px;height:96px}:host([size='96']) .default-icon,:host([size='120']) .default-icon,:host([size='128']) .default-icon,:host([size='96']) ::slotted(svg),:host([size='120']) ::slotted(svg),:host([size='128']) ::slotted(svg){width:48px;height:48px;font-size:48px}:host([size='120']),:host([size='128']){font-size:${fontSizeBase600}}:host([size='120']){width:120px;height:120px}:host([size='128']){width:128px;height:128px}:host([shape='square']){border-radius:${borderRadiusMedium}}:host([shape='square'][size='20']),:host([shape='square'][size='24']){border-radius:${borderRadiusSmall}}:host([shape='square'][size='56']),:host([shape='square'][size='64']),:host([shape='square'][size='72']){border-radius:${borderRadiusLarge}}:host([shape='square'][size='96']),:host([shape='square'][size='120']),:host([shape='square'][size='128']){border-radius:${borderRadiusXLarge}}:host([
|
|
4539
|
+
${display("inline-flex")} :host{position:relative;align-items:center;justify-content:center;flex-shrink:0;width:32px;height:32px;font-family:${fontFamilyBase};font-weight:${fontWeightSemibold};font-size:${fontSizeBase300};border-radius:${borderRadiusCircular};color:${colorNeutralForeground3};background-color:${colorNeutralBackground6};contain:layout style}.default-icon,::slotted(svg){width:20px;height:20px;font-size:20px}::slotted(img){box-sizing:border-box;width:100%;height:100%;border-radius:${borderRadiusCircular}}::slotted([slot='badge']){position:absolute;bottom:0;right:0;box-shadow:0 0 0 ${strokeWidthThin}) ${colorNeutralBackground1}}:host([size='64']) ::slotted([slot='badge']),:host([size='72']) ::slotted([slot='badge']),:host([size='96']) ::slotted([slot='badge']),:host([size='120']) ::slotted([slot='badge']),:host([size='128']) ::slotted([slot='badge']){box-shadow:0 0 0 ${strokeWidthThick}) ${colorNeutralBackground1}}:host([size='16']),:host([size='20']),:host([size='24']){font-size:${fontSizeBase100};font-weight:${fontWeightRegular}}:host([size='16']){width:16px;height:16px}:host([size='20']){width:20px;height:20px}:host([size='24']){width:24px;height:24px}:host([size='16']) .default-icon,:host([size='16']) ::slotted(svg){width:12px;height:12px;font-size:12px}:host([size='20']) .default-icon,:host([size='24']) .default-icon,:host([size='20']) ::slotted(svg),:host([size='24']) ::slotted(svg){width:16px;height:16px;font-size:16px}:host([size='28']){width:28px;height:28px;font-size:${fontSizeBase200}}:host([size='36']){width:36px;height:36px}:host([size='40']){width:40px;height:40px}:host([size='48']),:host([size='56']){font-size:${fontSizeBase400}}:host([size='48']){width:48px;height:48px}:host([size='48']) .default-icon,:host([size='48']) ::slotted(svg){width:24px;height:24px;font-size:24px}:host([size='56']){width:56px;height:56px}:host([size='56']) .default-icon,:host([size='56']) ::slotted(svg){width:28px;height:28px;font-size:28px}:host([size='64']),:host([size='72']),:host([size='96']){font-size:${fontSizeBase500}}:host([size='64']) .default-icon,:host([size='72']) .default-icon,:host([size='64']) ::slotted(svg),:host([size='72']) ::slotted(svg){width:32px;height:32px;font-size:32px}:host([size='64']){width:64px;height:64px}:host([size='72']){width:72px;height:72px}:host([size='96']){width:96px;height:96px}:host([size='96']) .default-icon,:host([size='120']) .default-icon,:host([size='128']) .default-icon,:host([size='96']) ::slotted(svg),:host([size='120']) ::slotted(svg),:host([size='128']) ::slotted(svg){width:48px;height:48px;font-size:48px}:host([size='120']),:host([size='128']){font-size:${fontSizeBase600}}:host([size='120']){width:120px;height:120px}:host([size='128']){width:128px;height:128px}:host([shape='square']){border-radius:${borderRadiusMedium}}:host([shape='square'][size='20']),:host([shape='square'][size='24']){border-radius:${borderRadiusSmall}}:host([shape='square'][size='56']),:host([shape='square'][size='64']),:host([shape='square'][size='72']){border-radius:${borderRadiusLarge}}:host([shape='square'][size='96']),:host([shape='square'][size='120']),:host([shape='square'][size='128']){border-radius:${borderRadiusXLarge}}:host(:is([state--brand],:state(brand))){color:${colorNeutralForegroundStaticInverted};background-color:${colorBrandBackgroundStatic}}:host(:is([state--dark-red],:state(dark-red))){color:${colorPaletteDarkRedForeground2};background-color:${colorPaletteDarkRedBackground2}}:host(:is([state--cranberry],:state(cranberry))){color:${colorPaletteCranberryForeground2};background-color:${colorPaletteCranberryBackground2}}:host(:is([state--red],:state(red))){color:${colorPaletteRedForeground2};background-color:${colorPaletteRedBackground2}}:host(:is([state--pumpkin],:state(pumpkin))){color:${colorPalettePumpkinForeground2};background-color:${colorPalettePumpkinBackground2}}:host(:is([state--peach],:state(peach))){color:${colorPalettePeachForeground2};background-color:${colorPalettePeachBackground2}}:host(:is([state--marigold],:state(marigold))){color:${colorPaletteMarigoldForeground2};background-color:${colorPaletteMarigoldBackground2}}:host(:is([state--gold],:state(gold))){color:${colorPaletteGoldForeground2};background-color:${colorPaletteGoldBackground2}}:host(:is([state--brass],:state(brass))){color:${colorPaletteBrassForeground2};background-color:${colorPaletteBrassBackground2}}:host(:is([state--brown],:state(brown))){color:${colorPaletteBrownForeground2};background-color:${colorPaletteBrownBackground2}}:host(:is([state--forest],:state(forest))){color:${colorPaletteForestForeground2};background-color:${colorPaletteForestBackground2}}:host(:is([state--seafoam],:state(seafoam))){color:${colorPaletteSeafoamForeground2};background-color:${colorPaletteSeafoamBackground2}}:host(:is([state--dark-green],:state(dark-green))){color:${colorPaletteDarkGreenForeground2};background-color:${colorPaletteDarkGreenBackground2}}:host(:is([state--light-teal],:state(light-teal))){color:${colorPaletteLightTealForeground2};background-color:${colorPaletteLightTealBackground2}}:host(:is([state--teal],:state(teal))){color:${colorPaletteTealForeground2};background-color:${colorPaletteTealBackground2}}:host(:is([state--steel],:state(steel))){color:${colorPaletteSteelForeground2};background-color:${colorPaletteSteelBackground2}}:host(:is([state--blue],:state(blue))){color:${colorPaletteBlueForeground2};background-color:${colorPaletteBlueBackground2}}:host(:is([state--royal-blue],:state(royal-blue))){color:${colorPaletteRoyalBlueForeground2};background-color:${colorPaletteRoyalBlueBackground2}}:host(:is([state--cornflower],:state(cornflower))){color:${colorPaletteCornflowerForeground2};background-color:${colorPaletteCornflowerBackground2}}:host(:is([state--navy],:state(navy))){color:${colorPaletteNavyForeground2};background-color:${colorPaletteNavyBackground2}}:host(:is([state--lavender],:state(lavender))){color:${colorPaletteLavenderForeground2};background-color:${colorPaletteLavenderBackground2}}:host(:is([state--purple],:state(purple))){color:${colorPalettePurpleForeground2};background-color:${colorPalettePurpleBackground2}}:host(:is([state--grape],:state(grape))){color:${colorPaletteGrapeForeground2};background-color:${colorPaletteGrapeBackground2}}:host(:is([state--lilac],:state(lilac))){color:${colorPaletteLilacForeground2};background-color:${colorPaletteLilacBackground2}}:host(:is([state--pink],:state(pink))){color:${colorPalettePinkForeground2};background-color:${colorPalettePinkBackground2}}:host(:is([state--magenta],:state(magenta))){color:${colorPaletteMagentaForeground2};background-color:${colorPaletteMagentaBackground2}}:host(:is([state--plum],:state(plum))){color:${colorPalettePlumForeground2};background-color:${colorPalettePlumBackground2}}:host(:is([state--beige],:state(beige))){color:${colorPaletteBeigeForeground2};background-color:${colorPaletteBeigeBackground2}}:host(:is([state--mink],:state(mink))){color:${colorPaletteMinkForeground2};background-color:${colorPaletteMinkBackground2}}:host(:is([state--platinum],:state(platinum))){color:${colorPalettePlatinumForeground2};background-color:${colorPalettePlatinumBackground2}}:host(:is([state--anchor],:state(anchor))){color:${colorPaletteAnchorForeground2};background-color:${colorPaletteAnchorBackground2}}:host([active]){transform:perspective(1px);transition-property:transform,opacity;transition-duration:${durationUltraSlow},${durationFaster};transition-delay:${animations.fastEase},${animations.nullEasing}}:host([active])::before{content:'';position:absolute;top:0;left:0;bottom:0;right:0;border-radius:inherit;transition-property:margin,opacity;transition-duration:${durationUltraSlow}),${durationSlower};transition-delay:${animations.fastEase}),${animations.nullEasing})}:host([active])::before{box-shadow:${shadow8};border-style:solid;border-color:${colorBrandBackgroundStatic}}:host([active][appearance='shadow'])::before{border-style:none;border-color:none}:host([active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThick});border-width:${strokeWidthThick}}:host([size='56'][active]:not([appearance='shadow']))::before,:host([size='64'][active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThicker});border-width:${strokeWidthThicker}}:host([size='72'][active]:not([appearance='shadow']))::before,:host([size='96'][active]:not([appearance='shadow']))::before,:host([size='120'][active]:not([appearance='shadow']))::before,:host([size='128'][active]:not([appearance='shadow']))::before{margin:calc(-2 * ${strokeWidthThickest});border-width:${strokeWidthThickest}}:host([size='20'][active][appearance])::before,:host([size='24'][active][appearance])::before,:host([size='28'][active][appearance])::before{box-shadow:${shadow4}}:host([size='56'][active][appearance])::before,:host([size='64'][active][appearance])::before{box-shadow:${shadow16}}:host([size='72'][active][appearance])::before,:host([size='96'][active][appearance])::before,:host([size='120'][active][appearance])::before,:host([size='128'][active][appearance])::before{box-shadow:${shadow28}}:host([active][appearance='ring'])::before{box-shadow:none}:host([active='inactive']){opacity:0.8;transform:scale(0.875);transition-property:transform,opacity;transition-duration:${durationUltraSlow},${durationFaster};transition-delay:${animations.fastOutSlowInMin},${animations.nullEasing}}:host([active='inactive'])::before{margin:0;opacity:0;transition-property:margin,opacity;transition-duration:${durationUltraSlow},${durationSlower};transition-delay:${animations.fastOutSlowInMin},${animations.nullEasing}}@media screen and (prefers-reduced-motion:reduce){:host([active]){transition-duration:0.01ms}:host([active])::before{transition-duration:0.01ms;transition-delay:0.01ms}}`;
|
|
4496
4540
|
|
|
4497
4541
|
const defaultIconTemplate = html`<svg width="1em" height="1em" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" class="default-icon" fill="currentcolor" aria-hidden="true"><path d="M10 2a4 4 0 100 8 4 4 0 000-8zM7 6a3 3 0 116 0 3 3 0 01-6 0zm-2 5a2 2 0 00-2 2c0 1.7.83 2.97 2.13 3.8A9.14 9.14 0 0010 18c1.85 0 3.58-.39 4.87-1.2A4.35 4.35 0 0017 13a2 2 0 00-2-2H5zm-1 2a1 1 0 011-1h10a1 1 0 011 1c0 1.3-.62 2.28-1.67 2.95A8.16 8.16 0 0110 17a8.16 8.16 0 01-4.33-1.05A3.36 3.36 0 014 13z"></path></svg>`;
|
|
4498
4542
|
function avatarTemplate() {
|
|
4499
|
-
return html`<
|
|
4543
|
+
return html`<slot>${x => x.name || x.initials ? x.generateInitials() : defaultIconTemplate}</slot><slot name="badge"></slot>`;
|
|
4500
4544
|
}
|
|
4501
4545
|
const template$s = avatarTemplate();
|
|
4502
4546
|
|
|
@@ -5185,20 +5229,6 @@ const definition$q = Button.compose({
|
|
|
5185
5229
|
|
|
5186
5230
|
definition$q.define(FluentDesignSystem.registry);
|
|
5187
5231
|
|
|
5188
|
-
const CustomStatesSetSupported = CSS.supports("selector(:state(g))");
|
|
5189
|
-
function toggleState(elementInternals, state, force) {
|
|
5190
|
-
if (!CustomStatesSetSupported) {
|
|
5191
|
-
elementInternals.shadowRoot.host.toggleAttribute(`state--${state}`, force);
|
|
5192
|
-
return;
|
|
5193
|
-
}
|
|
5194
|
-
force = force ?? !elementInternals.states.has(state);
|
|
5195
|
-
if (force) {
|
|
5196
|
-
elementInternals.states.add(state);
|
|
5197
|
-
return;
|
|
5198
|
-
}
|
|
5199
|
-
elementInternals.states.delete(state);
|
|
5200
|
-
}
|
|
5201
|
-
|
|
5202
5232
|
var __defProp$l = Object.defineProperty;
|
|
5203
5233
|
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
5204
5234
|
var __decorateClass$l = (decorators, target, key, kind) => {
|