{"version":3,"file":"verben-ng-ui-src-lib-components-notification.mjs","sources":["../../../projects/verben-ng-ui/src/lib/components/notification/notification.module.ts","../../../projects/verben-ng-ui/src/lib/components/notification/notification.component.ts","../../../projects/verben-ng-ui/src/lib/components/notification/notification.component.html","../../../projects/verben-ng-ui/src/lib/components/notification/verben-ng-ui-src-lib-components-notification.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { NotificationComponent } from '.';\nimport { CommonModule } from '@angular/common';\nimport { SvgModule } from 'verben-ng-ui/src/lib/components/svg';\nimport { VerbenaButtonModule } from 'verben-ng-ui/src/lib/verbena-button';\n\n@NgModule({\n  declarations: [NotificationComponent],\n  imports: [CommonModule, SvgModule, VerbenaButtonModule],\n  exports: [NotificationComponent],\n})\nexport class NotificationModule {}\n","import {\n  Component,\n  Input,\n  EventEmitter,\n  Output,\n  OnInit,\n  OnDestroy,\n} from '@angular/core';\nimport { NotificationService } from 'verben-ng-ui/src/lib/services';\nimport {\n  NotificationButton,\n  NotificationOptions,\n} from 'verben-ng-ui/src/lib/models';\nimport { Subscription } from 'rxjs';\n\n@Component({\n  selector: 'verben-notification',\n  templateUrl: './notification.component.html',\n  styleUrl: './notification.component.css',\n})\nexport class NotificationComponent implements OnInit, OnDestroy {\n  @Input() width?: string = '400px';\n  height?: string = '50px';\n  // Look (2026-10-16): close to shadcn / Sonner \"rich colors\" toasts\n  borderRadius: string = '10px';\n  fontSize: string = '14px';\n  fontWeight: string = '500';\n  padding: string = '14px 2.5rem 14px 16px';\n  @Input() content?: string;\n  top: string = '';\n  bottom: string = '';\n  @Input() buttons: NotificationButton[] = [];\n  @Input() timeout: number = 10000;\n  @Input() position: string = 'top-left';\n  transition: string = '0.6s ease-in-out';\n\n  showNotification = false;\n  notificationContent = '';\n  notificationOptions: NotificationOptions | null = null;\n  subscription: Subscription;\n\n  constructor(private notificationService: NotificationService) {\n    this.subscription = new Subscription();\n  }\n\n  ngOnInit() {\n    this.subscription = this.notificationService.notification$.subscribe(\n      (notification) => {\n        if (notification) {\n          this.showNotification = true;\n          this.notificationContent = notification.message;\n          this.notificationOptions = notification.options;\n\n          setTimeout(() => {\n            this.closeNotification();\n          }, this.notificationOptions.timeout);\n        } else {\n          this.showNotification = false;\n        }\n      },\n    );\n  }\n\n  ngOnDestroy() {\n    this.subscription.unsubscribe();\n  }\n\n  closeNotification() {\n    this.showNotification = false;\n    this.notificationService.clearNotification();\n  }\n\n  @Output() buttonClick = new EventEmitter<NotificationButton>();\n  @Output() close = new EventEmitter();\n\n  get notificationStyles() {\n    return {\n      'background-color': this.notificationOptions\n        ? this.notificationOptions.backgroundColor\n        : '',\n      color: this.notificationOptions ? this.notificationOptions.textColor : '',\n      // The toast's colours for its buttons (main = text colour, others = a tint of it)\n      '--vbn-toast-fg': this.notificationOptions?.textColor || 'currentColor',\n      '--vbn-toast-bg': this.notificationOptions?.backgroundColor || 'transparent',\n      '--vbn-toast-soft': 'color-mix(in srgb, var(--vbn-toast-fg) 12%, transparent)',\n      padding: this.padding,\n      'border-radius': this.borderRadius,\n      // --vbn-toast-border: set by the default look (CSS); the tinted ones use their text colour\n      border: '1px solid var(--vbn-toast-border, color-mix(in srgb, currentColor 20%, transparent))',\n      width: this.width,\n      'font-size': this.fontSize,\n      'font-weight': this.fontWeight,\n      display: 'flex',\n      'align-items': 'center',\n      'justify-content': 'space-between',\n      ...this.getPositionStyles(),\n      position: 'fixed',\n      'z-index': '9999',\n      transition: this.transition,\n    };\n  }\n\n  getPositionStyles() {\n    const positions: { [key: string]: any } = {\n      'top-left': {\n        top: this.top || '1rem',\n        left: this.showNotification ? '1rem' : '-100%',\n        transition: 'top 0.5s ease-in-out',\n      },\n      'top-right': {\n        top: this.top || '1rem',\n        right: this.showNotification ? '1rem' : '-100%',\n        transition: 'top 0.5s ease-in-out',\n      },\n      'middle-left': {\n        top: this.top || '45%',\n        left: this.showNotification ? '1rem' : '-100%',\n        transition: 'top 0.5s ease-in-out',\n      },\n      'middle-right': {\n        top: this.top || '45%',\n        right: this.showNotification ? '1rem' : '-100%',\n        transition: 'top 0.5s ease-in-out',\n      },\n      'bottom-left': {\n        bottom: this.bottom || '1rem',\n        left: this.showNotification ? '1rem' : '-100%',\n        transition: 'bottom 0.5s ease-in-out',\n      },\n      'bottom-right': {\n        bottom: this.bottom || '1rem',\n        right: this.showNotification ? '1rem' : '-100%',\n        transition: 'bottom 0.5s ease-in-out',\n      },\n    };\n\n    return positions[this.position] || positions['top-left'];\n  }\n\n  get btnWrapperStyle() {\n    return {\n      display: 'flex',\n      'align-items': 'center',\n      gap: '6px',\n    };\n  }\n\n  get innerWrapperStyles() {\n    return {\n      display: 'flex',\n      'align-items': 'center',\n      gap: '10px',\n    };\n  }\n\n  onButtonClick(button: NotificationButton) {\n    this.buttonClick.emit(button);\n  }\n}\n","<div\n  [ngStyle]=\"notificationStyles\"\n  class=\"mainwrapper\"\n  [attr.data-type]=\"notificationOptions.type\"\n  [class.has-description]=\"!!notificationOptions.description\"\n  [attr.role]=\"notificationOptions.type === 'error' ? 'alert' : 'status'\"\n  *ngIf=\"notificationOptions\"\n>\n  <div class=\"content\" [ngStyle]=\"innerWrapperStyles\">\n    <verben-svg\n      class=\"icon\"\n      *ngIf=\"notificationOptions.iconName\"\n      [icon]=\"notificationOptions.iconName || ''\"\n      [width]=\"notificationOptions.iconWidth || 18\"\n      [height]=\"notificationOptions.iconHeight || 18\"\n      [stroke]=\"notificationOptions.stroke || ''\"\n      [fill]=\"notificationOptions.fill || ''\"\n    ></verben-svg>\n    <div class=\"text\">\n      <p class=\"message\">{{ notificationContent }}</p>\n      <p class=\"description\" *ngIf=\"notificationOptions.description\">{{ notificationOptions.description }}</p>\n    </div>\n  </div>\n\n  <!-- Buttons: the first is the main action (solid), the others are quieter.\n       A button's own bgColor / primarycolor still win. -->\n  <div class=\"side\">\n    <ng-container *ngIf=\"notificationOptions.buttons\">\n      <div [ngStyle]=\"btnWrapperStyle\">\n        <verbena-button\n          *ngFor=\"let button of notificationOptions.buttons; let first = first\"\n          [text]=\"button.text\"\n          [bgColor]=\"button.bgColor || (first ? 'var(--vbn-toast-fg)' : 'var(--vbn-toast-soft)')\"\n          [textColor]=\"button.primarycolor || button.secondarycolor || (first ? 'var(--vbn-toast-bg)' : 'var(--vbn-toast-fg)')\"\n          [border]=\"'0'\"\n          [height]=\"'28px'\"\n          [borderRadius]=\"'6px'\"\n          [pd]=\"'0 10px'\"\n          [fontSize]=\"button.fontSize || '12.5px'\"\n          [fontWeight]=\"button.fontWeight || '600'\"\n          (click)=\"button.callBack && button.callBack()\"\n        ></verbena-button>\n      </div>\n    </ng-container>\n    <ng-container *ngIf=\"!notificationOptions.buttons\">\n      <div [ngStyle]=\"btnWrapperStyle\" *ngIf=\"buttons.length\">\n        <verbena-button\n          *ngFor=\"let button of buttons; let first = first\"\n          [text]=\"button.text\"\n          [bgColor]=\"button.bgColor || (first ? 'var(--vbn-toast-fg)' : 'var(--vbn-toast-soft)')\"\n          [textColor]=\"button.primarycolor || button.secondarycolor || (first ? 'var(--vbn-toast-bg)' : 'var(--vbn-toast-fg)')\"\n          [border]=\"'0'\"\n          [height]=\"'28px'\"\n          [borderRadius]=\"'6px'\"\n          [pd]=\"'0 10px'\"\n          [fontSize]=\"button.fontSize || '12.5px'\"\n          [fontWeight]=\"button.fontWeight || '600'\"\n          (click)=\"onButtonClick(button); button.callBack && button.callBack()\"\n        ></verbena-button>\n      </div>\n    </ng-container>\n  </div>\n\n  <button\n    type=\"button\"\n    class=\"closeSvg\"\n    aria-label=\"Close notification\"\n    title=\"Close\"\n    (click)=\"closeNotification()\"\n  >\n    <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\">\n      <path d=\"M18 6 6 18M6 6l12 12\" />\n    </svg>\n  </button>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAWa,kBAAkB,CAAA;wGAAlB,kBA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