import { r as registerInstance, c as createEvent, h, g as getElement } from './index-148a7577.js';
import { r as randomIdGenerator } from './randomIdGenerator.util-56406f2e.js';
import { s as NotificationAlertHeadingLevel, t as NotificationAlertSize, u as NotificationAlertVariation, y as TypographyVariation } from './typography-variation.enum-531cdf64.js';
import './badge-notification-shape.enum-e15a6245.js';
import './badge-status-variation.enum-8d6370ff.js';
import './code-example-variation.enum-e656d235.js';
import './form-input-search-variation.enum-6d8dc10a.js';
import { B as ButtonVariation } from './button-variation.enum-94fffdd6.js';
import './calendar-week-view-heading-level.enum-6774297c.js';
import './code-variation.enum-1eee7c7a.js';
import './expandable-accordion-header-level.enum-85681e2f.js';
import './expandable-faq-item-variation.enum-a8cb225b.js';
import './expandable-faq-variation.enum-6934c367.js';
import './footer-card-variation.enum-cc732148.js';
import './form-checkbox-variation.enum-83e906fc.js';
import './form-file-upload-variation.enum-9c49ec5e.js';
import './form-input-type.enum-3da3db27.js';
import './form-input-variation.enum-64d9450f.js';
import './form-select-variation.enum-f2f6098d.js';
import './form-textarea-variation.enum-05017e8e.js';
import './form-validation-message-variation.enum-bcef8a9d.js';
import './info-card-multi-type.enum-07ee124f.js';
import './info-card-variation.enum-2ccc52c1.js';
import './layout-block-variation.enum-b7a20db4.js';
import './layout-columns-variation.enum-34f7754e.js';
import './link-button-variation.enum-84d4976f.js';
import './list-type.enum-fbb331ad.js';
import './loader-skeleton-variation.enum-f9f867b4.js';
import './loader-spinner-size.enum-0b246fa0.js';
import './logo-variation.enum-5b68b79f.js';
import './media-figure-alignment.enum-a1d36567.js';
import './navigation-sidebar-variation.enum-8fead764.js';
import './progress-indicator-variation.enum-b12ba50a.js';
import './progress-list-item-variation.enum-384b9a3a.js';
import './progress-list-variation.enum-300bd89d.js';
import './progressbar-variation.enum-40adaab4.js';
import './quote-image-inner-position.enum-8e9b1e65.js';
import './table-variation.enum-dd9366b6.js';
import './tag-media-icon.enum-fefa191c.js';
import './tag-size.enum-403e0cd8.js';
import './tools-feedback-banner-type.enum-74b4e580.js';
import './tools-feedback-rating-variation.enum-29058ff2.js';
import './tools-theme-provider.brand.enum-8c5a98c9.js';
import './typography-heading-jumbo-variation.enum-eb737f1b.js';
import './typography-meta-variation.enum-1f7c2878.js';
import './typography-time-variation.enum-34c830ef.js';
import './util-breakpoint-observer-breakpoints.enum-6d004731.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) {
        registerInstance(this, hostRef);
        this.afOnClose = createEvent(this, "afOnClose", 7);
        this.afOnReady = createEvent(this, "afOnReady", 3);
        this.listItems = [];
        this.afHeading = undefined;
        this.afHeadingLevel = NotificationAlertHeadingLevel.H2;
        this.afSize = NotificationAlertSize.LARGE;
        this.afVariation = NotificationAlertVariation.INFO;
        this.afCloseable = false;
        this.afCloseAriaLabel = 'Stäng meddelandet';
        this.afId = 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 NotificationAlertVariation.SUCCESS:
                return h("digi-icon-notification-succes", null);
            case NotificationAlertVariation.WARNING:
                return h("digi-icon-notification-warning", null);
            case NotificationAlertVariation.DANGER:
                return h("digi-icon-notification-error", null);
            default:
                return h("digi-icon-notification-info", null);
        }
    }
    render() {
        return (h("div", { key: 'a65e377eef21711500336dffce094f7b40f35ce4', class: Object.assign({ 'digi-notification-alert': true }, this.cssModifiers) }, h("div", { key: 'a9a876baf7de65aa8eb93d5137c9059f93344d0a', class: "digi-notification-alert__layout" }, h("div", { key: '07193a4975b0f7f4f90423b36ac94b56d211c4e0', class: "icon-wrapper" }, h("div", { key: '66b386e44e4efb140964441afbaec022cc0d39ec', class: "digi-notification-alert__icon", slot: "media" }, this.icon)), h("div", { key: '3ae5fe83e801949034abef041510eb135a59f13b', class: "main-wrapper" }, h("div", { key: '3bd030aae0bbe614f6d3b5d60ede4eedfe94e199', class: "digi-notification-alert__wrapper" }, this.afCloseable && (h("digi-button", { key: 'b9378b953d4c075539cc6b8d523a52418633b3bc', "af-aria-label": this.afCloseAriaLabel, "af-variation": ButtonVariation.FUNCTION, onAfOnClick: (e) => this.clickHandler(e), class: "digi-notification-alert__close-button" }, h("span", { key: '491e27b98a6311c6a946a0c087b2312dd02bf0de', class: "digi-notification-alert__close-button__text" }, "St\u00E4ng"), h("digi-icon-x", { key: '6aba84a687b5fab08c1086a03628a3be7c9e9a30', slot: "icon-secondary", "aria-hidden": "true" }))), h("div", { key: '124516eb32cce95d50019522e808ebe0e0ccc5f8', class: "digi-notification-alert__text" }, this.afHeading &&
            this.afSize === NotificationAlertSize.LARGE && (h(this.afHeadingLevel, { key: '201565155f6d59df45b5127ce99bc7b65972d303', ref: (el) => (this._heading = el), tabindex: "-1", class: "digi-notification-alert__heading" }, this.afHeading)), h("div", { key: 'f5dc3c6c2f150b3ce472903955a4b2eae65e7f21', class: "digi-notification-alert__content" }, h("digi-typography", { key: 'e32223d898eabb4b2798e780548e6bff3fbfaf38', "af-variation": TypographyVariation.SMALL }, h("slot", { key: '7188bfa5ddbbe94832968dc9a1ae0bbd2c668e06' })))))))));
    }
    get hostElement() { return getElement(this); }
};
NotificationAlert.style = DigiNotificationAlertStyle0;

export { NotificationAlert as digi_notification_alert };
