import { r as registerInstance, h, a as getElement, c as createEvent } from './index-PqnYwNKt.js';
import { d as detectFramework, t as trackComponent } from './framework-detection-DcmcuUOA.js';
import { i as isNestedInIfxComponent } from './dom-utils-Bw2fh5LT.js';
import { c as classNames } from './index-Bt32KzDW.js';
import './_commonjsHelpers-B85MJLTf.js';

const spinnerCss = ":host{display:inline-block}.spinner{position:relative;width:40px;height:40px}.spinner.s{width:24px;height:24px}.border{box-sizing:border-box;position:absolute;width:100%;height:100%;border:4px solid transparent;border-top-color:#0A8276;border-left-color:#0A8276;border-right-color:#0A8276;border-top-left-radius:1px;border-top-right-radius:1px;border-radius:50%;animation:spin 2s linear infinite}.border.inverted{border-top-color:#FFFFFF;border-left-color:#FFFFFF;border-right-color:#FFFFFF}.semiconductor{width:100%;height:100%;animation:spin 2s linear infinite}.semiconductor svg{fill:#0A8276}.semiconductor.inverted svg{fill:#FFFFFF}.semiconductor.s svg{width:24px;height:24px}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";

const Spinner = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.inverted = false;
    }
    async componentDidLoad() {
        if (!isNestedInIfxComponent(this.el)) {
            const framework = detectFramework();
            trackComponent('ifx-spinner', await framework);
        }
    }
    render() {
        return (h("div", { key: 'cc004121aece9c9d878009544ec63946defe23e3', "aria-label": "spinner indicating a loading process", class: this.getClassNames() }, h("div", { key: 'a77498b0116f948131159f9d3bd28dc78d456e1d', class: `${this.variant !== 'brand' ? 'border' : ""} ${this.inverted ? 'inverted' : ""}` }), this.variant === 'brand'
            && h("div", { key: '909838ef79786f180e3f4686b5e36b8bf8b1db2b', class: `semiconductor ${this.inverted ? 'inverted' : ""} ${this.getSizeClass()}` }, h("svg", { key: 'be04483727a5450e8e8283445493b25e856d359c', width: '40', height: '40', viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'a971c7f05bd8cf7513566fbe6ca6839bb2334178', id: "spinner/conductor" }, h("path", { key: '1d57b418a7a66ff1898cda4e1485d63f6090ccc5', id: "Vector", d: "M38.75 18.75C39.4375 18.75 40 19.3125 40 20C40 20.6875 39.4409 21.25 38.75 21.25H35V26.25H38.75C39.4375 26.25 40 26.8125 40 27.5C40 28.1875 39.4409 28.75 38.75 28.75H35V30C35 32.7617 32.7617 35 30 35H28.75V38.75C28.75 39.4409 28.1875 40 27.5 40C26.8125 40 26.25 39.4409 26.25 38.75V35H21.25V38.75C21.25 39.4409 20.6875 40 20 40C19.3125 40 18.75 39.4409 18.75 38.75V35H13.75V38.75C13.75 39.4409 13.1875 40 12.5 40C11.8125 40 11.25 39.4409 11.25 38.75V35H10C7.23828 35 5 32.7617 5 30V28.75H1.25C0.559062 28.75 0 28.1875 0 27.5C0 26.8125 0.559062 26.25 1.25 26.25H5V21.25H1.25C0.559062 21.25 0 20.6875 0 20C0 19.3125 0.559062 18.75 1.25 18.75H5V13.75H1.25C0.559062 13.75 0 13.1875 0 12.5C0 11.8125 0.559062 11.25 1.25 11.25H5V10C5 7.23828 7.23828 5 10 5H11.25V1.25C11.25 0.5625 11.8125 0 12.5 0C13.1875 0 13.75 0.559063 13.75 1.25V5H18.75V1.25C18.75 0.559063 19.3091 0 20 0C20.6909 0 21.25 0.559063 21.25 1.25V5H26.25V1.25C26.25 0.559063 26.8091 0 27.5 0C28.1909 0 28.75 0.559063 28.75 1.25V5H30C32.7617 5 35 7.23828 35 10V11.25H38.75C39.4409 11.25 40 11.8091 40 12.5C40 13.1909 39.4409 13.75 38.75 13.75H35V18.75H38.75ZM32.5 10C32.5 8.62188 31.3781 7.5 30 7.5H10C8.62187 7.5 7.5 8.62188 7.5 10V30C7.5 31.3781 8.62187 32.5 10 32.5H30C31.3781 32.5 32.5 31.3781 32.5 30V10Z" }))))));
    }
    getSizeClass() {
        return `${this.size}` === "s"
            ? "s"
            : "";
    }
    getClassNames() {
        return classNames('spinner', this.size && `spinner ${this.getSizeClass()}`);
    }
    get el() { return getElement(this); }
};
Spinner.style = spinnerCss;

const textFieldCss = ":root{--ifx-font-family:\"Source Sans 3\", \"Arial, sans-serif\"}:host{display:flex}.textInput__container{display:flex;flex-direction:column;align-items:flex-start;padding:0px;width:100%;flex:none;order:0;align-self:stretch;flex-grow:0;font-family:var(--ifx-font-family)}.textInput__container .delete-icon{position:absolute;right:16px}.textInput__container:not(.readonly,.disabled) .delete-icon:hover{cursor:pointer}.textInput__container.disabled:not(.readonly) #text-field{color:#FFFFFF}.textInput__container.disabled:not(.readonly) .delete-icon{color:#FFFFFF}.textInput__container.disabled:not(.readonly) .textInput__top-wrapper label{color:#BFBBBB}.textInput__container.disabled:not(.readonly) .textInput__top-wrapper .required{color:#BFBBBB}.textInput__container.disabled:not(.readonly) .textInput__bottom-wrapper input{border:1px solid #BFBBBB;background-color:#BFBBBB}.textInput__container.disabled:not(.readonly) .textInput__bottom-wrapper input::placeholder{font-size:1rem;color:#FFFFFF}.textInput__container .textInput__top-wrapper{display:flex;flex-direction:row;align-items:flex-start;padding:0px;gap:4px;flex:none;order:0;align-self:stretch;flex-grow:0}.textInput__container .textInput__top-wrapper label{font-style:normal;font-weight:400;font-size:1rem;line-height:1.5rem;display:flex;align-items:center;color:#1D1D1D;flex:none;order:0;flex-grow:0}.textInput__container .textInput__top-wrapper label .optional-required{margin-left:4px}.textInput__container .textInput__top-wrapper label .optional{margin-left:4px}.textInput__container .textInput__top-wrapper label .required{color:#575352;margin-left:4px}.textInput__container .textInput__top-wrapper label .required.error{color:#CD002F}.textInput__container .input-container{position:relative;display:flex;align-items:center;width:100%}.textInput__container .textInput__bottom-wrapper{flex-grow:1;position:relative;display:flex;flex-direction:column;align-items:flex-start;padding:0px;gap:4px;flex:none;order:1;align-self:stretch;flex-grow:0}.textInput__container .textInput__bottom-wrapper input{width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:center;padding:8px 16px;gap:8px;height:40px;background-color:#FFFFFF;color:#1D1D1D;font-family:var(--ifx-font-family);font-size:1rem;line-height:1.5rem;border:1px solid #8D8786;border-radius:1px;flex:none;order:0;align-self:stretch;flex-grow:0;text-overflow:ellipsis}.textInput__container .textInput__bottom-wrapper input.input-s{height:36px;font-size:0.875rem;line-height:1.25rem}.textInput__container .textInput__bottom-wrapper input.input-s::placeholder{font-size:1rem;line-height:1.25rem}.textInput__container .textInput__bottom-wrapper input.icon{padding-left:40px}.textInput__container .textInput__bottom-wrapper input.error{border:1px solid #CD002F}.textInput__container .textInput__bottom-wrapper input.error:focus{outline:none}.textInput__container .textInput__bottom-wrapper input.readonly{border:none;border-radius:var(--borderRadius-12, 1px);border-bottom:1px solid var(--color-engineering-300, #bfbbbb);background:var(--color-base-white, #fff);padding-left:0}.textInput__container .textInput__bottom-wrapper input.readonly::placeholder{color:#1D1D1D}.textInput__container .textInput__bottom-wrapper input.success{border:1px solid #4CA460}.textInput__container .textInput__bottom-wrapper input.success:focus{outline:none}.textInput__container .textInput__bottom-wrapper input:focus:not(.error,.success):not(.readonly){outline:none;border:1px solid #0A8276}.textInput__container .textInput__bottom-wrapper input.readonly:focus,.textInput__container .textInput__bottom-wrapper input[readonly]:focus{outline:none;box-shadow:none;border:none;border-bottom:1px solid var(--color-engineering-300, #bfbbbb)}.textInput__container .textInput__bottom-wrapper input:hover:not(:disabled,:focus,.error,.success):not(.readonly){border:1px solid #575352}.textInput__container .textInput__bottom-wrapper .input-icon{position:absolute;top:50%;transform:translateY(-50%);left:16px;transition:0.3s;color:#8D8786}.textInput__container .textInput__bottom-wrapper .textInput__bottom-wrapper-caption{font-style:normal;font-weight:400;font-size:0.75rem;line-height:1rem;color:#1D1D1D;flex:none;order:1;align-self:stretch;flex-grow:0}.textInput__container .textInput__bottom-wrapper .textInput__bottom-wrapper-caption.error{color:#CD002F}.textInput__container .textInput__bottom-wrapper .textInput__bottom-wrapper-caption.disabled{color:#BFBBBB}";

const TextField = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.ifxInput = createEvent(this, "ifxInput", 7);
        if (hostRef.$hostElement$["s-ei"]) {
            this.internals = hostRef.$hostElement$["s-ei"];
        }
        else {
            this.internals = hostRef.$hostElement$.attachInternals();
            hostRef.$hostElement$["s-ei"] = this.internals;
        }
        this.placeholder = 'Placeholder';
        this.value = '';
        this.error = false;
        this.label = '';
        this.icon = '';
        this.caption = '';
        this.size = 'm';
        this.required = false;
        this.success = false;
        this.disabled = false;
        this.readOnly = false;
        this.showDeleteIcon = false;
        this.autocomplete = 'on';
        this.type = 'text';
        this.internalId = 'text-field';
    }
    valueWatcher(newValue) {
        if (newValue !== this.inputElement.value) {
            this.inputElement.value = newValue;
        }
    }
    async reset() {
        this.value = '';
        this.inputElement.value = '';
    }
    handleDeleteContent() {
        if (!this.disabled && !this.readOnly) {
            this.reset();
            this.ifxInput.emit(this.value);
        }
    }
    handleInput() {
        const query = this.inputElement.value;
        this.value = query;
        //this.internals.setFormValue(query) // update form value
        this.ifxInput.emit(this.value);
    }
    handleTypeProp() {
        this.internalType = this.type === 'text' || this.type === 'password' ? this.type : 'text';
    }
    // formResetCallback() {
    //   this.internals.setValidity({});
    //   this.internals.setFormValue("");
    // }
    componentWillLoad() {
        this.handleTypeProp();
    }
    async componentDidLoad() {
        if (!isNestedInIfxComponent(this.el)) {
            const framework = detectFramework();
            trackComponent('ifx-text-field', await framework);
        }
    }
    render() {
        return (h("div", { key: 'a917d45a2d28dc3afa2245a3f7db8f92100e803f', "aria-label": "a text field for user input", "aria-value": this.value, "aria-disabled": this.disabled, class: `textInput__container ${this.readOnly ? 'readonly' : ''} ${this.disabled && !this.error ? 'disabled' : ''}` }, h("div", { key: '15b5d674af480f32d219d90794eb4261c10bca70', class: "textInput__top-wrapper" }, this.label && (h("label", { key: '834bbcdc1ae575bf295fcb3ff090009a534dced2', htmlFor: this.internalId }, h("span", { key: 'b74c69e9f6eb1ea78200c5427f17450bda198397' }, this.label), this.required && h("span", { key: '0cc00c23127a60a2afacf86023e7d48f28566dcc', class: `required ${this.error && !this.readOnly ? 'error' : ''}` }, "*")))), h("div", { key: 'f180ab759ba95135282ca2c1e42073c29be5d9a1', class: "textInput__bottom-wrapper" }, h("div", { key: '8d6ba00fe8bc7cb166703c66c103ac0654f9cea9', class: "input-container" }, this.icon && h("ifx-icon", { key: '535ad98edec74b9753e58152cf83d8d92b4c9d02', class: "input-icon", icon: this.icon }), h("input", { key: '4c39d6864c7f66020750cacd78b39ab4e69d7140', ref: el => (this.inputElement = el), disabled: this.disabled && !this.error, autocomplete: this.autocomplete, type: this.internalType, id: this.internalId, value: this.value, onInput: () => this.handleInput(), placeholder: this.placeholder, readonly: this.readOnly, maxlength: this.maxlength, class: `${this.icon ? 'icon' : ''}
                ${this.error ? 'error' : ''} 
                ${this.readOnly ? 'readonly' : ''} 
              ${this.size === 's' ? 'input-s' : ''}
              ${this.success ? 'success' : ''}` }), this.showDeleteIcon && this.value && h("ifx-icon", { key: '43eecaee672420f84274bd7e0b22bc01aef78e4f', class: "delete-icon", icon: "cRemove16", onClick: () => this.handleDeleteContent() })), this.caption && (h("div", { key: '401614f455974256964365eb7f6e79cdf903ea8f', class: `textInput__bottom-wrapper-caption ${this.error && !this.readOnly ? 'error' : ''} ${this.disabled && !this.readOnly && !this.error ? 'disabled' : ''}` }, this.caption)))));
    }
    get el() { return getElement(this); }
    static get watchers() { return {
        "value": ["valueWatcher"]
    }; }
};
TextField.style = textFieldCss;

export { Spinner as ifx_spinner, TextField as ifx_text_field };
//# sourceMappingURL=ifx-spinner.ifx-text-field.entry.js.map

//# sourceMappingURL=ifx-spinner_2.entry.js.map