@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
8 lines • 672 B
JavaScript
import"../../node_modules/lit/index.js";import{internals as e}from"../behaviors/element-internals.js";
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
function t(t){t.addInitializer(t=>{let n=t;n.addEventListener(`click`,async t=>{let{type:r,[e]:i}=n,{form:a}=i;if(!(!a||r===`button`)&&(await new Promise(e=>{setTimeout(e)}),!t.defaultPrevented)){if(r===`reset`){a.reset();return}a.addEventListener(`submit`,e=>{Object.defineProperty(e,"submitter",{configurable:!0,enumerable:!0,get:()=>n})},{capture:!0,once:!0}),i.setFormValue(n.value),a.requestSubmit()}})})}export{t as setupFormSubmitter};
//# sourceMappingURL=form-submitter.js.map