1import{r as C,n as h,c as _,L as y,x as c}from"./main-DdEGjCiE.js";import{I as g}from"./i18n-BXwUgION.js";var v=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},r=(n,e,t)=>(v(n,e,"read from private field"),t?t.call(n):e.get(n)),u=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},m=(n,e,t,f)=>(v(n,e,"write to private field"),e.set(n,t),t),a,o;const w=`/*------------------------------------*\\ 2 #RESET 3\\*------------------------------------*/ 4/** 5 * Border-Box http:/paulirish.com/2012/box-sizing-border-box-ftw/ 6 */ 7*, 8::slotted(*), 9*:before, 10*:after { 11 box-sizing: border-box; 12} 13 14:host *, 15:host *::before, 16:host *::after { 17 box-sizing: inherit; 18} 19 20[hidden] { 21 display: none !important; 22} 23 24.leaf-c-button--success { 25 color: var(--leaf-color-content-success); 26} 27 28.leaf-c-button--error { 29 color: var(--leaf-color-content-error); 30} 31 32:host { 33 display: block; 34 font-size: var(--leaf-font-size-1); 35 font-weight: var(--leaf-typography-label-large-font-weight); 36 margin-left: var(--leaf-spacing-4); 37 margin-top: var(--leaf-spacing-8); 38}`;var E=Object.defineProperty,d=(n,e,t,f)=>{for(var l=void 0,s=n.length-1,p;s>=0;s--)(p=n[s])&&(l=p(e,t,l)||l);return l&&E(e,t,l),l};const b=class extends y{constructor(){super(...arguments),u(this,a,void 0),u(this,o,void 0),this.i18nController=new g(this),this.formControl=null}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.focusOnFormControl),window.addEventListener("leaf:form-element-update",()=>this.requestUpdate("for"))}willUpdate(e){var t,f,l,s;super.willUpdate(e),e.has("for")&&(this.for?(this.formControl=(t=this.getRootNode())==null?void 0:t.querySelector(`#${this.for}`),this.optional=!((f=this.formControl)!=null&&f.hasAttribute("required")),m(this,a,`${this.for}-leaf`),(l=r(this,o))==null||l.setAttribute("for",r(this,a))):((s=r(this,o))==null||s.removeAttribute("for"),this.formControl=null))}render(){return c` 39 <slot @slotchange=${this.onSlotchange} style="display: none"></slot> 40 <slot name="label"></slot> 41 ${this.optional?c`<span class="optional">(${this.i18nController.term("optional")})</span>`:""} 42 `}onSlotchange({target:e}){const t=e.assignedNodes({flatten:!0});r(this,o)&&t.length?(r(this,o).innerHTML="",r(this,o).append(...t)):(m(this,o,r(this,o)??(this.querySelector('label[slot="label"]')||document.createElement("label"))),r(this,o).htmlFor=r(this,a)??"",r(this,o).slot="label",r(this,o).append(...t),this.append(r(this,o)))}focusOnFormControl(){var e;(e=this.formControl)!=null&&e.formControlElement&&this.formControl.formControlElement.focus()}};a=new WeakMap;o=new WeakMap;b.styles=C(w);let i=b;d([h()],i.prototype,"for");d([_()],i.prototype,"formControl");d([h({type:Boolean})],i.prototype,"optional");d([h({type:Boolean,reflect:!0})],i.prototype,"disabled");customElements.define("leaf-label",i);export{i as LeafLabel}; 43//# sourceMappingURL=label-Da7Hu_ek.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.