UNPKG

@sandlada/mdc

Version:

@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.

2 lines (1 loc) 1.14 kB
import{_ as t}from"../../tslib.es6-CmLYFWVC.js";import"../../lit-element-Ho-VPzO1.js";import{n as e}from"../../property-Ck1wIidx.js";import{internals as s}from"../behaviors/element-internals.js";const r=Symbol("getFormValue"),a=Symbol("getFormState");function i(i){class l extends i{static{this.formAssociated=!0}get form(){return this[s].form}get labels(){return this[s].labels}get name(){return this.getAttribute("name")??""}set name(t){this.setAttribute("name",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}attributeChangedCallback(t,e,s){if("name"===t||"disabled"===t){const s="disabled"===t?null!==e:e;return void this.requestUpdate(t,s)}super.attributeChangedCallback(t,e,s)}requestUpdate(t,e,i){super.requestUpdate(t,e,i),this[s].setFormValue(this[r](),this[a]())}[r](){throw new Error("Implement [getFormValue]")}[a](){return this[r]()}formDisabledCallback(t){this.disabled=t}}return t([e({noAccessor:!0})],l.prototype,"name",null),t([e({type:Boolean,noAccessor:!0})],l.prototype,"disabled",null),l}export{a as getFormState,r as getFormValue,i as mixinFormAssociated};