@vaadin/vaadin-avatar 22.0.0-alpha4 → 22.0.0-alpha8

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.
@@ -3,599 +3,11 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
7
- import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
8
- import { calculateSplices } from '@polymer/polymer/lib/utils/array-splice.js';
9
- import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
10
- import { timeOut } from '@polymer/polymer/lib/utils/async.js';
11
- import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
12
- import { IronA11yAnnouncer } from '@polymer/iron-a11y-announcer/iron-a11y-announcer.js';
13
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
- import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
15
- import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
16
- import '@vaadin/vaadin-item/src/vaadin-item.js';
17
- import './vaadin-avatar-group-list-box.js';
18
- import './vaadin-avatar-group-overlay.js';
19
- import './vaadin-avatar.js';
20
-
21
- const MINIMUM_DISPLAYED_AVATARS = 2;
6
+ import { AvatarGroup } from '@vaadin/avatar-group/src/vaadin-avatar-group.js';
22
7
 
23
8
  /**
24
- * `<vaadin-avatar-group>` is a Web Component providing avatar group displaying functionality.
25
- *
26
- * To create the avatar group, first add the component to the page:
27
- *
28
- * ```
29
- * <vaadin-avatar-group></vaadin-avatar-group>
30
- * ```
31
- *
32
- * And then use [`items`](#/elements/vaadin-avatar-group#property-items) property to initialize the structure:
33
- *
34
- * ```
35
- * document.querySelector('vaadin-avatar-group').items = [
36
- * {name: 'John Doe'},
37
- * {abbr: 'AB'}
38
- * ];
39
- * ```
40
- *
41
- * ### Styling
42
- *
43
- * The following shadow DOM parts are exposed for styling:
44
- *
45
- * Part name | Description
46
- * ----------- | ---------------
47
- * `container` | The container element
48
- * `avatar` | Individual avatars
49
- *
50
- * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
51
- *
52
- * ### Internal components
53
- *
54
- * In addition to `<vaadin-avatar-group>` itself, the following internal
55
- * components are themable:
56
- *
57
- * - `<vaadin-avatar-group-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
58
- * - `<vaadin-avatar-group-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
59
- *
60
- * @extends HTMLElement
61
- * @mixes ElementMixin
62
- * @mixes ThemableMixin
9
+ * @deprecated Import `AvatarGroup` from `@vaadin/avatar-group` instead.
63
10
  */
64
- class AvatarGroupElement extends ElementMixin(ThemableMixin(mixinBehaviors([IronResizableBehavior], PolymerElement))) {
65
- static get template() {
66
- return html`
67
- <style>
68
- :host {
69
- display: block;
70
- width: 100%; /* prevent collapsing inside non-stretching column flex */
71
- --vaadin-avatar-group-overlap: 8px;
72
- --vaadin-avatar-group-overlap-border: 2px;
73
- --vaadin-avatar-size: 64px;
74
- }
75
-
76
- :host([hidden]) {
77
- display: none !important;
78
- }
79
-
80
- [part='container'] {
81
- display: flex;
82
- position: relative;
83
- width: 100%;
84
- flex-wrap: nowrap;
85
- }
86
-
87
- [part='avatar']:not(:first-child) {
88
- -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox=%220 0 300 300%22 fill=%22none%22 xmlns=%22http://www.w3.org/2000/svg%22><path fill-rule=%22evenodd%22 clip-rule=%22evenodd%22 d=%22M300 0H0V300H300V0ZM150 200C177.614 200 200 177.614 200 150C200 122.386 177.614 100 150 100C122.386 100 100 122.386 100 150C100 177.614 122.386 200 150 200Z%22 fill=%22black%22/></svg>');
89
- mask-image: url('data:image/svg+xml;utf8,<svg viewBox=%220 0 300 300%22 fill=%22none%22 xmlns=%22http://www.w3.org/2000/svg%22><path fill-rule=%22evenodd%22 clip-rule=%22evenodd%22 d=%22M300 0H0V300H300V0ZM150 200C177.614 200 200 177.614 200 150C200 122.386 177.614 100 150 100C122.386 100 100 122.386 100 150C100 177.614 122.386 200 150 200Z%22 fill=%22black%22/></svg>');
90
- -webkit-mask-size: calc(
91
- 300% + var(--vaadin-avatar-group-overlap-border) * 6 - var(--vaadin-avatar-outline-width) * 6
92
- );
93
- mask-size: calc(
94
- 300% + var(--vaadin-avatar-group-overlap-border) * 6 - var(--vaadin-avatar-outline-width) * 6
95
- );
96
- }
97
-
98
- [part='avatar']:not([dir='rtl']):not(:first-child) {
99
- margin-left: calc(var(--vaadin-avatar-group-overlap) * -1 - var(--vaadin-avatar-outline-width));
100
- -webkit-mask-position: calc(50% - var(--vaadin-avatar-size) + var(--vaadin-avatar-group-overlap));
101
- mask-position: calc(50% - var(--vaadin-avatar-size) + var(--vaadin-avatar-group-overlap));
102
- }
103
-
104
- [part='avatar'][dir='rtl']:not(:first-child) {
105
- margin-right: calc(var(--vaadin-avatar-group-overlap) * -1);
106
- -webkit-mask-position: calc(
107
- 50% + var(--vaadin-avatar-size) - var(--vaadin-avatar-group-overlap) + var(--vaadin-avatar-outline-width)
108
- );
109
- mask-position: calc(
110
- 50% + var(--vaadin-avatar-size) - var(--vaadin-avatar-group-overlap) + var(--vaadin-avatar-outline-width)
111
- );
112
- }
113
- </style>
114
- <div id="container" part="container">
115
- <template id="items" is="dom-repeat" items="[[__computeItems(items.*, __itemsInView, maxItemsVisible)]]">
116
- <vaadin-avatar
117
- name="[[item.name]]"
118
- abbr="[[item.abbr]]"
119
- img="[[item.img]]"
120
- part="avatar"
121
- theme$="[[theme]]"
122
- i18n="[[i18n]]"
123
- color-index="[[item.colorIndex]]"
124
- ></vaadin-avatar>
125
- </template>
126
- <vaadin-avatar
127
- id="overflow"
128
- part="avatar"
129
- hidden$="[[__computeMoreHidden(items.length, __itemsInView, __maxReached)]]"
130
- abbr="[[__computeMore(items.length, __itemsInView, maxItemsVisible)]]"
131
- theme$="[[theme]]"
132
- on-click="_onOverflowClick"
133
- on-keydown="_onOverflowKeyDown"
134
- aria-haspopup="listbox"
135
- ></vaadin-avatar>
136
- </div>
137
- <vaadin-avatar-group-overlay id="overlay" opened="{{_opened}}" on-vaadin-overlay-close="_onVaadinOverlayClose">
138
- <template>
139
- <vaadin-avatar-group-list-box on-keydown="_onListKeyDown">
140
- <template is="dom-repeat" items="[[__computeExtraItems(items.*, __itemsInView, maxItemsVisible)]]">
141
- <vaadin-item theme="avatar-group-item" role="option">
142
- <vaadin-avatar
143
- name="[[item.name]]"
144
- abbr="[[item.abbr]]"
145
- img="[[item.img]]"
146
- i18n="[[i18n]]"
147
- part="avatar"
148
- theme$="[[theme]]"
149
- color-index="[[item.colorIndex]]"
150
- tabindex="-1"
151
- aria-hidden="true"
152
- ></vaadin-avatar>
153
- [[item.name]]
154
- </vaadin-item>
155
- </template>
156
- </vaadin-avatar-group-list-box>
157
- </template>
158
- </vaadin-avatar-group-overlay>
159
- `;
160
- }
161
-
162
- static get is() {
163
- return 'vaadin-avatar-group';
164
- }
165
-
166
- static get properties() {
167
- return {
168
- /**
169
- * An array containing the items which will be stamped as avatars.
170
- *
171
- * The items objects allow to configure [`name`](#/elements/vaadin-avatar#property-name),
172
- * [`abbr`](#/elements/vaadin-avatar#property-abbr), [`img`](#/elements/vaadin-avatar#property-img)
173
- * and [`colorIndex`](#/elements/vaadin-avatar#property-colorIndex) properties on the
174
- * stamped avatars.
175
- *
176
- * #### Example
177
- *
178
- * ```js
179
- * group.items = [
180
- * {
181
- * name: 'User name',
182
- * img: 'url-to-image.png'
183
- * },
184
- * {
185
- * abbr: 'JD',
186
- * colorIndex: 1
187
- * },
188
- * ];
189
- * ```
190
- *
191
- * @type {!Array<!AvatarGroupItem> | undefined}
192
- */
193
- items: {
194
- type: Array
195
- },
196
-
197
- /**
198
- * The maximum number of avatars to display. By default, all the avatars are displayed.
199
- * When _maxItemsVisible_ is set, the overflowing avatars are grouped into one avatar with
200
- * a dropdown. Setting 0 or 1 has no effect so there are always at least two avatars visible.
201
- */
202
- maxItemsVisible: {
203
- type: Number
204
- },
205
-
206
- /**
207
- * The object used to localize this component.
208
- * To change the default localization, replace the entire
209
- * _i18n_ object or just the property you want to modify.
210
- *
211
- * The object has the following JSON structure and default values:
212
- * ```
213
- * {
214
- * // Translation of the anonymous user avatar title.
215
- * anonymous: 'anonymous',
216
- * // Translation of the avatar group accessible label.
217
- * // {count} is replaced with the actual count of users.
218
- * activeUsers: {
219
- * one: 'Currently one active user',
220
- * many: 'Currently {count} active users'
221
- * },
222
- * // Screen reader announcement when user joins group.
223
- * // {user} is replaced with the name or abbreviation.
224
- * // When neither is set, "anonymous" is used instead.
225
- * joined: '{user} joined',
226
- * // Screen reader announcement when user leaves group.
227
- * // {user} is replaced with the name or abbreviation.
228
- * // When neither is set, "anonymous" is used instead.
229
- * left: '{user} left'
230
- * }
231
- * ```
232
- * @type {!AvatarGroupI18n}
233
- * @default {English/US}
234
- */
235
- i18n: {
236
- type: Object,
237
- value: () => {
238
- return {
239
- anonymous: 'anonymous',
240
- activeUsers: {
241
- one: 'Currently one active user',
242
- many: 'Currently {count} active users'
243
- },
244
- joined: '{user} joined',
245
- left: '{user} left'
246
- };
247
- }
248
- },
249
-
250
- /** @private */
251
- __maxReached: {
252
- type: Boolean,
253
- computed: '__computeMaxReached(items.length, maxItemsVisible)'
254
- },
255
-
256
- /** @private */
257
- __itemsInView: {
258
- type: Number,
259
- value: null
260
- },
261
-
262
- /** @private */
263
- _opened: {
264
- type: Boolean,
265
- observer: '__openedChanged',
266
- value: false
267
- }
268
- };
269
- }
270
-
271
- static get observers() {
272
- return [
273
- '__computeMoreTitle(items.length, __itemsInView, maxItemsVisible)',
274
- '__itemsChanged(items.splices, items.*)',
275
- '__i18nItemsChanged(i18n.*, items.length)'
276
- ];
277
- }
278
-
279
- /** @protected */
280
- ready() {
281
- super.ready();
282
-
283
- IronA11yAnnouncer.requestAvailability();
284
-
285
- this.__boundSetPosition = this.__setPosition.bind(this);
286
-
287
- this.addEventListener('iron-resize', this._onResize.bind(this));
288
-
289
- this._overlayElement = this.shadowRoot.querySelector('vaadin-avatar-group-overlay');
290
-
291
- afterNextRender(this, () => {
292
- this.__setItemsInView();
293
- });
294
- }
295
-
296
- /**
297
- * @param {string} name
298
- * @param {?string} oldValue
299
- * @param {?string} newValue
300
- * @protected
301
- */
302
- attributeChangedCallback(name, oldValue, newValue) {
303
- super.attributeChangedCallback(name, oldValue, newValue);
304
- if (name === 'dir') {
305
- this.__setPosition();
306
- }
307
- }
308
-
309
- /**
310
- * @return {!Array<!HTMLElement>}
311
- * @protected
312
- */
313
- get _avatars() {
314
- return this.shadowRoot.querySelectorAll('vaadin-avatar');
315
- }
316
-
317
- /** @private */
318
- __announce(text) {
319
- this.dispatchEvent(
320
- new CustomEvent('iron-announce', {
321
- bubbles: true,
322
- composed: true,
323
- detail: {
324
- text
325
- }
326
- })
327
- );
328
- }
329
-
330
- /** @private */
331
- __getMessage(user, action) {
332
- return action.replace('{user}', user.name || user.abbr || this.i18n.anonymous);
333
- }
334
-
335
- /** @private */
336
- _onOverflowClick(e) {
337
- e.stopPropagation();
338
- if (this._opened) {
339
- this.$.overlay.close();
340
- } else if (!e.defaultPrevented) {
341
- this._opened = true;
342
- }
343
- }
344
-
345
- /** @private */
346
- _onOverflowKeyDown(e) {
347
- if (!this._opened) {
348
- if (/^(Enter|SpaceBar|\s)$/.test(e.key)) {
349
- e.preventDefault();
350
- this._opened = true;
351
- }
352
- }
353
- }
354
-
355
- /** @private */
356
- _onListKeyDown(event) {
357
- if (event.key === 'Escape' || event.key === 'Esc' || /^(Tab)$/.test(event.key)) {
358
- this._opened = false;
359
- }
360
- }
361
-
362
- /** @private */
363
- _onResize() {
364
- this.__debounceResize = Debouncer.debounce(this.__debounceResize, timeOut.after(0), () => {
365
- this.__setItemsInView();
366
- this.__setPosition();
367
- });
368
- }
369
-
370
- /** @private */
371
- _onVaadinOverlayClose(e) {
372
- if (e.detail.sourceEvent && e.detail.sourceEvent.composedPath().indexOf(this) !== -1) {
373
- e.preventDefault();
374
- }
375
- }
376
-
377
- /** @private */
378
- __computeItems(arr, itemsInView, maxItemsVisible) {
379
- const items = arr.base || [];
380
- const limit = this.__getLimit(items.length, itemsInView, maxItemsVisible);
381
- return limit ? items.slice(0, limit) : items;
382
- }
383
-
384
- /** @private */
385
- __computeExtraItems(arr, itemsInView, maxItemsVisible) {
386
- const items = arr.base || [];
387
- const limit = this.__getLimit(items.length, itemsInView, maxItemsVisible);
388
- return limit ? items.slice(limit) : items;
389
- }
390
-
391
- /** @private */
392
- __computeMaxReached(items, maxItemsVisible) {
393
- return maxItemsVisible != null && items > this.__getMax(maxItemsVisible);
394
- }
395
-
396
- /** @private */
397
- __computeMore(items, itemsInView, maxItemsVisible) {
398
- return `+${items - this.__getLimit(items, itemsInView, maxItemsVisible)}`;
399
- }
400
-
401
- /** @private */
402
- __computeMoreHidden(items, itemsInView, maxReached) {
403
- return !maxReached && !(itemsInView && itemsInView < items);
404
- }
405
-
406
- /** @private */
407
- __computeMoreTitle(items, itemsInView, maxItemsVisible) {
408
- const limit = this.__getLimit(items, itemsInView, maxItemsVisible);
409
- if (limit == null) {
410
- return;
411
- }
412
- const result = [];
413
- for (let i = limit; i < items; i++) {
414
- const item = this.items[i];
415
- result.push(item.name || item.abbr || 'anonymous');
416
- }
417
- // override generated title attribute
418
- this.$.overflow.setAttribute('title', result.join('\n'));
419
- }
420
-
421
- /** @private */
422
- __getLimit(items, itemsInView, maxItemsVisible) {
423
- let limit = null;
424
- // handle max set to 0 or 1
425
- const adjustedMax = this.__getMax(maxItemsVisible);
426
- if (maxItemsVisible != null && adjustedMax < items) {
427
- limit = adjustedMax - 1;
428
- } else if (itemsInView && itemsInView < items) {
429
- limit = itemsInView;
430
- }
431
-
432
- return Math.min(limit, this.__calculateAvatarsFitWidth());
433
- }
434
-
435
- /** @private */
436
- __getMax(maxItemsVisible) {
437
- return Math.max(maxItemsVisible, MINIMUM_DISPLAYED_AVATARS);
438
- }
439
-
440
- /** @private */
441
- __itemsChanged(splices, itemsChange) {
442
- const items = itemsChange.base;
443
- this.$.items.render();
444
- this.__setItemsInView();
445
-
446
- // mutation using group.splice('items')
447
- if (splices && Array.isArray(splices.indexSplices)) {
448
- splices.indexSplices.forEach((mutation) => {
449
- this.__announceItemsChange(items, mutation);
450
- });
451
- } else if (Array.isArray(items) && Array.isArray(this.__oldItems)) {
452
- // mutation using group.set('items')
453
- const diff = calculateSplices(items, this.__oldItems);
454
- diff.forEach((mutation) => {
455
- this.__announceItemsChange(items, mutation);
456
- });
457
- }
458
-
459
- this.__oldItems = items;
460
- }
461
-
462
- /** @private */
463
- __announceItemsChange(items, mutation) {
464
- const { addedCount, index, removed } = mutation;
465
- let addedMsg = [];
466
- let removedMsg = [];
467
- if (addedCount) {
468
- addedMsg = items
469
- .slice(index, index + addedCount)
470
- .map((user) => this.__getMessage(user, this.i18n.joined || '{user} joined'));
471
- }
472
-
473
- if (removed) {
474
- removedMsg = removed.map((user) => this.__getMessage(user, this.i18n.left || '{user} left'));
475
- }
476
-
477
- const messages = removedMsg.concat(addedMsg);
478
- if (messages.length > 0) {
479
- this.__announce(messages.join(', '));
480
- }
481
- }
482
-
483
- /** @private */
484
- __i18nItemsChanged(i18n, items) {
485
- const { base } = i18n;
486
- if (base && base.activeUsers) {
487
- const field = items === 1 ? 'one' : 'many';
488
- if (base.activeUsers[field]) {
489
- this.setAttribute('aria-label', base.activeUsers[field].replace('{count}', items || 0));
490
- }
491
- }
492
- }
493
-
494
- /** @private */
495
- __openedChanged(opened, wasOpened) {
496
- if (opened) {
497
- if (!this._menuElement) {
498
- this._menuElement = this._overlayElement.content.querySelector('vaadin-avatar-group-list-box');
499
- this._menuElement.setAttribute('role', 'listbox');
500
- }
501
-
502
- this._openedWithFocusRing = this.$.overflow.hasAttribute('focus-ring');
503
-
504
- const avatars = this._menuElement.querySelectorAll('vaadin-avatar');
505
- avatars.forEach((avatar) => avatar.removeAttribute('title'));
506
-
507
- this._menuElement.focus();
508
- this.__setPosition();
509
- window.addEventListener('scroll', this.__boundSetPosition, true);
510
- } else if (wasOpened) {
511
- this.$.overflow.focus();
512
- if (this._openedWithFocusRing) {
513
- this.$.overflow.setAttribute('focus-ring', '');
514
- }
515
- window.removeEventListener('scroll', this.__boundSetPosition, true);
516
- }
517
- this.$.overflow.setAttribute('aria-expanded', opened === true);
518
- }
519
-
520
- /** @private */
521
- __setItemsInView() {
522
- const avatars = this._avatars;
523
- const items = this.items;
524
-
525
- // always show at least two avatars
526
- if (!items || !avatars || avatars.length < 3) {
527
- return;
528
- }
529
-
530
- let result = this.__calculateAvatarsFitWidth();
531
-
532
- // only show overlay if two or more avatars don't fit
533
- if (result === items.length - 1) {
534
- result = items.length;
535
- }
536
-
537
- // close overlay if all avatars become visible
538
- if (result >= items.length && this._opened) {
539
- this.$.overlay.close();
540
- // FIXME: hack to avoid jump before closing
541
- this.$.overlay._flushAnimation('closing');
542
- }
543
-
544
- // reserve space for overflow avatar
545
- this.__itemsInView = result;
546
- }
547
-
548
- /** @private **/
549
- __calculateAvatarsFitWidth() {
550
- if (!this.shadowRoot || this._avatars.length < MINIMUM_DISPLAYED_AVATARS) {
551
- return MINIMUM_DISPLAYED_AVATARS;
552
- }
553
-
554
- const avatars = this._avatars;
555
-
556
- // assume all the avatars have the same width
557
- const avatarWidth = avatars[0].clientWidth;
558
-
559
- // take negative margin into account
560
- const { marginLeft, marginRight } = getComputedStyle(avatars[1]);
561
-
562
- const offset =
563
- this.getAttribute('dir') == 'rtl'
564
- ? parseInt(marginRight, 0) - parseInt(marginLeft, 0)
565
- : parseInt(marginLeft, 0) - parseInt(marginRight, 0);
566
-
567
- return Math.floor((this.$.container.offsetWidth - avatarWidth) / (avatarWidth + offset));
568
- }
569
-
570
- /** @private */
571
- __setPosition() {
572
- if (!this._opened) {
573
- return;
574
- }
575
- const btnRect = this.$.overflow.getBoundingClientRect();
576
- const viewportHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
577
- const bottomAlign = btnRect.top > (viewportHeight - btnRect.height) / 2;
578
-
579
- const isRtl = this.getAttribute('dir') === 'rtl';
580
-
581
- if (isRtl) {
582
- this._overlayElement.style.right = document.documentElement.clientWidth - btnRect.right + 'px';
583
- } else {
584
- this._overlayElement.style.left = btnRect.left + 'px';
585
- }
586
-
587
- if (bottomAlign) {
588
- this._overlayElement.setAttribute('bottom-aligned', '');
589
- this._overlayElement.style.removeProperty('top');
590
- this._overlayElement.style.bottom = viewportHeight - btnRect.top + 'px';
591
- } else {
592
- this._overlayElement.removeAttribute('bottom-aligned');
593
- this._overlayElement.style.removeProperty('bottom');
594
- this._overlayElement.style.top = btnRect.bottom + 'px';
595
- }
596
- }
597
- }
598
-
599
- customElements.define(AvatarGroupElement.is, AvatarGroupElement);
11
+ export const AvatarGroupElement = AvatarGroup;
600
12
 
601
- export { AvatarGroupElement };
13
+ export * from '@vaadin/avatar-group/src/vaadin-avatar-group.js';
@@ -1,74 +1,18 @@
1
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
2
-
3
- import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
4
-
5
- import { AvatarI18n } from './interfaces';
6
-
7
1
  /**
8
- * `<vaadin-avatar>` is a Web Component providing avatar displaying functionality.
9
- *
10
- * ```html
11
- * <vaadin-avatar img="avatars/avatar-1.jpg"></vaadin-avatar>
12
- * ```
13
- *
14
- * ### Styling
15
- *
16
- * The following shadow DOM parts are exposed for styling:
17
- *
18
- * Part name | Description
19
- * --------- | ---------------
20
- * `abbr` | The abbreviation element
21
- * `icon` | The icon element
22
- *
23
- * The following attributes are exposed for styling:
24
- *
25
- * Attribute | Description
26
- * --------- | -----------
27
- * `has-color-index` | Set when the avatar has `colorIndex` and the corresponding custom CSS property exists.
28
- *
29
- * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
2
+ * @license
3
+ * Copyright (c) 2021 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
30
5
  */
31
- declare class AvatarElement extends ElementMixin(ThemableMixin(HTMLElement)) {
32
- /**
33
- * The path to the image
34
- */
35
- img: string | null | undefined;
36
-
37
- /**
38
- * A shortened form of name that is displayed
39
- * in the avatar when `img` is not provided.
40
- */
41
- abbr: string | null | undefined;
42
-
43
- /**
44
- * Full name of the user
45
- * used for the title of the avatar.
46
- */
47
- name: string | null | undefined;
6
+ import { Avatar } from '@vaadin/avatar/src/vaadin-avatar.js';
48
7
 
49
- /**
50
- * Color index used for avatar background.
51
- */
52
- colorIndex: number | null | undefined;
53
-
54
- /**
55
- * The object used to localize this component.
56
- * To change the default localization, replace the entire
57
- * _i18n_ object or just the property you want to modify.
58
- *
59
- * The object has the following JSON structure and default values:
60
- * {
61
- * // Translation of the anonymous user avatar title.
62
- * anonymous: 'anonymous'
63
- * }
64
- */
65
- i18n: AvatarI18n;
66
- }
8
+ /**
9
+ * @deprecated Import `Avatar` from `@vaadin/avatar` instead.
10
+ */
11
+ export type AvatarElement = Avatar;
67
12
 
68
- declare global {
69
- interface HTMLElementTagNameMap {
70
- 'vaadin-avatar': AvatarElement;
71
- }
72
- }
13
+ /**
14
+ * @deprecated Import `Avatar` from `@vaadin/avatar` instead.
15
+ */
16
+ export const AvatarElement: typeof Avatar;
73
17
 
74
- export { AvatarElement };
18
+ export * from '@vaadin/avatar/src/vaadin-avatar.js';