{"version":3,"file":"siemens-element-ng-notification-item.mjs","sources":["../../../../projects/element-ng/notification-item/si-notification-item.component.ts","../../../../projects/element-ng/notification-item/si-notification-item.component.html","../../../../projects/element-ng/notification-item/index.ts","../../../../projects/element-ng/notification-item/siemens-element-ng-notification-item.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { CdkMenuTrigger } from '@angular/cdk/menu';\nimport { CommonModule } from '@angular/common';\nimport { booleanAttribute, ChangeDetectionStrategy, Component, inject, input } from '@angular/core';\nimport { ActivatedRoute, RouterModule, type NavigationExtras } from '@angular/router';\nimport { elementOptionsVertical } from '@siemens/element-icons';\nimport { addIcons, SiIconComponent } from '@siemens/element-ng/icon';\nimport { SiMenuFactoryComponent, type MenuItem } from '@siemens/element-ng/menu';\nimport { SiTranslatePipe, TranslatableString } from '@siemens/element-translate-ng/translate';\n\n/**\n * Interface for a router link in a notification item.\n * @param type - The type of the link, always 'router-link'.\n * @param routerLink - The router link to navigate to.\n * @param extras - Optional navigation extras for the router.\n */\nexport interface NotificationItemRouterLink {\n  type: 'router-link';\n  routerLink: string | any[];\n  extras?: NavigationExtras;\n}\n\n/**\n * Interface for a standard link in a notification item.\n * @param type - The type of the link, always 'link'.\n * @param href - The URL to navigate to.\n * @param target - Optional target attribute for the link.\n */\nexport interface NotificationItemLink {\n  type: 'link';\n  href: string;\n  target?: string;\n}\n\n/**\n * Base interface for notification item actions.\n * @param ariaLabel - The ARIA label for accessibility.\n * @param icon - The icon to display for the action.\n */\nexport interface NotificationItemBase {\n  ariaLabel: TranslatableString;\n  icon: string;\n}\n\n/**\n * Interface for an action circle button in a notification item.\n * @param type - The type of the action, always 'action-circle-button'.\n * @param customClass - Optional custom CSS class for styling.\n * @param action - The action to perform when the button is clicked.\n * @deprecated Use NotificationItemActionIconButton instead. This will be removed in a future release.\n */\nexport interface NotificationItemActionCircleButton extends NotificationItemBase {\n  type: 'action-circle-button';\n  customClass?: string;\n  action: (source: this) => void;\n}\n\n/**\n * Interface for an action icon button in a notification item.\n * @param type - The type of the action, always 'action-icon-button'.\n * @param customClass - Optional custom CSS class for styling.\n * @param action - The action to perform when the button is clicked.\n */\nexport interface NotificationItemActionIconButton extends NotificationItemBase {\n  type: 'action-icon-button';\n  customClass?: string;\n  action: (source: this) => void;\n}\n\n/**\n * Interface for a router link with an icon in a notification item.\n * @param type - The type of the link, always 'router-link'.\n * @param routerLink - The router link to navigate to.\n * @param extras - Optional navigation extras for the router.\n */\nexport interface NotificationItemRouterLinkIcon extends NotificationItemBase {\n  type: 'router-link';\n  routerLink: string | any[];\n  extras?: NavigationExtras;\n}\n\n/**\n * Interface for a standard link with an icon in a notification item.\n * @param type - The type of the link, always 'link'.\n * @param href - The URL to navigate to.\n * @param target - Optional target attribute for the link.\n */\nexport interface NotificationItemLinkIcon extends NotificationItemBase {\n  type: 'link';\n  href: string;\n  target?: string;\n}\n\n/**\n * Interface for an action button in a notification item.\n * @param type - The type of the action, always 'action-button'.\n * @param label - The label to display on the button.\n * @param action - The action to perform when the button is clicked.\n */\nexport interface NotificationItemActionButton {\n  type: 'action-button';\n  label: TranslatableString;\n  action: (source: this) => void;\n}\n\n/**\n * Interface for a menu in a notification item.\n * @param type - The type of the action, always 'menu'.\n * @param menuItems - The menu items to display in the menu.\n */\nexport interface NotificationItemMenu {\n  type: 'menu';\n  menuItems: MenuItem[];\n}\n\n/**\n * Union type for quick actions in a notification item.\n */\nexport type NotificationItemQuickAction =\n  | NotificationItemActionCircleButton\n  | NotificationItemActionIconButton\n  | NotificationItemLinkIcon\n  | NotificationItemRouterLinkIcon;\n\n/**\n * Union type for primary actions in a notification item.\n */\nexport type NotificationItemPrimaryAction =\n  | NotificationItemActionCircleButton\n  | NotificationItemActionIconButton\n  | NotificationItemLinkIcon\n  | NotificationItemRouterLinkIcon\n  | NotificationItemMenu\n  | NotificationItemActionButton;\n\n/**\n * This component represents a single notification that can be used within notification\n * centers, popovers, or other containers. It supports various action types including\n * router links, standard links, action buttons, and menus.\n */\n@Component({\n  selector: 'si-notification-item',\n  imports: [\n    SiTranslatePipe,\n    RouterModule,\n    CommonModule,\n    SiMenuFactoryComponent,\n    CdkMenuTrigger,\n    SiIconComponent\n  ],\n  templateUrl: './si-notification-item.component.html',\n  styleUrl: './si-notification-item.component.scss',\n  changeDetection: ChangeDetectionStrategy.Eager\n})\nexport class SiNotificationItemComponent {\n  protected readonly icons = addIcons({ elementOptionsVertical });\n\n  /**\n   * The timestamp of the notification item.\n   */\n  readonly timeStamp = input.required<TranslatableString>();\n  /**\n   * The heading of the notification item.\n   */\n  readonly heading = input.required<TranslatableString>();\n  /**\n   * Optional translatable description.\n   */\n  readonly description = input<TranslatableString>();\n  /**\n   * Unread messages are emphasized with a bolder font.\n   *\n   * @defaultValue false\n   */\n  readonly unread = input(false, { transform: booleanAttribute });\n  /**\n   * Link to the source or relevant information of the notification,\n   * which triggers when clicking on the notification item text area.\n   */\n  readonly itemLink = input<NotificationItemRouterLink | NotificationItemLink>();\n  /**\n   * Actions that are displayed below the text of the notification.\n   */\n  readonly quickActions = input<NotificationItemQuickAction[]>();\n  /**\n   * Action that is displayed on the right side of the notification.\n   */\n  readonly primaryAction = input<NotificationItemPrimaryAction>();\n\n  protected readonly activatedRoute = inject(ActivatedRoute, { optional: true });\n}\n","<div class=\"notification-item px-6 py-5\">\n  <div class=\"notification-item-indicator\">\n    <div>\n      @if (unread()) {\n        <span class=\"dot\"></span>\n      }\n      <ng-content select=\"si-avatar,si-circle-status,si-icon,si-status-icon\" />\n    </div>\n  </div>\n\n  <div class=\"notification-item-content\">\n    @let itemLinkValue = itemLink();\n    @if (itemLinkValue) {\n      @switch (itemLinkValue.type) {\n        @case ('link') {\n          <a [href]=\"itemLinkValue.href\" [target]=\"itemLinkValue.target\">\n            <ng-container *ngTemplateOutlet=\"content\" />\n          </a>\n        }\n        @case ('router-link') {\n          <a\n            [routerLink]=\"itemLinkValue.routerLink\"\n            [queryParams]=\"itemLinkValue.extras?.queryParams\"\n            [queryParamsHandling]=\"itemLinkValue.extras?.queryParamsHandling\"\n            [fragment]=\"itemLinkValue.extras?.fragment\"\n            [state]=\"itemLinkValue.extras?.state\"\n            [relativeTo]=\"itemLinkValue.extras?.relativeTo ?? activatedRoute\"\n            [preserveFragment]=\"itemLinkValue.extras?.preserveFragment\"\n            [skipLocationChange]=\"itemLinkValue.extras?.skipLocationChange\"\n            [replaceUrl]=\"itemLinkValue.extras?.replaceUrl\"\n          >\n            <ng-container *ngTemplateOutlet=\"content\" />\n          </a>\n        }\n      }\n    } @else {\n      <ng-container *ngTemplateOutlet=\"content\" />\n    }\n  </div>\n\n  @let primaryActionValue = primaryAction();\n  @if (primaryActionValue) {\n    <div class=\"notification-item-primary-action\">\n      @if (primaryActionValue.type === 'menu') {\n        <ng-container *ngTemplateOutlet=\"menu; context: { $implicit: primaryActionValue }\" />\n      } @else if (primaryActionValue.type === 'action-button') {\n        <button\n          type=\"button\"\n          class=\"btn btn-tertiary\"\n          (click)=\"primaryActionValue.action(primaryActionValue)\"\n          >{{ primaryActionValue.label | translate }}</button\n        >\n      } @else {\n        <ng-container *ngTemplateOutlet=\"action; context: { $implicit: primaryActionValue }\" />\n      }\n    </div>\n  } @else {\n    <div class=\"notification-item-primary-action\">\n      <ng-content select=\"[action]\" />\n    </div>\n  }\n\n  @let quickActionsValue = quickActions();\n  @if (quickActionsValue) {\n    <div class=\"notification-item-quick-actions\">\n      @for (quickAction of quickActionsValue; track $index) {\n        <ng-container *ngTemplateOutlet=\"action; context: { $implicit: quickAction }\" />\n      }\n    </div>\n  } @else {\n    <div class=\"notification-item-quick-actions\">\n      <ng-content select=\"[quick-actions]\" />\n    </div>\n  }\n</div>\n\n<ng-template #action let-action>\n  @switch (action.type) {\n    @case ('action-circle-button') {\n      <ng-container *ngTemplateOutlet=\"actionButton; context: { $implicit: action }\" />\n    }\n    @case ('action-icon-button') {\n      <ng-container *ngTemplateOutlet=\"actionButton; context: { $implicit: action }\" />\n    }\n    @case ('router-link') {\n      <ng-container *ngTemplateOutlet=\"routerLink; context: { $implicit: action }\" />\n    }\n    @case ('link') {\n      <ng-container *ngTemplateOutlet=\"link; context: { $implicit: action }\" />\n    }\n  }\n</ng-template>\n\n<ng-template #content>\n  <div class=\"d-flex flex-column gap-3 text-primary\">\n    <span class=\"si-body text-secondary\">{{ timeStamp() | translate }}</span>\n    <span [class.si-h5-bold]=\"unread()\" [class.si-h5]=\"!unread()\">{{ heading() | translate }}</span>\n    @if (description()) {\n      <span class=\"si-body\">{{ description() | translate }}</span>\n    }\n    <div class=\"si-body\">\n      <ng-content select=\"[description]\" />\n    </div>\n  </div>\n</ng-template>\n\n<ng-template #actionButton let-action>\n  <button\n    type=\"button\"\n    class=\"btn btn-tertiary-ghost btn-icon\"\n    [attr.aria-label]=\"action.ariaLabel\"\n    (click)=\"action.action(action)\"\n  >\n    <si-icon class=\"icon\" [icon]=\"action.icon\" />\n  </button>\n</ng-template>\n\n<ng-template #routerLink let-action>\n  <a\n    class=\"btn btn-tertiary-ghost p-2 btn-icon\"\n    [routerLink]=\"action.routerLink\"\n    [queryParams]=\"action.extras?.queryParams\"\n    [queryParamsHandling]=\"action.extras?.queryParamsHandling\"\n    [fragment]=\"action.extras?.fragment\"\n    [state]=\"action.extras?.state\"\n    [relativeTo]=\"action.extras?.relativeTo ?? activatedRoute\"\n    [preserveFragment]=\"action.extras?.preserveFragment\"\n    [skipLocationChange]=\"action.extras?.skipLocationChange\"\n    [replaceUrl]=\"action.extras?.replaceUrl\"\n    [attr.aria-label]=\"action.ariaLabel\"\n  >\n    <si-icon class=\"icon\" [icon]=\"action.icon\" />\n  </a>\n</ng-template>\n\n<ng-template #link let-action>\n  <a\n    class=\"btn btn-tertiary-ghost p-2 btn-icon\"\n    [href]=\"action.href\"\n    [target]=\"action.target\"\n    [attr.aria-label]=\"action.ariaLabel\"\n  >\n    <si-icon class=\"icon\" [icon]=\"action.icon\" />\n  </a>\n</ng-template>\n\n<ng-template #menu let-action>\n  <button\n    type=\"button\"\n    class=\"btn btn-tertiary-ghost btn-icon\"\n    [attr.aria-label]=\"heading() + ' dropdown'\"\n    [cdkMenuTriggerFor]=\"actionMenu\"\n  >\n    <si-icon [icon]=\"icons.elementOptionsVertical\" />\n  </button>\n\n  <ng-template #actionMenu>\n    <si-menu-factory [items]=\"action.menuItems\" />\n  </ng-template>\n</ng-template>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-notification-item.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;AAGG;AAuIH;;;;AAIG;MAeU,2BAA2B,CAAA;AACnB,IAAA,KAAK,GAAG,QAAQ,CAAC,EAAE,sBAAsB,EAAE,CAAC;AAE/D;;AAEG;IACM,SAAS,GAAG,KAAK,CAAC,QAAQ;kFAAsB;AACzD;;AAEG;IACM,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAsB;AACvD;;AAEG;AACM,IAAA,WAAW,GAAG,KAAK;+FAAsB;AAClD;;;;AAIG;IACM,MAAM,GAAG,KAAK,CAAC,KAAK,8EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAC/D;;;AAGG;AACM,IAAA,QAAQ,GAAG,KAAK;4FAAqD;AAC9E;;AAEG;AACM,IAAA,YAAY,GAAG,KAAK;gGAAiC;AAC9D;;AAEG;AACM,IAAA,aAAa,GAAG,KAAK;iGAAiC;IAE5C,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;uGAnCnE,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA3B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,2BAA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