UNPKG

@sandlada/mdc

Version:

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

7 lines (6 loc) 619 B
import"../../lit-element-Ho-VPzO1.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=>{const r=t;r.addEventListener("click",async t=>{const{type:n,[e]:i}=r,{form:s}=i;s&&"button"!==n&&(await new Promise(e=>{setTimeout(e)}),t.defaultPrevented||("reset"!==n?(s.addEventListener("submit",e=>{Object.defineProperty(e,"submitter",{configurable:!0,enumerable:!0,get:()=>r})},{capture:!0,once:!0}),i.setFormValue(r.value),s.requestSubmit()):s.reset()))})})}export{t as setupFormSubmitter};