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: '0714a446215f218b8cc5449a318090a7e15de36e', class: "digi-form-label" }, h("div", { key: '290f19411233736a2741ccff9f95a328f0181513', class: "digi-form-label__label-group" }, this.afFor && this.afLabel && (h("label", { key: '9c990f78e47ee4bc1de6cc750cea54f8eb763033', class: "digi-form-label__label", htmlFor: this.afFor, id: this.afId }, h("span", { key: '22a428a427bb72921dd9b2487f2fb97844db541f', class: "digi-form-label__label--label" }, this.labelText), this.afDescription && (h("span", { key: 'd13261b4e0525e5fd680032cd625c579d8037302', class: "digi-form-label__label--description" }, this.afDescription)))), this.hasActionSlot && (h("div", { key: '198faa5a754472ca76e2e84edf38f6ea1280b067', class: "digi-form-label__actions" }, h("slot", { key: '0066fc1f5cab5b72c2971e50cb8f0b1736d24ec7', 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: '397e813bc6d40303d92437bfa1e4552fc92b980b', class: Object.assign({ 'digi-form-validation-message': true }, this.cssModifiers) }, h("div", { key: 'b2e87b27cfce83f7f7c868f4233a7b912b54473f', class: "digi-form-validation-message__icon", "aria-hidden": "true" }, this.icon), h("span", { key: '62442c92ad270e486f1a28d5a51a9a734d334a85', class: "digi-form-validation-message__text" }, h("slot", { key: '42ea340b45c74cc1003544677712087268809ae4' }))));
    }
    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: 'daaa2f68dbf788e719060c10491d4c92a6615d23', 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: 'b328f5e8a2b4b0efc6bf92ea54f0a520ef6e4220', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: '1d01416bb7e7b7fe5176233b0541fd6ed2b2b260' }, this.afDesc), h("path", { key: '643a69ff433972ef69a5984ad61453bb03c7de28', 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: 'de30d92503ad57205ef5fdfca08e1884159710bd', 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: '2996a565b482407e22a56ac8c028fbb019425f72', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: 'fa1fa2974bc270a80434803c864502998ded704e' }, this.afDesc), h("path", { key: 'c4aea6e544ba403a7511ec45b9395b6181a78453', 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: 'fb9af02a7037ff74e21b20d20540849014be7e9d' }, h("svg", { key: 'ba50e2905cf6af29794d07558a60042d37af5930', 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: 'c693a8a9ea27ec82bac429fd570ed9c3b128647c', id: this.titleId }, this.afTitle), this.afDesc && h("desc", { key: 'd16f8833d2732fc5cec73efa78bd858240300ac9' }, this.afDesc), h("g", { key: '7f7cf95fecf1a5273cf896fd92f2088586dc035a', fill: "none", "fill-rule": "evenodd" }, h("circle", { key: '4151cf12c89e97f4a4982e07257e873749d82763', cx: "9", cy: "9", r: "6.75", fill: "#333" }), h("path", { key: 'ebc8a1eac31217eda5c65ad6e172e86753a4d1b4', 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 };
