{"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 { Subscription } from 'rxjs';\n\ninterface Button {\n  text: string;\n  bgColor?: string;\n  primarycolor?: string;\n  secondarycolor?: string;\n  fontSize?: string;\n  fontWeight?: string;\n}\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  borderRadius: string = '15px';\n  fontSize: string = '20px';\n  fontWeight: string = '700';\n  padding: string = '10px 2.5rem 10px 1.5rem';\n  @Input() content?: string;\n  top: string = '';\n  bottom: string = '';\n  @Input() buttons: Button[] = [];\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: any = {};\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<Button>();\n  @Output() close = new EventEmitter();\n\n  get notificationStyles() {\n    return {\n      'background-color': this.notificationOptions.backgroundColor,\n      color: this.notificationOptions.textColor,\n      padding: this.padding,\n      'border-radius': this.borderRadius,\n      border: '1px solid 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: '0.2rem',\n    };\n  }\n\n  get innerWrapperStyles() {\n    return {\n      display: 'flex',\n      'align-items': 'center',\n      gap: '1.5rem',\n    };\n  }\n\n  onButtonClick(button: Button) {\n    this.buttonClick.emit(button);\n  }\n}\n","<div \n[ngStyle]=\"notificationStyles\"\nclass=\"mainwrapper\"\n>\n  <div [ngStyle]=\"innerWrapperStyles\">\n    <verben-svg\n      [icon]=\"notificationOptions.iconName\"\n      [width]=\"notificationOptions.iconWidth\"\n      [height]=\"notificationOptions.iconHeight\"\n      [stroke]=\"notificationOptions.stroke\"\n      [fill]=\"notificationOptions.fill\"\n    ></verben-svg>\n        <p>{{ notificationContent }}</p>\n  </div>\n  <div>\n    <div [ngStyle]=\"btnWrapperStyle\" *ngIf=\"buttons.length\">\n    <verbena-button\n    *ngFor=\"let button of buttons\"\n    [text]=\"button.text\"\n    [bgColor]=\"button.bgColor\"\n    [textColor]=\"button.primarycolor || button.secondarycolor\"\n    [borderRadius]=\"'8px'\"\n    [pd]=\"'0px 8px'\"\n    [fontSize]=\"'14px'\"\n    (click)=\"onButtonClick(button)\"\n  ></verbena-button>\n    </div>\n    <verben-svg\n    class=\"closeSvg\"\n    [icon]=\"'close'\"\n    [size]=\"'sm'\"\n    [stroke]=\"'grey'\"\n    (click) = \"closeNotification()\"\n  ></verben-svg>\n  </div>\n</div>\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAWa,kBAAkB,CAAA;wGAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;yGAAlB,kBAAkB,EAAA,YAAA,EAAA,CAJd,qBAAqB,CAC1B,EAAA,OAAA,EAAA,CAAA,YAAY,EAAE,SAAS,EAAE,mBAAmB,CAAA,EAAA,OAAA,EAAA,CAC5C,qBAAqB,CAAA,EAAA,CAAA,CAAA;A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