UNPKG

@ncstate/sat-popover

Version:
1 lines 66.8 kB
{"version":3,"file":"ncstate-sat-popover.mjs","sources":["../../../src/lib/popover/popover.animations.ts","../../../src/lib/popover/types.ts","../../../src/lib/popover/popover.errors.ts","../../../src/lib/popover/popover-anchoring.service.ts","../../../src/lib/popover/tokens.ts","../../../src/lib/popover/popover.component.ts","../../../src/lib/popover/popover.component.html","../../../src/lib/popover/popover-hover.directive.ts","../../../src/lib/popover/popover.module.ts","../../../src/lib/ncstate-sat-popover.ts"],"sourcesContent":["import { trigger, state, style, animate, transition, AnimationTriggerMetadata } from '@angular/animations';\n\nexport const transformPopover: AnimationTriggerMetadata = trigger('transformPopover', [\n state('enter', style({ opacity: 1, transform: 'scale(1)' }), { params: { startAtScale: 0.3 } }),\n state('void, exit', style({ opacity: 0, transform: 'scale({{endAtScale}})' }), { params: { endAtScale: 0.5 } }),\n transition('* => enter', [\n style({ opacity: 0, transform: 'scale({{endAtScale}})' }),\n animate('{{openTransition}}', style({ opacity: 1, transform: 'scale(1)' }))\n ]),\n transition('* => void, * => exit', [\n animate('{{closeTransition}}', style({ opacity: 0, transform: 'scale({{endAtScale}})' }))\n ])\n]);\n","export type SatPopoverScrollStrategy = 'noop' | 'block' | 'reposition' | 'close';\nexport const VALID_SCROLL: SatPopoverScrollStrategy[] = ['noop', 'block', 'reposition', 'close'];\n\nexport type SatPopoverHorizontalAlign = 'before' | 'start' | 'center' | 'end' | 'after';\nexport const VALID_HORIZ_ALIGN: SatPopoverHorizontalAlign[] = ['before', 'start', 'center', 'end', 'after'];\n\nexport type SatPopoverVerticalAlign = 'above' | 'start' | 'center' | 'end' | 'below';\nexport const VALID_VERT_ALIGN: SatPopoverVerticalAlign[] = ['above', 'start', 'center', 'end', 'below'];\n\nexport interface SatPopoverOpenOptions {\n /**\n * Whether the popover should return focus to the previously focused element after\n * closing. Defaults to true.\n */\n restoreFocus?: boolean;\n\n /** Whether the first focusable element should be focused on open. Defaults to true. */\n autoFocus?: boolean;\n}\n","import { VALID_HORIZ_ALIGN, VALID_VERT_ALIGN, VALID_SCROLL } from './types';\n\nexport function getUnanchoredPopoverError(): Error {\n return Error('SatPopover does not have an anchor.');\n}\n\nexport function getInvalidPopoverAnchorError(): Error {\n return Error('SatPopover#anchor must be an instance of SatPopoverAnchor, ElementRef, or HTMLElement.');\n}\n\nexport function getInvalidPopoverError(): Error {\n return Error('SatPopoverAnchor#satPopoverAnchor must be an instance of SatPopover.');\n}\n\nexport function getInvalidSatPopoverAnchorError(): Error {\n return Error(\n `SatPopoverAnchor must be associated with a ` +\n `SatPopover component. ` +\n `Examples: <sat-popover [anchor]=\"satPopoverAnchorTemplateRef\"> or ` +\n `<button satPopoverAnchor [satPopoverAnchor]=\"satPopoverTemplateRef\">`\n );\n}\n\nexport function getInvalidHorizontalAlignError(alignment): Error {\n return Error(generateGenericError('horizontalAlign/xAlign', alignment, VALID_HORIZ_ALIGN));\n}\n\nexport function getInvalidVerticalAlignError(alignment): Error {\n return Error(generateGenericError('verticalAlign/yAlign', alignment, VALID_VERT_ALIGN));\n}\n\nexport function getInvalidScrollStrategyError(strategy): Error {\n return Error(generateGenericError('scrollStrategy', strategy, VALID_SCROLL));\n}\n\nfunction generateGenericError(apiName: string, invalid: string | null, valid: string[]): string {\n return `Invalid ${apiName}: '${invalid}'. Valid options are ${valid.map((v) => `'${v}'`).join(', ')}.`;\n}\n","import { ElementRef, Injectable, NgZone, OnDestroy, Optional, ViewContainerRef } from '@angular/core';\nimport {\n ConnectionPositionPair,\n FlexibleConnectedPositionStrategy,\n HorizontalConnectionPos,\n Overlay,\n OverlayConfig,\n OverlayRef,\n ScrollStrategy,\n VerticalConnectionPos\n} from '@angular/cdk/overlay';\nimport { Directionality, Direction } from '@angular/cdk/bidi';\nimport { ESCAPE } from '@angular/cdk/keycodes';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Subscription, Subject } from 'rxjs';\nimport { takeUntil, take, filter, tap } from 'rxjs/operators';\n\nimport { SatPopoverComponent } from './popover.component';\nimport {\n SatPopoverHorizontalAlign,\n SatPopoverVerticalAlign,\n SatPopoverScrollStrategy,\n SatPopoverOpenOptions\n} from './types';\n\n/**\n * Configuration provided by the popover for the anchoring service\n * to build the correct overlay config.\n */\ninterface PopoverConfig {\n horizontalAlign: SatPopoverHorizontalAlign;\n verticalAlign: SatPopoverVerticalAlign;\n hasBackdrop: boolean;\n backdropClass: string;\n scrollStrategy: SatPopoverScrollStrategy;\n forceAlignment: boolean;\n lockAlignment: boolean;\n panelClass: string | string[];\n}\n\n@Injectable()\nexport class SatPopoverAnchoringService implements OnDestroy {\n /** Emits when the popover is opened. */\n popoverOpened = new Subject<void>();\n\n /** Emits when the popover is closed. */\n popoverClosed = new Subject<unknown>();\n\n /** Reference to the overlay containing the popover component. */\n _overlayRef: OverlayRef;\n\n /** Reference to the target popover. */\n private _popover: SatPopoverComponent;\n\n /** Reference to the view container for the popover template. */\n private _viewContainerRef: ViewContainerRef;\n\n /** Reference to the anchor element. */\n private _anchor: HTMLElement;\n\n /** Reference to a template portal where the overlay will be attached. */\n private _portal: TemplatePortal<unknown>;\n\n /** Single subscription to notifications service events. */\n private _notificationsSubscription: Subscription;\n\n /** Single subscription to position changes. */\n private _positionChangeSubscription: Subscription;\n\n /** Whether the popover is presently open. */\n private _popoverOpen = false;\n\n /** Emits when the service is destroyed. */\n private _onDestroy = new Subject<void>();\n\n constructor(\n private _overlay: Overlay,\n private _ngZone: NgZone,\n @Optional() private _dir: Directionality\n ) {}\n\n ngOnDestroy() {\n // Destroy popover before terminating subscriptions so that any resulting\n // detachments update 'closed state'\n this._destroyPopover();\n\n // Terminate subscriptions\n if (this._notificationsSubscription) {\n this._notificationsSubscription.unsubscribe();\n }\n if (this._positionChangeSubscription) {\n this._positionChangeSubscription.unsubscribe();\n }\n this._onDestroy.next();\n this._onDestroy.complete();\n\n this.popoverOpened.complete();\n this.popoverClosed.complete();\n }\n\n /** Anchor a popover instance to a view and connection element. */\n anchor(popover: SatPopoverComponent, viewContainerRef: ViewContainerRef, anchor: ElementRef | HTMLElement): void {\n // If we're just changing the anchor element and the overlayRef already exists,\n // simply update the existing _overlayRef's anchor.\n if (this._popover === popover && this._viewContainerRef === viewContainerRef && this._overlayRef) {\n this._anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;\n const config = this._overlayRef.getConfig();\n const strategy = config.positionStrategy as FlexibleConnectedPositionStrategy;\n strategy.setOrigin(this._anchor);\n this._overlayRef.updatePosition();\n return;\n }\n\n // Destroy any previous popovers\n this._destroyPopover();\n\n // Assign local refs\n this._popover = popover;\n this._viewContainerRef = viewContainerRef;\n this._anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;\n }\n\n /** Gets whether the popover is presently open. */\n isPopoverOpen(): boolean {\n return this._popoverOpen;\n }\n\n /** Toggles the popover between the open and closed states. */\n togglePopover(): void {\n return this._popoverOpen ? this.closePopover() : this.openPopover();\n }\n\n /** Opens the popover. */\n openPopover(options: SatPopoverOpenOptions = {}): void {\n if (!this._popoverOpen) {\n this._applyOpenOptions(options);\n this._createOverlay();\n this._subscribeToBackdrop();\n this._subscribeToEscape();\n this._subscribeToDetachments();\n this._saveOpenedState();\n }\n }\n\n /** Closes the popover. */\n closePopover(value?: unknown): void {\n if (this._overlayRef) {\n this._saveClosedState(value);\n this._overlayRef.detach();\n }\n }\n\n /** TODO: implement when the overlay's position can be dynamically changed */\n repositionPopover(): void {\n this.updatePopoverConfig();\n }\n\n /** TODO: when the overlay's position can be dynamically changed, do not destroy */\n updatePopoverConfig(): void {\n this._destroyPopoverOnceClosed();\n }\n\n /** Realign the popover to the anchor. */\n realignPopoverToAnchor(): void {\n if (this._overlayRef) {\n const config = this._overlayRef.getConfig();\n const strategy = config.positionStrategy as FlexibleConnectedPositionStrategy;\n strategy.reapplyLastPosition();\n }\n }\n\n /** Get a reference to the anchor element. */\n getAnchorElement(): HTMLElement {\n return this._anchor;\n }\n\n /** Apply behavior properties on the popover based on the open options. */\n private _applyOpenOptions(options: SatPopoverOpenOptions): void {\n // Only override restoreFocus as `false` if the option is explicitly `false`\n const restoreFocus = options.restoreFocus !== false;\n this._popover._restoreFocusOverride = restoreFocus;\n\n // Only override autoFocus as `false` if the option is explicitly `false`\n const autoFocus = options.autoFocus !== false;\n this._popover._autoFocusOverride = autoFocus;\n }\n\n /** Create an overlay to be attached to the portal. */\n private _createOverlay(): OverlayRef {\n // Create overlay if it doesn't yet exist\n if (!this._overlayRef) {\n this._portal = new TemplatePortal(this._popover._templateRef, this._viewContainerRef);\n\n const popoverConfig: PopoverConfig = {\n horizontalAlign: this._popover.horizontalAlign,\n verticalAlign: this._popover.verticalAlign,\n hasBackdrop: coerceBooleanProperty(this._popover.hasBackdrop),\n backdropClass: this._popover.backdropClass,\n scrollStrategy: this._popover.scrollStrategy,\n forceAlignment: coerceBooleanProperty(this._popover.forceAlignment),\n lockAlignment: coerceBooleanProperty(this._popover.lockAlignment),\n panelClass: this._popover.panelClass\n };\n\n const overlayConfig = this._getOverlayConfig(popoverConfig, this._anchor);\n\n this._subscribeToPositionChanges(overlayConfig.positionStrategy as FlexibleConnectedPositionStrategy);\n\n this._overlayRef = this._overlay.create(overlayConfig);\n }\n\n // Actually open the popover\n this._overlayRef.attach(this._portal);\n return this._overlayRef;\n }\n\n /** Removes the popover from the DOM. Does NOT update open state. */\n private _destroyPopover(): void {\n if (this._overlayRef) {\n this._overlayRef.dispose();\n this._overlayRef = null;\n }\n }\n\n /**\n * Destroys the popover immediately if it is closed, or waits until it\n * has been closed to destroy it.\n */\n private _destroyPopoverOnceClosed(): void {\n if (this.isPopoverOpen() && this._overlayRef) {\n this._overlayRef\n .detachments()\n .pipe(take(1), takeUntil(this._onDestroy))\n .subscribe(() => this._destroyPopover());\n } else {\n this._destroyPopover();\n }\n }\n\n /** Close popover when backdrop is clicked. */\n private _subscribeToBackdrop(): void {\n this._overlayRef\n .backdropClick()\n .pipe(\n tap(() => this._popover.backdropClicked.emit()),\n filter(() => this._popover.interactiveClose),\n takeUntil(this.popoverClosed),\n takeUntil(this._onDestroy)\n )\n .subscribe(() => this.closePopover());\n }\n\n /** Close popover when escape keydown event occurs. */\n private _subscribeToEscape(): void {\n this._overlayRef\n .keydownEvents()\n .pipe(\n tap((event) => this._popover.overlayKeydown.emit(event)),\n filter((event) => event.keyCode === ESCAPE),\n filter(() => this._popover.interactiveClose),\n takeUntil(this.popoverClosed),\n takeUntil(this._onDestroy)\n )\n .subscribe(() => this.closePopover());\n }\n\n /** Set state back to closed when detached. */\n private _subscribeToDetachments(): void {\n this._overlayRef\n .detachments()\n .pipe(takeUntil(this._onDestroy))\n .subscribe(() => this._saveClosedState());\n }\n\n /** Save the opened state of the popover and emit. */\n private _saveOpenedState(): void {\n if (!this._popoverOpen) {\n this._popover._state = 'enter';\n this._popover._open = this._popoverOpen = true;\n\n this.popoverOpened.next();\n this._popover.opened.emit();\n }\n }\n\n /** Save the closed state of the popover and emit. */\n private _saveClosedState(value?: unknown): void {\n if (this._popoverOpen) {\n this._popover._open = this._popoverOpen = false;\n\n this._popover._startExitAnimation();\n this.popoverClosed.next(value);\n this._popover.closed.emit(value);\n }\n }\n\n /** Gets the text direction of the containing app. */\n private _getDirection(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\n }\n\n /** Create and return a config for creating the overlay. */\n private _getOverlayConfig(config: PopoverConfig, anchor: HTMLElement): OverlayConfig {\n return new OverlayConfig({\n positionStrategy: this._getPositionStrategy(\n config.horizontalAlign,\n config.verticalAlign,\n config.forceAlignment,\n config.lockAlignment,\n anchor\n ),\n hasBackdrop: config.hasBackdrop,\n backdropClass: config.backdropClass || 'cdk-overlay-transparent-backdrop',\n scrollStrategy: this._getScrollStrategyInstance(config.scrollStrategy),\n direction: this._getDirection(),\n panelClass: config.panelClass\n });\n }\n\n /**\n * Listen to changes in the position of the overlay and set the correct alignment classes,\n * ensuring that the animation origin is correct, even with a fallback position.\n */\n private _subscribeToPositionChanges(position: FlexibleConnectedPositionStrategy): void {\n if (this._positionChangeSubscription) {\n this._positionChangeSubscription.unsubscribe();\n }\n\n this._positionChangeSubscription = position.positionChanges.pipe(takeUntil(this._onDestroy)).subscribe((change) => {\n // Position changes may occur outside the Angular zone\n this._ngZone.run(() => {\n this._popover._setAlignmentClasses(\n getHorizontalPopoverAlignment(change.connectionPair.overlayX),\n getVerticalPopoverAlignment(change.connectionPair.overlayY)\n );\n });\n });\n }\n\n /** Map a scroll strategy string type to an instance of a scroll strategy. */\n private _getScrollStrategyInstance(strategy: SatPopoverScrollStrategy): ScrollStrategy {\n switch (strategy) {\n case 'block':\n return this._overlay.scrollStrategies.block();\n case 'reposition':\n return this._overlay.scrollStrategies.reposition();\n case 'close':\n return this._overlay.scrollStrategies.close();\n case 'noop':\n default:\n return this._overlay.scrollStrategies.noop();\n }\n }\n\n /** Create and return a position strategy based on config provided to the component instance. */\n private _getPositionStrategy(\n horizontalTarget: SatPopoverHorizontalAlign,\n verticalTarget: SatPopoverVerticalAlign,\n forceAlignment: boolean,\n lockAlignment: boolean,\n anchor: HTMLElement\n ): FlexibleConnectedPositionStrategy {\n // Attach the overlay at the preferred position\n const targetPosition = getPosition(horizontalTarget, verticalTarget);\n const positions = [targetPosition];\n\n const strategy = this._overlay\n .position()\n .flexibleConnectedTo(anchor)\n .withFlexibleDimensions(false)\n .withPush(false)\n .withViewportMargin(0)\n .withLockedPosition(lockAlignment);\n\n // Unless the alignment is forced, add fallbacks based on the preferred positions\n if (!forceAlignment) {\n const fallbacks = this._getFallbacks(horizontalTarget, verticalTarget);\n positions.push(...fallbacks);\n }\n\n return strategy.withPositions(positions);\n }\n\n /** Get fallback positions based around target alignments. */\n private _getFallbacks(\n hTarget: SatPopoverHorizontalAlign,\n vTarget: SatPopoverVerticalAlign\n ): ConnectionPositionPair[] {\n // Determine if the target alignments overlap the anchor\n const horizontalOverlapAllowed = hTarget !== 'before' && hTarget !== 'after';\n const verticalOverlapAllowed = vTarget !== 'above' && vTarget !== 'below';\n\n // If a target alignment doesn't cover the anchor, don't let any of the fallback alignments\n // cover the anchor\n const possibleHorizontalAlignments: SatPopoverHorizontalAlign[] = horizontalOverlapAllowed\n ? ['before', 'start', 'center', 'end', 'after']\n : ['before', 'after'];\n const possibleVerticalAlignments: SatPopoverVerticalAlign[] = verticalOverlapAllowed\n ? ['above', 'start', 'center', 'end', 'below']\n : ['above', 'below'];\n\n // Create fallbacks for each allowed prioritized fallback alignment combo\n const fallbacks: ConnectionPositionPair[] = [];\n prioritizeAroundTarget(hTarget, possibleHorizontalAlignments).forEach((h) => {\n prioritizeAroundTarget(vTarget, possibleVerticalAlignments).forEach((v) => {\n fallbacks.push(getPosition(h, v));\n });\n });\n\n // Remove the first item since it will be the target alignment and isn't considered a fallback\n return fallbacks.slice(1, fallbacks.length);\n }\n}\n\n/** Helper function to get a cdk position pair from SatPopover alignments. */\nfunction getPosition(h: SatPopoverHorizontalAlign, v: SatPopoverVerticalAlign): ConnectionPositionPair {\n const { originX, overlayX } = getHorizontalConnectionPosPair(h);\n const { originY, overlayY } = getVerticalConnectionPosPair(v);\n return new ConnectionPositionPair({ originX, originY }, { overlayX, overlayY });\n}\n\n/** Helper function to convert an overlay connection position to equivalent popover alignment. */\nfunction getHorizontalPopoverAlignment(h: HorizontalConnectionPos): SatPopoverHorizontalAlign {\n if (h === 'start') {\n return 'after';\n }\n\n if (h === 'end') {\n return 'before';\n }\n\n return 'center';\n}\n\n/** Helper function to convert an overlay connection position to equivalent popover alignment. */\nfunction getVerticalPopoverAlignment(v: VerticalConnectionPos): SatPopoverVerticalAlign {\n if (v === 'top') {\n return 'below';\n }\n\n if (v === 'bottom') {\n return 'above';\n }\n\n return 'center';\n}\n\n/** Helper function to convert alignment to origin/overlay position pair. */\nfunction getHorizontalConnectionPosPair(h: SatPopoverHorizontalAlign): {\n originX: HorizontalConnectionPos;\n overlayX: HorizontalConnectionPos;\n} {\n switch (h) {\n case 'before':\n return { originX: 'start', overlayX: 'end' };\n case 'start':\n return { originX: 'start', overlayX: 'start' };\n case 'end':\n return { originX: 'end', overlayX: 'end' };\n case 'after':\n return { originX: 'end', overlayX: 'start' };\n default:\n return { originX: 'center', overlayX: 'center' };\n }\n}\n\n/** Helper function to convert alignment to origin/overlay position pair. */\nfunction getVerticalConnectionPosPair(v: SatPopoverVerticalAlign): {\n originY: VerticalConnectionPos;\n overlayY: VerticalConnectionPos;\n} {\n switch (v) {\n case 'above':\n return { originY: 'top', overlayY: 'bottom' };\n case 'start':\n return { originY: 'top', overlayY: 'top' };\n case 'end':\n return { originY: 'bottom', overlayY: 'bottom' };\n case 'below':\n return { originY: 'bottom', overlayY: 'top' };\n default:\n return { originY: 'center', overlayY: 'center' };\n }\n}\n\n/**\n * Helper function that takes an ordered array options and returns a reorderded\n * array around the target item. e.g.:\n *\n * target: 3; options: [1, 2, 3, 4, 5, 6, 7];\n *\n * return: [3, 4, 2, 5, 1, 6, 7]\n */\nfunction prioritizeAroundTarget<T>(target: T, options: T[]): T[] {\n const targetIndex = options.indexOf(target);\n\n // Set the first item to be the target\n const reordered = [target];\n\n // Make left and right stacks where the highest priority item is last\n const left = options.slice(0, targetIndex);\n const right = options.slice(targetIndex + 1, options.length).reverse();\n\n // Alternate between stacks until one is empty\n while (left.length && right.length) {\n reordered.push(right.pop());\n reordered.push(left.pop());\n }\n\n // Flush out right side\n while (right.length) {\n reordered.push(right.pop());\n }\n\n // Flush out left side\n while (left.length) {\n reordered.push(left.pop());\n }\n\n return reordered;\n}\n","import { InjectionToken } from '@angular/core';\n\n// See http://cubic-bezier.com/#.25,.8,.25,1 for reference.\n// const DEFAULT_TRANSITION = '200ms cubic-bezier(0.25, 0.8, 0.25, 1)';\nexport const DEFAULT_TRANSITION = new InjectionToken('DefaultTransition');\n","import {\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n ViewChild,\n ViewEncapsulation,\n TemplateRef,\n OnInit,\n Optional,\n Output,\n Directive,\n ViewContainerRef,\n AfterViewInit,\n DOCUMENT\n} from '@angular/core';\nimport { AnimationEvent } from '@angular/animations';\nimport { CommonModule } from '@angular/common';\nimport { ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty, coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\n\nimport { transformPopover } from './popover.animations';\nimport {\n getUnanchoredPopoverError,\n getInvalidHorizontalAlignError,\n getInvalidVerticalAlignError,\n getInvalidScrollStrategyError,\n getInvalidPopoverAnchorError,\n getInvalidSatPopoverAnchorError,\n getInvalidPopoverError\n} from './popover.errors';\nimport {\n SatPopoverScrollStrategy,\n SatPopoverHorizontalAlign,\n SatPopoverVerticalAlign,\n VALID_SCROLL,\n VALID_HORIZ_ALIGN,\n VALID_VERT_ALIGN,\n SatPopoverOpenOptions\n} from './types';\nimport { SatPopoverAnchoringService } from './popover-anchoring.service';\nimport { DEFAULT_TRANSITION } from './tokens';\n\nconst DEFAULT_OPEN_ANIMATION_START_SCALE = 0.3;\nconst DEFAULT_CLOSE_ANIMATION_END_SCALE = 0.5;\n\n@Directive({\n selector: '[satPopoverAnchor]',\n exportAs: 'satPopoverAnchor'\n})\nexport class SatPopoverAnchorDirective implements AfterViewInit {\n @Input('satPopoverAnchor')\n get popover() {\n return this._popover;\n }\n set popover(val: SatPopoverComponent) {\n if (val instanceof SatPopoverComponent) {\n val.anchor = this;\n } else {\n // when a directive is added with no arguments,\n // angular assigns `''` as the argument\n if (val !== '') {\n throw getInvalidPopoverError();\n }\n }\n }\n\n /** @internal */\n _popover: SatPopoverComponent;\n\n constructor(\n public elementRef: ElementRef,\n public viewContainerRef: ViewContainerRef\n ) {}\n\n ngAfterViewInit() {\n if (!this.popover) {\n throw getInvalidSatPopoverAnchorError();\n }\n }\n}\n\n@Component({\n animations: [transformPopover],\n encapsulation: ViewEncapsulation.None,\n imports: [CommonModule],\n providers: [SatPopoverAnchoringService],\n selector: 'sat-popover',\n styleUrls: ['./popover.component.scss'],\n templateUrl: './popover.component.html'\n})\nexport class SatPopoverComponent implements OnInit {\n /** Anchor element. */\n @Input()\n get anchor() {\n return this._anchor;\n }\n set anchor(val: SatPopoverAnchorDirective | ElementRef<HTMLElement> | HTMLElement) {\n if (val instanceof SatPopoverAnchorDirective) {\n val._popover = this;\n this._anchoringService.anchor(this, val.viewContainerRef, val.elementRef);\n this._anchor = val;\n } else if (val instanceof ElementRef || val instanceof HTMLElement) {\n this._anchoringService.anchor(this, this._viewContainerRef, val);\n this._anchor = val;\n } else if (val) {\n throw getInvalidPopoverAnchorError();\n }\n }\n private _anchor: SatPopoverAnchorDirective | ElementRef<HTMLElement> | HTMLElement;\n\n /** Alignment of the popover on the horizontal axis. */\n @Input()\n get horizontalAlign() {\n return this._horizontalAlign;\n }\n set horizontalAlign(val: SatPopoverHorizontalAlign) {\n this._validateHorizontalAlign(val);\n if (this._horizontalAlign !== val) {\n this._horizontalAlign = val;\n this._anchoringService.repositionPopover();\n }\n }\n private _horizontalAlign: SatPopoverHorizontalAlign = 'center';\n\n /** Alignment of the popover on the x axis. Alias for `horizontalAlign`. */\n @Input()\n get xAlign() {\n return this.horizontalAlign;\n }\n set xAlign(val: SatPopoverHorizontalAlign) {\n this.horizontalAlign = val;\n }\n\n /** Alignment of the popover on the vertical axis. */\n @Input()\n get verticalAlign() {\n return this._verticalAlign;\n }\n set verticalAlign(val: SatPopoverVerticalAlign) {\n this._validateVerticalAlign(val);\n if (this._verticalAlign !== val) {\n this._verticalAlign = val;\n this._anchoringService.repositionPopover();\n }\n }\n private _verticalAlign: SatPopoverVerticalAlign = 'center';\n\n /** Alignment of the popover on the y axis. Alias for `verticalAlign`. */\n @Input()\n get yAlign() {\n return this.verticalAlign;\n }\n set yAlign(val: SatPopoverVerticalAlign) {\n this.verticalAlign = val;\n }\n\n /** Whether the popover always opens with the specified alignment. */\n @Input()\n get forceAlignment() {\n return this._forceAlignment;\n }\n set forceAlignment(val: BooleanInput) {\n const coercedVal = coerceBooleanProperty(val);\n if (this._forceAlignment !== coercedVal) {\n this._forceAlignment = coercedVal;\n this._anchoringService.repositionPopover();\n }\n }\n private _forceAlignment = false;\n\n /**\n * Whether the popover's alignment is locked after opening. This prevents the popover\n * from changing its alignement when scrolling or changing the size of the viewport.\n */\n @Input()\n get lockAlignment() {\n return this._lockAlignment;\n }\n set lockAlignment(val: BooleanInput) {\n const coercedVal = coerceBooleanProperty(val);\n if (this._lockAlignment !== coercedVal) {\n this._lockAlignment = coerceBooleanProperty(val);\n this._anchoringService.repositionPopover();\n }\n }\n private _lockAlignment = false;\n\n /** Whether the first focusable element should be focused on open. */\n @Input()\n get autoFocus() {\n return this._autoFocus && this._autoFocusOverride;\n }\n set autoFocus(val: BooleanInput) {\n this._autoFocus = coerceBooleanProperty(val);\n }\n private _autoFocus = true;\n _autoFocusOverride = true;\n\n /** Whether the popover should return focus to the previously focused element after closing. */\n @Input()\n get restoreFocus() {\n return this._restoreFocus && this._restoreFocusOverride;\n }\n set restoreFocus(val: BooleanInput) {\n this._restoreFocus = coerceBooleanProperty(val);\n }\n private _restoreFocus = true;\n _restoreFocusOverride = true;\n\n /** How the popover should handle scrolling. */\n @Input()\n get scrollStrategy() {\n return this._scrollStrategy;\n }\n set scrollStrategy(val: SatPopoverScrollStrategy) {\n this._validateScrollStrategy(val);\n if (this._scrollStrategy !== val) {\n this._scrollStrategy = val;\n this._anchoringService.updatePopoverConfig();\n }\n }\n private _scrollStrategy: SatPopoverScrollStrategy = 'reposition';\n\n /** Whether the popover should have a backdrop (includes closing on click). */\n @Input()\n get hasBackdrop() {\n return this._hasBackdrop;\n }\n set hasBackdrop(val: BooleanInput) {\n this._hasBackdrop = coerceBooleanProperty(val);\n }\n private _hasBackdrop = false;\n\n /** Whether the popover should close when the user clicks the backdrop or presses ESC. */\n @Input()\n get interactiveClose(): boolean {\n return this._interactiveClose;\n }\n set interactiveClose(val: BooleanInput) {\n this._interactiveClose = coerceBooleanProperty(val);\n }\n private _interactiveClose = true;\n\n /** Custom transition to use while opening. */\n @Input()\n get openTransition() {\n return this._openTransition;\n }\n set openTransition(val: string) {\n if (val) {\n this._openTransition = val;\n }\n }\n private _openTransition;\n\n /** Custom transition to use while closing. */\n @Input()\n get closeTransition() {\n return this._closeTransition;\n }\n set closeTransition(val: string) {\n if (val) {\n this._closeTransition = val;\n }\n }\n private _closeTransition;\n\n /** Scale value at the start of the :enter animation. */\n @Input()\n get openAnimationStartAtScale() {\n return this._openAnimationStartAtScale;\n }\n set openAnimationStartAtScale(val: NumberInput) {\n const coercedVal = coerceNumberProperty(val);\n if (!isNaN(coercedVal)) {\n this._openAnimationStartAtScale = coercedVal;\n }\n }\n private _openAnimationStartAtScale = DEFAULT_OPEN_ANIMATION_START_SCALE;\n\n /** Scale value at the end of the :leave animation */\n @Input()\n get closeAnimationEndAtScale() {\n return this._closeAnimationEndAtScale;\n }\n set closeAnimationEndAtScale(val: NumberInput) {\n const coercedVal = coerceNumberProperty(val);\n if (!isNaN(coercedVal)) {\n this._closeAnimationEndAtScale = coercedVal;\n }\n }\n private _closeAnimationEndAtScale = DEFAULT_CLOSE_ANIMATION_END_SCALE;\n\n /** Optional backdrop class. */\n @Input() backdropClass = '';\n\n /** Optional custom class to add to the overlay pane. */\n @Input() panelClass: string | string[] = '';\n\n /** Emits when the popover is opened. */\n @Output() opened = new EventEmitter<void>();\n\n /** Emits when the popover is closed. */\n @Output() closed = new EventEmitter<unknown | void>();\n\n /** Emits when the popover has finished opening. */\n @Output() afterOpen = new EventEmitter<void>();\n\n /** Emits when the popover has finished closing. */\n @Output() afterClose = new EventEmitter<void>();\n\n /** Emits when the backdrop is clicked. */\n @Output() backdropClicked = new EventEmitter<void>();\n\n /** Emits when a keydown event is targeted to this popover's overlay. */\n @Output() overlayKeydown = new EventEmitter<KeyboardEvent>();\n\n /** Reference to template so it can be placed within a portal. */\n @ViewChild(TemplateRef, { static: true }) _templateRef: TemplateRef<unknown>;\n\n /** Classes to be added to the popover for setting the correct transform origin. */\n _classList: { [className: string]: boolean } = {};\n\n /** Whether the popover is presently open. */\n _open = false;\n\n _state: 'enter' | 'void' | 'exit' = 'enter';\n\n /** @internal */\n _anchoringService: SatPopoverAnchoringService;\n\n /** Reference to the element to build a focus trap around. */\n @ViewChild('focusTrapElement')\n private _focusTrapElement: ElementRef;\n\n /** Reference to the element that was focused before opening. */\n private _previouslyFocusedElement: HTMLElement;\n\n /** Reference to a focus trap around the popover. */\n private _focusTrap: ConfigurableFocusTrap;\n\n constructor(\n private _focusTrapFactory: ConfigurableFocusTrapFactory,\n _anchoringService: SatPopoverAnchoringService,\n private _viewContainerRef: ViewContainerRef,\n @Inject(DEFAULT_TRANSITION) private _defaultTransition: string,\n @Optional() @Inject(DOCUMENT) private _document = document\n ) {\n // `@internal` stripping doesn't seem to work if the property is\n // declared inside the constructor\n this._anchoringService = _anchoringService;\n this._openTransition = _defaultTransition;\n this._closeTransition = _defaultTransition;\n }\n\n ngOnInit() {\n this._setAlignmentClasses();\n }\n\n /** Open this popover. */\n open(options: SatPopoverOpenOptions = {}): void {\n if (this._anchor) {\n this._anchoringService.openPopover(options);\n return;\n }\n\n throw getUnanchoredPopoverError();\n }\n\n /** Close this popover. */\n close(value?: unknown): void {\n this._anchoringService.closePopover(value);\n }\n\n /** Toggle this popover open or closed. */\n toggle(): void {\n this._anchoringService.togglePopover();\n }\n\n /** Realign the popover to the anchor. */\n realign(): void {\n this._anchoringService.realignPopoverToAnchor();\n }\n\n /** Gets whether the popover is presently open. */\n isOpen(): boolean {\n return this._open;\n }\n\n /** Allows programmatically setting a custom anchor. */\n setCustomAnchor(viewContainer: ViewContainerRef, el: ElementRef<HTMLElement> | HTMLElement): void {\n this._anchor = el;\n this._anchoringService.anchor(this, viewContainer, el);\n }\n\n /** Gets an animation config with customized (or default) transition values. */\n get state() {\n return this._state;\n }\n get params() {\n return {\n openTransition: this.openTransition,\n closeTransition: this.closeTransition,\n startAtScale: this.openAnimationStartAtScale,\n endAtScale: this.closeAnimationEndAtScale\n };\n }\n\n /** Callback for when the popover is finished animating in or out. */\n _onAnimationDone({ toState }: AnimationEvent) {\n if (toState === 'enter') {\n this._trapFocus();\n this.afterOpen.emit();\n } else if (toState === 'exit' || toState === 'void') {\n this._restoreFocusAndDestroyTrap();\n this.afterClose.emit();\n }\n }\n\n /** Starts the dialog exit animation. */\n _startExitAnimation(): void {\n this._state = 'exit';\n }\n /** Apply alignment classes based on alignment inputs. */\n _setAlignmentClasses(horizAlign = this.horizontalAlign, vertAlign = this.verticalAlign) {\n this._classList['sat-popover-before'] = horizAlign === 'before' || horizAlign === 'end';\n this._classList['sat-popover-after'] = horizAlign === 'after' || horizAlign === 'start';\n\n this._classList['sat-popover-above'] = vertAlign === 'above' || vertAlign === 'end';\n this._classList['sat-popover-below'] = vertAlign === 'below' || vertAlign === 'start';\n\n this._classList['sat-popover-center'] = horizAlign === 'center' || vertAlign === 'center';\n }\n\n /** Move the focus inside the focus trap and remember where to return later. */\n private _trapFocus(): void {\n this._savePreviouslyFocusedElement();\n\n // There won't be a focus trap element if the close animation starts before open finishes\n if (!this._focusTrapElement) {\n return;\n }\n\n if (!this._focusTrap && this._focusTrapElement) {\n this._focusTrap = this._focusTrapFactory.create(this._focusTrapElement.nativeElement);\n }\n\n if (this.autoFocus) {\n this._focusTrap.focusInitialElementWhenReady();\n }\n }\n\n /** Restore focus to the element focused before the popover opened. Also destroy trap. */\n private _restoreFocusAndDestroyTrap(): void {\n const toFocus = this._previouslyFocusedElement;\n\n // Must check active element is focusable for IE sake\n if (toFocus && 'focus' in toFocus && this.restoreFocus) {\n this._previouslyFocusedElement.focus();\n }\n\n this._previouslyFocusedElement = null;\n\n if (this._focusTrap) {\n this._focusTrap.destroy();\n this._focusTrap = undefined;\n }\n }\n\n /** Save a reference to the element focused before the popover was opened. */\n private _savePreviouslyFocusedElement(): void {\n if (this._document) {\n this._previouslyFocusedElement = this._document.activeElement as HTMLElement;\n }\n }\n\n /** Throws an error if the alignment is not a valid horizontalAlign. */\n private _validateHorizontalAlign(pos: SatPopoverHorizontalAlign): void {\n if (VALID_HORIZ_ALIGN.indexOf(pos) === -1) {\n throw getInvalidHorizontalAlignError(pos);\n }\n }\n\n /** Throws an error if the alignment is not a valid verticalAlign. */\n private _validateVerticalAlign(pos: SatPopoverVerticalAlign): void {\n if (VALID_VERT_ALIGN.indexOf(pos) === -1) {\n throw getInvalidVerticalAlignError(pos);\n }\n }\n\n /** Throws an error if the scroll strategy is not a valid strategy. */\n private _validateScrollStrategy(strategy: SatPopoverScrollStrategy): void {\n if (VALID_SCROLL.indexOf(strategy) === -1) {\n throw getInvalidScrollStrategyError(strategy);\n }\n }\n}\n","<ng-template>\n <div\n class=\"sat-popover-container\"\n #focusTrapElement\n [ngClass]=\"_classList\"\n [@transformPopover]=\"{ value: state, params: params }\"\n (@transformPopover.done)=\"_onAnimationDone($event)\"\n >\n <ng-content></ng-content>\n </div>\n</ng-template>\n","import { AfterViewInit, Directive, HostListener, Input, OnDestroy } from '@angular/core';\nimport { coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\nimport { of, Subject } from 'rxjs';\nimport { delay, switchMap, takeUntil } from 'rxjs/operators';\n\nimport { SatPopoverAnchorDirective } from './popover.component';\n\n@Directive({\n selector: '[satPopoverHover]'\n})\nexport class SatPopoverHoverDirective implements AfterViewInit, OnDestroy {\n /**\n * Amount of time to delay (ms) after hovering starts before\n * the popover opens. Defaults to 0ms.\n */\n @Input()\n get satPopoverHover() {\n return this._satPopoverHover;\n }\n set satPopoverHover(val: NumberInput) {\n this._satPopoverHover = coerceNumberProperty(val);\n }\n private _satPopoverHover = 0;\n\n /** Emits when the directive is destroyed. */\n private _onDestroy = new Subject<void>();\n\n /** Emits when the user's mouse enters the element. */\n private _onMouseEnter = new Subject<void>();\n\n /** Emits when the user's mouse leaves the element. */\n private _onMouseLeave = new Subject<void>();\n\n constructor(public anchor: SatPopoverAnchorDirective) {}\n\n ngAfterViewInit() {\n // Whenever the user hovers this host element, delay the configured\n // amount of time and open the popover. Terminate if the mouse leaves\n // the host element before the delay is complete.\n this._onMouseEnter\n .pipe(\n switchMap(() => {\n return of(null).pipe(delay(this._satPopoverHover || 0), takeUntil(this._onMouseLeave));\n }),\n takeUntil(this._onDestroy)\n )\n .subscribe(() => this.anchor.popover.open());\n }\n\n ngOnDestroy() {\n this._onDestroy.next();\n this._onDestroy.complete();\n }\n\n @HostListener('mouseenter')\n showPopover() {\n this._onMouseEnter.next();\n }\n\n @HostListener('mouseleave')\n closePopover() {\n this._onMouseLeave.next();\n this.anchor.popover.close();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport { A11yModule } from '@angular/cdk/a11y';\nimport { BidiModule } from '@angular/cdk/bidi';\n\nimport { SatPopoverComponent, SatPopoverAnchorDirective } from './popover.component';\nimport { SatPopoverHoverDirective } from './popover-hover.directive';\nimport { DEFAULT_TRANSITION } from './tokens';\n\n@NgModule({\n imports: [\n CommonModule,\n OverlayModule,\n A11yModule,\n BidiModule,\n SatPopoverComponent,\n SatPopoverAnchorDirective,\n SatPopoverHoverDirective\n ],\n providers: [\n // See http://cubic-bezier.com/#.25,.8,.25,1 for reference.\n { provide: DEFAULT_TRANSITION, useValue: '200ms cubic-bezier(0.25, 0.8, 0.25, 1)' }\n ],\n exports: [SatPopoverComponent, SatPopoverAnchorDirective, SatPopoverHoverDirective, BidiModule]\n})\nexport class SatPopoverModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2.SatPopoverAnchoringService","i1.SatPopoverAnchorDirective"],"mappings":";;;;;;;;;;;;;;;;;AAEO,MAAM,gBAAgB,GAA6B,OAAO,CAAC,kBAAkB,EAAE;IACpF,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,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