avatarpackage.src.vaadin-avatar.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vaadin-webcomponents Show documentation
Show all versions of vaadin-webcomponents Show documentation
Mvnpm composite: Vaadin webcomponents
The newest version!
/**
* @license
* Copyright (c) 2020 - 2024 Vaadin Ltd.
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import './vaadin-avatar-icons.js';
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import { AvatarMixin } from './vaadin-avatar-mixin.js';
import { avatarStyles } from './vaadin-avatar-styles.js';
registerStyles('vaadin-avatar', avatarStyles, { moduleId: 'vaadin-avatar-styles' });
/**
* `` is a Web Component providing avatar displaying functionality.
*
* ```html
*
* ```
*
* ### Styling
*
* The following shadow DOM parts are exposed for styling:
*
* Part name | Description
* --------- | ---------------
* `abbr` | The abbreviation element
* `icon` | The icon element
*
* The following state attributes are available for styling:
*
* Attribute | Description
* ------------------|-------------
* `focus-ring` | Set when the avatar is focused using the keyboard.
* `focused` | Set when the avatar is focused.
* `has-color-index` | Set when the avatar has `colorIndex` and the corresponding custom CSS property exists.
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*
* @customElement
* @extends HTMLElement
* @mixes AvatarMixin
* @mixes ControllerMixin
* @mixes ElementMixin
* @mixes ThemableMixin
*/
class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
static get template() {
return html`
`;
}
static get is() {
return 'vaadin-avatar';
}
/** @protected */
ready() {
super.ready();
this._tooltipController = new TooltipController(this);
this.addController(this._tooltipController);
}
}
defineCustomElement(Avatar);
export { Avatar };