{"version":3,"file":"mn-angular-lib-bottom-sheet.mjs","sources":["../../../projects/mn-angular-lib/bottom-sheet/src/mn-bottom-sheet/mn-bottom-sheet.component.ts","../../../projects/mn-angular-lib/bottom-sheet/src/mn-bottom-sheet/mn-bottom-sheet.component.html","../../../projects/mn-angular-lib/bottom-sheet/public-api.ts","../../../projects/mn-angular-lib/bottom-sheet/mn-angular-lib-bottom-sheet.ts"],"sourcesContent":["import {\n  ChangeDetectorRef,\n  Component,\n  ElementRef,\n  EventEmitter,\n  HostBinding,\n  inject,\n  Input,\n  OnDestroy,\n  OnInit,\n  Output,\n  viewChild,\n} from '@angular/core';\nimport { NgClass } from '@angular/common';\n\n/**\n * A viewport-anchored bottom sheet — the mobile presentation shared by the modal\n * shell and the multi-select dropdown.\n *\n * It owns only the sheet *chrome and gestures*: a bottom-anchored, full-width,\n * rounded-top surface with an optional dimming backdrop and drag grabber, a\n * slide-up entrance, swipe/flick-to-dismiss, and a promise-based slide-down exit.\n * It is deliberately presentational: the body is projected via `<ng-content>`, and\n * dismissal is reported through {@link dismiss} for the host to act on (run a close\n * guard, tear down its overlay, …) rather than being handled here.\n *\n * Positioning is `position: fixed` against the viewport, so the host relocates itself\n * to `document.body` on init and blocks scrolling behind it while open. Both are\n * unconditional: rendering viewport-fixed chrome in place made correctness depend on\n * where a consumer happened to write the tag. A `transform`/`filter`/`contain`\n * ancestor becomes the containing block and pushes the sheet to the middle of the\n * screen — which a *stacked* modal did to its own sheet — and, because `position:\n * fixed` moves where an element paints but not where it sits in the DOM, a gesture on\n * the backdrop still scrolled whichever ancestor was the scroll container.\n *\n * The multi-select and dropdown used to do the relocating themselves; that is why the\n * behaviour reads as new here but is not new to them.\n */\n@Component({\n  selector: 'mn-bottom-sheet',\n  standalone: true,\n  imports: [NgClass],\n  templateUrl: './mn-bottom-sheet.component.html',\n  styleUrl: './mn-bottom-sheet.component.css',\n})\nexport class MnBottomSheet implements OnInit, OnDestroy {\n  /** Tailwind's `sm` breakpoint — at or below this the swipe gesture is armed.\n   *  Kept in step with the same constant in the modal shell and multi-select. */\n  private static readonly SHEET_MAX_WIDTH = 639.98;\n  /** Drag distance (px) past which a release dismisses regardless of speed. */\n  private static readonly SWIPE_DISMISS_THRESHOLD = 150;\n  /** Downward release speed (px/ms) above which a short drag still dismisses — a \"flick\". */\n  private static readonly FLICK_VELOCITY = 0.5;\n  /** Minimum drag distance (px) a flick must cover, so an incidental fast tap never dismisses. */\n  private static readonly FLICK_MIN_DISTANCE = 32;\n  /** Upper bound for the exit wait if no `transitionend` fires (e.g. animation suppressed). */\n  private static readonly CLOSE_FALLBACK_MS = 700;\n  /** Whether to render the dimming backdrop behind the sheet (default: true).\n   *  A host that already paints its own backdrop (the modal shell) sets this false. */\n  @Input() showBackdrop = true;\n  /** Whether to render the drag grabber handle that arms swipe-to-dismiss (default: true). */\n  @Input() showGrabber = true;\n  /** Whether the sheet can be dismissed by the user via swipe/flick or backdrop tap\n   *  (default: true). When false the gestures are inert and the backdrop is non-closing. */\n  @Input() dismissible = true;\n  /** Optional `min-height` floor (px) for the container, so filtering its content\n   *  shorter cannot shrink the sheet mid-interaction. Null leaves it content-sized. */\n  @Input() minHeightPx: number | null = null;\n  /** Cap on the sheet height as a fraction of the viewport, in vh (default: 80). */\n  @Input() maxHeightVh = 80;\n  /** Extra class(es) applied to the sheet container, so a host can attach the hooks\n   *  its own CSS depends on (e.g. the modal shell's `modal-container`). */\n  @Input() containerClass = '';\n  /** Accessible name for the sheet dialog. */\n  @Input() ariaLabel?: string;\n  /** Id of the element that labels this dialog (takes precedence over `ariaLabel`). */\n  @Input() ariaLabelledby?: string;\n  /**\n   * When true, the sheet grows to its `maxHeightVh` while the host app marks the soft\n   * keyboard open (a `.mn-keyboard-open` class on a document ancestor), guaranteeing\n   * scroll room to lift a focused field above an overlaying keyboard. Off by default so\n   * a keyboard opened over an unrelated sheet (a multi-select search) does not resize it.\n   */\n  @Input() growWithKeyboard = false;\n  /**\n   * Optional async gate consulted before a user-initiated dismissal (swipe/flick/backdrop\n   * tap) is committed. Resolving false aborts the dismissal and springs the sheet back —\n   * used by the modal to run its close guard (e.g. an unsaved-changes prompt). A\n   * programmatic {@link startClosing} bypasses it.\n   */\n  @Input() dismissGuard?: () => boolean | Promise<boolean>;\n  /**\n   * Emitted once the user has dismissed the sheet — after the slide-down exit has\n   * finished, so the host can remove the sheet from the DOM without cutting the\n   * animation short. The host decides what dismissal means (close, run a guard, …).\n   */\n  @Output() dismiss = new EventEmitter<void>();\n  /** Current downward drag offset (px) applied to the sheet while swiping. */\n  sheetDragY = 0;\n  /** True while the user is actively dragging the grabber (disables the snap transition). */\n  isDraggingSheet = false;\n  /** True once a dismissal has committed — the sheet glides off-screen via its transition. */\n  isDismissing = false;\n  private readonly cdr = inject(ChangeDetectorRef);\n  private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n  /** The sheet container element, used to measure its height and drive the exit. */\n  private readonly containerRef = viewChild<ElementRef<HTMLElement>>('container');\n  private dragStartY = 0;\n\n  /** The two most recent (y, timestamp) pointer samples, for estimating flick velocity.\n   *  `t` uses the event timestamp (monotonic), so no wall-clock is read. */\n  private lastSample: { y: number; t: number } | null = null;\n  private prevSample: { y: number; t: number } | null = null;\n\n  /** In-flight exit animation, so a swipe-dismiss and a follow-up programmatic\n   *  {@link startClosing} share one glide instead of re-triggering it. */\n  private exitPromise: Promise<void> | null = null;\n\n  /** The host node once moved to `document.body`, so it is only detached if we moved it. */\n  private portalledHost: HTMLElement | null = null;\n\n  /** Blocks scroll gestures aimed at anything behind the sheet, while it is open. */\n  private scrollGuard: ((event: Event) => void) | null = null;\n\n  /** Moves the host out to `document.body` and stops the page behind scrolling. */\n  ngOnInit(): void {\n    if (typeof document === 'undefined') return;\n    const host = this.el.nativeElement;\n    document.body.appendChild(host);\n    this.portalledHost = host;\n    this.lockScroll();\n  }\n\n  /**\n   * Stops pointer scrolling behind the sheet for as long as it is open.\n   *\n   * Cancels the gesture rather than setting `overflow: hidden` on `document.body`: an\n   * app whose scroll container is a layout element (a `<main>`, a drawer body) leaves\n   * `body` unscrollable, so locking it there is a no-op and the page still slides about\n   * under the sheet. Cancelling `wheel` and `touchmove` before anything acts on them\n   * holds regardless of which element does the scrolling.\n   *\n   * Gestures that begin inside the sheet are let through so its own content still\n   * scrolls; `overscroll-behavior: contain` keeps those from chaining out at the ends.\n   *\n   * Pointer input only. Page Down and the arrows still reach the page behind when focus\n   * is left there — closing that needs either a key filter or moving focus into the\n   * sheet, and neither belongs in this change.\n   */\n  private lockScroll(): void {\n    const guard = (event: Event): void => {\n      const target = event.target as Node | null;\n      const container = this.containerRef()?.nativeElement;\n      if (container && target && container.contains(target)) return;\n      // Only cancellable events can be stopped; a passive listener elsewhere in the\n      // chain would otherwise log a console error for a no-op preventDefault.\n      if (event.cancelable) event.preventDefault();\n    };\n    // Capture phase, so the gesture is cancelled before any scroller sees it.\n    document.addEventListener('wheel', guard, { capture: true, passive: false });\n    document.addEventListener('touchmove', guard, { capture: true, passive: false });\n    this.scrollGuard = guard;\n  }\n\n  /** Releases the scroll guard. Idempotent. */\n  private unlockScroll(): void {\n    if (!this.scrollGuard) return;\n    document.removeEventListener('wheel', this.scrollGuard, { capture: true });\n    document.removeEventListener('touchmove', this.scrollGuard, { capture: true });\n    this.scrollGuard = null;\n  }\n\n  /**\n   * Detaches the relocated host.\n   *\n   * Angular tears a view down by removing the nodes it created from their parent; a\n   * host we moved to `body` is no longer among the parent's children, so without\n   * this the sheet would outlive the view that declared it.\n   */\n  ngOnDestroy(): void {\n    this.unlockScroll();\n    this.portalledHost?.remove();\n    this.portalledHost = null;\n  }\n\n  @HostBinding('class') get hostClasses(): string {\n    return (\n      `mn-bottom-sheet${this.isDismissing ? ' is-dismissing' : ''}` +\n      `${this.growWithKeyboard ? ' grow-with-keyboard' : ''}`\n    );\n  }\n\n  /** Whether the viewport is currently narrow enough for the sheet to accept a swipe. */\n  private get isNarrow(): boolean {\n    return typeof window === 'undefined' || window.innerWidth <= MnBottomSheet.SHEET_MAX_WIDTH;\n  }\n\n  onSheetPointerDown(event: PointerEvent): void {\n    if (!this.dismissible || !this.isNarrow) return;\n    // Don't hijack drags that begin on an interactive control inside the sheet.\n    if ((event.target as HTMLElement).closest('button, input, textarea, select, a')) return;\n    this.isDraggingSheet = true;\n    this.dragStartY = event.clientY;\n    // Seed the velocity window so a fast flick that releases on the first move still measures.\n    this.lastSample = { y: event.clientY, t: event.timeStamp };\n    this.prevSample = this.lastSample;\n    (event.target as HTMLElement).setPointerCapture(event.pointerId);\n  }\n\n  onSheetPointerMove(event: PointerEvent): void {\n    if (!this.isDraggingSheet) return;\n    // Only track downward movement.\n    this.sheetDragY = Math.max(0, event.clientY - this.dragStartY);\n    this.prevSample = this.lastSample;\n    this.lastSample = { y: event.clientY, t: event.timeStamp };\n  }\n\n  onSheetPointerUp(): void {\n    if (!this.isDraggingSheet) return;\n    this.isDraggingSheet = false;\n\n    if (this.shouldDismiss()) {\n      void this.attemptDismiss();\n    } else {\n      this.snapBack();\n    }\n\n    this.lastSample = null;\n    this.prevSample = null;\n  }\n\n  onBackdropClick(): void {\n    void this.attemptDismiss();\n  }\n\n  /**\n   * Plays the slide-down exit and resolves once it has finished. Exposed so a host that\n   * dismisses the sheet programmatically (not via a gesture) can await the same exit\n   * before tearing the sheet down. Idempotent: a swipe-dismiss already in flight and a\n   * subsequent programmatic close share the one glide rather than restarting it.\n   */\n  startClosing(): Promise<void> {\n    return this.playExit();\n  }\n\n  /**\n   * Runs the optional {@link dismissGuard}, then either commits the dismissal (glide out\n   * + emit) or springs the sheet back if the guard rejects. A non-dismissible sheet never\n   * gets here from a gesture, but the guard is still short-circuited defensively.\n   */\n  private async attemptDismiss(): Promise<void> {\n    if (!this.dismissible) return;\n    if (this.dismissGuard) {\n      const allowed = await this.dismissGuard();\n      if (!allowed) {\n        this.snapBack();\n        this.cdr.detectChanges();\n        return;\n      }\n    }\n    this.commitDismiss();\n  }\n\n  /** Whether the release should dismiss: a long-enough drag OR a fast downward flick. */\n  private shouldDismiss(): boolean {\n    if (this.sheetDragY > MnBottomSheet.SWIPE_DISMISS_THRESHOLD) {\n      return true;\n    }\n    return (\n      this.releaseVelocity() > MnBottomSheet.FLICK_VELOCITY &&\n      this.sheetDragY > MnBottomSheet.FLICK_MIN_DISTANCE\n    );\n  }\n\n  /** Downward release speed (px/ms) from the last two pointer samples; 0 when unusable. */\n  private releaseVelocity(): number {\n    if (!this.lastSample || !this.prevSample) return 0;\n    const dt = this.lastSample.t - this.prevSample.t;\n    if (dt <= 0) return 0;\n    return (this.lastSample.y - this.prevSample.y) / dt;\n  }\n\n  /** Springs the sheet back to its resting position after a drag that didn't dismiss. */\n  private snapBack(): void {\n    this.sheetDragY = 0;\n  }\n\n  /**\n   * Commits a dismissal: glides the sheet the rest of the way off-screen, then emits\n   * {@link dismiss} once the exit animation settles. Continuing the gesture (rather than\n   * snapping back to 0 first) keeps a swipe feeling like one unbroken motion.\n   */\n  private commitDismiss(): void {\n    void this.playExit().then(() => this.dismiss.emit());\n  }\n\n  /** Commits the exit animation exactly once and returns the shared in-flight promise.\n   *  Short-circuits under reduced motion and falls back to a timeout if no event fires. */\n  private playExit(): Promise<void> {\n    if (this.exitPromise) return this.exitPromise;\n    this.isDismissing = true;\n    this.sheetDragY = window.innerHeight;\n    this.cdr.detectChanges();\n    this.exitPromise = this.awaitExit();\n    return this.exitPromise;\n  }\n\n  /** Waits for the container's exit transition to end, with a reduced-motion short-circuit\n   *  and a fallback timeout so it always resolves. */\n  private awaitExit(): Promise<void> {\n    return new Promise((resolve) => {\n      if (this.prefersReducedMotion()) {\n        resolve();\n        return;\n      }\n      const container =\n        this.containerRef()?.nativeElement ??\n        this.el.nativeElement.querySelector<HTMLElement>('.mn-sheet-container');\n      if (!container) {\n        resolve();\n        return;\n      }\n      let settled = false;\n      const done = (event?: Event): void => {\n        // Ignore end events bubbling up from descendant transitions.\n        if (event && event.target !== container) return;\n        if (settled) return;\n        settled = true;\n        container.removeEventListener('transitionend', done);\n        clearTimeout(fallback);\n        resolve();\n      };\n      container.addEventListener('transitionend', done);\n      const fallback = setTimeout(done, MnBottomSheet.CLOSE_FALLBACK_MS);\n    });\n  }\n\n  private prefersReducedMotion(): boolean {\n    return (\n      typeof window !== 'undefined' &&\n      typeof window.matchMedia === 'function' &&\n      window.matchMedia('(prefers-reduced-motion: reduce)').matches\n    );\n  }\n}\n","@if (showBackdrop) {\n  <!-- Dims the page behind the sheet. Tapping it dismisses when the sheet is dismissible. -->\n    <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n  <div (click)=\"onBackdropClick()\" class=\"mn-sheet-backdrop fixed inset-0 z-9998 bg-black/40\"></div>\n}\n\n<div\n  #container\n  [attr.aria-label]=\"ariaLabelledby ? null : (ariaLabel || null)\"\n  [attr.aria-labelledby]=\"ariaLabelledby || null\"\n  [class.sheet-dragging]=\"isDraggingSheet\"\n  [ngClass]=\"containerClass\"\n  [style.--mn-sheet-max]=\"maxHeightVh + 'vh'\"\n  [style.max-height.vh]=\"maxHeightVh\"\n  [style.min-height.px]=\"minHeightPx\"\n  [style.transform]=\"sheetDragY ? 'translateY(' + sheetDragY + 'px)' : null\"\n  aria-modal=\"true\"\n  class=\"mn-sheet-container fixed inset-x-0 bottom-0 z-9999 flex flex-col bg-base-100 border-t border-base-300 rounded-t-2xl shadow-lg\"\n  role=\"dialog\"\n  tabindex=\"-1\"\n>\n  @if (showGrabber) {\n    <!-- Drag handle for swipe-to-dismiss. The gesture is armed on the whole handle;\n         drags starting on a control inside the projected content are ignored. -->\n    <div\n      (pointercancel)=\"onSheetPointerUp()\"\n      (pointerdown)=\"onSheetPointerDown($event)\"\n      (pointermove)=\"onSheetPointerMove($event)\"\n      (pointerup)=\"onSheetPointerUp()\"\n      class=\"flex justify-center pt-2 pb-1 touch-none cursor-grab shrink-0\"\n    >\n      <div class=\"h-1.5 w-10 rounded-full bg-base-300\"></div>\n    </div>\n  }\n\n  <ng-content></ng-content>\n</div>\n","/**\n * Public API of the `mn-angular-lib/bottom-sheet` entry point: the bottom sheet.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/mn-bottom-sheet';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAeA;;;;;;;;;;;;;;;;;;;;;;AAsBG;MAQU,aAAa,CAAA;AACxB;AAC+E;AACvE,IAAA,OAAgB,eAAe,GAAG,MAAM;;AAExC,IAAA,OAAgB,uBAAuB,GAAG,GAAG;;AAE7C,IAAA,OAAgB,cAAc,GAAG,GAAG;;AAEpC,IAAA,OAAgB,kBAAkB,GAAG,EAAE;;AAEvC,IAAA,OAAgB,iBAAiB,GAAG,GAAG;AAC/C;AACqF;IAC5E,YAAY,GAAG,IAAI;;IAEnB,WAAW,GAAG,IAAI;AAC3B;AAC0F;IACjF,WAAW,GAAG,IAAI;AAC3B;AACqF;IAC5E,WAAW,GAAkB,IAAI;;IAEjC,WAAW,GAAG,EAAE;AACzB;AACyE;IAChE,cAAc,GAAG,EAAE;;AAEnB,IAAA,SAAS;;AAET,IAAA,cAAc;AACvB;;;;;AAKG;IACM,gBAAgB,GAAG,KAAK;AACjC;;;;;AAKG;AACM,IAAA,YAAY;AACrB;;;;AAIG;AACO,IAAA,OAAO,GAAG,IAAI,YAAY,EAAQ;;IAE5C,UAAU,GAAG,CAAC;;IAEd,eAAe,GAAG,KAAK;;IAEvB,YAAY,GAAG,KAAK;AACH,IAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC/B,IAAA,EAAE,GAAG,MAAM,CAA0B,UAAU,CAAC;;IAEhD,YAAY,GAAG,SAAS,CAA0B,WAAW;qFAAC;IACvE,UAAU,GAAG,CAAC;AAEtB;AAC0E;IAClE,UAAU,GAAoC,IAAI;IAClD,UAAU,GAAoC,IAAI;AAE1D;AACwE;IAChE,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