{"version":3,"file":"babybeet-angular-anchored-floating-box.mjs","sources":["../../../projects/angular-anchored-floating-box/src/lib/utils.ts","../../../projects/angular-anchored-floating-box/src/lib/anchored-floating-box.component.ts","../../../projects/angular-anchored-floating-box/src/lib/anchored-floating-box.component.html","../../../projects/angular-anchored-floating-box/src/lib/anchored-floating-box-ref.ts","../../../projects/angular-anchored-floating-box/src/lib/anchored-floating-box.service.ts","../../../projects/angular-anchored-floating-box/src/babybeet-angular-anchored-floating-box.ts"],"sourcesContent":["import { fromEvent, Observable } from 'rxjs';\nimport { debounceTime, filter, map } from 'rxjs/operators';\n\nexport function isMobile() {\n  return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);\n}\n\nexport interface ResizeEvent {\n  height: number;\n  resizeFactor: number;\n  width: number;\n}\n\nexport function viewportVerticalSizeChanges(): Observable<ResizeEvent> {\n  let previousVisibleViewportBoundingBox = document.body.getBoundingClientRect();\n\n  return fromEvent(window, 'resize').pipe(\n    debounceTime(250),\n    map(() => {\n      const currentVisibleViewportBoundingBox = document.body.getBoundingClientRect();\n      const deltaWidth = Math.abs(currentVisibleViewportBoundingBox.width - previousVisibleViewportBoundingBox.width);\n      const deltaHeight = Math.abs(\n        currentVisibleViewportBoundingBox.height - previousVisibleViewportBoundingBox.height\n      );\n\n      previousVisibleViewportBoundingBox = currentVisibleViewportBoundingBox;\n\n      if (deltaHeight > deltaWidth) {\n        return {\n          height: currentVisibleViewportBoundingBox.height,\n          resizeFactor: currentVisibleViewportBoundingBox.height / previousVisibleViewportBoundingBox.height,\n          width: currentVisibleViewportBoundingBox.width\n        };\n      }\n\n      return null;\n    }),\n    filter(event => event !== null)\n  ) as unknown as Observable<ResizeEvent>;\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n  ChangeDetectionStrategy,\n  Component,\n  ElementRef,\n  Host,\n  HostListener,\n  Inject,\n  OnDestroy,\n  OnInit,\n  PLATFORM_ID,\n  signal,\n  ViewEncapsulation\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\n\nimport { Theme } from './theme';\nimport { isMobile, viewportVerticalSizeChanges } from './utils';\n\n@Component({\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n  // eslint-disable-next-line @angular-eslint/no-host-metadata-property\n  host: {\n    '[class]': '\"lc-anchored-floating-box-container \" + (_className() ? \" \" + _className() : \"\")'\n  },\n  selector: 'lc-anchored-floating-box',\n  styleUrls: ['./anchored-floating-box.component.scss'],\n  templateUrl: './anchored-floating-box.component.html'\n})\nexport class AnchoredFloatingBoxComponent implements OnInit, OnDestroy {\n  protected readonly _className = signal<string | undefined>(undefined);\n  protected readonly _theme = signal<Theme>('light');\n\n  /**\n   * The target at which the floating is placed\n   */\n  private _anchor!: Element;\n\n  /**\n   * Are we entering into viewport or leaving?\n   */\n  private _enter = false;\n\n  /**\n   * The DOM element for this floating box\n   */\n  private _floatingBox!: HTMLElement;\n\n  private _viewportVerticalSizeChangeSubscription?: Subscription;\n  private _afterClosedListeners?: Array<() => void>;\n  private _afterOpenedListeners?: Array<() => void>;\n\n  constructor(\n    @Host() private readonly _host: ElementRef<HTMLElement>,\n    @Inject(PLATFORM_ID) private readonly _platformId: object\n  ) {}\n\n  ngOnInit() {\n    if (!isPlatformBrowser(this._platformId)) {\n      return;\n    }\n\n    if (isMobile()) {\n      this._viewportVerticalSizeChangeSubscription = viewportVerticalSizeChanges().subscribe({\n        next: event => {\n          if (this._floatingBox) {\n            const floatingBoxBoundingBox = this._floatingBox.getBoundingClientRect();\n\n            /**\n             * If this floating box's bottom is larger than the newly resized viewport's height,\n             * then we want to shift this floating box up by the difference between its bottom's value\n             * and the new viewport's height value, otherwise, we want to place the floating at the bottom\n             * of the anchor\n             */\n            if (floatingBoxBoundingBox.bottom >= event.height) {\n              if (event.resizeFactor < 1) {\n                this._floatingBox.style.top = `${event.height - floatingBoxBoundingBox.height - 60}px`;\n              }\n            } else {\n              this._showBottom();\n            }\n          }\n        }\n      });\n    }\n  }\n\n  ngOnDestroy() {\n    this._viewportVerticalSizeChangeSubscription?.unsubscribe();\n\n    this._afterClosedListeners = undefined;\n    this._afterOpenedListeners = undefined;\n  }\n\n  @HostListener('click', ['$event'])\n  protected _onPreventClickEventFromBubbling(event: Event) {\n    event.stopPropagation();\n  }\n\n  setClassName(className: string) {\n    this._className.set(className);\n  }\n\n  setTheme(theme: Theme) {\n    this._theme.set(theme);\n  }\n\n  /**\n   * Close this anchored floating box\n   */\n  close() {\n    this._enter = false;\n    this._host.nativeElement.classList.add('leave');\n  }\n\n  addAfterClosedListener(listener: () => void) {\n    if (!Array.isArray(this._afterClosedListeners)) {\n      this._afterClosedListeners = [];\n    }\n\n    this._afterClosedListeners.push(listener);\n  }\n\n  addAfterOpenedListener(listener: () => void) {\n    if (!Array.isArray(this._afterOpenedListeners)) {\n      this._afterOpenedListeners = [];\n    }\n\n    this._afterOpenedListeners.push(listener);\n  }\n\n  /**\n   * Open a floating box anchored at `anchor`\n   *\n   * @param anchor The target at which to place this anchored floating box\n   * @param content The body content to show\n   */\n  open(anchor: Element, content: Element) {\n    this._floatingBox = this._host.nativeElement.querySelector('.lc-anchored-floating-box') as HTMLElement;\n    this._anchor = anchor;\n    this._floatingBox.querySelector('.lc-anchored-floating-box__content')?.appendChild(content);\n    this._showBottom();\n  }\n\n  private _showBottom() {\n    setTimeout(() => {\n      const floatingBoxBoundingBox = this._floatingBox.getBoundingClientRect();\n      const anchorBoundingBox = this._anchor.getBoundingClientRect();\n      const arrowHeight = 15;\n      const spaceBetweenArrowAndAnchor = 10;\n      // The floating box will be placed centered horizontally with the anchor.\n      const floatingBoxLeft = anchorBoundingBox.left + (anchorBoundingBox.width - floatingBoxBoundingBox.width) / 2;\n      let floatingBoxTop = anchorBoundingBox.bottom + spaceBetweenArrowAndAnchor;\n      const isOverflowingBottomEdgeOfViewport =\n        floatingBoxTop + arrowHeight + floatingBoxBoundingBox.height + spaceBetweenArrowAndAnchor >= window.innerHeight;\n\n      /**\n       * If the floating box overflows the bottom of the viewport, we want to shift the floating box\n       * to the top of the anchor, but if this shifting causes the floating box to overflow\n       * the top of the viewport which is when `floatingBoxTop` is negative, then we want\n       * to limit the height of the floating box to the distance between the anchor's top\n       * position minus some spacing.\n       */\n      if (isOverflowingBottomEdgeOfViewport) {\n        floatingBoxTop = anchorBoundingBox.top - floatingBoxBoundingBox.height - spaceBetweenArrowAndAnchor;\n\n        if (floatingBoxTop < 0) {\n          const newFloatingBoxHeight = anchorBoundingBox.top - spaceBetweenArrowAndAnchor * 1.5;\n\n          this._floatingBox.style.height = `${newFloatingBoxHeight}px`;\n          floatingBoxTop = spaceBetweenArrowAndAnchor / 2;\n        }\n\n        this._floatingBox.classList.remove('bottom');\n        this._floatingBox.classList.add('top');\n      } else {\n        /**\n         * If the floating box overflows the bottom edge of viewport, we want to shrink\n         * its height by the amount of overflowing distance and some spacing.\n         */\n        const effectiveFloatingBoxBottom = floatingBoxTop + floatingBoxBoundingBox.height;\n        const differenceBetweenFloatingBoxBottomAndViewportBottom = effectiveFloatingBoxBottom - window.innerHeight;\n\n        if (differenceBetweenFloatingBoxBottomAndViewportBottom > 0) {\n          const newFloatingBoxHeight =\n            floatingBoxBoundingBox.height -\n            differenceBetweenFloatingBoxBottomAndViewportBottom -\n            spaceBetweenArrowAndAnchor / 2;\n          this._floatingBox.style.height = `${newFloatingBoxHeight}px`;\n        }\n      }\n\n      const horizontalDifference =\n        this._calculateRightEdgeOverflowingDistance(floatingBoxLeft, floatingBoxBoundingBox.width) ||\n        this._calculateLeftEdgeOverflowingDistance(floatingBoxLeft);\n\n      this._floatingBox.style.left = `${floatingBoxLeft - horizontalDifference}px`;\n      this._floatingBox.style.top = `${floatingBoxTop}px`;\n\n      this._floatingBox.classList.add('visible');\n\n      this._enter = true;\n      this._host.nativeElement.classList.add('enter');\n    });\n  }\n\n  /**\n   * Returns a value greater than 0 for the overflowing distance\n   * if floating box overflows the right edge of the screen, 0 otherwise\n   */\n  private _calculateRightEdgeOverflowingDistance(left: number, width: number) {\n    const spacing = 5;\n    const difference = left + width - window.innerWidth + spacing;\n\n    if (difference > spacing) {\n      (this._floatingBox.querySelector('.lc-anchored-floating-box__arrow') as HTMLElement).style.left =\n        `calc(50% + ${difference}px)`;\n\n      return difference;\n    }\n\n    return 0;\n  }\n\n  /**\n   * Returns a value greater than 0 for the overflowing distance\n   * if floating box overflows the left edge of the screen, 0 otherwise\n   */\n  private _calculateLeftEdgeOverflowingDistance(left: number) {\n    if (left < 0) {\n      const spacing = 5;\n      const newLeft = `calc(50% - ${Math.abs(left) + spacing}px)`;\n\n      (this._floatingBox.querySelector('.lc-anchored-floating-box__arrow') as HTMLElement).style.left = newLeft;\n\n      return left - spacing;\n    }\n\n    return 0;\n  }\n\n  @HostListener('window:keyup', ['$event'])\n  protected _onCloseWhenEscapeKeyIsPressed(event: KeyboardEvent) {\n    if (event.key === 'Escape') {\n      this.close();\n    }\n  }\n\n  @HostListener('window:resize')\n  protected _onWindowResize() {\n    setTimeout(() => this._showBottom(), 250);\n  }\n\n  protected _onBackdropClick() {\n    this.close();\n  }\n\n  /**\n   * @private To be used by template\n   */\n  protected _onAnimationDone() {\n    if (!this._enter) {\n      this._afterClosedListeners?.forEach(listener => listener());\n    } else {\n      this._afterOpenedListeners?.forEach(listener => listener());\n    }\n  }\n}\n","<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<div\n    class=\"lc-anchored-floating-box__backdrop\"\n    (click)=\"_onBackdropClick()\"></div>\n<div\n    class=\"lc-anchored-floating-box bottom\"\n    [class]=\"_theme()\"\n    (animationend)=\"_onAnimationDone()\">\n    <div class=\"lc-anchored-floating-box__arrow\"></div>\n    <div class=\"lc-anchored-floating-box__content\"></div>\n</div>\n","import { AnchoredFloatingBoxComponent } from './anchored-floating-box.component';\n\n/**\n * A reference to the opened anchored floating box that can be used to\n * close it, or to add the listeners to be invoked depending on\n * whether the floating box is opened or closed.\n */\nexport class AnchoredFloatingBoxRef {\n  constructor(private readonly _instance: AnchoredFloatingBoxComponent) {}\n\n  /**\n   * Close this anchored floating box only.\n   */\n  close() {\n    this._instance.close();\n  }\n\n  /**\n   * Add a callback to be invoked after the floating box is closed.\n   */\n  addAfterClosedListener(listener: () => void) {\n    this._instance.addAfterClosedListener(listener);\n  }\n\n  /**\n   * Add a callback to be invoked after the floating box is opened.\n   */\n  addAfterOpenedListener(listener: () => void) {\n    this._instance.addAfterOpenedListener(listener);\n  }\n}\n","import { ApplicationRef, createComponent, Injectable, TemplateRef } from '@angular/core';\n\nimport { AnchoredFloatingBoxComponent } from './anchored-floating-box.component';\nimport { AnchoredFloatingBoxConfiguration } from './anchored-floating-box-configuration';\nimport { AnchoredFloatingBoxRef } from './anchored-floating-box-ref';\nimport { Theme } from './theme';\n\n/**\n * This class allows to show a floating box anchored at an element.\n * See {@see AnchoredFloatingBoxConfiguration} for the different\n * options to configure the floating box.\n */\n@Injectable({\n  providedIn: 'root'\n})\nexport class AnchoredFloatingBoxService {\n  private static _defaultTheme: Theme = 'light';\n\n  constructor(private readonly _applicationRef: ApplicationRef) {}\n\n  /**\n   * Set the default theme that will be used for all floating boxes created in the future.\n   *\n   * @param theme The new theme to be used as the default.\n   */\n  static setDefaultTheme(theme: Theme) {\n    AnchoredFloatingBoxService._defaultTheme = theme;\n  }\n\n  /**\n   * Open a new floating box with a configuration object specified by `configuration`. This service\n   * supports rendering [`TemplateRef`](https://angular.io/api/core/TemplateRef) as well as any\n   * [`@Component`](https://angular.io/api/core/Component) class.\n   *\n   * @param configuration The configuration object for the anchored floating box.\n   *\n   * @returns A ref object used to interact with the created floating box.\n   */\n  open(configuration: AnchoredFloatingBoxConfiguration): AnchoredFloatingBoxRef {\n    const floatingBoxComponentRef = createComponent(AnchoredFloatingBoxComponent, {\n      environmentInjector: this._applicationRef.injector\n    });\n    const floatingBoxRef = new AnchoredFloatingBoxRef(floatingBoxComponentRef.instance);\n    const createdContent = this._createContent(configuration);\n\n    floatingBoxRef.addAfterClosedListener(() => {\n      this._applicationRef.detachView(floatingBoxComponentRef.hostView);\n      floatingBoxComponentRef.destroy();\n      createdContent.ref.destroy();\n    });\n\n    if (configuration.className) {\n      floatingBoxComponentRef.instance.setClassName(configuration.className);\n    }\n\n    floatingBoxComponentRef.instance.setTheme(configuration.theme || AnchoredFloatingBoxService._defaultTheme);\n\n    floatingBoxComponentRef.instance.open(configuration.anchor, createdContent.rootNode);\n\n    this._applicationRef.attachView(floatingBoxComponentRef.hostView);\n\n    document.body.appendChild(floatingBoxComponentRef.location.nativeElement);\n\n    return floatingBoxRef;\n  }\n\n  private _createContent(configuration: AnchoredFloatingBoxConfiguration) {\n    if (configuration.content instanceof TemplateRef) {\n      const embeddedView = configuration.content.createEmbeddedView(configuration.context || {});\n\n      this._applicationRef.attachView(embeddedView);\n\n      return {\n        ref: embeddedView,\n        /**\n         * If the markups inside the provided template ref aren't being wrapped inside\n         * a containing DOM element, then there will be multiple root nodes, in this case,\n         * we want to add them all as the content by appending them to a document fragment\n         */\n        rootNode: embeddedView.rootNodes.reduce((fragment, next) => {\n          fragment.appendChild(next);\n\n          return fragment;\n        }, document.createDocumentFragment())\n      };\n    }\n\n    const componentRef = createComponent(configuration.content, { environmentInjector: this._applicationRef.injector });\n\n    this._applicationRef.attachView(componentRef.hostView);\n\n    return {\n      ref: componentRef,\n      rootNode: componentRef.location.nativeElement as Element\n    };\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;SAGgB,QAAQ,GAAA;IACtB,OAAO,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC/D,CAAC;SAQe,2BAA2B,GAAA;IACzC,IAAI,kCAAkC,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;AAE/E,IAAA,OAAO,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,CACrC,YAAY,CAAC,GAA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