@tailng-ui/primitives 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/package.json +2 -2
  2. package/src/lib/form/_shared/select/tng-select.overlay.shared.d.ts +1 -0
  3. package/src/lib/form/_shared/select/tng-select.overlay.shared.d.ts.map +1 -1
  4. package/src/lib/form/_shared/select/tng-select.overlay.shared.js +8 -1
  5. package/src/lib/form/_shared/select/tng-select.overlay.shared.js.map +1 -1
  6. package/src/lib/form/autocomplete/tng-autocomplete.overlay.d.ts +1 -0
  7. package/src/lib/form/autocomplete/tng-autocomplete.overlay.d.ts.map +1 -1
  8. package/src/lib/form/autocomplete/tng-autocomplete.overlay.js +25 -5
  9. package/src/lib/form/autocomplete/tng-autocomplete.overlay.js.map +1 -1
  10. package/src/lib/form/datepicker/tng-datepicker.overlay.d.ts +2 -1
  11. package/src/lib/form/datepicker/tng-datepicker.overlay.d.ts.map +1 -1
  12. package/src/lib/form/datepicker/tng-datepicker.overlay.js +13 -5
  13. package/src/lib/form/datepicker/tng-datepicker.overlay.js.map +1 -1
  14. package/src/lib/form/index.d.ts +0 -1
  15. package/src/lib/form/index.d.ts.map +1 -1
  16. package/src/lib/form/index.js +0 -1
  17. package/src/lib/form/index.js.map +1 -1
  18. package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.overlay.d.ts +1 -0
  19. package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.overlay.d.ts.map +1 -1
  20. package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.overlay.js +8 -1
  21. package/src/lib/form/multi-autocomplete/tng-multi-autocomplete.overlay.js.map +1 -1
  22. package/src/lib/layout/index.d.ts +1 -2
  23. package/src/lib/layout/index.d.ts.map +1 -1
  24. package/src/lib/layout/index.js +1 -2
  25. package/src/lib/layout/index.js.map +1 -1
  26. package/src/lib/layout/stepper/__tests__/tng-stepper.test-harness.d.ts +44 -0
  27. package/src/lib/layout/stepper/__tests__/tng-stepper.test-harness.d.ts.map +1 -0
  28. package/src/lib/layout/stepper/__tests__/tng-stepper.test-harness.js +149 -0
  29. package/src/lib/layout/stepper/__tests__/tng-stepper.test-harness.js.map +1 -0
  30. package/src/lib/layout/stepper/index.d.ts +2 -0
  31. package/src/lib/layout/stepper/index.d.ts.map +1 -0
  32. package/src/lib/layout/stepper/index.js +2 -0
  33. package/src/lib/layout/stepper/index.js.map +1 -0
  34. package/src/lib/layout/stepper/tng-stepper.d.ts +198 -2
  35. package/src/lib/layout/stepper/tng-stepper.d.ts.map +1 -1
  36. package/src/lib/layout/stepper/tng-stepper.js +898 -2
  37. package/src/lib/layout/stepper/tng-stepper.js.map +1 -1
  38. package/src/lib/navigation/index.d.ts +1 -3
  39. package/src/lib/navigation/index.d.ts.map +1 -1
  40. package/src/lib/navigation/index.js +1 -3
  41. package/src/lib/navigation/index.js.map +1 -1
  42. package/src/lib/navigation/pagination/__tests__/tng-pagination.test-harness.d.ts +44 -0
  43. package/src/lib/navigation/pagination/__tests__/tng-pagination.test-harness.d.ts.map +1 -0
  44. package/src/lib/navigation/pagination/__tests__/tng-pagination.test-harness.js +194 -0
  45. package/src/lib/navigation/pagination/__tests__/tng-pagination.test-harness.js.map +1 -0
  46. package/src/lib/navigation/pagination/index.d.ts +2 -0
  47. package/src/lib/navigation/pagination/index.d.ts.map +1 -0
  48. package/src/lib/navigation/pagination/index.js +2 -0
  49. package/src/lib/navigation/pagination/index.js.map +1 -0
  50. package/src/lib/navigation/pagination/tng-pagination.d.ts +131 -0
  51. package/src/lib/navigation/pagination/tng-pagination.d.ts.map +1 -0
  52. package/src/lib/navigation/pagination/tng-pagination.js +437 -0
  53. package/src/lib/navigation/pagination/tng-pagination.js.map +1 -0
  54. package/src/lib/form/multiselect/tng-multiselect.d.ts +0 -7
  55. package/src/lib/form/multiselect/tng-multiselect.d.ts.map +0 -1
  56. package/src/lib/form/multiselect/tng-multiselect.js +0 -18
  57. package/src/lib/form/multiselect/tng-multiselect.js.map +0 -1
  58. package/src/lib/layout/bottom-sheet/tng-bottom-sheet.d.ts +0 -7
  59. package/src/lib/layout/bottom-sheet/tng-bottom-sheet.d.ts.map +0 -1
  60. package/src/lib/layout/bottom-sheet/tng-bottom-sheet.js +0 -18
  61. package/src/lib/layout/bottom-sheet/tng-bottom-sheet.js.map +0 -1
  62. package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.d.ts +0 -7
  63. package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.d.ts.map +0 -1
  64. package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.js +0 -18
  65. package/src/lib/navigation/dropdown-menu/tng-dropdown-menu.js.map +0 -1
  66. package/src/lib/navigation/navigation-menu/tng-navigation-menu.d.ts +0 -7
  67. package/src/lib/navigation/navigation-menu/tng-navigation-menu.d.ts.map +0 -1
  68. package/src/lib/navigation/navigation-menu/tng-navigation-menu.js +0 -18
  69. package/src/lib/navigation/navigation-menu/tng-navigation-menu.js.map +0 -1
  70. package/src/lib/navigation/toolbar/tng-toolbar.d.ts +0 -7
  71. package/src/lib/navigation/toolbar/tng-toolbar.d.ts.map +0 -1
  72. package/src/lib/navigation/toolbar/tng-toolbar.js +0 -18
  73. package/src/lib/navigation/toolbar/tng-toolbar.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailng-ui/primitives",
3
- "version": "0.43.0",
3
+ "version": "0.45.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "peerDependencies": {
19
19
  "@angular/core": "^21.1.0",
20
- "@tailng-ui/cdk": "^0.30.0",
20
+ "@tailng-ui/cdk": "^0.32.0",
21
21
  "tslib": "^2.3.0"
22
22
  },
23
23
  "sideEffects": false
@@ -31,6 +31,7 @@ export declare class TngSelectOverlay {
31
31
  private teardownRepositionListeners;
32
32
  private findTriggerEl;
33
33
  private syncPortalledThemeVars;
34
+ private applyPortalledStacking;
34
35
  private clearPortalledThemeVars;
35
36
  private mountToBodyAndPosition;
36
37
  private restoreToPlaceholder;
@@ -1 +1 @@
1
- {"version":3,"file":"tng-select.overlay.shared.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/tailng-ui/primitives/src/lib/form/_shared/select/tng-select.overlay.shared.ts"],"names":[],"mappings":";AAmGA,qBAIa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6C;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,cAAc,CAA+B;IAErD,QAAQ,CAAC,SAAS;;;oBAAqD;IACvE,QAAQ,CAAC,MAAM;;;oBAAkD;IACjE,QAAQ,CAAC,SAAS;;;;oBAA4D;IAG9E,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAoB;IAGjE,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,IAAI,CAEhC;IAED,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,wBAAwB,CAA6B;;IAsB7D,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,sBAAsB;IA4C9B,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,mBAAmB;yCA3PhB,gBAAgB;2CAAhB,gBAAgB;CAwQ5B"}
1
+ {"version":3,"file":"tng-select.overlay.shared.d.ts","sourceRoot":"","sources":["../../../../../../../../../libs/tailng-ui/primitives/src/lib/form/_shared/select/tng-select.overlay.shared.ts"],"names":[],"mappings":";AAsGA,qBAIa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA6C;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,cAAc,CAA+B;IAErD,QAAQ,CAAC,SAAS;;;oBAAqD;IACvE,QAAQ,CAAC,MAAM;;;oBAAkD;IACjE,QAAQ,CAAC,SAAS;;;;oBAA4D;IAG9E,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAoB;IAGjE,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,IAAI,CAEhC;IAED,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,wBAAwB,CAA6B;;IAsB7D,OAAO,CAAC,UAAU;IAuBlB,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,sBAAsB;IA4C9B,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,mBAAmB;yCAhQhB,gBAAgB;2CAAhB,gBAAgB;CA6Q5B"}
@@ -16,6 +16,9 @@ const PORTALLED_SELECT_THEME_VARS = [
16
16
  '--tng-select-overlay-radius',
17
17
  '--tng-select-overlay-shadow',
18
18
  '--tng-select-overlay-max-width',
19
+ '--tng-select-z-overlay',
20
+ '--tng-select-overlay-z-index',
21
+ '--tng-z-overlay',
19
22
  '--tng-select-overlay-border',
20
23
  '--tng-select-overlay-bg',
21
24
  '--tng-select-overlay-max-height',
@@ -185,6 +188,10 @@ export class TngSelectOverlay {
185
188
  panel.style.removeProperty('color-scheme');
186
189
  }
187
190
  }
191
+ applyPortalledStacking() {
192
+ this.elRef.nativeElement.style.zIndex =
193
+ 'var(--tng-select-z-overlay, var(--tng-select-overlay-z-index, var(--tng-z-overlay, 2)))';
194
+ }
188
195
  clearPortalledThemeVars() {
189
196
  const panel = this.elRef.nativeElement;
190
197
  for (const cssVar of PORTALLED_SELECT_THEME_VARS) {
@@ -202,8 +209,8 @@ export class TngSelectOverlay {
202
209
  panel.style.position = 'fixed';
203
210
  panel.style.left = '0px';
204
211
  panel.style.top = '0px';
205
- panel.style.zIndex = '1000';
206
212
  this.syncPortalledThemeVars();
213
+ this.applyPortalledStacking();
207
214
  queueMicrotask(() => {
208
215
  if (!this.host.open())
209
216
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"tng-select.overlay.shared.js","sourceRoot":"","sources":["../../../../../../../../../libs/tailng-ui/primitives/src/lib/form/_shared/select/tng-select.overlay.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;;AAU7D,MAAM,2BAA2B,GAAG;IAClC,qBAAqB;IACrB,4BAA4B;IAC5B,iCAAiC;IACjC,yBAAyB;IACzB,yBAAyB;IACzB,0BAA0B;IAC1B,wBAAwB;IACxB,2BAA2B;IAC3B,uCAAuC;IACvC,8BAA8B;IAC9B,6BAA6B;IAC7B,6BAA6B;IAC7B,gCAAgC;IAChC,6BAA6B;IAC7B,yBAAyB;IACzB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AW;uBAAC,gBAAgB;;sBAG5B,WAAW;uBAAC,aAAa","sourcesContent":["import {\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n inject,\n input,\n effect,\n} from '@angular/core';\nimport type {\n TngOverlayCollisionOptions,\n TngOverlayOffset,\n TngOverlayPlacement,\n} from '@tailng-ui/cdk';\nimport { computeOverlayPosition } from '@tailng-ui/cdk';\n\nimport { TNG_SELECT_HOST } from './tng-select.tokens.shared';\nimport type { TngSelectHostApi } from './tng-select.host-api';\n\ntype MaybeRect = Readonly<{\n left: number;\n top: number;\n width: number;\n height: number;\n}>;\n\nconst PORTALLED_SELECT_THEME_VARS = [\n '--tng-select-radius',\n '--tng-select-trigger-width',\n '--tng-select-trigger-min-height',\n '--tng-select-trigger-py',\n '--tng-select-trigger-px',\n '--tng-select-trigger-gap',\n '--tng-select-icon-size',\n '--tng-select-icon-opacity',\n '--tng-select-icon-margin-inline-start',\n '--tng-select-overlay-padding',\n '--tng-select-overlay-radius',\n '--tng-select-overlay-shadow',\n '--tng-select-overlay-max-width',\n '--tng-select-overlay-border',\n '--tng-select-overlay-bg',\n '--tng-select-overlay-max-height',\n '--tng-select-listbox-gap',\n '--tng-select-option-min-height',\n '--tng-select-option-py',\n '--tng-select-option-px',\n '--tng-select-option-radius',\n '--tng-select-option-bg-active',\n '--tng-select-option-border-active',\n '--tng-select-option-bg-selected',\n '--tng-select-option-border-selected',\n '--tng-select-option-fg-selected',\n '--tng-select-option-bg-selected-active',\n '--tng-select-option-border-selected-active',\n '--tng-select-option-shadow-selected-active',\n '--tng-select-option-disabled-opacity',\n '--tng-select-option-font-weight',\n '--tng-select-value-font-size',\n '--tng-select-value-font-weight',\n '--tng-select-value-color',\n '--tng-select-icon-margin-inline-end',\n '--tng-select-border',\n '--tng-select-border-strong',\n '--tng-select-border-hover',\n '--tng-select-bg',\n '--tng-select-surface',\n '--tng-select-fg',\n '--tng-select-muted',\n '--tng-select-brand',\n '--tng-select-danger',\n '--tng-select-focus-ring',\n '--tng-select-ease',\n '--tng-select-shadow',\n '--tng-select-shadow-focus',\n '--tng-semantic-background-base',\n '--tng-semantic-background-surface',\n '--tng-semantic-border-subtle',\n '--tng-semantic-border-strong',\n '--tng-semantic-foreground-primary',\n '--tng-semantic-foreground-secondary',\n '--tng-semantic-foreground-muted',\n '--tng-semantic-accent-brand',\n '--tng-semantic-accent-danger',\n '--tng-semantic-focus-ring',\n] as const;\n\nfunction rectFromClientRect(r: DOMRect | ClientRect): MaybeRect {\n return { left: r.left, top: r.top, width: r.width, height: r.height };\n}\n\nfunction viewportRect(): MaybeRect {\n return { left: 0, top: 0, width: window.innerWidth || 1024, height: window.innerHeight || 768 };\n}\n\nfunction isInside(target: EventTarget | null, container: HTMLElement): boolean {\n return !!target && target instanceof Node && container.contains(target);\n}\n\n@Directive({\n selector: '[tngSelectOverlay]',\n exportAs: 'tngSelectOverlay',\n})\nexport class TngSelectOverlay {\n private readonly host = inject<TngSelectHostApi>(TNG_SELECT_HOST);\n private readonly elRef = inject(ElementRef<HTMLElement>);\n private readonly destroyRef = inject(DestroyRef);\n\n private lastFocusedBeforeOpen: HTMLElement | null = null;\n private removeResizeListener: (() => void) | null = null;\n private removeScrollListener: (() => void) | null = null;\n private resizeObserver: ResizeObserver | null = null;\n\n readonly placement = input<TngOverlayPlacement | undefined>(undefined);\n readonly offset = input<TngOverlayOffset | undefined>(undefined);\n readonly collision = input<TngOverlayCollisionOptions | undefined>(undefined);\n\n @HostBinding('attr.data-slot')\n protected readonly dataSlot: 'select-overlay' = 'select-overlay';\n\n @HostBinding('attr.hidden')\n protected get hidden(): '' | null {\n return this.host.open() ? null : '';\n }\n\n private placeholder: Comment | null = null;\n private originalParent: Node | null = null;\n private removeDocPointerListener: (() => void) | null = null;\n\n constructor() {\n this.placeholder = document.createComment('tng-select-overlay-anchor');\n const hostEl = this.elRef.nativeElement;\n this.originalParent = hostEl.parentNode;\n this.originalParent?.insertBefore(this.placeholder, hostEl);\n\n effect(() => {\n const open = this.host.open();\n if (open) this.mountToBodyAndPosition();\n else this.restoreToPlaceholder();\n });\n\n this.destroyRef.onDestroy(() => {\n this.teardownOutsidePointer();\n this.restoreToPlaceholder(true);\n this.placeholder = null;\n this.originalParent = null;\n });\n }\n\n private reposition(): void {\n if (!this.host.open()) return;\n const panel = this.elRef.nativeElement;\n const trigger = this.findTriggerEl();\n if (!trigger) return;\n\n const anchor = rectFromClientRect(trigger.getBoundingClientRect());\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset: this.offset(),\n collision: this.collision(),\n });\n\n panel.style.left = `${result.x}px`;\n panel.style.top = `${result.y}px`;\n }\n\n private setupRepositionListeners(): void {\n let rafId: number | null = null;\n const schedule = () => {\n if (rafId !== null) return;\n rafId = requestAnimationFrame(() => {\n rafId = null;\n this.reposition();\n });\n };\n\n const onResize = () => schedule();\n const onScroll = () => schedule();\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n this.removeResizeListener = () => window.removeEventListener('resize', onResize);\n this.removeScrollListener = () => window.removeEventListener('scroll', onScroll, true);\n\n if ('ResizeObserver' in window) {\n this.resizeObserver = new ResizeObserver(() => schedule());\n const trigger = this.findTriggerEl();\n if (trigger) this.resizeObserver.observe(trigger);\n this.resizeObserver.observe(this.elRef.nativeElement);\n }\n }\n\n private teardownRepositionListeners(): void {\n this.removeResizeListener?.();\n this.removeScrollListener?.();\n this.removeResizeListener = null;\n this.removeScrollListener = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n }\n\n private findTriggerEl(): HTMLElement | null {\n const root = this.host.hostElement;\n return root.querySelector('[data-slot=\"select-trigger\"]') as HTMLElement | null;\n }\n\n private syncPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n const hostStyles = getComputedStyle(this.host.hostElement);\n\n for (const cssVar of PORTALLED_SELECT_THEME_VARS) {\n const value = hostStyles.getPropertyValue(cssVar).trim();\n if (value) {\n panel.style.setProperty(cssVar, value);\n } else {\n panel.style.removeProperty(cssVar);\n }\n }\n\n const colorScheme = hostStyles.colorScheme?.trim();\n if (colorScheme && colorScheme !== 'normal') {\n panel.style.colorScheme = colorScheme;\n } else {\n panel.style.removeProperty('color-scheme');\n }\n }\n\n private clearPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n\n for (const cssVar of PORTALLED_SELECT_THEME_VARS) {\n panel.style.removeProperty(cssVar);\n }\n\n panel.style.removeProperty('color-scheme');\n }\n\n private mountToBodyAndPosition(): void {\n this.lastFocusedBeforeOpen = document.activeElement as HTMLElement | null;\n this.setupRepositionListeners();\n const panel = this.elRef.nativeElement;\n\n if (panel.parentNode !== document.body) {\n document.body.appendChild(panel);\n }\n\n panel.style.position = 'fixed';\n panel.style.left = '0px';\n panel.style.top = '0px';\n panel.style.zIndex = '1000';\n this.syncPortalledThemeVars();\n\n queueMicrotask(() => {\n if (!this.host.open()) return;\n const trigger = this.findTriggerEl();\n if (!trigger) return;\n\n const anchor = rectFromClientRect(trigger.getBoundingClientRect());\n const viewportWidth = viewportRect().width;\n const inlineSize = Math.max(0, Math.min(anchor.width, viewportWidth - 16));\n panel.style.width = `${inlineSize}px`;\n panel.style.minWidth = `${inlineSize}px`;\n\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset: this.offset(),\n collision: this.collision(),\n });\n\n panel.style.left = `${result.x}px`;\n panel.style.top = `${result.y}px`;\n });\n\n this.setupOutsidePointer();\n }\n\n private restoreToPlaceholder(force = false): void {\n const panel = this.elRef.nativeElement;\n if (!force && panel.parentNode !== document.body) {\n this.teardownOutsidePointer();\n return;\n }\n\n if (this.placeholder?.parentNode) {\n this.placeholder.parentNode.insertBefore(panel, this.placeholder);\n } else if (this.originalParent) {\n this.originalParent.appendChild(panel);\n }\n\n this.teardownRepositionListeners();\n\n if (\n this.lastFocusedBeforeOpen &&\n document.contains(this.lastFocusedBeforeOpen)\n ) {\n const active = document.activeElement as HTMLElement | null;\n const panelEl = this.elRef.nativeElement;\n if (!active || panelEl.contains(active)) {\n this.lastFocusedBeforeOpen.focus();\n }\n }\n\n this.restoreFocusOnClose();\n panel.style.position = '';\n panel.style.left = '';\n panel.style.top = '';\n panel.style.zIndex = '';\n panel.style.width = '';\n panel.style.minWidth = '';\n this.clearPortalledThemeVars();\n this.teardownOutsidePointer();\n }\n\n private setupOutsidePointer(): void {\n if (this.removeDocPointerListener) return;\n\n const onPointerDown = (ev: PointerEvent) => {\n if (!this.host.open()) return;\n const panel = this.elRef.nativeElement;\n const trigger = this.findTriggerEl();\n if (isInside(ev.target, panel)) return;\n if (trigger && isInside(ev.target, trigger)) return;\n if (\n this.host.multiple() &&\n ev.target &&\n (ev.target as Element).closest?.(\n '[data-slot=\"select-option\"], [data-slot=\"multi-select-option\"]'\n )\n )\n return;\n this.host.close();\n };\n\n document.addEventListener('pointerdown', onPointerDown, true);\n this.removeDocPointerListener = () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n };\n }\n\n private teardownOutsidePointer(): void {\n this.removeDocPointerListener?.();\n this.removeDocPointerListener = null;\n }\n\n private restoreFocusOnClose(): void {\n const panel = this.elRef.nativeElement;\n const active = document.activeElement as HTMLElement | null;\n if (active && panel.contains(active)) {\n const trigger = this.findTriggerEl();\n trigger?.focus();\n return;\n }\n if (document.activeElement === document.body) {\n const trigger = this.findTriggerEl();\n trigger?.focus();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"tng-select.overlay.shared.js","sourceRoot":"","sources":["../../../../../../../../../libs/tailng-ui/primitives/src/lib/form/_shared/select/tng-select.overlay.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,GACP,MA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5D,IAAI,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACrC,OAAO,EAAE,KAAK,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,IAAI,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACrC,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;uGA5QU,gBAAgB;2FAAhB,gBAAgB;;2FAAhB,gBAAgB;kBAJ5B,SAAS;mBAAC;oBACT,QAAQ,EAAE,oBAAoB;oBAC9B,QAAQ,EAAE,kBAAkB;iBAC7B;;sBAeE,WAAW;uBAAC,gBAAgB;;sBAG5B,WAAW;uBAAC,aAAa","sourcesContent":["import {\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n inject,\n input,\n effect,\n} from '@angular/core';\nimport type {\n TngOverlayCollisionOptions,\n TngOverlayOffset,\n TngOverlayPlacement,\n} from '@tailng-ui/cdk';\nimport { computeOverlayPosition } from '@tailng-ui/cdk';\n\nimport { TNG_SELECT_HOST } from './tng-select.tokens.shared';\nimport type { TngSelectHostApi } from './tng-select.host-api';\n\ntype MaybeRect = Readonly<{\n left: number;\n top: number;\n width: number;\n height: number;\n}>;\n\nconst PORTALLED_SELECT_THEME_VARS = [\n '--tng-select-radius',\n '--tng-select-trigger-width',\n '--tng-select-trigger-min-height',\n '--tng-select-trigger-py',\n '--tng-select-trigger-px',\n '--tng-select-trigger-gap',\n '--tng-select-icon-size',\n '--tng-select-icon-opacity',\n '--tng-select-icon-margin-inline-start',\n '--tng-select-overlay-padding',\n '--tng-select-overlay-radius',\n '--tng-select-overlay-shadow',\n '--tng-select-overlay-max-width',\n '--tng-select-z-overlay',\n '--tng-select-overlay-z-index',\n '--tng-z-overlay',\n '--tng-select-overlay-border',\n '--tng-select-overlay-bg',\n '--tng-select-overlay-max-height',\n '--tng-select-listbox-gap',\n '--tng-select-option-min-height',\n '--tng-select-option-py',\n '--tng-select-option-px',\n '--tng-select-option-radius',\n '--tng-select-option-bg-active',\n '--tng-select-option-border-active',\n '--tng-select-option-bg-selected',\n '--tng-select-option-border-selected',\n '--tng-select-option-fg-selected',\n '--tng-select-option-bg-selected-active',\n '--tng-select-option-border-selected-active',\n '--tng-select-option-shadow-selected-active',\n '--tng-select-option-disabled-opacity',\n '--tng-select-option-font-weight',\n '--tng-select-value-font-size',\n '--tng-select-value-font-weight',\n '--tng-select-value-color',\n '--tng-select-icon-margin-inline-end',\n '--tng-select-border',\n '--tng-select-border-strong',\n '--tng-select-border-hover',\n '--tng-select-bg',\n '--tng-select-surface',\n '--tng-select-fg',\n '--tng-select-muted',\n '--tng-select-brand',\n '--tng-select-danger',\n '--tng-select-focus-ring',\n '--tng-select-ease',\n '--tng-select-shadow',\n '--tng-select-shadow-focus',\n '--tng-semantic-background-base',\n '--tng-semantic-background-surface',\n '--tng-semantic-border-subtle',\n '--tng-semantic-border-strong',\n '--tng-semantic-foreground-primary',\n '--tng-semantic-foreground-secondary',\n '--tng-semantic-foreground-muted',\n '--tng-semantic-accent-brand',\n '--tng-semantic-accent-danger',\n '--tng-semantic-focus-ring',\n] as const;\n\nfunction rectFromClientRect(r: DOMRect | ClientRect): MaybeRect {\n return { left: r.left, top: r.top, width: r.width, height: r.height };\n}\n\nfunction viewportRect(): MaybeRect {\n return { left: 0, top: 0, width: window.innerWidth || 1024, height: window.innerHeight || 768 };\n}\n\nfunction isInside(target: EventTarget | null, container: HTMLElement): boolean {\n return !!target && target instanceof Node && container.contains(target);\n}\n\n@Directive({\n selector: '[tngSelectOverlay]',\n exportAs: 'tngSelectOverlay',\n})\nexport class TngSelectOverlay {\n private readonly host = inject<TngSelectHostApi>(TNG_SELECT_HOST);\n private readonly elRef = inject(ElementRef<HTMLElement>);\n private readonly destroyRef = inject(DestroyRef);\n\n private lastFocusedBeforeOpen: HTMLElement | null = null;\n private removeResizeListener: (() => void) | null = null;\n private removeScrollListener: (() => void) | null = null;\n private resizeObserver: ResizeObserver | null = null;\n\n readonly placement = input<TngOverlayPlacement | undefined>(undefined);\n readonly offset = input<TngOverlayOffset | undefined>(undefined);\n readonly collision = input<TngOverlayCollisionOptions | undefined>(undefined);\n\n @HostBinding('attr.data-slot')\n protected readonly dataSlot: 'select-overlay' = 'select-overlay';\n\n @HostBinding('attr.hidden')\n protected get hidden(): '' | null {\n return this.host.open() ? null : '';\n }\n\n private placeholder: Comment | null = null;\n private originalParent: Node | null = null;\n private removeDocPointerListener: (() => void) | null = null;\n\n constructor() {\n this.placeholder = document.createComment('tng-select-overlay-anchor');\n const hostEl = this.elRef.nativeElement;\n this.originalParent = hostEl.parentNode;\n this.originalParent?.insertBefore(this.placeholder, hostEl);\n\n effect(() => {\n const open = this.host.open();\n if (open) this.mountToBodyAndPosition();\n else this.restoreToPlaceholder();\n });\n\n this.destroyRef.onDestroy(() => {\n this.teardownOutsidePointer();\n this.restoreToPlaceholder(true);\n this.placeholder = null;\n this.originalParent = null;\n });\n }\n\n private reposition(): void {\n if (!this.host.open()) return;\n const panel = this.elRef.nativeElement;\n const trigger = this.findTriggerEl();\n if (!trigger) return;\n\n const anchor = rectFromClientRect(trigger.getBoundingClientRect());\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset: this.offset(),\n collision: this.collision(),\n });\n\n panel.style.left = `${result.x}px`;\n panel.style.top = `${result.y}px`;\n }\n\n private setupRepositionListeners(): void {\n let rafId: number | null = null;\n const schedule = () => {\n if (rafId !== null) return;\n rafId = requestAnimationFrame(() => {\n rafId = null;\n this.reposition();\n });\n };\n\n const onResize = () => schedule();\n const onScroll = () => schedule();\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n this.removeResizeListener = () => window.removeEventListener('resize', onResize);\n this.removeScrollListener = () => window.removeEventListener('scroll', onScroll, true);\n\n if ('ResizeObserver' in window) {\n this.resizeObserver = new ResizeObserver(() => schedule());\n const trigger = this.findTriggerEl();\n if (trigger) this.resizeObserver.observe(trigger);\n this.resizeObserver.observe(this.elRef.nativeElement);\n }\n }\n\n private teardownRepositionListeners(): void {\n this.removeResizeListener?.();\n this.removeScrollListener?.();\n this.removeResizeListener = null;\n this.removeScrollListener = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n }\n\n private findTriggerEl(): HTMLElement | null {\n const root = this.host.hostElement;\n return root.querySelector('[data-slot=\"select-trigger\"]') as HTMLElement | null;\n }\n\n private syncPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n const hostStyles = getComputedStyle(this.host.hostElement);\n\n for (const cssVar of PORTALLED_SELECT_THEME_VARS) {\n const value = hostStyles.getPropertyValue(cssVar).trim();\n if (value) {\n panel.style.setProperty(cssVar, value);\n } else {\n panel.style.removeProperty(cssVar);\n }\n }\n\n const colorScheme = hostStyles.colorScheme?.trim();\n if (colorScheme && colorScheme !== 'normal') {\n panel.style.colorScheme = colorScheme;\n } else {\n panel.style.removeProperty('color-scheme');\n }\n }\n\n private applyPortalledStacking(): void {\n this.elRef.nativeElement.style.zIndex =\n 'var(--tng-select-z-overlay, var(--tng-select-overlay-z-index, var(--tng-z-overlay, 2)))';\n }\n\n private clearPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n\n for (const cssVar of PORTALLED_SELECT_THEME_VARS) {\n panel.style.removeProperty(cssVar);\n }\n\n panel.style.removeProperty('color-scheme');\n }\n\n private mountToBodyAndPosition(): void {\n this.lastFocusedBeforeOpen = document.activeElement as HTMLElement | null;\n this.setupRepositionListeners();\n const panel = this.elRef.nativeElement;\n\n if (panel.parentNode !== document.body) {\n document.body.appendChild(panel);\n }\n\n panel.style.position = 'fixed';\n panel.style.left = '0px';\n panel.style.top = '0px';\n this.syncPortalledThemeVars();\n this.applyPortalledStacking();\n\n queueMicrotask(() => {\n if (!this.host.open()) return;\n const trigger = this.findTriggerEl();\n if (!trigger) return;\n\n const anchor = rectFromClientRect(trigger.getBoundingClientRect());\n const viewportWidth = viewportRect().width;\n const inlineSize = Math.max(0, Math.min(anchor.width, viewportWidth - 16));\n panel.style.width = `${inlineSize}px`;\n panel.style.minWidth = `${inlineSize}px`;\n\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset: this.offset(),\n collision: this.collision(),\n });\n\n panel.style.left = `${result.x}px`;\n panel.style.top = `${result.y}px`;\n });\n\n this.setupOutsidePointer();\n }\n\n private restoreToPlaceholder(force = false): void {\n const panel = this.elRef.nativeElement;\n if (!force && panel.parentNode !== document.body) {\n this.teardownOutsidePointer();\n return;\n }\n\n if (this.placeholder?.parentNode) {\n this.placeholder.parentNode.insertBefore(panel, this.placeholder);\n } else if (this.originalParent) {\n this.originalParent.appendChild(panel);\n }\n\n this.teardownRepositionListeners();\n\n if (\n this.lastFocusedBeforeOpen &&\n document.contains(this.lastFocusedBeforeOpen)\n ) {\n const active = document.activeElement as HTMLElement | null;\n const panelEl = this.elRef.nativeElement;\n if (!active || panelEl.contains(active)) {\n this.lastFocusedBeforeOpen.focus();\n }\n }\n\n this.restoreFocusOnClose();\n panel.style.position = '';\n panel.style.left = '';\n panel.style.top = '';\n panel.style.zIndex = '';\n panel.style.width = '';\n panel.style.minWidth = '';\n this.clearPortalledThemeVars();\n this.teardownOutsidePointer();\n }\n\n private setupOutsidePointer(): void {\n if (this.removeDocPointerListener) return;\n\n const onPointerDown = (ev: PointerEvent) => {\n if (!this.host.open()) return;\n const panel = this.elRef.nativeElement;\n const trigger = this.findTriggerEl();\n if (isInside(ev.target, panel)) return;\n if (trigger && isInside(ev.target, trigger)) return;\n if (\n this.host.multiple() &&\n ev.target &&\n (ev.target as Element).closest?.(\n '[data-slot=\"select-option\"], [data-slot=\"multi-select-option\"]'\n )\n )\n return;\n this.host.close();\n };\n\n document.addEventListener('pointerdown', onPointerDown, true);\n this.removeDocPointerListener = () => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n };\n }\n\n private teardownOutsidePointer(): void {\n this.removeDocPointerListener?.();\n this.removeDocPointerListener = null;\n }\n\n private restoreFocusOnClose(): void {\n const panel = this.elRef.nativeElement;\n const active = document.activeElement as HTMLElement | null;\n if (active && panel.contains(active)) {\n const trigger = this.findTriggerEl();\n trigger?.focus();\n return;\n }\n if (document.activeElement === document.body) {\n const trigger = this.findTriggerEl();\n trigger?.focus();\n }\n }\n}\n"]}
@@ -35,6 +35,7 @@ export declare class TngAutocompleteOverlay {
35
35
  private setupOutsidePointer;
36
36
  private teardownOutsidePointer;
37
37
  private syncPortalledThemeVars;
38
+ private applyPortalledStacking;
38
39
  private clearPortalledThemeVars;
39
40
  private mountToBodyAndPosition;
40
41
  private restoreToPlaceholder;
@@ -1 +1 @@
1
- {"version":3,"file":"tng-autocomplete.overlay.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/primitives/src/lib/form/autocomplete/tng-autocomplete.overlay.ts"],"names":[],"mappings":";AA2FA,qBAIa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6C;IAC1E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,wBAAwB,CAA6B;IAE7D,QAAQ,CAAC,SAAS;;;oBAAqD;IACvE,QAAQ,CAAC,MAAM;;;oBAAkD;IACjE,QAAQ,CAAC,SAAS;;;;oBAA4D;IAE9E,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAqB;IAG3C,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAG,sBAAsB,CAAU;IAG9D,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,IAAI,CAEhC;;IAsBD,uFAAuF;IACvF,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,UAAU;IAoBlB,OAAO,CAAC,wBAAwB;IAuBhC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,sBAAsB;IAoC9B,OAAO,CAAC,oBAAoB;IAmC5B,OAAO,CAAC,mBAAmB;yCA1OhB,sBAAsB;2CAAtB,sBAAsB;CA4PlC"}
1
+ {"version":3,"file":"tng-autocomplete.overlay.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/primitives/src/lib/form/autocomplete/tng-autocomplete.overlay.ts"],"names":[],"mappings":";AAoHA,qBAIa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6C;IAC1E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,wBAAwB,CAA6B;IAE7D,QAAQ,CAAC,SAAS;;;oBAAqD;IACvE,QAAQ,CAAC,MAAM;;;oBAAkD;IACjE,QAAQ,CAAC,SAAS;;;;oBAA4D;IAE9E,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAqB;IAG3C,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAG,sBAAsB,CAAU;IAG9D,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,IAAI,CAEhC;;IAsBD,uFAAuF;IACvF,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,UAAU;IA4BlB,OAAO,CAAC,wBAAwB;IAuBhC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,sBAAsB;IA4C9B,OAAO,CAAC,oBAAoB;IAmC5B,OAAO,CAAC,mBAAmB;yCAhQhB,sBAAsB;2CAAtB,sBAAsB;CAkRlC"}
@@ -19,6 +19,9 @@ const PORTALLED_AUTOCOMPLETE_THEME_VARS = [
19
19
  '--tng-autocomplete-overlay-radius',
20
20
  '--tng-autocomplete-overlay-shadow',
21
21
  '--tng-autocomplete-overlay-max-width',
22
+ '--tng-autocomplete-z-overlay',
23
+ '--tng-autocomplete-overlay-z-index',
24
+ '--tng-z-overlay',
22
25
  '--tng-autocomplete-overlay-border',
23
26
  '--tng-autocomplete-overlay-bg',
24
27
  '--tng-autocomplete-listbox-gap',
@@ -66,6 +69,17 @@ function rectFromClientRect(r) {
66
69
  function viewportRect() {
67
70
  return { left: 0, top: 0, width: window.innerWidth || 1024, height: window.innerHeight || 768 };
68
71
  }
72
+ function resolveAnchoredYWhenOffscreen(resultY, anchor, overlay, viewport, side, sideOffset) {
73
+ const viewportBottom = viewport.top + viewport.height;
74
+ const anchorBottom = anchor.top + anchor.height;
75
+ if (anchorBottom < viewport.top && side === 'bottom') {
76
+ return anchorBottom + sideOffset;
77
+ }
78
+ if (anchor.top > viewportBottom && side === 'top') {
79
+ return anchor.top - overlay.height - sideOffset;
80
+ }
81
+ return resultY;
82
+ }
69
83
  function isInside(target, container) {
70
84
  return !!target && target instanceof Node && container.contains(target);
71
85
  }
@@ -128,16 +142,17 @@ export class TngAutocompleteOverlay {
128
142
  const anchor = rectFromClientRect(anchorEl.getBoundingClientRect());
129
143
  const overlay = rectFromClientRect(panel.getBoundingClientRect());
130
144
  const viewport = viewportRect();
145
+ const offset = this.offset();
131
146
  const result = computeOverlayPosition({
132
147
  anchorRect: anchor,
133
148
  overlayRect: overlay,
134
149
  viewportRect: viewport,
135
150
  placement: this.placement(),
136
- offset: this.offset(),
151
+ offset,
137
152
  collision: this.collision(),
138
153
  });
139
154
  panel.style.left = `${result.x}px`;
140
- panel.style.top = `${result.y}px`;
155
+ panel.style.top = `${resolveAnchoredYWhenOffscreen(result.y, anchor, overlay, viewport, result.side, offset?.side ?? 0)}px`;
141
156
  }
142
157
  setupRepositionListeners() {
143
158
  let rafId = null;
@@ -214,6 +229,10 @@ export class TngAutocompleteOverlay {
214
229
  panel.style.removeProperty('color-scheme');
215
230
  }
216
231
  }
232
+ applyPortalledStacking() {
233
+ const panel = this.elRef.nativeElement;
234
+ panel.style.zIndex = 'var(--tng-autocomplete-z-overlay, var(--tng-autocomplete-overlay-z-index, var(--tng-z-overlay, 2)))';
235
+ }
217
236
  clearPortalledThemeVars() {
218
237
  const panel = this.elRef.nativeElement;
219
238
  for (const cssVar of PORTALLED_AUTOCOMPLETE_THEME_VARS) {
@@ -231,8 +250,8 @@ export class TngAutocompleteOverlay {
231
250
  panel.style.position = 'fixed';
232
251
  panel.style.left = '0px';
233
252
  panel.style.top = '0px';
234
- panel.style.zIndex = '1000';
235
253
  this.syncPortalledThemeVars();
254
+ this.applyPortalledStacking();
236
255
  queueMicrotask(() => {
237
256
  if (!this.autocomplete.open())
238
257
  return;
@@ -243,16 +262,17 @@ export class TngAutocompleteOverlay {
243
262
  panel.style.minWidth = `${anchor.width}px`;
244
263
  const overlay = rectFromClientRect(panel.getBoundingClientRect());
245
264
  const viewport = viewportRect();
265
+ const offset = this.offset();
246
266
  const result = computeOverlayPosition({
247
267
  anchorRect: anchor,
248
268
  overlayRect: overlay,
249
269
  viewportRect: viewport,
250
270
  placement: this.placement(),
251
- offset: this.offset(),
271
+ offset,
252
272
  collision: this.collision(),
253
273
  });
254
274
  panel.style.left = `${result.x}px`;
255
- panel.style.top = `${result.y}px`;
275
+ panel.style.top = `${resolveAnchoredYWhenOffscreen(result.y, anchor, overlay, viewport, result.side, offset?.side ?? 0)}px`;
256
276
  });
257
277
  this.setupOutsidePointer();
258
278
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tng-autocomplete.overlay.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/primitives/src/lib/form/autocomplete/tng-autocomplete.overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;;AAK7D,MAAM,iCAAiC,GAAG;IACxC,2BAA2B;IAC3B,kCAAkC;IAClC,uCAAuC;IACvC,iDAAiD;IACjD,0CAA0C;IAC1C,yCAAyC;IACzC,+BAA+B;IAC/B,+BAA+B;IAC/B,8BAA8B;IAC9B,kCAAkC;IAClC,iCAAiC;IACjC,2CAA2C;IAC3C,oCAAoC;IACpC,mCAAmC;IACnC,mCAAmC;IACnC,sCAAsC;IACtC,mCAAmC;IACnC,+BAA+B;IAC/B,gCAAgC;IAChC,sCAAsC;IACtC,8BAA8B;IAC9B,8BAA8B;IAC9B,kCAAkC;IAClC,qCAAqC;IACrC,yCAAyC;IACzC,uCAAuC;IACvC,2CAA2C;IAC3C,uCAAuC;IACvC,8CAA8C;IAC9C,kDAAkD;IAClD,kDAAkD;IAClD,4CAA4C;IAC5C,2BAA2B;IAC3B,kCAAkC;IAClC,iCAAiC;IACjC,uBAAuB;IACvB,4BAA4B;IAC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AAW;uBAAC,aAAa","sourcesContent":["import {\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n inject,\n input,\n effect,\n} from '@angular/core';\nimport type {\n TngOverlayCollisionOptions,\n TngOverlayOffset,\n TngOverlayPlacement,\n} from '@tailng-ui/cdk';\nimport { computeOverlayPosition } from '@tailng-ui/cdk';\nimport { TNG_AUTOCOMPLETE } from './tng-autocomplete.tokens';\nimport type { TngAutocomplete } from './tng-autocomplete';\n\ntype MaybeRect = Readonly<{ left: number; top: number; width: number; height: number }>;\n\nconst PORTALLED_AUTOCOMPLETE_THEME_VARS = [\n '--tng-autocomplete-radius',\n '--tng-autocomplete-trigger-width',\n '--tng-autocomplete-trigger-min-height',\n '--tng-autocomplete-trigger-container-min-height',\n '--tng-autocomplete-trigger-container-gap',\n '--tng-autocomplete-trigger-container-px',\n '--tng-autocomplete-trigger-py',\n '--tng-autocomplete-trigger-px',\n '--tng-autocomplete-icon-size',\n '--tng-autocomplete-icon-box-size',\n '--tng-autocomplete-icon-opacity',\n '--tng-autocomplete-icon-margin-inline-end',\n '--tng-autocomplete-overlay-padding',\n '--tng-autocomplete-overlay-radius',\n '--tng-autocomplete-overlay-shadow',\n '--tng-autocomplete-overlay-max-width',\n '--tng-autocomplete-overlay-border',\n '--tng-autocomplete-overlay-bg',\n '--tng-autocomplete-listbox-gap',\n '--tng-autocomplete-option-min-height',\n '--tng-autocomplete-option-py',\n '--tng-autocomplete-option-px',\n '--tng-autocomplete-option-radius',\n '--tng-autocomplete-option-bg-active',\n '--tng-autocomplete-option-border-active',\n '--tng-autocomplete-option-bg-selected',\n '--tng-autocomplete-option-border-selected',\n '--tng-autocomplete-option-fg-selected',\n '--tng-autocomplete-option-bg-selected-active',\n '--tng-autocomplete-option-border-selected-active',\n '--tng-autocomplete-option-shadow-selected-active',\n '--tng-autocomplete-option-disabled-opacity',\n '--tng-autocomplete-border',\n '--tng-autocomplete-border-strong',\n '--tng-autocomplete-border-hover',\n '--tng-autocomplete-bg',\n '--tng-autocomplete-surface',\n '--tng-autocomplete-fg',\n '--tng-autocomplete-muted',\n '--tng-autocomplete-brand',\n '--tng-autocomplete-danger',\n '--tng-autocomplete-focus-ring',\n '--tng-autocomplete-ease',\n '--tng-autocomplete-shadow',\n '--tng-autocomplete-shadow-focus',\n '--tng-semantic-background-base',\n '--tng-semantic-background-canvas',\n '--tng-semantic-background-surface',\n '--tng-semantic-border-subtle',\n '--tng-semantic-border-strong',\n '--tng-semantic-foreground-primary',\n '--tng-semantic-foreground-secondary',\n '--tng-semantic-foreground-muted',\n '--tng-semantic-accent-brand',\n '--tng-semantic-accent-danger',\n '--tng-semantic-focus-ring',\n] as const;\n\nfunction rectFromClientRect(r: DOMRect | ClientRect): MaybeRect {\n return { left: r.left, top: r.top, width: r.width, height: r.height };\n}\n\nfunction viewportRect(): MaybeRect {\n return { left: 0, top: 0, width: window.innerWidth || 1024, height: window.innerHeight || 768 };\n}\n\nfunction isInside(target: EventTarget | null, container: HTMLElement): boolean {\n return !!target && target instanceof Node && container.contains(target);\n}\n\n@Directive({\n selector: '[tngAutocompleteOverlay]',\n exportAs: 'tngAutocompleteOverlay',\n})\nexport class TngAutocompleteOverlay {\n private readonly autocomplete = inject<TngAutocomplete>(TNG_AUTOCOMPLETE);\n private readonly elRef = inject(ElementRef<HTMLElement>);\n private readonly destroyRef = inject(DestroyRef);\n\n private lastFocusedBeforeOpen: HTMLElement | null = null;\n private removeResizeListener: (() => void) | null = null;\n private removeScrollListener: (() => void) | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private removeDocPointerListener: (() => void) | null = null;\n\n readonly placement = input<TngOverlayPlacement | undefined>(undefined);\n readonly offset = input<TngOverlayOffset | undefined>(undefined);\n readonly collision = input<TngOverlayCollisionOptions | undefined>(undefined);\n\n private placeholder: Comment | null = null;\n private originalParent: Node | null = null;\n\n @HostBinding('attr.data-slot')\n protected readonly dataSlot = 'autocomplete-overlay' as const;\n\n @HostBinding('attr.hidden')\n protected get hidden(): '' | null {\n return this.autocomplete.open() ? null : '';\n }\n\n constructor() {\n this.placeholder = document.createComment('tng-autocomplete-overlay-anchor');\n const hostEl = this.elRef.nativeElement;\n this.originalParent = hostEl.parentNode;\n this.originalParent?.insertBefore(this.placeholder, hostEl);\n\n effect(() => {\n const open = this.autocomplete.open();\n if (open) this.mountToBodyAndPosition();\n else this.restoreToPlaceholder();\n });\n\n this.destroyRef.onDestroy(() => {\n this.teardownOutsidePointer();\n this.restoreToPlaceholder(true);\n this.placeholder = null;\n this.originalParent = null;\n });\n }\n\n /** Anchor for overlay: container (trigger+icon) if present, else the input trigger. */\n private findAnchorEl(): HTMLElement | null {\n const root = this.autocomplete.hostElement;\n const container = root.querySelector('[data-slot=\"autocomplete-trigger-container\"]') as HTMLElement | null;\n if (container) return container;\n return root.querySelector('[data-slot=\"autocomplete-trigger\"]') as HTMLElement | null;\n }\n\n private findTriggerEl(): HTMLElement | null {\n const root = this.autocomplete.hostElement;\n return root.querySelector('[data-slot=\"autocomplete-trigger\"]') as HTMLElement | null;\n }\n\n private reposition(): void {\n if (!this.autocomplete.open()) return;\n const panel = this.elRef.nativeElement;\n const anchorEl = this.findAnchorEl();\n if (!anchorEl) return;\n const anchor = rectFromClientRect(anchorEl.getBoundingClientRect());\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset: this.offset(),\n collision: this.collision(),\n });\n panel.style.left = `${result.x}px`;\n panel.style.top = `${result.y}px`;\n }\n\n private setupRepositionListeners(): void {\n let rafId: number | null = null;\n const schedule = () => {\n if (rafId !== null) return;\n rafId = requestAnimationFrame(() => {\n rafId = null;\n this.reposition();\n });\n };\n const onResize = () => schedule();\n const onScroll = () => schedule();\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n this.removeResizeListener = () => window.removeEventListener('resize', onResize);\n this.removeScrollListener = () => window.removeEventListener('scroll', onScroll, true);\n if ('ResizeObserver' in window) {\n this.resizeObserver = new ResizeObserver(() => schedule());\n const anchorEl = this.findAnchorEl();\n if (anchorEl) this.resizeObserver.observe(anchorEl);\n this.resizeObserver.observe(this.elRef.nativeElement);\n }\n }\n\n private teardownRepositionListeners(): void {\n this.removeResizeListener?.();\n this.removeScrollListener?.();\n this.removeResizeListener = null;\n this.removeScrollListener = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n }\n\n private setupOutsidePointer(): void {\n if (this.removeDocPointerListener) return;\n const onPointerDown = (ev: PointerEvent) => {\n if (!this.autocomplete.open()) return;\n const panel = this.elRef.nativeElement;\n const anchorEl = this.findAnchorEl();\n if (isInside(ev.target, panel)) return;\n if (anchorEl && isInside(ev.target, anchorEl)) return;\n if (ev.target && (ev.target as Element).closest?.('[data-slot=\"autocomplete-option\"]')) return;\n this.autocomplete.close();\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n this.removeDocPointerListener = () =>\n document.removeEventListener('pointerdown', onPointerDown, true);\n }\n\n private teardownOutsidePointer(): void {\n this.removeDocPointerListener?.();\n this.removeDocPointerListener = null;\n }\n\n private syncPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n const hostStyles = getComputedStyle(this.autocomplete.hostElement);\n\n for (const cssVar of PORTALLED_AUTOCOMPLETE_THEME_VARS) {\n const value = hostStyles.getPropertyValue(cssVar).trim();\n if (value) {\n panel.style.setProperty(cssVar, value);\n } else {\n panel.style.removeProperty(cssVar);\n }\n }\n\n const colorScheme = hostStyles.colorScheme?.trim();\n if (colorScheme && colorScheme !== 'normal') {\n panel.style.colorScheme = colorScheme;\n } else {\n panel.style.removeProperty('color-scheme');\n }\n }\n\n private clearPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n\n for (const cssVar of PORTALLED_AUTOCOMPLETE_THEME_VARS) {\n panel.style.removeProperty(cssVar);\n }\n\n panel.style.removeProperty('color-scheme');\n }\n\n private mountToBodyAndPosition(): void {\n this.lastFocusedBeforeOpen = document.activeElement as HTMLElement | null;\n this.setupRepositionListeners();\n const panel = this.elRef.nativeElement;\n if (panel.parentNode !== document.body) {\n document.body.appendChild(panel);\n }\n panel.style.position = 'fixed';\n panel.style.left = '0px';\n panel.style.top = '0px';\n panel.style.zIndex = '1000';\n this.syncPortalledThemeVars();\n\n queueMicrotask(() => {\n if (!this.autocomplete.open()) return;\n const anchorEl = this.findAnchorEl();\n if (!anchorEl) return;\n const anchor = rectFromClientRect(anchorEl.getBoundingClientRect());\n panel.style.minWidth = `${anchor.width}px`;\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset: this.offset(),\n collision: this.collision(),\n });\n panel.style.left = `${result.x}px`;\n panel.style.top = `${result.y}px`;\n });\n\n this.setupOutsidePointer();\n }\n\n private restoreToPlaceholder(force = false): void {\n const panel = this.elRef.nativeElement;\n if (!force && panel.parentNode !== document.body) {\n this.teardownOutsidePointer();\n return;\n }\n if (this.placeholder?.parentNode) {\n this.placeholder.parentNode.insertBefore(panel, this.placeholder);\n } else if (this.originalParent) {\n this.originalParent.appendChild(panel);\n }\n this.teardownRepositionListeners();\n\n if (\n this.lastFocusedBeforeOpen &&\n document.contains(this.lastFocusedBeforeOpen)\n ) {\n const active = document.activeElement as HTMLElement | null;\n if (!active || panel.contains(active)) {\n this.autocomplete._restoringFocus = true;\n this.lastFocusedBeforeOpen.focus();\n queueMicrotask(() => { this.autocomplete._restoringFocus = false; });\n }\n }\n this.restoreFocusOnClose();\n\n panel.style.position = '';\n panel.style.left = '';\n panel.style.top = '';\n panel.style.zIndex = '';\n panel.style.minWidth = '';\n this.clearPortalledThemeVars();\n this.teardownOutsidePointer();\n }\n\n private restoreFocusOnClose(): void {\n const panel = this.elRef.nativeElement;\n const active = document.activeElement as HTMLElement | null;\n const trigger = this.findTriggerEl();\n if (!trigger) return;\n\n if (active && panel.contains(active)) {\n this.autocomplete._restoringFocus = true;\n trigger.focus();\n queueMicrotask(() => { this.autocomplete._restoringFocus = false; });\n return;\n }\n if (document.activeElement === document.body) {\n this.autocomplete._restoringFocus = true;\n trigger.focus();\n queueMicrotask(() => { this.autocomplete._restoringFocus = false; });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"tng-autocomplete.overlay.js","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/primitives/src/lib/form/autocomplete/tng-autocomplete.overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;;AAK7D,MAAM,iCAAiC,GAAG;IACxC,2BAA2B;IAC3B,kCAAkC;IAClC,uCAAuC;IACvC,iDAAiD;IACjD,0CAA0C;IAC1C,yCAAyC;IACzC,+BAA+B;IAC/B,+BAA+B;IAC/B,8BAA8B;IAC9B,kCAAkC;IAClC,iCAAiC;IACjC,2CAA2C;IAC3C,oCAAoC;IACpC,mCAAmC;IACnC,mCAAmC;IACnC,sCAAsC;IACtC,8BAA8B;IAC9B,oCAAoC;IACpC,iBAAiB;IACjB,mCAAmC;IACnC,+BAA+B;IAC/B,gCAAgC;IAChC,sCAAsC;IACtC,8BAA8B;IAC9B,8BAA8B;IAC9B,kCAAkC;IAClC,qCAAqC;IACrC,yCAAyC;IACzC,uCAAuC;IACvC,2CAA2C;IAC3C,uCAAuC;IACvC,8CAA8C;IAC9C,kDAAkD;IAClD,kDAAkD;IAClD,4CAA4C;IAC5C,2BAA2B;IAC3B,kCAAkC;IAClC,iCAAiC;IACjC,uBAAuB;IACvB,4BAA4B;IAC5B,uBAAuB;IACvB,0BAA0B;IAC1B,0BAA0B;IAC1B,2BAA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Aa,CAAC;QACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAmC,CAAC;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,IAAI,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,IAAI,CAAC;YACzC,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,cAAc,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACrE,OAAO;QACT,CAAC;QACD,IAAI,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,IAAI,CAAC;YACzC,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,cAAc,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;uGAjRU,sBAAsB;2FAAtB,sBAAsB;;2FAAtB,sBAAsB;kBAJlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,0BAA0B;oBACpC,QAAQ,EAAE,wBAAwB;iBACnC;;sBAmBE,WAAW;uBAAC,gBAAgB;;sBAG5B,WAAW;uBAAC,aAAa","sourcesContent":["import {\n DestroyRef,\n Directive,\n ElementRef,\n HostBinding,\n inject,\n input,\n effect,\n} from '@angular/core';\nimport type {\n TngOverlayCollisionOptions,\n TngOverlayOffset,\n TngOverlayPlacement,\n} from '@tailng-ui/cdk';\nimport { computeOverlayPosition } from '@tailng-ui/cdk';\nimport { TNG_AUTOCOMPLETE } from './tng-autocomplete.tokens';\nimport type { TngAutocomplete } from './tng-autocomplete';\n\ntype MaybeRect = Readonly<{ left: number; top: number; width: number; height: number }>;\n\nconst PORTALLED_AUTOCOMPLETE_THEME_VARS = [\n '--tng-autocomplete-radius',\n '--tng-autocomplete-trigger-width',\n '--tng-autocomplete-trigger-min-height',\n '--tng-autocomplete-trigger-container-min-height',\n '--tng-autocomplete-trigger-container-gap',\n '--tng-autocomplete-trigger-container-px',\n '--tng-autocomplete-trigger-py',\n '--tng-autocomplete-trigger-px',\n '--tng-autocomplete-icon-size',\n '--tng-autocomplete-icon-box-size',\n '--tng-autocomplete-icon-opacity',\n '--tng-autocomplete-icon-margin-inline-end',\n '--tng-autocomplete-overlay-padding',\n '--tng-autocomplete-overlay-radius',\n '--tng-autocomplete-overlay-shadow',\n '--tng-autocomplete-overlay-max-width',\n '--tng-autocomplete-z-overlay',\n '--tng-autocomplete-overlay-z-index',\n '--tng-z-overlay',\n '--tng-autocomplete-overlay-border',\n '--tng-autocomplete-overlay-bg',\n '--tng-autocomplete-listbox-gap',\n '--tng-autocomplete-option-min-height',\n '--tng-autocomplete-option-py',\n '--tng-autocomplete-option-px',\n '--tng-autocomplete-option-radius',\n '--tng-autocomplete-option-bg-active',\n '--tng-autocomplete-option-border-active',\n '--tng-autocomplete-option-bg-selected',\n '--tng-autocomplete-option-border-selected',\n '--tng-autocomplete-option-fg-selected',\n '--tng-autocomplete-option-bg-selected-active',\n '--tng-autocomplete-option-border-selected-active',\n '--tng-autocomplete-option-shadow-selected-active',\n '--tng-autocomplete-option-disabled-opacity',\n '--tng-autocomplete-border',\n '--tng-autocomplete-border-strong',\n '--tng-autocomplete-border-hover',\n '--tng-autocomplete-bg',\n '--tng-autocomplete-surface',\n '--tng-autocomplete-fg',\n '--tng-autocomplete-muted',\n '--tng-autocomplete-brand',\n '--tng-autocomplete-danger',\n '--tng-autocomplete-focus-ring',\n '--tng-autocomplete-ease',\n '--tng-autocomplete-shadow',\n '--tng-autocomplete-shadow-focus',\n '--tng-semantic-background-base',\n '--tng-semantic-background-canvas',\n '--tng-semantic-background-surface',\n '--tng-semantic-border-subtle',\n '--tng-semantic-border-strong',\n '--tng-semantic-foreground-primary',\n '--tng-semantic-foreground-secondary',\n '--tng-semantic-foreground-muted',\n '--tng-semantic-accent-brand',\n '--tng-semantic-accent-danger',\n '--tng-semantic-focus-ring',\n] as const;\n\nfunction rectFromClientRect(r: DOMRect | ClientRect): MaybeRect {\n return { left: r.left, top: r.top, width: r.width, height: r.height };\n}\n\nfunction viewportRect(): MaybeRect {\n return { left: 0, top: 0, width: window.innerWidth || 1024, height: window.innerHeight || 768 };\n}\n\nfunction resolveAnchoredYWhenOffscreen(\n resultY: number,\n anchor: MaybeRect,\n overlay: MaybeRect,\n viewport: MaybeRect,\n side: 'bottom' | 'top' | 'left' | 'right',\n sideOffset: number,\n): number {\n const viewportBottom = viewport.top + viewport.height;\n const anchorBottom = anchor.top + anchor.height;\n\n if (anchorBottom < viewport.top && side === 'bottom') {\n return anchorBottom + sideOffset;\n }\n\n if (anchor.top > viewportBottom && side === 'top') {\n return anchor.top - overlay.height - sideOffset;\n }\n\n return resultY;\n}\n\nfunction isInside(target: EventTarget | null, container: HTMLElement): boolean {\n return !!target && target instanceof Node && container.contains(target);\n}\n\n@Directive({\n selector: '[tngAutocompleteOverlay]',\n exportAs: 'tngAutocompleteOverlay',\n})\nexport class TngAutocompleteOverlay {\n private readonly autocomplete = inject<TngAutocomplete>(TNG_AUTOCOMPLETE);\n private readonly elRef = inject(ElementRef<HTMLElement>);\n private readonly destroyRef = inject(DestroyRef);\n\n private lastFocusedBeforeOpen: HTMLElement | null = null;\n private removeResizeListener: (() => void) | null = null;\n private removeScrollListener: (() => void) | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private removeDocPointerListener: (() => void) | null = null;\n\n readonly placement = input<TngOverlayPlacement | undefined>(undefined);\n readonly offset = input<TngOverlayOffset | undefined>(undefined);\n readonly collision = input<TngOverlayCollisionOptions | undefined>(undefined);\n\n private placeholder: Comment | null = null;\n private originalParent: Node | null = null;\n\n @HostBinding('attr.data-slot')\n protected readonly dataSlot = 'autocomplete-overlay' as const;\n\n @HostBinding('attr.hidden')\n protected get hidden(): '' | null {\n return this.autocomplete.open() ? null : '';\n }\n\n constructor() {\n this.placeholder = document.createComment('tng-autocomplete-overlay-anchor');\n const hostEl = this.elRef.nativeElement;\n this.originalParent = hostEl.parentNode;\n this.originalParent?.insertBefore(this.placeholder, hostEl);\n\n effect(() => {\n const open = this.autocomplete.open();\n if (open) this.mountToBodyAndPosition();\n else this.restoreToPlaceholder();\n });\n\n this.destroyRef.onDestroy(() => {\n this.teardownOutsidePointer();\n this.restoreToPlaceholder(true);\n this.placeholder = null;\n this.originalParent = null;\n });\n }\n\n /** Anchor for overlay: container (trigger+icon) if present, else the input trigger. */\n private findAnchorEl(): HTMLElement | null {\n const root = this.autocomplete.hostElement;\n const container = root.querySelector('[data-slot=\"autocomplete-trigger-container\"]') as HTMLElement | null;\n if (container) return container;\n return root.querySelector('[data-slot=\"autocomplete-trigger\"]') as HTMLElement | null;\n }\n\n private findTriggerEl(): HTMLElement | null {\n const root = this.autocomplete.hostElement;\n return root.querySelector('[data-slot=\"autocomplete-trigger\"]') as HTMLElement | null;\n }\n\n private reposition(): void {\n if (!this.autocomplete.open()) return;\n const panel = this.elRef.nativeElement;\n const anchorEl = this.findAnchorEl();\n if (!anchorEl) return;\n const anchor = rectFromClientRect(anchorEl.getBoundingClientRect());\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n const offset = this.offset();\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset,\n collision: this.collision(),\n });\n panel.style.left = `${result.x}px`;\n panel.style.top = `${resolveAnchoredYWhenOffscreen(\n result.y,\n anchor,\n overlay,\n viewport,\n result.side,\n offset?.side ?? 0,\n )}px`;\n }\n\n private setupRepositionListeners(): void {\n let rafId: number | null = null;\n const schedule = () => {\n if (rafId !== null) return;\n rafId = requestAnimationFrame(() => {\n rafId = null;\n this.reposition();\n });\n };\n const onResize = () => schedule();\n const onScroll = () => schedule();\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n this.removeResizeListener = () => window.removeEventListener('resize', onResize);\n this.removeScrollListener = () => window.removeEventListener('scroll', onScroll, true);\n if ('ResizeObserver' in window) {\n this.resizeObserver = new ResizeObserver(() => schedule());\n const anchorEl = this.findAnchorEl();\n if (anchorEl) this.resizeObserver.observe(anchorEl);\n this.resizeObserver.observe(this.elRef.nativeElement);\n }\n }\n\n private teardownRepositionListeners(): void {\n this.removeResizeListener?.();\n this.removeScrollListener?.();\n this.removeResizeListener = null;\n this.removeScrollListener = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n }\n\n private setupOutsidePointer(): void {\n if (this.removeDocPointerListener) return;\n const onPointerDown = (ev: PointerEvent) => {\n if (!this.autocomplete.open()) return;\n const panel = this.elRef.nativeElement;\n const anchorEl = this.findAnchorEl();\n if (isInside(ev.target, panel)) return;\n if (anchorEl && isInside(ev.target, anchorEl)) return;\n if (ev.target && (ev.target as Element).closest?.('[data-slot=\"autocomplete-option\"]')) return;\n this.autocomplete.close();\n };\n document.addEventListener('pointerdown', onPointerDown, true);\n this.removeDocPointerListener = () =>\n document.removeEventListener('pointerdown', onPointerDown, true);\n }\n\n private teardownOutsidePointer(): void {\n this.removeDocPointerListener?.();\n this.removeDocPointerListener = null;\n }\n\n private syncPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n const hostStyles = getComputedStyle(this.autocomplete.hostElement);\n\n for (const cssVar of PORTALLED_AUTOCOMPLETE_THEME_VARS) {\n const value = hostStyles.getPropertyValue(cssVar).trim();\n if (value) {\n panel.style.setProperty(cssVar, value);\n } else {\n panel.style.removeProperty(cssVar);\n }\n }\n\n const colorScheme = hostStyles.colorScheme?.trim();\n if (colorScheme && colorScheme !== 'normal') {\n panel.style.colorScheme = colorScheme;\n } else {\n panel.style.removeProperty('color-scheme');\n }\n }\n\n private applyPortalledStacking(): void {\n const panel = this.elRef.nativeElement;\n\n panel.style.zIndex = 'var(--tng-autocomplete-z-overlay, var(--tng-autocomplete-overlay-z-index, var(--tng-z-overlay, 2)))';\n }\n\n private clearPortalledThemeVars(): void {\n const panel = this.elRef.nativeElement;\n\n for (const cssVar of PORTALLED_AUTOCOMPLETE_THEME_VARS) {\n panel.style.removeProperty(cssVar);\n }\n\n panel.style.removeProperty('color-scheme');\n }\n\n private mountToBodyAndPosition(): void {\n this.lastFocusedBeforeOpen = document.activeElement as HTMLElement | null;\n this.setupRepositionListeners();\n const panel = this.elRef.nativeElement;\n if (panel.parentNode !== document.body) {\n document.body.appendChild(panel);\n }\n panel.style.position = 'fixed';\n panel.style.left = '0px';\n panel.style.top = '0px';\n this.syncPortalledThemeVars();\n this.applyPortalledStacking();\n\n queueMicrotask(() => {\n if (!this.autocomplete.open()) return;\n const anchorEl = this.findAnchorEl();\n if (!anchorEl) return;\n const anchor = rectFromClientRect(anchorEl.getBoundingClientRect());\n panel.style.minWidth = `${anchor.width}px`;\n const overlay = rectFromClientRect(panel.getBoundingClientRect());\n const viewport = viewportRect();\n const offset = this.offset();\n const result = computeOverlayPosition({\n anchorRect: anchor,\n overlayRect: overlay,\n viewportRect: viewport,\n placement: this.placement(),\n offset,\n collision: this.collision(),\n });\n panel.style.left = `${result.x}px`;\n panel.style.top = `${resolveAnchoredYWhenOffscreen(\n result.y,\n anchor,\n overlay,\n viewport,\n result.side,\n offset?.side ?? 0,\n )}px`;\n });\n\n this.setupOutsidePointer();\n }\n\n private restoreToPlaceholder(force = false): void {\n const panel = this.elRef.nativeElement;\n if (!force && panel.parentNode !== document.body) {\n this.teardownOutsidePointer();\n return;\n }\n if (this.placeholder?.parentNode) {\n this.placeholder.parentNode.insertBefore(panel, this.placeholder);\n } else if (this.originalParent) {\n this.originalParent.appendChild(panel);\n }\n this.teardownRepositionListeners();\n\n if (\n this.lastFocusedBeforeOpen &&\n document.contains(this.lastFocusedBeforeOpen)\n ) {\n const active = document.activeElement as HTMLElement | null;\n if (!active || panel.contains(active)) {\n this.autocomplete._restoringFocus = true;\n this.lastFocusedBeforeOpen.focus();\n queueMicrotask(() => { this.autocomplete._restoringFocus = false; });\n }\n }\n this.restoreFocusOnClose();\n\n panel.style.position = '';\n panel.style.left = '';\n panel.style.top = '';\n panel.style.zIndex = '';\n panel.style.minWidth = '';\n this.clearPortalledThemeVars();\n this.teardownOutsidePointer();\n }\n\n private restoreFocusOnClose(): void {\n const panel = this.elRef.nativeElement;\n const active = document.activeElement as HTMLElement | null;\n const trigger = this.findTriggerEl();\n if (!trigger) return;\n\n if (active && panel.contains(active)) {\n this.autocomplete._restoringFocus = true;\n trigger.focus();\n queueMicrotask(() => { this.autocomplete._restoringFocus = false; });\n return;\n }\n if (document.activeElement === document.body) {\n this.autocomplete._restoringFocus = true;\n trigger.focus();\n queueMicrotask(() => { this.autocomplete._restoringFocus = false; });\n }\n }\n}\n"]}
@@ -39,6 +39,7 @@ export declare class TngDatepickerOverlay {
39
39
  padding?: number;
40
40
  shift?: boolean;
41
41
  }> | undefined>;
42
+ readonly themeSource: import("@angular/core").InputSignal<OverlayAnchorInput>;
42
43
  protected get hidden(): '' | null;
43
44
  protected get display(): string | null;
44
45
  protected get dataPlacement(): 'bottom' | 'top';
@@ -68,7 +69,7 @@ export declare class TngDatepickerOverlay {
68
69
  private resolveCollision;
69
70
  private resolveDirection;
70
71
  static ɵfac: i0.ɵɵFactoryDeclaration<TngDatepickerOverlay, never>;
71
- static ɵdir: i0.ɵɵDirectiveDeclaration<TngDatepickerOverlay, "[tngDatepickerOverlay]", ["tngDatepickerOverlay"], { "controller": { "alias": "tngDatepickerOverlay"; "required": true; "isSignal": true; }; "anchor": { "alias": "tngDatepickerOverlayAnchor"; "required": false; "isSignal": true; }; "placement": { "alias": "tngDatepickerOverlayPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "tngDatepickerOverlayOffset"; "required": false; "isSignal": true; }; "collision": { "alias": "tngDatepickerOverlayCollision"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
72
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TngDatepickerOverlay, "[tngDatepickerOverlay]", ["tngDatepickerOverlay"], { "controller": { "alias": "tngDatepickerOverlay"; "required": true; "isSignal": true; }; "anchor": { "alias": "tngDatepickerOverlayAnchor"; "required": false; "isSignal": true; }; "placement": { "alias": "tngDatepickerOverlayPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "tngDatepickerOverlayOffset"; "required": false; "isSignal": true; }; "collision": { "alias": "tngDatepickerOverlayCollision"; "required": false; "isSignal": true; }; "themeSource": { "alias": "tngDatepickerOverlayThemeSource"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
72
73
  }
73
74
  export {};
74
75
  //# sourceMappingURL=tng-datepicker.overlay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tng-datepicker.overlay.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/primitives/src/lib/form/datepicker/tng-datepicker.overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAOX,MAAM,eAAe,CAAC;AAYvB,OAAO,KAAK,EACV,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;;AAa5B,KAAK,kBAAkB,GACnB,UAAU,CAAC,WAAW,CAAC,GACvB,WAAW,GACX,IAAI,GACJ,SAAS,CAAC;AAgDd,qBAIa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkD;IAChF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IACvE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAsC;IAExE,OAAO,CAAC,kBAAkB,CAAwB;IAClD,OAAO,CAAC,qBAAqB,CAAqB;IAClD,OAAO,CAAC,kBAAkB,CAAuB;IACjD,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;IAGD,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;;IA+C/C,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,wBAAwB;IA6BhC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,gBAAgB;yCAnWb,oBAAoB;2CAApB,oBAAoB;CAsWhC"}
1
+ {"version":3,"file":"tng-datepicker.overlay.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/tailng-ui/primitives/src/lib/form/datepicker/tng-datepicker.overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAOX,MAAM,eAAe,CAAC;AAYvB,OAAO,KAAK,EACV,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;;AAa5B,KAAK,kBAAkB,GACnB,UAAU,CAAC,WAAW,CAAC,GACvB,WAAW,GACX,IAAI,GACJ,SAAS,CAAC;AAwDd,qBAIa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkD;IAChF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IACvE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAsC;IAExE,OAAO,CAAC,kBAAkB,CAAwB;IAClD,OAAO,CAAC,qBAAqB,CAAqB;IAClD,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CA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AAG,IAAI,CAGlC;IAGD,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;;IAgD/C,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,wBAAwB;IA6BhC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,gBAAgB;yCAvWb,oBAAoB;2CAApB,oBAAoB;CA0WhC"}
@@ -34,15 +34,21 @@ const PORTALLED_DATEPICKER_THEME_VARS = [
34
34
  '--tng-semantic-accent-brand',
35
35
  '--tng-semantic-accent-danger',
36
36
  '--tng-semantic-focus-ring',
37
+ '--tng-datepicker-z-overlay',
38
+ '--tng-z-overlay',
37
39
  ];
38
40
  const OVERLAY_VIEWPORT_MARGIN = 12;
39
41
  const OVERLAY_OFFSET = 9;
42
+ const OVERLAY_Z_INDEX = 'var(--tng-datepicker-z-overlay, var(--tng-z-overlay, 1000))';
40
43
  function resolveAnchorElement(anchor) {
41
44
  if (anchor instanceof ElementRef) {
42
45
  return anchor.nativeElement;
43
46
  }
44
47
  return anchor instanceof HTMLElement ? anchor : null;
45
48
  }
49
+ function resolveThemeSourceElement(source) {
50
+ return resolveAnchorElement(source);
51
+ }
46
52
  export class TngDatepickerOverlay {
47
53
  elRef = inject((ElementRef));
48
54
  destroyRef = inject(DestroyRef);
@@ -61,6 +67,7 @@ export class TngDatepickerOverlay {
61
67
  placement = input(undefined, { ...(ngDevMode ? { debugName: "placement" } : {}), alias: 'tngDatepickerOverlayPlacement' });
62
68
  offset = input(undefined, { ...(ngDevMode ? { debugName: "offset" } : {}), alias: 'tngDatepickerOverlayOffset' });
63
69
  collision = input(undefined, { ...(ngDevMode ? { debugName: "collision" } : {}), alias: 'tngDatepickerOverlayCollision' });
70
+ themeSource = input(undefined, { ...(ngDevMode ? { debugName: "themeSource" } : {}), alias: 'tngDatepickerOverlayThemeSource' });
64
71
  get hidden() {
65
72
  this.renderVersion();
66
73
  return this.controller().getOutputs().open ? null : '';
@@ -131,6 +138,7 @@ export class TngDatepickerOverlay {
131
138
  this.placement();
132
139
  this.offset();
133
140
  this.collision();
141
+ this.themeSource();
134
142
  this.anchor();
135
143
  if (open) {
136
144
  this.mountToBodyAndPosition();
@@ -237,7 +245,7 @@ export class TngDatepickerOverlay {
237
245
  }
238
246
  syncPortalledThemeVars() {
239
247
  const overlay = this.elRef.nativeElement;
240
- const themeSource = this.findAnchorEl();
248
+ const themeSource = resolveThemeSourceElement(this.themeSource()) ?? this.findAnchorEl();
241
249
  if (themeSource === null) {
242
250
  return;
243
251
  }
@@ -259,7 +267,7 @@ export class TngDatepickerOverlay {
259
267
  if (overlay.parentNode !== this.ownerDocument.body) {
260
268
  this.ownerDocument.body.appendChild(overlay);
261
269
  }
262
- applyFixedPortalledOverlayBaseStyles(overlay);
270
+ applyFixedPortalledOverlayBaseStyles(overlay, OVERLAY_Z_INDEX);
263
271
  this.syncPortalledThemeVars();
264
272
  queueMicrotask(() => {
265
273
  if (!this.controller().getOutputs().open) {
@@ -307,14 +315,14 @@ export class TngDatepickerOverlay {
307
315
  return this.collision() ?? {
308
316
  flip: true,
309
317
  padding: OVERLAY_VIEWPORT_MARGIN,
310
- shift: true,
318
+ shift: false,
311
319
  };
312
320
  }
313
321
  resolveDirection() {
314
322
  return this.controller().getOutputs().getHostAttributes()['dir'] === 'rtl' ? 'rtl' : 'ltr';
315
323
  }
316
324
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngDatepickerOverlay, deps: [], target: i0.ɵɵFactoryTarget.Directive });
317
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: TngDatepickerOverlay, isStandalone: true, selector: "[tngDatepickerOverlay]", inputs: { controller: { classPropertyName: "controller", publicName: "tngDatepickerOverlay", isSignal: true, isRequired: true, transformFunction: null }, anchor: { classPropertyName: "anchor", publicName: "tngDatepickerOverlayAnchor", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "tngDatepickerOverlayPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "tngDatepickerOverlayOffset", isSignal: true, isRequired: false, transformFunction: null }, collision: { classPropertyName: "collision", publicName: "tngDatepickerOverlayCollision", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.hidden": "this.hidden", "style.display": "this.display", "attr.data-placement": "this.dataPlacement", "attr.aria-describedby": "this.ariaDescribedby", "attr.aria-label": "this.ariaLabel", "attr.aria-labelledby": "this.ariaLabelledby", "attr.aria-modal": "this.ariaModal", "attr.data-open": "this.dataOpen", "attr.data-position": "this.dataPosition", "attr.data-slot": "this.dataSlot", "attr.id": "this.id", "attr.role": "this.role" } }, exportAs: ["tngDatepickerOverlay"], ngImport: i0 });
325
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: TngDatepickerOverlay, isStandalone: true, selector: "[tngDatepickerOverlay]", inputs: { controller: { classPropertyName: "controller", publicName: "tngDatepickerOverlay", isSignal: true, isRequired: true, transformFunction: null }, anchor: { classPropertyName: "anchor", publicName: "tngDatepickerOverlayAnchor", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "tngDatepickerOverlayPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "tngDatepickerOverlayOffset", isSignal: true, isRequired: false, transformFunction: null }, collision: { classPropertyName: "collision", publicName: "tngDatepickerOverlayCollision", isSignal: true, isRequired: false, transformFunction: null }, themeSource: { classPropertyName: "themeSource", publicName: "tngDatepickerOverlayThemeSource", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.hidden": "this.hidden", "style.display": "this.display", "attr.data-placement": "this.dataPlacement", "attr.aria-describedby": "this.ariaDescribedby", "attr.aria-label": "this.ariaLabel", "attr.aria-labelledby": "this.ariaLabelledby", "attr.aria-modal": "this.ariaModal", "attr.data-open": "this.dataOpen", "attr.data-position": "this.dataPosition", "attr.data-slot": "this.dataSlot", "attr.id": "this.id", "attr.role": "this.role" } }, exportAs: ["tngDatepickerOverlay"], ngImport: i0 });
318
326
  }
319
327
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: TngDatepickerOverlay, decorators: [{
320
328
  type: Directive,
@@ -322,7 +330,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
322
330
  selector: '[tngDatepickerOverlay]',
323
331
  exportAs: 'tngDatepickerOverlay',
324
332
  }]
325
- }], ctorParameters: () => [], propDecorators: { controller: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlay", required: true }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayAnchor", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayPlacement", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayOffset", required: false }] }], collision: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayCollision", required: false }] }], hidden: [{
333
+ }], ctorParameters: () => [], propDecorators: { controller: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlay", required: true }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayAnchor", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayPlacement", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayOffset", required: false }] }], collision: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayCollision", required: false }] }], themeSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngDatepickerOverlayThemeSource", required: false }] }], hidden: [{
326
334
  type: HostBinding,
327
335
  args: ['attr.hidden']
328
336
  }], display: [{