import { __decorate } from "tslib"; import { html } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { styleMap } from 'lit/directives/style-map.js'; import { MduiElement } from '@mdui/shared/base/mdui-element.js'; import { HasSlotController } from '@mdui/shared/controllers/has-slot.js'; import { nothingTemplate } from '@mdui/shared/helpers/template.js'; import { componentStyle } from '@mdui/shared/lit-styles/component-style.js'; import '../icon.js'; import { style } from './style.js'; /** * @summary 头像组件 * * ```html * * ``` * * @slot - 自定义头像内容,可以为字母、汉字、`` 元素、图标等 * * @csspart image - 使用图片作为头像时,组件内部的 `` 元素 * @csspart icon - 使用图标作为头像时,组件内部的 `` 元素 * * @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner) */ let Avatar = class Avatar extends MduiElement { constructor() { super(...arguments); this.hasSlotController = new HasSlotController(this, '[default]'); } render() { return this.hasSlotController.test('[default]') ? html `` : this.src ? html `${ifDefined(this.label)}` : this.icon ? html `` : nothingTemplate; } }; Avatar.styles = [componentStyle, style]; __decorate([ property({ reflect: true }) ], Avatar.prototype, "src", void 0); __decorate([ property({ reflect: true }) ], Avatar.prototype, "fit", void 0); __decorate([ property({ reflect: true }) ], Avatar.prototype, "icon", void 0); __decorate([ property({ reflect: true }) ], Avatar.prototype, "label", void 0); Avatar = __decorate([ customElement('mdui-avatar') ], Avatar); export { Avatar };