import { r as registerInstance, h, g as getElement } from './index-148a7577.js';
import { r as randomIdGenerator } from './randomIdGenerator.util-56406f2e.js';
import { l as logger } from './logger.util-ede3c48a.js';
import { _ as _t } from './text-26e02c8d.js';
import { F as FormValidationMessageVariation } from './form-validation-message-variation.enum-bcef8a9d.js';

const formLabelCss = ".sc-digi-form-label-h .digi-form-label.sc-digi-form-label{font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);color:var(--digi--color--text--primary);display:flex;flex-direction:column}.sc-digi-form-label-h .digi-form-label__label--label.sc-digi-form-label{font-weight:var(--digi--typography--label--font-weight--desktop)}.sc-digi-form-label-h .digi-form-label__label--label.sc-digi-form-label,.sc-digi-form-label-h .digi-form-label__label--description.sc-digi-form-label{line-height:var(--digi--typography--label--line-height--desktop);cursor:pointer;display:block}.sc-digi-form-label-h .digi-form-label__label-group.sc-digi-form-label{display:inline-flex;align-items:center;gap:var(--digi--gutter--icon)}.sc-digi-form-label-h .digi-form-label__description.sc-digi-form-label{max-width:var(--digi--paragraph-width--medium);line-height:var(--digi--typography--label-description--line-height--desktop);font-size:var(--digi--typography--label-description--font-size--desktop)}";
const DigiFormLabelStyle0 = formLabelCss;

const FormLabel = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.labelText = undefined;
        this.hasActionSlot = undefined;
        this.afLabel = undefined;
        this.afId = randomIdGenerator('digi-form-label');
        this.afFor = undefined;
        this.afDescription = undefined;
        this.afRequired = undefined;
        this.afAnnounceIfOptional = false;
        this.afRequiredText = _t.required.toLowerCase();
        this.afAnnounceIfOptionalText = _t.optional.toLowerCase();
    }
    componentWillLoad() {
        this.setLabelText();
        this.validateFor();
        this.handleSlotVisibility();
    }
    validateFor() {
        if (this.afFor == null) {
            logger.warn(`digi-form-label must have a for attribute. Please add a for attribute using af-for`, this.hostElement);
        }
    }
    setLabelText() {
        this.labelText = `${this.afLabel} ${this.requiredText}`;
        if (!this.afLabel) {
            logger.warn(`digi-form-label must have a label. Please add a label using af-label`, this.hostElement);
        }
    }
    handleSlotVisibility() {
        this.hasActionSlot = !!this.hostElement.querySelector('[slot="actions"]');
    }
    get requiredText() {
        if (this.afRequired && !this.afAnnounceIfOptional) {
            return this.afRequiredText ? ` (${this.afRequiredText})` : '';
        }
        else if (!this.afRequired && this.afAnnounceIfOptional) {
            return this.afAnnounceIfOptionalText
                ? ` (${this.afAnnounceIfOptionalText})`
                : '';
        }
        else {
            return '';
        }
    }
    render() {
        return (h("div", { key: '4d902817beba8134dc999fa1835dea7c515b219c', class: "digi-form-label" }, h("div", { key: 'd49a36a498fd27ab79b470e481d8014322aade63', class: "digi-form-label__label-group" }, this.afFor && this.afLabel && (h("label", { key: 'e2fa422d53a288ceb44e943d43cf0881e3b01c64', class: "digi-form-label__label", htmlFor: this.afFor, id: this.afId }, h("span", { key: '7e7ce153d2482ecdb5904673766ce2f775acd377', class: "digi-form-label__label--label" }, this.labelText), this.afDescription && (h("span", { key: '56e68644319fbeb1abecb5effd0a0d57e170de85', class: "digi-form-label__label--description" }, this.afDescription)))), this.hasActionSlot && (h("div", { key: '2f1786041eb70e527dfb041f30caceeb036bc134', class: "digi-form-label__actions" }, h("slot", { key: '2b188afa76c11ca3bee6f88c3f119c892c6f81ee', name: "actions" }))))));
    }
    get hostElement() { return getElement(this); }
    static get watchers() { return {
        "afFor": ["validateFor"],
        "afLabel": ["setLabelText"],
        "afRequired": ["setLabelText"],
        "afAnnounceIfOptional": ["setLabelText"]
    }; }
};
FormLabel.style = DigiFormLabelStyle0;

const formValidationMessageCss = ".sc-digi-form-validation-message-h{--digi--form-validation-message--icon-color--success:var(--digi--color--icon--validation--success);--digi--form-validation-message--icon-color--warning:var(--digi--color--icon--validation--warning);--digi--form-validation-message--icon-color--error:var(--digi--color--icon--validation--error)}.sc-digi-form-validation-message-h .digi-form-validation-message.sc-digi-form-validation-message{display:flex;flex-wrap:wrap;align-items:center}.sc-digi-form-validation-message-h .digi-form-validation-message--success.sc-digi-form-validation-message{--ICON-COLOR:var(--digi--form-validation-message--icon-color--success)}.sc-digi-form-validation-message-h .digi-form-validation-message--warning.sc-digi-form-validation-message{--ICON-COLOR:var(--digi--form-validation-message--icon-color--warning)}.sc-digi-form-validation-message-h .digi-form-validation-message--error.sc-digi-form-validation-message{--ICON-COLOR:var(--digi--form-validation-message--icon-color--error)}.sc-digi-form-validation-message-h .digi-form-validation-message__icon.sc-digi-form-validation-message{color:var(--ICON-COLOR);margin-inline-end:var(--digi--gutter--icon)}.sc-digi-form-validation-message-h .digi-form-validation-message__icon.sc-digi-form-validation-message>*.sc-digi-form-validation-message{--digi--icon--width:1.25em;--digi--icon--height:1.25em;--digi--icon--color:var(--ICON-COLOR);display:flex}.sc-digi-form-validation-message-h .digi-form-validation-message__icon.sc-digi-form-validation-message .warning.sc-digi-form-validation-message{top:3px;position:relative}.sc-digi-form-validation-message-h .digi-form-validation-message__text.sc-digi-form-validation-message{flex:1;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--tag--font-size--desktop);color:var(--digi--color--text--primary)}";
const DigiFormValidationMessageStyle0 = formValidationMessageCss;

const FormValidationMessage = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.afVariation = FormValidationMessageVariation.SUCCESS;
    }
    get cssModifiers() {
        return {
            'digi-form-validation-message--success': this.afVariation === FormValidationMessageVariation.SUCCESS,
            'digi-form-validation-message--error': this.afVariation === FormValidationMessageVariation.ERROR,
            'digi-form-validation-message--warning': this.afVariation === FormValidationMessageVariation.WARNING
        };
    }
    get icon() {
        switch (this.afVariation) {
            case FormValidationMessageVariation.SUCCESS:
                return h("digi-icon-validation-success", null);
            case FormValidationMessageVariation.ERROR:
                return h("digi-icon-validation-error", null);
            case FormValidationMessageVariation.WARNING:
                return h("digi-icon-validation-warning", { class: "warning" });
        }
    }
    render() {
        return (h("div", { key: 'b39aa9f7c7e9ec75c7ffd7613953a350129f1689', class: Object.assign({ 'digi-form-validation-message': true }, this.cssModifiers) }, h("div", { key: '2b0507799231c329f600279e9140fc4ab4e09c70', class: "digi-form-validation-message__icon", "aria-hidden": "true" }, this.icon), h("span", { key: '4027b59a97f1ce0fe1d30b12453456ee0a044c06', class: "digi-form-validation-message__text" }, h("slot", { key: 'f115e6f24b60e34eb9b0b6bec5b6cfd2fff639fd' }))));
    }
    get hostElement() { return getElement(this); }
};
FormValidationMessage.style = DigiFormValidationMessageStyle0;

const iconValidationErrorCss = ".sc-digi-icon-validation-error-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-validation-error-h svg.sc-digi-icon-validation-error{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
const DigiIconValidationErrorStyle0 = iconValidationErrorCss;

const IconValidationError = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.afTitle = undefined;
        this.afDesc = undefined;
        this.afSvgAriaHidden = true;
        this.afSvgAriaLabelledby = undefined;
        this.titleId = randomIdGenerator('icontitle');
    }
    render() {
        return (h("svg", { key: 'a3066c8707f6f0a1ed8be127e10e6166578f2584', class: "digi-icon-validation-error", width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
                ? this.afSvgAriaLabelledby
                : this.afTitle
                    ? this.titleId
                    : undefined }, this.afTitle && h("title", { key: '90c9921e691d6a646be443273f2679df4fe02936', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '19a5d97bdacdb14d1ba037b4f1aa85349f5776f8' }, this.afDesc), h("path", { key: '88e2fb895899fb17895bcb5be69a3a238a2948a7', class: "digi-icon-validation-error__shape", d: "M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z", fill: "currentColor", "fill-rule": "nonzero" })));
    }
};
IconValidationError.style = DigiIconValidationErrorStyle0;

const iconValidationSuccessCss = ".sc-digi-icon-validation-success-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-validation-success-h svg.sc-digi-icon-validation-success{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
const DigiIconValidationSuccessStyle0 = iconValidationSuccessCss;

const IconCheckCircle = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.afTitle = undefined;
        this.afDesc = undefined;
        this.afSvgAriaHidden = true;
        this.afSvgAriaLabelledby = undefined;
        this.titleId = randomIdGenerator('icontitle');
    }
    render() {
        return (h("svg", { key: '253c41b3eec2b8cf5d03bb05ca04bb9c8f3ecfba', class: "digi-icon-validation-success", width: "25", height: "25", viewBox: "0 0 25 25", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
                ? this.afSvgAriaLabelledby
                : this.afTitle
                    ? this.titleId
                    : undefined, xmlns: "http://www.w3.org/2000/svg" }, this.afTitle && h("title", { key: '75c7dc872f2b3acd7559a2ca5103a8a9f335d01a', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '1c699244714a8e67204dc3245c09a80f1e222ef4' }, this.afDesc), h("path", { key: '850682e74d826ff323d2a225adf34aed897b256e', class: "digi-icon-validation-success__shape", d: "M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z", fill: "currentColor", "fill-rule": "nonzero" })));
    }
};
IconCheckCircle.style = DigiIconValidationSuccessStyle0;

const iconValidationWarningCss = ".sc-digi-icon-validation-warning-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-validation-warning-h svg.sc-digi-icon-validation-warning{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
const DigiIconValidationWarningStyle0 = iconValidationWarningCss;

const IconValidationWarning = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.afTitle = undefined;
        this.afDesc = undefined;
        this.afSvgAriaHidden = true;
        this.afSvgAriaLabelledby = undefined;
        this.titleId = randomIdGenerator('icontitle');
    }
    render() {
        return (h("div", { key: '4b2915251fcad07985bea41e6a3761b8fdf6cfac' }, h("svg", { key: '2d58830353438155a46bc655a481726f994a9d94', class: "digi-icon-validation-warning", width: "18", height: "18", viewBox: "0 0 18 18", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
                ? this.afSvgAriaLabelledby
                : this.afTitle
                    ? this.titleId
                    : undefined }, this.afTitle && h("title", { key: '89b3cddbab4ed46001074b427118447ca4b03dce', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '437d1bbd833abe5f6781b9ef7a5c6d7838dd49b3' }, this.afDesc), h("g", { key: 'eb54fd247a6fa06b8b3fdd851fbc5b18e641bf77', fill: "none", "fill-rule": "evenodd" }, h("circle", { key: '517f9348cb0cd47b7abeb4000a0d538e75c426c1', cx: "9", cy: "9", r: "6.75", fill: "#333" }), h("path", { key: 'bb860600b4cd0ffc71d702c5ec30559297cdc026', d: "m18 9c0 4.9717-4.0298 9-9 9-4.9702 0-9-4.0283-9-9 0-4.9688 4.0298-9 9-9 4.9702 0 9 4.0312 9 9zm-9 1.8145c-0.92196 0-1.6694 0.7474-1.6694 1.6694 0 0.92196 0.7474 1.6694 1.6694 1.6694s1.6694-0.7474 1.6694-1.6694c0-0.92196-0.7474-1.6694-1.6694-1.6694zm-1.3157-1.065c0.012593 0.23095 0.20355 0.41175 0.43483 0.41175h1.7618c0.23128 0 0.42224-0.1808 0.43483-0.41175l0.2692-4.9355c0.013609-0.24946-0.18501-0.45922-0.43483-0.45922h-2.3002c-0.24982 0-0.4484 0.20976-0.43479 0.45922l0.2692 4.9355z", fill: "#FFE200" })))));
    }
};
IconValidationWarning.style = DigiIconValidationWarningStyle0;

export { FormLabel as digi_form_label, FormValidationMessage as digi_form_validation_message, IconValidationError as digi_icon_validation_error, IconCheckCircle as digi_icon_validation_success, IconValidationWarning as digi_icon_validation_warning };
