{"version":3,"file":"takkion-components-pretty-box.mjs","sources":["../../../libraries/components/pretty-box/pretty-box.component.ts","../../../libraries/components/pretty-box/pretty-box.component.html","../../../libraries/components/pretty-box/index.ts","../../../libraries/components/pretty-box/takkion-components-pretty-box.ts"],"sourcesContent":["import {\n  AfterViewInit,\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  ElementRef,\n  Input,\n  ViewChild,\n  ViewEncapsulation,\n} from '@angular/core';\n\n@Component({\n  selector: 'tak-pretty-box',\n  templateUrl: './pretty-box.component.html',\n  standalone: true,\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TakPrettyBoxModule implements AfterViewInit {\n  @ViewChild('header') header!: ElementRef;\n  @ViewChild('footer') footer!: ElementRef;\n  @ViewChild('scroll') scroll!: ElementRef;\n\n  @Input() calcHeight: string | number = 94;\n  @Input() headerHeightPx: number = 0;\n  @Input() footerHeightPx: number = 0;\n  @Input() encapsulated = true;\n\n  private _hasHeader = false;\n  private _hasFooter = false;\n  private _substractFromHeight = 0;\n\n  constructor(private _cd: ChangeDetectorRef) {}\n\n  public ngAfterViewInit(): void {\n    setTimeout(() => {\n      this._config();\n    }, 100);\n    setTimeout(() => {\n      this._config();\n    }, 2000);\n  }\n\n  public scrollTop(): void {\n    if (this.scroll) this.scroll.nativeElement.scrollTo({ top: 0 });\n  }\n\n  private _config(): void {\n    const header = this.header.nativeElement.querySelector('[tak-pretty-box-header]');\n    const footer = this.footer.nativeElement.querySelector('[tak-pretty-box-footer]');\n\n    this._hasHeader = header ? true : false;\n    this._hasFooter = footer ? true : false;\n\n    if (typeof this.calcHeight === 'number') {\n      const refreshInterval = setInterval(() => {\n        if (this._substractFromHeight === 0) {\n          const headerHeight = this._hasHeader\n            ? !this.headerHeightPx\n              ? this.header.nativeElement.offsetHeight\n              : this.headerHeightPx\n            : 0;\n\n          const footerHeight = this._hasFooter\n            ? !this.footerHeightPx\n              ? this.footer.nativeElement.offsetHeight\n              : this.footerHeightPx\n            : 0;\n\n          this._substractFromHeight = +this.calcHeight + headerHeight + footerHeight;\n        } else {\n          clearInterval(refreshInterval);\n          this._cd.markForCheck();\n        }\n      }, 10);\n    }\n\n    if (!this._hasHeader) this.scroll.nativeElement.classList.add('tak-pretty-box-border-top');\n    if (!this._hasFooter) this.scroll.nativeElement.classList.add('tak-pretty-box-border-bottom');\n\n    this._cd.markForCheck();\n  }\n\n  get minHeightFt(): string {\n    if (typeof this.calcHeight === 'number') return `calc(100vh - ${this._substractFromHeight}px)`;\n    else return this.calcHeight;\n  }\n\n  get hasHeader(): boolean {\n    return this._hasHeader;\n  }\n\n  get hasFooter(): boolean {\n    return this._hasFooter;\n  }\n}\n","<div class=\"{{ encapsulated ? 'container' : '' }}\">\n  <div [class]=\"encapsulated ? 'row' : ''\">\n    <div\n      [class]=\"encapsulated ? 'col-t-12 col-t-md-8 col-t-lg-6 col-t-xxl-4' : ''\"\n      [style]=\"encapsulated ? 'margin: auto' : ''\"\n    >\n      <div class=\"tak-pretty-box--container\">\n        <div\n          #header\n          [hidden]=\"!hasHeader\"\n          class=\"tak-pretty-box--header\"\n          [style]=\"headerHeightPx ? 'height:' + headerHeightPx + 'px' : ''\"\n        >\n          <ng-content select=\"[tak-pretty-box-header]\"></ng-content>\n        </div>\n\n        <div class=\"tak-pretty-box--scroll\" #scroll [style]=\"'height: ' + minHeightFt\">\n          <ng-content select=\"[tak-pretty-box-content]\"></ng-content>\n        </div>\n\n        <div\n          #footer\n          [hidden]=\"!hasFooter\"\n          class=\"tak-pretty-box--footer\"\n          [style]=\"footerHeightPx ? 'height:' + footerHeightPx + 'px' : ''\"\n        >\n          <ng-content select=\"[tak-pretty-box-footer]\"></ng-content>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n","/*\n * Public API Surface of @takkion/components/pretty-box\n */\nexport * from './pretty-box.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAk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