@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
2 lines • 2.33 kB
JavaScript
import{customElement as e}from"../../node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as t}from"../../node_modules/@lit/reactive-element/decorators/property.js";import{query as n}from"../../node_modules/@lit/reactive-element/decorators/query.js";import"../../node_modules/lit/decorators.js";import{html as r}from"../../node_modules/lit-html/lit-html.js";import{LitElement as i}from"../../node_modules/lit-element/lit-element.js";import"../../node_modules/lit/index.js";import{classMap as a}from"../../node_modules/lit-html/directives/class-map.js";import"../../node_modules/lit/directives/class-map.js";import{mixinElementInternals as o}from"../../utils/behaviors/element-internals.js";import{composeMixin as s}from"../../utils/compose-mixin/compose-mixin.js";import c from"../../_virtual/_@oxc-project_runtime@0.144.0/helpers/esm/decorate.js";import{Duration as l}from"../../node_modules/@sandlada/mdk/build/domain/duration.js";import"../../node_modules/@sandlada/mdk/build/index.js";import{mixinDelegatesAria as u}from"../../utils/aria/delegate.js";import{MeasuredDimensionController as d}from"../../utils/controller/measured-dimension-controller.js";import{OpacityTransitionController as f}from"../../utils/controller/opacity-transition-controller.js";import{BadgeStyles as p}from"./badge.style.js";let m=class extends s(u,o)(i){static{this.styles=p}constructor(){super(),this.size=`small`,this.value=null,this.opacityController=new f(this,{target:()=>this.labelElement}),this.measuredDimensionController=new d(this,{target:()=>this.labelElement,dimension:`width`,duration:l.StandardFastSpatial.Value})}getRenderClasses(){return{[this.size]:!0,container:!0,"has-label":this.hasLabel}}render(){return r`<div class="${a(this.getRenderClasses())}">${this.renderLabel()}</div>`}renderLabel(){return r`<span class="label">${this.displayValue}</span>`}get displayValue(){return this.value==null?``:typeof this.value==`string`?this.value:this.value>99?`99+`:String(this.value)}get hasLabel(){return this.value!=null&&this.value!==``}};c([t({type:String,attribute:`size`,reflect:!0})],m.prototype,`size`,void 0),c([t({type:String,reflect:!0})],m.prototype,`value`,void 0),c([n(`.label`)],m.prototype,`labelElement`,void 0),m=c([e(`mdc-badge`)],m);export{m as MDCBadge};
//# sourceMappingURL=badge.js.map