ng-primitives 0.35.0 → 0.36.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 (70) hide show
  1. package/a11y/visually-hidden/visually-hidden-state.d.ts +1 -1
  2. package/accordion/accordion/accordion-state.d.ts +1 -1
  3. package/accordion/accordion-item/accordion-item-state.d.ts +1 -1
  4. package/avatar/avatar/avatar-state.d.ts +1 -1
  5. package/button/button/button-state.d.ts +1 -1
  6. package/checkbox/checkbox/checkbox-state.d.ts +1 -1
  7. package/date-picker/date-picker/date-picker-state.d.ts +1 -1
  8. package/dialog/dialog/dialog-state.d.ts +1 -1
  9. package/fesm2022/ng-primitives-file-upload.mjs +6 -4
  10. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  11. package/fesm2022/ng-primitives-internal.mjs +73 -50
  12. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  13. package/fesm2022/ng-primitives-popover.mjs +95 -59
  14. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  15. package/fesm2022/ng-primitives-radio.mjs +4 -0
  16. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  17. package/fesm2022/ng-primitives-state.mjs +10 -3
  18. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  19. package/fesm2022/ng-primitives-tabs.mjs +17 -22
  20. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  21. package/fesm2022/ng-primitives-tooltip.mjs +94 -43
  22. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  23. package/fesm2022/ng-primitives-utils.mjs +18 -0
  24. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  25. package/file-upload/file-dropzone/file-dropzone-state.d.ts +2 -2
  26. package/file-upload/file-dropzone/file-dropzone.d.ts +3 -2
  27. package/file-upload/file-upload/file-upload-state.d.ts +2 -2
  28. package/file-upload/file-upload/file-upload.d.ts +3 -2
  29. package/form-field/form-control/form-control-state.d.ts +1 -1
  30. package/form-field/form-field/form-field-state.d.ts +1 -1
  31. package/input/input/input-state.d.ts +1 -1
  32. package/internal/exit-animation/exit-animation-manager.d.ts +17 -0
  33. package/internal/exit-animation/exit-animation.d.ts +4 -17
  34. package/internal/index.d.ts +2 -1
  35. package/listbox/listbox/listbox-state.d.ts +2 -2
  36. package/package.json +5 -5
  37. package/pagination/pagination/pagination-state.d.ts +1 -1
  38. package/popover/index.d.ts +1 -0
  39. package/popover/popover/popover-token.d.ts +10 -0
  40. package/popover/popover/popover.d.ts +3 -2
  41. package/popover/popover-trigger/popover-trigger-state.d.ts +5 -3
  42. package/popover/popover-trigger/popover-trigger.d.ts +26 -18
  43. package/progress/progress/progress-state.d.ts +1 -1
  44. package/radio/radio-group/radio-group-state.d.ts +1 -1
  45. package/radio/radio-item/radio-item-state.d.ts +1 -1
  46. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +1 -1
  47. package/schematics/ng-generate/schema.d.ts +3 -1
  48. package/schematics/ng-generate/schema.json +3 -1
  49. package/schematics/ng-generate/templates/toolbar/toolbar-button.__fileSuffix@dasherize__.ts.template +58 -0
  50. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +29 -0
  51. package/schematics/ng-generate/templates/tooltip/tooltip-trigger.__fileSuffix@dasherize__.ts.template +35 -0
  52. package/schematics/ng-generate/templates/tooltip/tooltip.__fileSuffix@dasherize__.ts.template +60 -0
  53. package/search/search/search-state.d.ts +1 -1
  54. package/select/select/select-state.d.ts +1 -1
  55. package/slider/slider/slider-state.d.ts +1 -1
  56. package/state/index.d.ts +7 -1
  57. package/switch/switch/switch-state.d.ts +1 -1
  58. package/tabs/index.d.ts +1 -2
  59. package/tabs/tab-button/tab-button.d.ts +2 -2
  60. package/tabs/tabset/tabset-state.d.ts +1 -1
  61. package/textarea/textarea/textarea-state.d.ts +1 -1
  62. package/toggle/toggle/toggle-state.d.ts +1 -1
  63. package/toggle-group/toggle-group/toggle-group-state.d.ts +1 -1
  64. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +1 -1
  65. package/tooltip/index.d.ts +1 -0
  66. package/tooltip/tooltip/tooltip-token.d.ts +10 -0
  67. package/tooltip/tooltip/tooltip.d.ts +2 -1
  68. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +3 -3
  69. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +39 -18
  70. package/tabs/tabset/tabset-token.d.ts +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-tooltip.mjs","sources":["../../../../packages/ng-primitives/tooltip/src/config/tooltip-config.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger-state.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/ng-primitives-tooltip.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpTooltipConfig {\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n placement: Placement;\n\n /**\n * Define the delay before the tooltip is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the tooltip should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n};\n\nexport const NgpTooltipConfigToken = new InjectionToken<NgpTooltipConfig>('NgpTooltipConfigToken');\n\n/**\n * Provide the default Tooltip configuration\n * @param config The Tooltip configuration\n * @returns The provider\n */\nexport function provideTooltipConfig(config: Partial<NgpTooltipConfig>): Provider[] {\n return [\n {\n provide: NgpTooltipConfigToken,\n useValue: { ...defaultTooltipConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tooltip configuration\n * @returns The global Tooltip configuration\n */\nexport function injectTooltipConfig(): NgpTooltipConfig {\n return inject(NgpTooltipConfigToken, { optional: true }) ?? defaultTooltipConfig;\n}\n","import { Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpTooltipTrigger } from './tooltip-trigger';\n\n/**\n * The state token for the TooltipTrigger primitive.\n */\nexport const NgpTooltipTriggerStateToken = createStateToken<NgpTooltipTrigger>('TooltipTrigger');\n\n/**\n * Provides the TooltipTrigger state.\n */\nexport const provideTooltipTriggerState = createStateProvider(NgpTooltipTriggerStateToken);\n\n/**\n * Injects the TooltipTrigger state.\n */\nexport const injectTooltipTriggerState = createStateInjector(\n NgpTooltipTriggerStateToken,\n) as () => Signal<State<NgpTooltipTrigger>>;\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n Directive,\n ElementRef,\n EmbeddedViewRef,\n Injector,\n OnDestroy,\n TemplateRef,\n ViewContainerRef,\n booleanAttribute,\n computed,\n inject,\n input,\n numberAttribute,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n Middleware,\n Placement,\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n} from '@floating-ui/dom';\nimport { fromResizeEvent } from 'ng-primitives/resize';\nimport { injectDisposables, onBooleanChange } from 'ng-primitives/utils';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltipTrigger` directive to an element that triggers the tooltip to show.\n */\n@Directive({\n selector: '[ngpTooltipTrigger]',\n exportAs: 'ngpTooltipTrigger',\n providers: [provideTooltipTriggerState()],\n host: {\n '[attr.data-open]': 'state.open() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '(mouseenter)': 'show()',\n '(mouseleave)': 'hide()',\n '(focus)': 'show()',\n '(blur)': 'hide()',\n },\n})\nexport class NgpTooltipTrigger implements OnDestroy {\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the view container ref.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the disposable utilities\n */\n private readonly disposables = injectDisposables();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input.required<TemplateRef<void>>({\n alias: 'ngpTooltipTrigger',\n });\n\n /**\n * The open state of the tooltip.\n * @default false\n */\n readonly open = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerOpen',\n transform: booleanAttribute,\n });\n\n /**\n * Emit an event when the tooltip is opened or closed.\n */\n readonly openChange = output<boolean>({\n alias: 'ngpTooltipTriggerOpenChange',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpTooltipTriggerPlacement',\n });\n\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpTooltipTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpTooltipTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpTooltipTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpTooltipTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the tooltip should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Store the tooltip view ref.\n */\n private viewRef: EmbeddedViewRef<void> | null = null;\n\n /**\n * Derive the tooltip middleware from the provided configuration.\n */\n private readonly middleware = computed(() => {\n const middleware: Middleware[] = [offset(this.state.offset()), shift()];\n\n if (this.state.flip()) {\n middleware.push(flip());\n }\n\n return middleware;\n });\n\n /**\n * Store the computed position of the tooltip.\n * @internal\n */\n readonly position = signal<{ x: number; y: number }>({\n x: 0,\n y: 0,\n });\n\n /**\n * The dispose function to stop computing the position of the tooltip.\n */\n private dispose?: () => void;\n\n /**\n * @internal\n * Store the trigger width.\n */\n readonly width = signal<number | null>(null);\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger>(this);\n\n constructor() {\n // any time the open state changes then show or hide the tooltip\n onBooleanChange(this.state.open, this.show.bind(this), this.hide.bind(this));\n\n // update the width of the trigger when it resizes\n fromResizeEvent(this.trigger.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.width.set(this.trigger.nativeElement.offsetWidth));\n }\n\n ngOnDestroy(): void {\n this.destroyTooltip();\n }\n\n private show(): void {\n // if the trigger is disabled or the tooltip is already open then do not show the tooltip\n if (this.state.disabled() || this.state.open()) {\n return;\n }\n\n this.state.open.set(true);\n this.openChange.emit(true);\n this.disposables.setTimeout(() => this.createTooltip(), this.state.showDelay());\n }\n\n private hide(): void {\n // if the trigger is disabled or the tooltip is already closed then do not hide the tooltip\n if (this.state.disabled() || !this.state.open()) {\n return;\n }\n\n this.state.open.set(false);\n this.openChange.emit(false);\n this.disposables.setTimeout(() => this.destroyTooltip(), this.state.hideDelay());\n }\n\n private createTooltip(): void {\n const portal = new TemplatePortal(\n this.tooltip(),\n this.viewContainerRef,\n undefined,\n this.injector,\n );\n\n const domOutlet = new DomPortalOutlet(\n this.state.container() ?? this.document.body,\n undefined,\n undefined,\n Injector.create({\n parent: this.injector,\n providers: [],\n }),\n );\n\n this.viewRef = domOutlet.attach(portal);\n this.viewRef.detectChanges();\n\n const outletElement = this.viewRef.rootNodes[0];\n\n // we want to determine the strategy to use. If the tooltip has position: fixed then we want to use\n // fixed positioning. Otherwise we want to use absolute positioning.\n const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';\n\n this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, outletElement, {\n placement: this.state.placement(),\n middleware: this.middleware(),\n strategy,\n });\n\n this.position.set({ x: position.x, y: position.y });\n });\n }\n\n private destroyTooltip(): void {\n this.state.open.set(false);\n this.openChange.emit(false);\n this.viewRef?.destroy();\n this.viewRef = null;\n this.dispose?.();\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Directive,\n ElementRef,\n OnInit,\n PLATFORM_ID,\n computed,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { getTransformOrigin } from 'ng-primitives/popover';\nimport { injectTooltipTriggerState } from '../tooltip-trigger/tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltip` directive to an element that represents the tooltip. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpTooltip]',\n exportAs: 'ngpTooltip',\n host: {\n role: 'tooltip',\n '[style.left.px]': 'x()',\n '[style.top.px]': 'y()',\n '[style.--ngp-tooltip-trigger-width.px]': 'trigger().width()',\n '[style.--ngp-tooltip-transform-origin]': 'transformOrigin()',\n },\n})\nexport class NgpTooltip implements OnInit {\n /**\n * Access the tooltip element.\n */\n private readonly tooltip = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the platform.\n */\n private readonly platform = inject(PLATFORM_ID);\n\n /**\n * Access the trigger instance.\n */\n private readonly trigger = injectTooltipTriggerState();\n\n /**\n * Compute the x position of the tooltip.\n */\n protected readonly x = computed(() => this.trigger().position().x);\n\n /**\n * Compute the y position of the tooltip.\n */\n protected readonly y = computed(() => this.trigger().position().y);\n\n /**\n * Derive the transform origin of the popover.\n */\n protected readonly transformOrigin = computed(() =>\n getTransformOrigin(this.trigger().placement()),\n );\n\n ngOnInit(): void {\n // if the element does not have a fixed position then throw a warning in dev mode\n if (isDevMode() && isPlatformBrowser(this.platform)) {\n const { position } = getComputedStyle(this.tooltip.nativeElement);\n\n if (position !== 'absolute' && position !== 'fixed') {\n console.warn(\n `The tooltip element must have an absolute or fixed position. The current position is ${position}.`,\n );\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAyCO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,IAAI;CAChB;AAEM,MAAM,qBAAqB,GAAG,IAAI,cAAc,CAAmB,uBAAuB,CAAC;AAElG;;;;AAIG;AACG,SAAU,oBAAoB,CAAC,MAAiC,EAAA;IACpE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM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QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,iBAAiB,EAAE,KAAK;AACxB,wBAAA,gBAAgB,EAAE,KAAK;AACvB,wBAAA,wCAAwC,EAAE,mBAAmB;AAC7D,wBAAA,wCAAwC,EAAE,mBAAmB;AAC9D,qBAAA;AACF,iBAAA;;;AC1BD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-tooltip.mjs","sources":["../../../../packages/ng-primitives/tooltip/src/config/tooltip-config.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip-token.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger-state.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/ng-primitives-tooltip.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpTooltipConfig {\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n placement: Placement;\n\n /**\n * Define the delay before the tooltip is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the tooltip should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n};\n\nexport const NgpTooltipConfigToken = new InjectionToken<NgpTooltipConfig>('NgpTooltipConfigToken');\n\n/**\n * Provide the default Tooltip configuration\n * @param config The Tooltip configuration\n * @returns The provider\n */\nexport function provideTooltipConfig(config: Partial<NgpTooltipConfig>): Provider[] {\n return [\n {\n provide: NgpTooltipConfigToken,\n useValue: { ...defaultTooltipConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tooltip configuration\n * @returns The global Tooltip configuration\n */\nexport function injectTooltipConfig(): NgpTooltipConfig {\n return inject(NgpTooltipConfigToken, { optional: true }) ?? defaultTooltipConfig;\n}\n","import { inject, InjectionToken, ValueProvider } from '@angular/core';\n\nexport const NgpTooltipContextToken = new InjectionToken<unknown>('NgpTooltipContextToken');\n\n/**\n * Inject the Tooltip context\n */\nexport function injectTooltipContext<T>(): T {\n return inject(NgpTooltipContextToken) as T;\n}\n\n/**\n * Provide the Tooltip directive instance\n */\nexport function provideTooltipContext<T>(context: T): ValueProvider {\n return { provide: NgpTooltipContextToken, useValue: context };\n}\n","import { Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpTooltipTrigger } from './tooltip-trigger';\n\n/**\n * The state token for the TooltipTrigger primitive.\n */\nexport const NgpTooltipTriggerStateToken =\n createStateToken<NgpTooltipTrigger<unknown>>('TooltipTrigger');\n\n/**\n * Provides the TooltipTrigger state.\n */\nexport const provideTooltipTriggerState = createStateProvider(NgpTooltipTriggerStateToken);\n\n/**\n * Injects the TooltipTrigger state.\n */\nexport const injectTooltipTriggerState = createStateInjector(NgpTooltipTriggerStateToken) as <\n T,\n>() => Signal<State<NgpTooltipTrigger<T>>>;\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { ComponentPortal, DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n ComponentRef,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n Injector,\n OnDestroy,\n TemplateRef,\n Type,\n ViewContainerRef,\n booleanAttribute,\n computed,\n inject,\n input,\n numberAttribute,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n Middleware,\n Placement,\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n} from '@floating-ui/dom';\nimport { injectExitAnimationManager, provideExitAnimationManager } from 'ng-primitives/internal';\nimport { fromResizeEvent } from 'ng-primitives/resize';\nimport { injectDisposables } from 'ng-primitives/utils';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { provideTooltipContext } from '../tooltip/tooltip-token';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltipTrigger` directive to an element that triggers the tooltip to show.\n */\n@Directive({\n selector: '[ngpTooltipTrigger]',\n exportAs: 'ngpTooltipTrigger',\n providers: [provideTooltipTriggerState(), provideExitAnimationManager()],\n host: {\n '[attr.data-open]': 'viewRef !== null ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(mouseenter)': 'show()',\n '(mouseleave)': 'hide()',\n '(focus)': 'show()',\n '(blur)': 'hide()',\n },\n})\nexport class NgpTooltipTrigger<T = null> implements OnDestroy {\n /**\n * Access the exit animation manager.\n */\n private readonly exitAnimationManager = injectExitAnimationManager();\n\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the view container ref.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the disposable utilities\n */\n private readonly disposables = injectDisposables();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpTooltipContent<T> | null>(null, {\n alias: 'ngpTooltipTrigger',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpTooltipTriggerPlacement',\n });\n\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpTooltipTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpTooltipTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpTooltipTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpTooltipTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the tooltip should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Provide context to the tooltip.\n * @default null\n */\n readonly context = input<T | null>(null, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * Store the tooltip view ref.\n */\n protected viewRef: ComponentRef<unknown> | EmbeddedViewRef<T> | null = null;\n\n /**\n * Derive the tooltip middleware from the provided configuration.\n */\n private readonly middleware = computed(() => {\n const middleware: Middleware[] = [offset(this.state.offset()), shift()];\n\n if (this.state.flip()) {\n middleware.push(flip());\n }\n\n return middleware;\n });\n\n /**\n * Store the computed position of the tooltip.\n * @internal\n */\n readonly position = signal<{ x: number; y: number }>({\n x: 0,\n y: 0,\n });\n\n /**\n * The dispose function to stop computing the position of the tooltip.\n */\n private dispose?: () => void;\n\n /**\n * @internal\n * Store the trigger width.\n */\n readonly width = signal<number | null>(null);\n\n /**\n * @internal\n * The timeout to open the tooltip.\n */\n private openTimeout?: () => void;\n\n /**\n * @internal\n * The timeout to close the tooltip.\n */\n private closeTimeout?: () => void;\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n constructor() {\n // update the width of the trigger when it resizes\n fromResizeEvent(this.trigger.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.width.set(this.trigger.nativeElement.offsetWidth));\n }\n\n ngOnDestroy(): void {\n this.destroyTooltip();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // if closing is in progress then clear the timeout to stop the popover from closing\n if (this.closeTimeout) {\n this.closeTimeout();\n this.closeTimeout = undefined;\n }\n\n // if the trigger is disabled or the tooltip is already open then do not show the tooltip\n if (this.state.disabled() || this.openTimeout) {\n return;\n }\n\n // if the tooltip exists in the DOM then do not create it again\n if (this.viewRef) {\n return;\n }\n\n this.openTimeout = this.disposables.setTimeout(\n () => this.createTooltip(),\n this.state.showDelay(),\n );\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // if closing is in progress then clear the timeout to stop the popover from opening\n if (this.openTimeout) {\n this.openTimeout();\n this.openTimeout = undefined;\n }\n\n // if the trigger is disabled or the tooltip is already closed then do not hide the tooltip\n if (this.state.disabled() || this.closeTimeout) {\n return;\n }\n\n this.closeTimeout = this.disposables.setTimeout(\n () => this.destroyTooltip(),\n this.state.hideDelay(),\n );\n }\n\n private createTooltip(): void {\n this.openTimeout = undefined;\n const tooltip = this.state.tooltip();\n\n let portal: TemplatePortal | ComponentPortal<unknown>;\n\n // Create a new inject with the tooltip context\n const injector = Injector.create({\n parent: this.injector,\n providers: [provideTooltipContext(this.state.context())],\n });\n\n if (tooltip instanceof TemplateRef) {\n portal = new TemplatePortal<NgpTooltipTemplateContext<T>>(\n tooltip,\n this.viewContainerRef,\n { $implicit: this.state.context() } as NgpTooltipTemplateContext<T>,\n injector,\n );\n } else if (tooltip instanceof Type) {\n portal = new ComponentPortal(tooltip, this.viewContainerRef, injector);\n } else {\n throw new Error('Tooltip must be either a TemplateRef or a ComponentType');\n }\n\n const domOutlet = new DomPortalOutlet(\n this.state.container() ?? this.document.body,\n undefined,\n undefined,\n injector,\n );\n\n this.viewRef = domOutlet.attach(portal);\n\n let outletElement: HTMLElement | null = null;\n\n if (this.viewRef instanceof ComponentRef) {\n this.viewRef.changeDetectorRef.detectChanges();\n outletElement = this.viewRef.location.nativeElement;\n } else if (this.viewRef) {\n this.viewRef.detectChanges();\n outletElement = this.viewRef.rootNodes[0] as HTMLElement;\n }\n\n if (!outletElement) {\n throw new Error('Outlet element is not available.');\n }\n\n // we want to determine the strategy to use. If the tooltip has position: fixed then we want to use\n // fixed positioning. Otherwise we want to use absolute positioning.\n const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';\n\n this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, outletElement, {\n placement: this.state.placement(),\n middleware: this.middleware(),\n strategy,\n });\n\n this.position.set({ x: position.x, y: position.y });\n });\n }\n\n private async destroyTooltip(): Promise<void> {\n this.closeTimeout = undefined;\n await this.exitAnimationManager.exit();\n\n this.viewRef?.destroy();\n this.viewRef = null;\n this.dispose?.();\n }\n}\n\ntype NgpTooltipTemplateContext<T> = {\n $implicit: T;\n};\ntype NgpTooltipContent<T> = TemplateRef<NgpTooltipTemplateContext<T>> | Type<unknown>;\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Directive,\n ElementRef,\n OnInit,\n PLATFORM_ID,\n computed,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { getTransformOrigin } from 'ng-primitives/popover';\nimport { injectTooltipTriggerState } from '../tooltip-trigger/tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltip` directive to an element that represents the tooltip. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpTooltip]',\n exportAs: 'ngpTooltip',\n hostDirectives: [NgpExitAnimation],\n host: {\n role: 'tooltip',\n '[style.left.px]': 'x()',\n '[style.top.px]': 'y()',\n '[style.--ngp-tooltip-trigger-width.px]': 'trigger().width()',\n '[style.--ngp-tooltip-transform-origin]': 'transformOrigin()',\n },\n})\nexport class NgpTooltip implements OnInit {\n /**\n * Access the tooltip element.\n */\n private readonly tooltip = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the platform.\n */\n private readonly platform = inject(PLATFORM_ID);\n\n /**\n * Access the trigger instance.\n */\n private readonly trigger = injectTooltipTriggerState();\n\n /**\n * Compute the x position of the tooltip.\n */\n protected readonly x = computed(() => this.trigger().position().x);\n\n /**\n * Compute the y position of the tooltip.\n */\n protected readonly y = computed(() => this.trigger().position().y);\n\n /**\n * Derive the transform origin of the popover.\n */\n protected readonly transformOrigin = computed(() =>\n getTransformOrigin(this.trigger().placement()),\n );\n\n ngOnInit(): void {\n // if the element does not have a fixed position then throw a warning in dev mode\n if (isDevMode() && isPlatformBrowser(this.platform)) {\n const { position } = getComputedStyle(this.tooltip.nativeElement);\n\n if (position !== 'absolute' && position !== 'fixed') {\n console.warn(\n `The tooltip element must have an absolute or fixed position. The current position is ${position}.`,\n );\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyCO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,IAAI;CAChB;AAEM,MAAM,qBAAqB,GAAG,IAAI,cAAc,CAAmB,uBAAuB,CAAC;AAElG;;;;AAIG;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AE;AACnD,gBAAA,OAAO,CAAC,IAAI,CACV,wFAAwF,QAAQ,CAAA,CAAA,CAAG,CACpG;;;;8GAzCI,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,KAAA,EAAA,cAAA,EAAA,KAAA,EAAA,sCAAA,EAAA,mBAAA,EAAA,sCAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBAZtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE,YAAY;oBACtB,cAAc,EAAE,CAAC,gBAAgB,CAAC;AAClC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,iBAAiB,EAAE,KAAK;AACxB,wBAAA,gBAAgB,EAAE,KAAK;AACvB,wBAAA,wCAAwC,EAAE,mBAAmB;AAC7D,wBAAA,wCAAwC,EAAE,mBAAmB;AAC9D,qBAAA;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
@@ -18,6 +18,8 @@ function provideValueAccessor(type) {
18
18
  */
19
19
  function injectDisposables() {
20
20
  const destroyRef = inject(DestroyRef);
21
+ let isDestroyed = false;
22
+ destroyRef.onDestroy(() => (isDestroyed = true));
21
23
  return {
22
24
  /**
23
25
  * Set a timeout that will be cleared when the component is destroyed.
@@ -26,6 +28,10 @@ function injectDisposables() {
26
28
  * @returns A function to clear the timeout
27
29
  */
28
30
  setTimeout: (callback, delay) => {
31
+ if (isDestroyed) {
32
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
33
+ return () => { };
34
+ }
29
35
  const id = setTimeout(callback, delay);
30
36
  const cleanup = () => clearTimeout(id);
31
37
  destroyRef.onDestroy(cleanup);
@@ -44,6 +50,10 @@ function injectDisposables() {
44
50
  addEventListener: (target, type,
45
51
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
52
  listener, options) => {
53
+ if (isDestroyed) {
54
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
55
+ return () => { };
56
+ }
47
57
  target.addEventListener(type, listener, options);
48
58
  const cleanup = () => target.removeEventListener(type, listener, options);
49
59
  destroyRef.onDestroy(cleanup);
@@ -56,6 +66,10 @@ function injectDisposables() {
56
66
  * @returns A function to clear the interval
57
67
  */
58
68
  setInterval: (callback, delay) => {
69
+ if (isDestroyed) {
70
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
71
+ return () => { };
72
+ }
59
73
  const id = setInterval(callback, delay);
60
74
  const cleanup = () => clearInterval(id);
61
75
  destroyRef.onDestroy(cleanup);
@@ -67,6 +81,10 @@ function injectDisposables() {
67
81
  * @returns A function to clear the requestAnimationFrame
68
82
  */
69
83
  requestAnimationFrame: (callback) => {
84
+ if (isDestroyed) {
85
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
86
+ return () => { };
87
+ }
70
88
  const id = requestAnimationFrame(callback);
71
89
  const cleanup = () => cancelAnimationFrame(id);
72
90
  destroyRef.onDestroy(cleanup);
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-utils.mjs","sources":["../../../../packages/ng-primitives/utils/src/forms/providers.ts","../../../../packages/ng-primitives/utils/src/helpers/disposables.ts","../../../../packages/ng-primitives/utils/src/helpers/unique-id.ts","../../../../packages/ng-primitives/utils/src/signals/index.ts","../../../../packages/ng-primitives/utils/src/ui/dimensions.ts","../../../../packages/ng-primitives/utils/src/ng-primitives-utils.ts"],"sourcesContent":["import { ExistingProvider, Type } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * A simple helper function to provide a value accessor for a given type.\n * @param type The type to provide the value accessor for\n */\nexport function provideValueAccessor<T>(type: Type<T>): ExistingProvider {\n return { provide: NG_VALUE_ACCESSOR, useExisting: type, multi: true };\n}\n","import { DestroyRef, inject } from '@angular/core';\n\n/**\n * Disposable functions are a way to manage timers, intervals, and event listeners\n * that should be cleared when a component is destroyed.\n *\n * This is heavily inspired by Headless UI disposables:\n * https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/utils/disposables.ts\n */\nexport function injectDisposables() {\n const destroyRef = inject(DestroyRef);\n\n return {\n /**\n * Set a timeout that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @param delay The delay before the callback is executed\n * @returns A function to clear the timeout\n */\n setTimeout: (callback: () => void, delay: number) => {\n const id = setTimeout(callback, delay);\n const cleanup = () => clearTimeout(id);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n /**\n * Set an interval that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @param delay The delay before the callback is executed\n * @param target\n * @param type\n * @param listener\n * @param options\n * @returns A function to clear the interval\n */\n addEventListener: <K extends keyof HTMLElementEventMap>(\n target: EventTarget,\n type: K,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions,\n ) => {\n target.addEventListener(type, listener as EventListenerOrEventListenerObject, options);\n const cleanup = () =>\n target.removeEventListener(type, listener as EventListenerOrEventListenerObject, options);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n /**\n * Set an interval that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @param delay The delay before the callback is executed\n * @returns A function to clear the interval\n */\n setInterval: (callback: () => void, delay: number) => {\n const id = setInterval(callback, delay);\n const cleanup = () => clearInterval(id);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n /**\n * Set a requestAnimationFrame that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @returns A function to clear the requestAnimationFrame\n */\n requestAnimationFrame: (callback: FrameRequestCallback) => {\n const id = requestAnimationFrame(callback);\n const cleanup = () => cancelAnimationFrame(id);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n };\n}\n","/**\n * Store a map of unique ids for elements so that there are no collisions.\n */\nconst uniqueIdMap = new Map<string, number>();\n\n/**\n * Generate a unique id for an element\n * @param prefix - The prefix to use for the id\n * @returns The generated id\n */\nexport function uniqueId(prefix: string): string {\n const id = uniqueIdMap.get(prefix) ?? 0;\n uniqueIdMap.set(prefix, id + 1);\n return `${prefix}-${id}`;\n}\n","import { effect, Injector, Signal, signal, untracked } from '@angular/core';\n\n/**\n * Listen for changes to a signal and call a function when the signal changes.\n * @param source\n * @param fn\n * @param options\n * @param options.injector\n * @internal\n */\nexport function onChange<T>(\n source: Signal<T | null | undefined>,\n fn: (value: T | null | undefined, previousValue: T | null | undefined) => void,\n options?: { injector: Injector },\n): void {\n const previousValue = signal(source());\n\n effect(\n () => {\n const value = source();\n if (value !== previousValue()) {\n untracked(() => fn(value, previousValue()));\n previousValue.set(value);\n }\n },\n { injector: options?.injector },\n );\n\n // call the fn with the initial value\n fn(source(), null);\n}\n\n/**\n * Listen for changes to a boolean signal and call one of two functions when the signal changes.\n * @param source\n * @param onTrue\n * @param onFalse\n * @param options\n */\nexport function onBooleanChange(\n source: Signal<boolean>,\n onTrue?: () => void,\n onFalse?: () => void,\n options?: { injector: Injector },\n): void {\n onChange(source, value => (value ? onTrue?.() : onFalse?.()), options);\n}\n","import { ElementRef, Renderer2, afterNextRender, inject, signal } from '@angular/core';\n\n/**\n * Injects the dimensions of the element\n * @returns The dimensions of the element\n */\nexport function injectDimensions() {\n const renderer = inject(Renderer2);\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const size = signal<{ width: number; height: number; mounted: boolean }>({\n width: 0,\n height: 0,\n mounted: false,\n });\n let transitionDuration: string | undefined, animationName: string | undefined;\n\n afterNextRender({\n earlyRead: () => {\n transitionDuration = element.style.transitionDuration;\n animationName = element.style.animationName;\n },\n write: () => {\n // block any animations/transitions so the element renders at its full dimensions\n renderer.setStyle(element, 'transitionDuration', '0s');\n renderer.setStyle(element, 'animationName', 'none');\n },\n read: () => {\n const { width, height } = element.getBoundingClientRect();\n size.set({ width, height, mounted: true });\n // restore the original transition duration and animation name\n renderer.setStyle(element, 'transitionDuration', transitionDuration);\n renderer.setStyle(element, 'animationName', animationName);\n },\n });\n\n return size;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAGA;;;AAGG;AACG,SAAU,oBAAoB,CAAI,IAAa,EAAA;AACnD,IAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;AACvE;;ACPA;;;;;;AAMG;SACa,iBAAiB,GAAA;AAC/B,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAErC,OAAO;AACL;;;;;AAKG;AACH,QAAA,UAAU,EAAE,CAAC,QAAoB,EAAE,KAAa,KAAI;YAClD,MAAM,EAAE,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,EAAE,CAAC;AACtC,YAAA,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC;AAC7B,YAAA,OAAO,OAAO;SACf;AACD;;;;;;;;;AASG;AACH,QAAA,gBAAgB,EAAE,CAChB,MAAmB,EACnB,IAAO;;QAEP,QAAgE,EAChE,OAA2C,KACzC;YACF,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAA8C,EAAE,OAAO,CAAC;AACtF,YAAA,MAAM,OAAO,GAAG,MACd,MAAM,CAAC,mBAAmB,CAAC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AAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;YAE1C,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,CAAC;YACpE,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,aAAa,CAAC;SAC3D;AACF,KAAA,CAAC;AAEF,IAAA,OAAO,IAAI;AACb;;ACpCA;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-utils.mjs","sources":["../../../../packages/ng-primitives/utils/src/forms/providers.ts","../../../../packages/ng-primitives/utils/src/helpers/disposables.ts","../../../../packages/ng-primitives/utils/src/helpers/unique-id.ts","../../../../packages/ng-primitives/utils/src/signals/index.ts","../../../../packages/ng-primitives/utils/src/ui/dimensions.ts","../../../../packages/ng-primitives/utils/src/ng-primitives-utils.ts"],"sourcesContent":["import { ExistingProvider, Type } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * A simple helper function to provide a value accessor for a given type.\n * @param type The type to provide the value accessor for\n */\nexport function provideValueAccessor<T>(type: Type<T>): ExistingProvider {\n return { provide: NG_VALUE_ACCESSOR, useExisting: type, multi: true };\n}\n","import { DestroyRef, inject } from '@angular/core';\n\n/**\n * Disposable functions are a way to manage timers, intervals, and event listeners\n * that should be cleared when a component is destroyed.\n *\n * This is heavily inspired by Headless UI disposables:\n * https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/utils/disposables.ts\n */\nexport function injectDisposables() {\n const destroyRef = inject(DestroyRef);\n let isDestroyed = false;\n\n destroyRef.onDestroy(() => (isDestroyed = true));\n\n return {\n /**\n * Set a timeout that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @param delay The delay before the callback is executed\n * @returns A function to clear the timeout\n */\n setTimeout: (callback: () => void, delay: number) => {\n if (isDestroyed) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n const id = setTimeout(callback, delay);\n const cleanup = () => clearTimeout(id);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n /**\n * Set an interval that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @param delay The delay before the callback is executed\n * @param target\n * @param type\n * @param listener\n * @param options\n * @returns A function to clear the interval\n */\n addEventListener: <K extends keyof HTMLElementEventMap>(\n target: EventTarget,\n type: K,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions,\n ) => {\n if (isDestroyed) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n target.addEventListener(type, listener as EventListenerOrEventListenerObject, options);\n const cleanup = () =>\n target.removeEventListener(type, listener as EventListenerOrEventListenerObject, options);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n /**\n * Set an interval that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @param delay The delay before the callback is executed\n * @returns A function to clear the interval\n */\n setInterval: (callback: () => void, delay: number) => {\n if (isDestroyed) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n const id = setInterval(callback, delay);\n const cleanup = () => clearInterval(id);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n /**\n * Set a requestAnimationFrame that will be cleared when the component is destroyed.\n * @param callback The callback to execute\n * @returns A function to clear the requestAnimationFrame\n */\n requestAnimationFrame: (callback: FrameRequestCallback) => {\n if (isDestroyed) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n const id = requestAnimationFrame(callback);\n const cleanup = () => cancelAnimationFrame(id);\n destroyRef.onDestroy(cleanup);\n return cleanup;\n },\n };\n}\n","/**\n * Store a map of unique ids for elements so that there are no collisions.\n */\nconst uniqueIdMap = new Map<string, number>();\n\n/**\n * Generate a unique id for an element\n * @param prefix - The prefix to use for the id\n * @returns The generated id\n */\nexport function uniqueId(prefix: string): string {\n const id = uniqueIdMap.get(prefix) ?? 0;\n uniqueIdMap.set(prefix, id + 1);\n return `${prefix}-${id}`;\n}\n","import { effect, Injector, Signal, signal, untracked } from '@angular/core';\n\n/**\n * Listen for changes to a signal and call a function when the signal changes.\n * @param source\n * @param fn\n * @param options\n * @param options.injector\n * @internal\n */\nexport function onChange<T>(\n source: Signal<T | null | undefined>,\n fn: (value: T | null | undefined, previousValue: T | null | undefined) => void,\n options?: { injector: Injector },\n): void {\n const previousValue = signal(source());\n\n effect(\n () => {\n const value = source();\n if (value !== previousValue()) {\n untracked(() => fn(value, previousValue()));\n previousValue.set(value);\n }\n },\n { injector: options?.injector },\n );\n\n // call the fn with the initial value\n fn(source(), null);\n}\n\n/**\n * Listen for changes to a boolean signal and call one of two functions when the signal changes.\n * @param source\n * @param onTrue\n * @param onFalse\n * @param options\n */\nexport function onBooleanChange(\n source: Signal<boolean>,\n onTrue?: () => void,\n onFalse?: () => void,\n options?: { injector: Injector },\n): void {\n onChange(source, value => (value ? onTrue?.() : onFalse?.()), options);\n}\n","import { ElementRef, Renderer2, afterNextRender, inject, signal } from '@angular/core';\n\n/**\n * Injects the dimensions of the element\n * @returns The dimensions of the element\n */\nexport function injectDimensions() {\n const renderer = inject(Renderer2);\n const element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const size = signal<{ width: number; height: number; mounted: boolean }>({\n width: 0,\n height: 0,\n mounted: false,\n });\n let transitionDuration: string | undefined, animationName: string | undefined;\n\n afterNextRender({\n earlyRead: () => {\n transitionDuration = element.style.transitionDuration;\n animationName = element.style.animationName;\n },\n write: () => {\n // block any animations/transitions so the element renders at its full dimensions\n renderer.setStyle(element, 'transitionDuration', '0s');\n renderer.setStyle(element, 'animationName', 'none');\n },\n read: () => {\n const { width, height } = element.getBoundingClientRect();\n size.set({ width, height, mounted: true });\n // restore the original transition duration and animation name\n renderer.setStyle(element, 'transitionDuration', transitionDuration);\n renderer.setStyle(element, 'animationName', animationName);\n },\n });\n\n return size;\n}\n","/**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,CAAC;;YAE1C,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,CAAC;YACpE,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,aAAa,CAAC;SAC3D;AACF,KAAA,CAAC;AAEF,IAAA,OAAO,IAAI;AACb;;ACpCA;;AAEG;;;;"}
@@ -6,13 +6,13 @@ export declare const NgpFileDropzoneStateToken: import("@angular/core").Injectio
6
6
  /**
7
7
  * Provides the FileDropzone state.
8
8
  */
9
- export declare const provideFileDropzoneState: () => import("@angular/core").FactoryProvider;
9
+ export declare const provideFileDropzoneState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the FileDropzone state.
12
12
  */
13
13
  export declare const injectFileDropzoneState: <U = {
14
14
  readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
15
- readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
15
+ readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string | string[]>;
16
16
  readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
17
17
  readonly directory: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
18
18
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
@@ -9,9 +9,10 @@ export declare class NgpFileDropzone {
9
9
  */
10
10
  private readonly elementRef;
11
11
  /**
12
- * The accepted file types.
12
+ * The accepted file types. This can be an array of strings or a comma-separated string.
13
+ * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).
13
14
  */
14
- readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
15
+ readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string | string[]>;
15
16
  /**
16
17
  * Whether to allow multiple files to be selected.
17
18
  */
@@ -6,13 +6,13 @@ export declare const NgpFileUploadStateToken: import("@angular/core").InjectionT
6
6
  /**
7
7
  * Provides the FileUpload state.
8
8
  */
9
- export declare const provideFileUploadState: () => import("@angular/core").FactoryProvider;
9
+ export declare const provideFileUploadState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the FileUpload state.
12
12
  */
13
13
  export declare const injectFileUploadState: <U = {
14
14
  readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
15
- readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
15
+ readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string | string[]>;
16
16
  readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
17
17
  readonly directory: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
18
18
  readonly dragAndDrop: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
@@ -9,9 +9,10 @@ export declare class NgpFileUpload {
9
9
  */
10
10
  private readonly elementRef;
11
11
  /**
12
- * The accepted file types.
12
+ * The accepted file types. This can be an array of strings or a comma-separated string.
13
+ * Accepted types can either be file extensions (e.g. `.jpg`) or MIME types (e.g. `image/jpeg`).
13
14
  */
14
- readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string>;
15
+ readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string | string[]>;
15
16
  /**
16
17
  * Whether to allow multiple files to be selected.
17
18
  */
@@ -7,7 +7,7 @@ export declare const NgpFormControlStateToken: import("@angular/core").Injection
7
7
  /**
8
8
  * Provides the FormControl state.
9
9
  */
10
- export declare const provideFormControlState: () => import("@angular/core").FactoryProvider;
10
+ export declare const provideFormControlState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
11
11
  /**
12
12
  * Injects the FormControl state.
13
13
  */
@@ -6,7 +6,7 @@ export declare const NgpFormFieldStateToken: import("@angular/core").InjectionTo
6
6
  /**
7
7
  * Provides the FormField state.
8
8
  */
9
- export declare const provideFormFieldState: () => import("@angular/core").FactoryProvider;
9
+ export declare const provideFormFieldState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the FormField state.
12
12
  */
@@ -6,7 +6,7 @@ export declare const NgpInputStateToken: import("@angular/core").InjectionToken<
6
6
  /**
7
7
  * Provides the Input state.
8
8
  */
9
- export declare const provideInputState: () => import("@angular/core").FactoryProvider;
9
+ export declare const provideInputState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the Input state.
12
12
  */
@@ -0,0 +1,17 @@
1
+ import { ClassProvider } from '@angular/core';
2
+ import type { NgpExitAnimation } from './exit-animation';
3
+ import * as i0 from "@angular/core";
4
+ export declare class NgpExitAnimationManager {
5
+ /** Store the instances of the exit animation directive. */
6
+ private readonly instances;
7
+ /** Add an instance to the manager. */
8
+ add(instance: NgpExitAnimation): void;
9
+ /** Remove an instance from the manager. */
10
+ remove(instance: NgpExitAnimation): void;
11
+ /** Exit all instances. */
12
+ exit(): Promise<void[]>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgpExitAnimationManager, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgpExitAnimationManager>;
15
+ }
16
+ export declare function provideExitAnimationManager(): ClassProvider;
17
+ export declare function injectExitAnimationManager(): NgpExitAnimationManager;
@@ -4,27 +4,14 @@ export declare class NgpExitAnimation implements OnDestroy {
4
4
  /** The animation manager. */
5
5
  private readonly animationManager;
6
6
  /** The element to animate. */
7
- private readonly element;
8
- /** Access the change detector. */
9
- private readonly changeDetector;
10
- /** The animation state */
11
- private readonly state;
7
+ private readonly elementRef;
8
+ /** Access the renderer. */
9
+ private readonly renderer;
12
10
  constructor();
13
11
  ngOnDestroy(): void;
14
12
  /** Mark the element as exiting. */
15
13
  exit(): Promise<void>;
14
+ private setAnimationState;
16
15
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpExitAnimation, never>;
17
16
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgpExitAnimation, "[ngpExitAnimation]", ["ngpExitAnimation"], {}, {}, never, never, true, never>;
18
17
  }
19
- export declare class NgpExitAnimationManager {
20
- /** Store the instances of the exit animation directive. */
21
- private readonly instances;
22
- /** Add an instance to the manager. */
23
- add(instance: NgpExitAnimation): void;
24
- /** Remove an instance from the manager. */
25
- remove(instance: NgpExitAnimation): void;
26
- /** Exit all instances. */
27
- exit(): Promise<void[]>;
28
- static ɵfac: i0.ɵɵFactoryDeclaration<NgpExitAnimationManager, never>;
29
- static ɵprov: i0.ɵɵInjectableDeclaration<NgpExitAnimationManager>;
30
- }
@@ -1,4 +1,5 @@
1
- export { NgpExitAnimation, NgpExitAnimationManager } from './exit-animation/exit-animation';
1
+ export { NgpExitAnimation } from './exit-animation/exit-animation';
2
+ export { injectExitAnimationManager, NgpExitAnimationManager, provideExitAnimationManager, } from './exit-animation/exit-animation-manager';
2
3
  export * from './interactions/index';
3
4
  export * from './signals/explicit-effect';
4
5
  export * from './signals/sync-state';
@@ -6,14 +6,14 @@ export declare const NgpListboxStateToken: import("@angular/core").InjectionToke
6
6
  /**
7
7
  * Provides the Listbox state.
8
8
  */
9
- export declare const provideListboxState: () => import("@angular/core").FactoryProvider;
9
+ export declare const provideListboxState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the Listbox state.
12
12
  */
13
13
  export declare const injectListboxState: <U = {
14
14
  readonly injector: import("@angular/core").Injector;
15
15
  readonly destroyRef: import("@angular/core").DestroyRef;
16
- readonly popoverTrigger: import("@angular/core").Signal<import("ng-primitives/state").State<import("ng-primitives/popover").NgpPopoverTrigger>>;
16
+ readonly popoverTrigger: import("@angular/core").Signal<import("ng-primitives/state").State<import("ng-primitives/popover").NgpPopoverTrigger<unknown>>>;
17
17
  readonly id: import("@angular/core").InputSignal<string>;
18
18
  readonly mode: import("@angular/core").InputSignal<import("ng-primitives/common").NgpSelectionMode>;
19
19
  readonly value: import("@angular/core").InputSignal<unknown[]>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ng-primitives",
3
3
  "description": "Angular Primitives is a low-level headless UI component library with a focus on accessibility, customization, and developer experience. ",
4
4
  "license": "Apache-2.0",
5
- "version": "0.35.0",
5
+ "version": "0.36.0",
6
6
  "keywords": [
7
7
  "angular",
8
8
  "primitives",
@@ -99,14 +99,14 @@
99
99
  "types": "./date-time/index.d.ts",
100
100
  "default": "./fesm2022/ng-primitives-date-time.mjs"
101
101
  },
102
- "./dialog": {
103
- "types": "./dialog/index.d.ts",
104
- "default": "./fesm2022/ng-primitives-dialog.mjs"
105
- },
106
102
  "./date-time-luxon": {
107
103
  "types": "./date-time-luxon/index.d.ts",
108
104
  "default": "./fesm2022/ng-primitives-date-time-luxon.mjs"
109
105
  },
106
+ "./dialog": {
107
+ "types": "./dialog/index.d.ts",
108
+ "default": "./fesm2022/ng-primitives-dialog.mjs"
109
+ },
110
110
  "./file-upload": {
111
111
  "types": "./file-upload/index.d.ts",
112
112
  "default": "./fesm2022/ng-primitives-file-upload.mjs"
@@ -6,7 +6,7 @@ export declare const NgpPaginationStateToken: import("@angular/core").InjectionT
6
6
  /**
7
7
  * Provides the Pagination state.
8
8
  */
9
- export declare const providePaginationState: () => import("@angular/core").FactoryProvider;
9
+ export declare const providePaginationState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the Pagination state.
12
12
  */
@@ -2,4 +2,5 @@ export { NgpPopoverConfig, providePopoverConfig } from './config/popover-config'
2
2
  export { NgpPopoverTrigger } from './popover-trigger/popover-trigger';
3
3
  export { injectPopoverTriggerState, providePopoverTriggerState, } from './popover-trigger/popover-trigger-state';
4
4
  export { NgpPopover } from './popover/popover';
5
+ export { injectPopoverContext, NgpPopoverContextToken } from './popover/popover-token';
5
6
  export { getTransformOrigin } from './utils/transform-origin';
@@ -0,0 +1,10 @@
1
+ import { InjectionToken, ValueProvider } from '@angular/core';
2
+ export declare const NgpPopoverContextToken: InjectionToken<unknown>;
3
+ /**
4
+ * Inject the Popover context
5
+ */
6
+ export declare function injectPopoverContext<T>(): T;
7
+ /**
8
+ * Provide the Popover context
9
+ */
10
+ export declare function providePopoverContext<T>(context: T): ValueProvider;
@@ -1,6 +1,7 @@
1
1
  import { FocusOrigin } from '@angular/cdk/a11y';
2
2
  import * as i0 from "@angular/core";
3
3
  import * as i1 from "ng-primitives/focus-trap";
4
+ import * as i2 from "ng-primitives/internal";
4
5
  /**
5
6
  * Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`.
6
7
  */
@@ -20,7 +21,7 @@ export declare class NgpPopover {
20
21
  /**
21
22
  * Access the trigger instance.
22
23
  */
23
- protected readonly trigger: import("@angular/core").Signal<import("ng-primitives/state").State<import("ng-primitives/popover").NgpPopoverTrigger>>;
24
+ protected readonly trigger: import("@angular/core").Signal<import("ng-primitives/state").State<import("ng-primitives/popover").NgpPopoverTrigger<unknown>>>;
24
25
  /**
25
26
  * Compute the x position of the popover.
26
27
  */
@@ -41,5 +42,5 @@ export declare class NgpPopover {
41
42
  */
42
43
  setInitialFocus(origin: FocusOrigin): void;
43
44
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpPopover, never>;
44
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpPopover, "[ngpPopover]", ["ngpPopover"], {}, {}, never, never, true, [{ directive: typeof i1.NgpFocusTrap; inputs: {}; outputs: {}; }]>;
45
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpPopover, "[ngpPopover]", ["ngpPopover"], {}, {}, never, never, true, [{ directive: typeof i1.NgpFocusTrap; inputs: {}; outputs: {}; }, { directive: typeof i2.NgpExitAnimation; inputs: {}; outputs: {}; }]>;
45
46
  }
@@ -1,16 +1,18 @@
1
+ import { InjectOptions, Signal } from '@angular/core';
2
+ import { State } from 'ng-primitives/state';
1
3
  import type { NgpPopoverTrigger } from './popover-trigger';
2
4
  /**
3
5
  * The state token for the PopoverTrigger primitive.
4
6
  */
5
- export declare const NgpPopoverTriggerStateToken: import("@angular/core").InjectionToken<NgpPopoverTrigger>;
7
+ export declare const NgpPopoverTriggerStateToken: import("@angular/core").InjectionToken<NgpPopoverTrigger<null>>;
6
8
  /**
7
9
  * Provides the PopoverTrigger state.
8
10
  */
9
- export declare const providePopoverTriggerState: () => import("@angular/core").FactoryProvider;
11
+ export declare const providePopoverTriggerState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
12
  /**
11
13
  * Injects the PopoverTrigger state.
12
14
  */
13
- export declare const injectPopoverTriggerState: <U = NgpPopoverTrigger>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
15
+ export declare const injectPopoverTriggerState: <T>(options?: InjectOptions) => Signal<State<NgpPopoverTrigger<T>>>;
14
16
  /**
15
17
  * The PopoverTrigger state registration function.
16
18
  */
@@ -1,17 +1,21 @@
1
1
  import { FocusOrigin } from '@angular/cdk/a11y';
2
2
  import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
3
- import { OnDestroy, TemplateRef } from '@angular/core';
3
+ import { ComponentRef, EmbeddedViewRef, OnDestroy, TemplateRef, Type } from '@angular/core';
4
4
  import { Placement } from '@floating-ui/dom';
5
5
  import type { NgpPopover } from '../popover/popover';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.
9
9
  */
10
- export declare class NgpPopoverTrigger implements OnDestroy {
10
+ export declare class NgpPopoverTrigger<T = null> implements OnDestroy {
11
11
  /**
12
12
  * Access the trigger element
13
13
  */
14
14
  private readonly trigger;
15
+ /**
16
+ * Access the exit animation state.
17
+ */
18
+ private readonly exitAnimationState;
15
19
  /**
16
20
  * Inject the parent popover trigger if available.
17
21
  */
@@ -47,16 +51,7 @@ export declare class NgpPopoverTrigger implements OnDestroy {
47
51
  /**
48
52
  * Access the popover template ref.
49
53
  */
50
- readonly popover: import("@angular/core").InputSignal<TemplateRef<void>>;
51
- /**
52
- * The open state of the popover.
53
- * @default false
54
- */
55
- readonly open: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
56
- /**
57
- * Emit when the open state changes.
58
- */
59
- readonly openChange: import("@angular/core").OutputEmitterRef<boolean>;
54
+ readonly popover: import("@angular/core").InputSignal<NgpPopoverContent<T> | null>;
60
55
  /**
61
56
  * Define if the trigger should be disabled.
62
57
  * @default false
@@ -107,10 +102,19 @@ export declare class NgpPopoverTrigger implements OnDestroy {
107
102
  * @default 'reposition'
108
103
  */
109
104
  readonly scrollBehavior: import("@angular/core").InputSignal<"reposition" | "block">;
105
+ /**
106
+ * Provide context to the popover.
107
+ * @default null
108
+ */
109
+ readonly context: import("@angular/core").InputSignal<T | null>;
110
110
  /**
111
111
  * Store the popover view ref.
112
112
  */
113
- private viewRef;
113
+ protected readonly viewRef: import("@angular/core").WritableSignal<ComponentRef<unknown> | EmbeddedViewRef<void> | null>;
114
+ /**
115
+ * Determines if the popover is open.
116
+ */
117
+ readonly open: import("@angular/core").Signal<boolean>;
114
118
  /**
115
119
  * Derive the popover middleware from the provided configuration.
116
120
  */
@@ -150,7 +154,7 @@ export declare class NgpPopoverTrigger implements OnDestroy {
150
154
  * @internal
151
155
  * Register any child popover to the stack.
152
156
  */
153
- readonly stack: NgpPopoverTrigger[];
157
+ readonly stack: NgpPopoverTrigger<any>[];
154
158
  /**
155
159
  * @internal
156
160
  * The timeout to open the popover.
@@ -164,12 +168,11 @@ export declare class NgpPopoverTrigger implements OnDestroy {
164
168
  /**
165
169
  * The popover trigger state.
166
170
  */
167
- protected readonly state: import("ng-primitives/state").CreatedState<NgpPopoverTrigger>;
171
+ readonly state: import("ng-primitives/state").CreatedState<NgpPopoverTrigger<T>>;
168
172
  constructor();
169
173
  ngOnDestroy(): void;
170
174
  protected toggleOpenState(event: MouseEvent): void;
171
175
  /**
172
- * @internal
173
176
  * Show the popover.
174
177
  */
175
178
  show(origin: FocusOrigin): void;
@@ -192,6 +195,11 @@ export declare class NgpPopoverTrigger implements OnDestroy {
192
195
  * @internal
193
196
  */
194
197
  setPopover(instance: NgpPopover): void;
195
- static ɵfac: i0.ɵɵFactoryDeclaration<NgpPopoverTrigger, never>;
196
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpPopoverTrigger, "[ngpPopoverTrigger]", ["ngpPopoverTrigger"], { "popover": { "alias": "ngpPopoverTrigger"; "required": true; "isSignal": true; }; "open": { "alias": "ngpPopoverTriggerOpen"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpPopoverTriggerDisabled"; "required": false; "isSignal": true; }; "placement": { "alias": "ngpPopoverTriggerPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "ngpPopoverTriggerOffset"; "required": false; "isSignal": true; }; "showDelay": { "alias": "ngpPopoverTriggerShowDelay"; "required": false; "isSignal": true; }; "hideDelay": { "alias": "ngpPopoverTriggerHideDelay"; "required": false; "isSignal": true; }; "flip": { "alias": "ngpPopoverTriggerFlip"; "required": false; "isSignal": true; }; "container": { "alias": "ngpPopoverTriggerContainer"; "required": false; "isSignal": true; }; "closeOnOutsideClick": { "alias": "ngpPopoverTriggerCloseOnOutsideClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "ngpPopoverTriggerCloseOnEscape"; "required": false; "isSignal": true; }; "scrollBehavior": { "alias": "ngpPopoverTriggerScrollBehavior"; "required": false; "isSignal": true; }; }, { "openChange": "ngpPopoverTriggerOpenChange"; }, never, never, true, never>;
198
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgpPopoverTrigger<any>, never>;
199
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpPopoverTrigger<any>, "[ngpPopoverTrigger]", ["ngpPopoverTrigger"], { "popover": { "alias": "ngpPopoverTrigger"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpPopoverTriggerDisabled"; "required": false; "isSignal": true; }; "placement": { "alias": "ngpPopoverTriggerPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "ngpPopoverTriggerOffset"; "required": false; "isSignal": true; }; "showDelay": { "alias": "ngpPopoverTriggerShowDelay"; "required": false; "isSignal": true; }; "hideDelay": { "alias": "ngpPopoverTriggerHideDelay"; "required": false; "isSignal": true; }; "flip": { "alias": "ngpPopoverTriggerFlip"; "required": false; "isSignal": true; }; "container": { "alias": "ngpPopoverTriggerContainer"; "required": false; "isSignal": true; }; "closeOnOutsideClick": { "alias": "ngpPopoverTriggerCloseOnOutsideClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "ngpPopoverTriggerCloseOnEscape"; "required": false; "isSignal": true; }; "scrollBehavior": { "alias": "ngpPopoverTriggerScrollBehavior"; "required": false; "isSignal": true; }; "context": { "alias": "ngpPopoverTriggerContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
197
200
  }
201
+ type NgpPopoverTemplateContext<T> = {
202
+ $implicit: T;
203
+ };
204
+ type NgpPopoverContent<T> = TemplateRef<NgpPopoverTemplateContext<T>> | Type<unknown>;
205
+ export {};
@@ -6,7 +6,7 @@ export declare const NgpProgressStateToken: import("@angular/core").InjectionTok
6
6
  /**
7
7
  * Provides the Progress state.
8
8
  */
9
- export declare const provideProgressState: () => import("@angular/core").FactoryProvider;
9
+ export declare const provideProgressState: (options?: import("ng-primitives/state").CreateStateProviderOptions) => import("@angular/core").FactoryProvider;
10
10
  /**
11
11
  * Injects the Progress state.
12
12
  */