@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
8 lines • 825 B
JavaScript
import{Validator as e}from"./validator.js";
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
var t=class extends e{computeValidity(e){this.radioElement||(this.radioElement=document.createElement(`input`),this.radioElement.type=`radio`,this.radioElement.name=`group`);let t=!1,n=!1;for(let{checked:r,required:i}of e)i&&(t=!0),r&&(n=!0);return this.radioElement.checked=n,this.radioElement.required=t,{validity:{valueMissing:t&&!n},validationMessage:this.radioElement.validationMessage}}equals(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.checked!==i.checked||r.required!==i.required)return!1}return!0}copy(e){return e.map(({checked:e,required:t})=>({checked:e,required:t}))}};export{t as RadioValidator};
//# sourceMappingURL=radio-validator.js.map