@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
8 lines • 1.38 kB
JavaScript
import{property as e}from"../../node_modules/@lit/reactive-element/decorators/property.js";import"../../node_modules/lit/decorators.js";import"../../node_modules/lit/index.js";import{internals as t}from"../behaviors/element-internals.js";import n from"../../_virtual/_@oxc-project_runtime@0.144.0/helpers/esm/decorate.js";
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const r=Symbol(`getFormValue`),i=Symbol(`getFormState`);function a(a){class o extends a{static{this.formAssociated=!0}get form(){return this[t].form}get labels(){return this[t].labels}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){if(e===`name`||e===`disabled`){let n=e===`disabled`?t!==null:t;this.requestUpdate(e,n);return}super.attributeChangedCallback(e,t,n)}requestUpdate(e,n,a){super.requestUpdate(e,n,a),this[t].setFormValue(this[r](),this[i]())}[r](){throw Error(`Implement [getFormValue]`)}[i](){return this[r]()}formDisabledCallback(e){this.disabled=e}}return n([e({noAccessor:!0})],o.prototype,`name`,null),n([e({type:Boolean,noAccessor:!0})],o.prototype,`disabled`,null),o}export{i as getFormState,r as getFormValue,a as mixinFormAssociated};
//# sourceMappingURL=form-associated.js.map