import { h, p as proxyCustomElement, H } from './p-604af0ee.js';
import { g as guid } from './p-97e3e910.js';
import { d as defineCustomElement$3 } from './p-cdd41c39.js';
import { d as defineCustomElement$2 } from './p-888b8e69.js';
import { d as defineCustomElement$1 } from './p-0102a31f.js';

const feedbackIconTypes = {
    success: h("dga-icon", { icon: "CheckmarkCircle02Icon", variant: "solid" }),
    error: h("dga-icon", { icon: "AlertCircleIcon", variant: "solid" }),
    warning: h("dga-icon", { icon: "Alert02Icon", variant: "solid" }),
};
const DgaTextInput = /*@__PURE__*/ proxyCustomElement(class DgaTextInput extends H {
    constructor() {
        super();
        this.__registerHost();
        this.size = 'lg';
        this.type = 'text';
        this.variant = 'default';
        this.error = false;
        this.feedbackIcon = false;
        this.feedbackIconType = 'success';
        this.feedbackIconRing = false;
        this.helperText = '';
        this.disabled = false;
        this.readonly = false;
        this.required = false;
        //   @Prop() id: string = guid();
        this.name = guid();
        this.value = '';
        this.isActive = false;
        this.isFocused = false;
    }
    // @Element() el: HTMLElement;
    //   handleFocus = () => {
    //     this.isFocused = true;
    //   };
    //   handleBlur = (e: FocusEvent) => {
    //     this.isFocused = false;
    //     if (this.onBlur) {
    //       this.onBlur(e);
    //     }
    //   };
    //   handleMouseDown = () => {
    //     this.isActive = true;
    //   };
    //   handleMouseUp = () => {
    //     this.isActive = false;
    //   };
    //   handleMouseOut = () => {
    //     this.isActive = false;
    //   };
    // componentWillLoad() {
    //   this.el.childNodes.forEach(item => {
    //     const el = item as HTMLElement;
    //     if (el.tagName === 'DGA-SLIDEOUT-MENU-ACTIONS' && el.attributes.getNamedItem('slot') === null) {
    //       el.setAttribute('slot', 'slideout-menu-actions');
    //     }
    //   });
    // }
    render() {
        return (h("div", { key: '19f0b99b9f435a38edd22905a3db29d8aff57cb6', class: "dga-form-control" }, this.label && h("dga-label", { key: '7e6a15e17be30c0f9a018a692bc6c992ab97e135', label: this.label, size: this.size, required: this.required, disabled: this.disabled }), h("div", { key: '0fa51c9f567dc1f842c35e4e1cfcc53006d91cd4', class: `input input--${this.size} ${this.error ? 'input--error' : ''} ${this.variant !== 'default' ? `input--${this.variant}` : ''} ${this.isActive ? 'active' : ''} ${this.isFocused ? 'focus' : ''} ${this.disabled ? 'input--disabled' : ''} ${this.readonly ? 'readOnly' : ''}`, ref: el => (this.inputContainerRef = el) }, h("slot", { key: 'a7074b723ada5e6baa0a2ee67bd74112ef25198b', name: "prefix" }), this.icon && (h("span", { key: '19f471c8ef43a45db98bc376a71d44223c8bf62b', class: "input__icon" }, h("dga-icon", { key: '8553ea7464f912dccbf27cbc44de3ccf53be559b', icon: this.icon.name, variant: this.icon.variant, type: this.icon.type, size: 20 }))), h("input", { key: '1b485d4d06d91fad904aaa87a982051d3549589c',
            // id={id}
            value: this.value, name: this.name, type: this.type, onFocus: () => (this.isFocused = true), onBlur: e => {
                this.isFocused = false;
                this.onBlur(e);
            }, class: "input__field", placeholder: this.placeholder, disabled: this.disabled, readOnly: this.readonly, required: this.required, onMouseDown: () => (this.isActive = true), onMouseUp: () => (this.isActive = false), onMouseOut: () => (this.isActive = false), onChange: this.onChange, onInput: this.onInput }), this.error ? (h("span", { class: `input__feedback-icon input__feedback-icon--error ${this.feedbackIconRing ? 'input__feedback-icon--ring' : ''}` })) : this.feedbackIcon ? (h("span", { class: `input__feedback-icon input__feedback-icon--${this.feedbackIconType} ${this.feedbackIconRing ? 'input__feedback-icon--ring' : ''}` }, feedbackIconTypes[this.feedbackIconType])) : null, h("slot", { key: 'a7428ebd28be904b9f9386cf58a8b54ee45836f2', name: "suffix" }), " "), this.helperText && h("dga-helper-text", { key: '3aabb5c06f1fb0ef3c58494197ab2c625a6c6aaa', helperText: this.helperText, helperTextIcon: this.helperTextIcon, error: this.error })));
    }
}, [4, "dga-text-input", {
        "label": [1],
        "placeholder": [1],
        "size": [1],
        "type": [1],
        "variant": [1],
        "error": [4],
        "feedbackIcon": [4, "feedback-icon"],
        "feedbackIconType": [1, "feedback-icon-type"],
        "feedbackIconRing": [4, "feedback-icon-ring"],
        "helperTextIcon": [16],
        "helperText": [1, "helper-text"],
        "icon": [16],
        "disabled": [4],
        "readonly": [4],
        "required": [4],
        "name": [1],
        "value": [1],
        "onChange": [16],
        "onInput": [16],
        "onBlur": [16],
        "isActive": [32],
        "isFocused": [32]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["dga-text-input", "dga-helper-text", "dga-icon", "dga-label"];
    components.forEach(tagName => { switch (tagName) {
        case "dga-text-input":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, DgaTextInput);
            }
            break;
        case "dga-helper-text":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "dga-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "dga-label":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}

export { DgaTextInput as D, defineCustomElement as d };

//# sourceMappingURL=p-a7c64e98.js.map