/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import{a}from"./chunk.2KXSGD3S.js";import{b as s}from"./chunk.DL7NX432.js";var h=`${s}text-field`,u={MULTI_INPUT:"data-forge-multi-input",MULTI_INPUT_SEPARATOR:"data-forge-multi-input-separator"},r={ROOT:"forge-text-field",MULTI_INPUT:"forge-text-field--multi-input",TEXTAREA:"forge-text-field--textarea"},_={ROOT:`.${r.ROOT}`},d={elementName:h,attributes:u,classes:r,selectors:_};var m=class extends a{constructor(e){super(e)}_build(){var t,i;let e=document.createElement(d.elementName);return this._inputElement=this._buildInputElement(e),(t=this._config.options)!=null&&t.leadingElement&&(this._config.options.leadingElement.slot="leading",e.appendChild(this._config.options.leadingElement)),(i=this._config.options)!=null&&i.trailingElement&&(this._config.options.trailingElement.slot="trailing",e.appendChild(this._config.options.trailingElement)),e.appendChild(this._inputElement),e}_configure(){var e,t;(e=this._config.options)!=null&&e.helperText&&this.setHelperText(this._config.options.helperText),typeof((t=this._config.options)==null?void 0:t.label)=="string"&&this._createLabel(this._config.options.label)}get value(){return this._inputElement.value}set value(e){this._inputElement.value=e}get disabled(){return this._inputElement.disabled}set disabled(e){this._inputElement.disabled=e}get invalid(){return this._element.invalid||!1}set invalid(e){this._element.invalid=e}get inputElement(){return this._inputElement}get labelElement(){return this._labelElement}onChange(e){this._inputElement.addEventListener("input",t=>e(t.target.value))}onFocus(e){this._inputElement.addEventListener("focus",t=>e(t))}onBlur(e){this._inputElement.addEventListener("blur",t=>e(t))}setLabel(e){e?this._labelElement?this._labelElement.textContent=e:this._createLabel(e):this._labelElement&&(this._element.removeChild(this._labelElement),this._labelElement=void 0)}setHelperText(e){e?(this._helperTextElement||(this._helperTextElement=document.createElement("span"),this._helperTextElement.slot="helper-text",this._element.appendChild(this._helperTextElement)),this._helperTextElement.textContent=e):this._helperTextElement&&(this._element.removeChild(this._helperTextElement),this._helperTextElement=void 0)}floatLabel(e){this._element.floatLabel(e)}_createLabel(e){var t;this._labelElement=document.createElement("label"),this._labelElement.textContent=e,(t=this._config.options)!=null&&t.id&&this._labelElement.setAttribute("for",this._config.options.id),this._element.appendChild(this._labelElement)}_buildInputElement(e){var i,n,l,o,p;let t=document.createElement("input");return t.type=((i=this._config.options)==null?void 0:i.type)||"text",((n=this._config.options)==null?void 0:n.value)!==void 0&&(t.value=this._config.options.value),(l=this._config.options)!=null&&l.id&&(t.id=this._config.options.id),typeof((o=this._config.options)==null?void 0:o.placeholder)=="string"&&(t.placeholder=(p=this._config.options)==null?void 0:p.placeholder),e.appendChild(t),t}};export{d as a,m as b};
//# sourceMappingURL=chunk.EYGSUZWX.js.map
