'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7a477838.js');
const randomIdGenerator_util = require('./randomIdGenerator.util-e7f4b6de.js');
const typographyVariation_enum = require('./typography-variation.enum-8fd8bed4.js');
require('./badge-notification-shape.enum-ff802554.js');
require('./badge-status-variation.enum-0a5adc21.js');
require('./code-example-variation.enum-1611825e.js');
require('./form-input-search-variation.enum-e0e025b1.js');
const buttonVariation_enum = require('./button-variation.enum-bc521499.js');
require('./calendar-week-view-heading-level.enum-fd0c841b.js');
require('./code-variation.enum-c4a4e6fd.js');
require('./expandable-accordion-header-level.enum-45483252.js');
require('./expandable-faq-item-variation.enum-89427195.js');
require('./expandable-faq-variation.enum-af923f49.js');
require('./footer-card-variation.enum-99555edc.js');
require('./form-checkbox-variation.enum-d2ca879e.js');
require('./form-file-upload-variation.enum-634cfae8.js');
require('./form-input-type.enum-9c8ee12a.js');
require('./form-input-variation.enum-c750520c.js');
require('./form-select-variation.enum-528c1bf0.js');
require('./form-textarea-variation.enum-9c90d40f.js');
require('./form-validation-message-variation.enum-855ae0be.js');
require('./info-card-multi-type.enum-14746572.js');
require('./info-card-variation.enum-64cef637.js');
require('./layout-block-variation.enum-f6102119.js');
require('./layout-columns-variation.enum-65675649.js');
require('./link-button-variation.enum-137785e3.js');
require('./list-type.enum-aea4d012.js');
require('./loader-skeleton-variation.enum-d52ba55e.js');
require('./loader-spinner-size.enum-db2973f0.js');
require('./logo-variation.enum-607fadb4.js');
require('./media-figure-alignment.enum-3885aba5.js');
require('./navigation-sidebar-variation.enum-1c0c3064.js');
require('./progress-indicator-variation.enum-7cf8e0e4.js');
require('./progress-list-item-variation.enum-90e4c874.js');
require('./progress-list-variation.enum-06d5ce27.js');
require('./progressbar-variation.enum-aff9fa80.js');
require('./quote-image-inner-position.enum-e64e7a6d.js');
require('./table-variation.enum-25df2ad7.js');
require('./tag-media-icon.enum-372563c5.js');
require('./tag-size.enum-387c516c.js');
require('./tools-feedback-banner-type.enum-de373ba0.js');
require('./tools-feedback-rating-variation.enum-2f71e84d.js');
require('./tools-theme-provider.brand.enum-bc855272.js');
require('./typography-heading-jumbo-variation.enum-8677e099.js');
require('./typography-meta-variation.enum-13ac3538.js');
require('./typography-time-variation.enum-bce1d87e.js');
require('./util-breakpoint-observer-breakpoints.enum-e96d3a84.js');

const notificationAlertCss = ".sc-digi-notification-alert-h{--digi--notification-alert--heading--font-weight:var(--digi--typography--heading-3--font-weight--desktop);--digi--notification-alert--heading--font-size:var(--digi--typography--heading-3--font-size--desktop);--digi--notification-alert--heading--font-size--large:var(--digi--typography--heading-3--font-size--desktop-large);--digi--notification-alert--icon--padding--large:var(--digi--gutter--largest);--digi--notification-alert--icon--padding--medium:var(--digi--gutter--largest);--digi--notification-alert--icon--padding--small:var(--digi--gutter--large);--digi--notification-alert--icon--width--large:2.25rem;--digi--notification-alert--icon--width--medium:1.4375rem;--digi--notification-alert--icon--width--small:1.4375rem;--digi--notification-alert--max-width--large:100%;--digi--notification-alert--max-width--medium:31.25rem;--digi--notification-alert--max-width--small:18.75rem;--digi--notification-alert--border--informative:var(--digi--border-width--secondary) solid var(--digi--color--border--sentiment--info);--digi--notification-alert--icon--color--informative:var(--digi--color--icon--secondary);--digi--notification-alert--icon--background--informative:var(--digi--color--background--sentiment--info--primary);--digi--notification-alert--border--success:var(--digi--border-width--secondary) solid var(--digi--color--border--sentiment--success);--digi--notification-alert--icon--color--success:var(--digi--color--icon--secondary);--digi--notification-alert--icon--background--success:var(--digi--color--background--sentiment--success--primary);--digi--notification-alert--border--warning:var(--digi--border-width--secondary) solid var(--digi--color--border--sentiment--warning);--digi--notification-alert--icon--color--warning:var(--digi--color--icon--primary);--digi--notification-alert--icon--background--warning:var(--digi--color--background--sentiment--warning--primary);--digi--notification-alert--border--danger:var(--digi--border-width--secondary) solid var(--digi--color--border--sentiment--error);--digi--notification-alert--icon--color--danger:var(--digi--color--icon--secondary);--digi--notification-alert--icon--background--danger:var(--digi--color--background--sentiment--error--primary)}.sc-digi-notification-alert-h .digi-notification-alert.sc-digi-notification-alert{position:relative;max-width:var(--MAX-WIDTH)}.sc-digi-notification-alert-h .digi-notification-alert--variation-info.sc-digi-notification-alert{--BORDER:var(--digi--notification-alert--border--informative);--ICON--COLOR:var(--digi--notification-alert--icon--color--informative);--ICON--BACKGROUND:var(--digi--notification-alert--icon--background--informative)}.sc-digi-notification-alert-h .digi-notification-alert--variation-success.sc-digi-notification-alert{--BORDER:var(--digi--notification-alert--border--success);--ICON--COLOR:var(--digi--notification-alert--icon--color--success);--ICON--BACKGROUND:var(--digi--notification-alert--icon--background--success)}.sc-digi-notification-alert-h .digi-notification-alert--variation-danger.sc-digi-notification-alert{--BORDER:var(--digi--notification-alert--border--danger);--ICON--COLOR:var(--digi--notification-alert--icon--color--danger);--ICON--BACKGROUND:var(--digi--notification-alert--icon--background--danger)}.sc-digi-notification-alert-h .digi-notification-alert--variation-warning.sc-digi-notification-alert{--BORDER:var(--digi--notification-alert--border--warning);--ICON--COLOR:var(--digi--notification-alert--icon--color--warning);--ICON--BACKGROUND:var(--digi--notification-alert--icon--background--warning)}.sc-digi-notification-alert-h .digi-notification-alert--size-large.sc-digi-notification-alert{--MAX-WIDTH:var(--digi--notification-alert--max-width--large);--ICON--PADDING:var(--digi--notification-alert--icon--padding--large);--ICON--WIDTH:var(--digi--notification-alert--icon--width--large)}.sc-digi-notification-alert-h .digi-notification-alert--size-medium.sc-digi-notification-alert{--MAX-WIDTH:var(--digi--notification-alert--max-width--medium);--ICON--PADDING:var(--digi--notification-alert--icon--padding--medium);--ICON--WIDTH:var(--digi--notification-alert--icon--width--medium)}.sc-digi-notification-alert-h .digi-notification-alert--size-small.sc-digi-notification-alert{--MAX-WIDTH:var(--digi--notification-alert--max-width--small);--ICON--PADDING:var(--digi--notification-alert--icon--padding--small);--ICON--WIDTH:var(--digi--notification-alert--icon--width--small)}.sc-digi-notification-alert-h .digi-notification-alert--size-small.sc-digi-notification-alert .digi-notification-alert__close-button__text.sc-digi-notification-alert{border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sc-digi-notification-alert-h .digi-notification-alert--closeable.sc-digi-notification-alert .digi-notification-alert__wrapper.sc-digi-notification-alert{display:flex;justify-content:space-between;flex-direction:row-reverse}.sc-digi-notification-alert-h .digi-notification-alert--closeable.sc-digi-notification-alert .digi-notification-alert__text.sc-digi-notification-alert{padding-right:0}.sc-digi-notification-alert-h .digi-notification-alert__layout.sc-digi-notification-alert{display:flex;align-items:stretch;gap:0}.sc-digi-notification-alert-h .digi-notification-alert__icon.sc-digi-notification-alert{background:var(--ICON--BACKGROUND);padding:var(--ICON--PADDING);display:flex;align-items:center;justify-content:center;height:100%;box-sizing:border-box}.sc-digi-notification-alert-h .digi-notification-alert__icon.sc-digi-notification-alert>*.sc-digi-notification-alert{--digi--icon--width:var(--ICON--WIDTH);--digi--icon--color:var(--ICON--COLOR)}.sc-digi-notification-alert-h .digi-notification-alert__wrapper.sc-digi-notification-alert{display:flex;border:var(--BORDER);background-color:var(--digi--color--background--primary);border-left:none;height:100%;box-sizing:border-box}.sc-digi-notification-alert-h .digi-notification-alert__text.sc-digi-notification-alert{padding:var(--digi--gutter--largest)}.sc-digi-notification-alert-h .digi-notification-alert__close-button.sc-digi-notification-alert{--digi--button--color--function:var(--digi--color--text--primary);--digi--button--color--function--hover:var(--digi--color--text--primary)}@media screen and (max-width: 47.9375rem){.sc-digi-notification-alert-h .digi-notification-alert__close-button__text.sc-digi-notification-alert{border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}}.sc-digi-notification-alert-h .digi-notification-alert__heading.sc-digi-notification-alert{font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--notification-alert--heading--font-size);font-weight:var(--digi--notification-alert--heading--font-weight);color:var(--digi--color--text--primary);margin:0;display:block}@media (min-width: 61.9375rem){.sc-digi-notification-alert-h .digi-notification-alert__heading.sc-digi-notification-alert{font-size:var(--digi--notification-alert--heading--font-size--large)}}.sc-digi-notification-alert-h .digi-notification-alert__heading.sc-digi-notification-alert:focus{outline:none}.sc-digi-notification-alert-h .digi-notification-alert__content.sc-digi-notification-alert>*.sc-digi-notification-alert{--digi--typography--max-width:var(--MAX-WIDTH);--digi--typography--margin-top--text:var(--digi--gutter--small)}.sc-digi-notification-alert-h .icon-wrapper.sc-digi-notification-alert{align-items:stretch}.sc-digi-notification-alert-h .main-wrapper.sc-digi-notification-alert{flex:1}";
const DigiNotificationAlertStyle0 = notificationAlertCss;

const NotificationAlert = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.afOnClose = index.createEvent(this, "afOnClose", 7);
        this.afOnReady = index.createEvent(this, "afOnReady", 3);
        this.listItems = [];
        this.afHeading = undefined;
        this.afHeadingLevel = typographyVariation_enum.NotificationAlertHeadingLevel.H2;
        this.afSize = typographyVariation_enum.NotificationAlertSize.LARGE;
        this.afVariation = typographyVariation_enum.NotificationAlertVariation.INFO;
        this.afCloseable = false;
        this.afCloseAriaLabel = 'Stäng meddelandet';
        this.afId = randomIdGenerator_util.randomIdGenerator('digi-notification-alert');
    }
    /**
     * Hämtar en referens till rubrikelementet. Bra för att t.ex. sätta fokus programmatiskt.
     * @en Returns a reference to the heading element. Handy for setting focus programmatically.
     */
    async afMGetHeadingElement() {
        return this._heading;
    }
    clickHandler(e) {
        this.afOnClose.emit(e);
    }
    componentDidLoad() {
        this.afOnReady.emit();
    }
    get cssModifiers() {
        return {
            [`digi-notification-alert--size-${this.afSize}`]: !!this.afSize,
            [`digi-notification-alert--variation-${this.afVariation}`]: !!this.afVariation,
            'digi-notification-alert--closeable': this.afCloseable
        };
    }
    get icon() {
        switch (this.afVariation) {
            case typographyVariation_enum.NotificationAlertVariation.SUCCESS:
                return index.h("digi-icon-notification-succes", null);
            case typographyVariation_enum.NotificationAlertVariation.WARNING:
                return index.h("digi-icon-notification-warning", null);
            case typographyVariation_enum.NotificationAlertVariation.DANGER:
                return index.h("digi-icon-notification-error", null);
            default:
                return index.h("digi-icon-notification-info", null);
        }
    }
    render() {
        return (index.h("div", { key: 'dc748e929eed3f3897d2fc2593afbf55ff734cfb', class: Object.assign({ 'digi-notification-alert': true }, this.cssModifiers) }, index.h("div", { key: 'ad1523ca0a2de00319faccf5b728d21d883298d0', class: "digi-notification-alert__layout" }, index.h("div", { key: 'f4bff6c9866930439b75da1b90128cb8e4a0e7b4', class: "icon-wrapper" }, index.h("div", { key: 'fcb244add5f937821abe4ef3d4ba1696c616eff5', class: "digi-notification-alert__icon", slot: "media" }, this.icon)), index.h("div", { key: '7646d9beba96bacd023f2798c993eead395cfe32', class: "main-wrapper" }, index.h("div", { key: '912c0b10d5269da2871ca9841356ccbcb08f9b95', class: "digi-notification-alert__wrapper" }, this.afCloseable && (index.h("digi-button", { key: 'aa9613aaa2f920e9c78eb5604ea8b547479be74a', "af-aria-label": this.afCloseAriaLabel, "af-variation": buttonVariation_enum.ButtonVariation.FUNCTION, onAfOnClick: (e) => this.clickHandler(e), class: "digi-notification-alert__close-button" }, index.h("span", { key: '4a02046286eb6a95b11e4abd952523f6ccb0cce6', class: "digi-notification-alert__close-button__text" }, "St\u00E4ng"), index.h("digi-icon-x", { key: '7586bb5c83b84d75a7f9dba3aacecb42f95116ec', slot: "icon-secondary", "aria-hidden": "true" }))), index.h("div", { key: '16a07407a8a9c4624a17804ddb194ab9e48b81fb', class: "digi-notification-alert__text" }, this.afHeading &&
            this.afSize === typographyVariation_enum.NotificationAlertSize.LARGE && (index.h(this.afHeadingLevel, { key: '00fdd00229e28890d4129015e901ec3e4c09e467', ref: (el) => (this._heading = el), tabindex: "-1", class: "digi-notification-alert__heading" }, this.afHeading)), index.h("div", { key: '3d613250eb00a25ed41624f2e04f619fa4cd8f84', class: "digi-notification-alert__content" }, index.h("digi-typography", { key: '2e205fee8a60564e89b5fbd7a0afefde19bd8ae2', "af-variation": typographyVariation_enum.TypographyVariation.SMALL }, index.h("slot", { key: 'e500c4ff93a2a14e2184375d62b1270642010831' })))))))));
    }
    get hostElement() { return index.getElement(this); }
};
NotificationAlert.style = DigiNotificationAlertStyle0;

exports.digi_notification_alert = NotificationAlert;
