ng-primitives 0.75.0 → 0.76.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 (65) hide show
  1. package/a11y/visually-hidden/visually-hidden.d.ts +1 -0
  2. package/{internal/interactions/button.d.ts → button/button/setup-button.d.ts} +2 -1
  3. package/button/index.d.ts +1 -0
  4. package/combobox/combobox/combobox.d.ts +1 -1
  5. package/combobox/config/combobox-config.d.ts +3 -3
  6. package/dialog/config/dialog-config.d.ts +2 -0
  7. package/dialog/dialog-overlay/dialog-overlay.d.ts +3 -2
  8. package/fesm2022/ng-primitives-a11y.mjs +3 -1
  9. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  10. package/fesm2022/ng-primitives-button.mjs +21 -2
  11. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  12. package/fesm2022/ng-primitives-checkbox.mjs +1 -1
  13. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  14. package/fesm2022/ng-primitives-combobox.mjs +3 -2
  15. package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
  16. package/fesm2022/ng-primitives-date-picker.mjs +2 -1
  17. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  18. package/fesm2022/ng-primitives-dialog.mjs +4 -1
  19. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  20. package/fesm2022/ng-primitives-file-upload.mjs +2 -1
  21. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-input.mjs +2 -1
  23. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-interactions.mjs +39 -2
  25. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-internal.mjs +2 -56
  27. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-listbox.mjs +2 -1
  29. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-menu.mjs +3 -2
  31. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  32. package/fesm2022/ng-primitives-pagination.mjs +1 -1
  33. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-popover.mjs +1 -1
  35. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  36. package/fesm2022/ng-primitives-portal.mjs +20 -1
  37. package/fesm2022/ng-primitives-portal.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-select.mjs +4 -3
  39. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-slider.mjs +2 -1
  41. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-switch.mjs +2 -1
  43. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-tabs.mjs +2 -1
  45. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-textarea.mjs +1 -1
  47. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-tooltip.mjs +1 -1
  49. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  50. package/interactions/index.d.ts +1 -0
  51. package/internal/index.d.ts +0 -1
  52. package/internal/interactions/index.d.ts +0 -1
  53. package/menu/config/menu-config.d.ts +3 -3
  54. package/menu/menu-trigger/menu-trigger.d.ts +1 -1
  55. package/package.json +15 -15
  56. package/popover/config/popover-config.d.ts +3 -3
  57. package/popover/popover-trigger/popover-trigger.d.ts +1 -1
  58. package/portal/overlay.d.ts +7 -2
  59. package/select/config/select-config.d.ts +3 -3
  60. package/select/index.d.ts +1 -0
  61. package/select/select/select.d.ts +1 -1
  62. package/tooltip/config/tooltip-config.d.ts +3 -3
  63. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +1 -1
  64. /package/{internal/utilities → interactions/setup-interactions}/interaction.d.ts +0 -0
  65. /package/{internal/interactions/interactions.d.ts → interactions/setup-interactions/setup-interactions.d.ts} +0 -0
@@ -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/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-text-content/tooltip-text-content.component.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-arrow/tooltip-arrow.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 500\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 /**\n * Whether the tooltip should only show when the trigger element overflows.\n * @default false\n */\n showOnOverflow: boolean;\n\n /**\n * Whether to use the text content of the trigger element as the tooltip content.\n * @default true\n */\n useTextContent: boolean;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 500,\n flip: true,\n container: null,\n showOnOverflow: false,\n useTextContent: true,\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 { Directive, input } from '@angular/core';\nimport { explicitEffect, setupHover } from 'ng-primitives/internal';\nimport { injectOverlay } from 'ng-primitives/portal';\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 '[id]': 'id()',\n '[style.left.px]': 'overlay.position().x',\n '[style.top.px]': 'overlay.position().y',\n '[style.--ngp-tooltip-trigger-width.px]': 'overlay.triggerWidth()',\n '[style.--ngp-tooltip-transform-origin]': 'overlay.transformOrigin()',\n '[attr.data-placement]': 'overlay.finalPlacement()',\n 'data-overlay': '',\n },\n})\nexport class NgpTooltip {\n /**\n * Access the overlay.\n */\n protected readonly overlay = injectOverlay();\n\n /**\n * The unique id of the tooltip.\n */\n readonly id = input(this.overlay.id());\n\n constructor() {\n explicitEffect([this.id], ([id]) => this.overlay.id.set(id));\n\n // if the mouse moves over the tooltip, we want to keep it open\n setupHover({\n hoverStart: () => this.overlay.cancelPendingClose(),\n hoverEnd: () => this.overlay.hide(),\n });\n }\n}\n","import { Component } from '@angular/core';\nimport { injectOverlayContext } from 'ng-primitives/portal';\nimport { NgpTooltip } from '../tooltip/tooltip';\n\n/**\n * Internal component for wrapping string content in tooltip portals\n * @internal\n */\n@Component({\n template: '{{ content() }}',\n hostDirectives: [NgpTooltip],\n host: {\n // Used only for styling, since the host directive isn’t added to the DOM.\n // This acts as the styling entry point.\n ngpTooltip: '',\n },\n})\nexport class NgpTooltipTextContentComponent {\n /**\n * The string content to display\n */\n readonly content = injectOverlayContext();\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\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<NgpTooltipTrigger<unknown>>(\n NgpTooltipTriggerStateToken,\n);\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n numberAttribute,\n OnDestroy,\n Signal,\n signal,\n ViewContainerRef,\n} from '@angular/core';\nimport { Placement } from '@floating-ui/dom';\nimport { setupOverflowListener } from 'ng-primitives/internal';\nimport {\n createOverlay,\n NgpOverlay,\n NgpOverlayConfig,\n NgpOverlayContent,\n} from 'ng-primitives/portal';\nimport { isString } from 'ng-primitives/utils';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { NgpTooltipTextContentComponent } from '../tooltip-text-content/tooltip-text-content.component';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\ntype TooltipInput<T> = NgpOverlayContent<T> | string | null | undefined;\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]': 'open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.aria-describedby]': 'overlay()?.ariaDescribedBy()',\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 trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the view container reference.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpOverlayContent<T> | string | null, TooltipInput<T>>(null, {\n alias: 'ngpTooltipTrigger',\n transform: (value: TooltipInput<T>) => (value && !isString(value) ? value : null),\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 500\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 * Define whether the tooltip should only show when the trigger element overflows.\n * @default false\n */\n readonly showOnOverflow = input<boolean, BooleanInput>(this.config.showOnOverflow, {\n alias: 'ngpTooltipTriggerShowOnOverflow',\n transform: booleanAttribute,\n });\n\n /**\n * Provide context to the tooltip. This can be used to pass data to the tooltip content.\n */\n readonly context = input<T>(undefined, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * Define whether to use the text content of the trigger element as the tooltip content.\n * When enabled, the tooltip will display the text content of the trigger element.\n * @default true\n */\n readonly useTextContent = input<boolean, BooleanInput>(this.config.useTextContent, {\n alias: 'ngpTooltipTriggerUseTextContent',\n transform: booleanAttribute,\n });\n\n /**\n * The overlay that manages the tooltip\n * @internal\n */\n readonly overlay = signal<NgpOverlay<T | string> | null>(null);\n\n /**\n * The unique id of the tooltip.\n */\n readonly tooltipId = signal<string | undefined>(undefined);\n\n /**\n * The open state of the tooltip.\n * @internal\n */\n readonly open = computed(() => this.overlay()?.isOpen() ?? false);\n\n /**\n * Determine if the trigger element has overflow.\n */\n private readonly hasOverflow: Signal<boolean>;\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n constructor() {\n this.hasOverflow = setupOverflowListener(this.trigger.nativeElement, {\n disabled: computed(() => !this.state.showOnOverflow()),\n });\n }\n\n ngOnDestroy(): void {\n this.overlay()?.destroy();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // If the trigger is disabled, do not show the tooltip\n if (this.state.disabled() || this.open()) {\n // we mark this as show again to stop it dismissing\n this.overlay()?.cancelPendingClose();\n return;\n }\n\n // if we should only show when there is overflow, check if the trigger has overflow\n if (this.state.showOnOverflow() && !this.hasOverflow()) {\n // If the trigger does not have overflow, do not show the tooltip\n return;\n }\n\n // Create the overlay if it doesn't exist yet\n if (!this.overlay()) {\n this.createOverlay();\n }\n\n this.overlay()?.show();\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // If the trigger is disabled, do nothing\n if (this.state.disabled()) {\n return;\n }\n\n this.overlay()?.hide();\n }\n\n /**\n * Create the overlay that will contain the tooltip\n */\n private createOverlay(): void {\n // Determine the content and context based on useTextContent setting\n const shouldUseTextContent = this.state.useTextContent();\n let content = this.state.tooltip();\n let context: Signal<T | string | undefined> = this.state.context;\n\n if (!content) {\n if (!shouldUseTextContent) {\n if (ngDevMode) {\n throw new Error(\n '[ngpTooltipTrigger]: Tooltip must be a string, TemplateRef, or ComponentType. Alternatively, set useTextContent to true if none is provided.',\n );\n }\n\n return;\n }\n\n const textContent = this.trigger.nativeElement.textContent?.trim() || '';\n if (ngDevMode && !textContent) {\n console.warn(\n '[ngpTooltipTrigger]: useTextContent is enabled but trigger element has no text content',\n );\n return;\n }\n content = NgpTooltipTextContentComponent;\n context = signal(textContent);\n } else if (isString(content)) {\n context = signal(content);\n content = NgpTooltipTextContentComponent;\n }\n\n // Create config for the overlay\n const config: NgpOverlayConfig<T | string> = {\n content,\n triggerElement: this.trigger.nativeElement,\n injector: this.injector,\n context,\n container: this.state.container(),\n placement: this.state.placement(),\n offset: this.state.offset(),\n flip: this.state.flip(),\n showDelay: this.state.showDelay(),\n hideDelay: this.state.hideDelay(),\n closeOnEscape: true,\n closeOnOutsideClick: true,\n viewContainerRef: this.viewContainerRef,\n };\n\n // Create the overlay instance\n this.overlay.set(createOverlay(config));\n }\n\n /**\n * Set the tooltip id.\n */\n setTooltipId(id: string): void {\n this.tooltipId.set(id);\n }\n}\n","import { Directive } from '@angular/core';\nimport { setupOverlayArrow } from 'ng-primitives/portal';\n\n@Directive({\n selector: '[ngpTooltipArrow]',\n exportAs: 'ngpTooltipArrow',\n})\nexport class NgpTooltipArrow {\n constructor() {\n setupOverlayArrow();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAqDO,M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c,EAAE,QAAQ;AACxB,wBAAA,SAAS,EAAE,QAAQ;AACnB,wBAAA,QAAQ,EAAE,QAAQ;AACnB,qBAAA;AACF,iBAAA;;;MCvCY,eAAe,CAAA;AAC1B,IAAA,WAAA,GAAA;AACE,QAAA,iBAAiB,EAAE;IACrB;+GAHW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE,iBAAiB;AAC5B,iBAAA;;;ACND;;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.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-text-content/tooltip-text-content.component.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-arrow/tooltip-arrow.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 500\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 element or selector in to which the tooltip should be attached.\n * @default 'body'\n */\n container: HTMLElement | string | null;\n\n /**\n * Whether the tooltip should only show when the trigger element overflows.\n * @default false\n */\n showOnOverflow: boolean;\n\n /**\n * Whether to use the text content of the trigger element as the tooltip content.\n * @default true\n */\n useTextContent: boolean;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 500,\n flip: true,\n container: 'body',\n showOnOverflow: false,\n useTextContent: true,\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 { Directive, input } from '@angular/core';\nimport { explicitEffect, setupHover } from 'ng-primitives/internal';\nimport { injectOverlay } from 'ng-primitives/portal';\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 '[id]': 'id()',\n '[style.left.px]': 'overlay.position().x',\n '[style.top.px]': 'overlay.position().y',\n '[style.--ngp-tooltip-trigger-width.px]': 'overlay.triggerWidth()',\n '[style.--ngp-tooltip-transform-origin]': 'overlay.transformOrigin()',\n '[attr.data-placement]': 'overlay.finalPlacement()',\n 'data-overlay': '',\n },\n})\nexport class NgpTooltip {\n /**\n * Access the overlay.\n */\n protected readonly overlay = injectOverlay();\n\n /**\n * The unique id of the tooltip.\n */\n readonly id = input(this.overlay.id());\n\n constructor() {\n explicitEffect([this.id], ([id]) => this.overlay.id.set(id));\n\n // if the mouse moves over the tooltip, we want to keep it open\n setupHover({\n hoverStart: () => this.overlay.cancelPendingClose(),\n hoverEnd: () => this.overlay.hide(),\n });\n }\n}\n","import { Component } from '@angular/core';\nimport { injectOverlayContext } from 'ng-primitives/portal';\nimport { NgpTooltip } from '../tooltip/tooltip';\n\n/**\n * Internal component for wrapping string content in tooltip portals\n * @internal\n */\n@Component({\n template: '{{ content() }}',\n hostDirectives: [NgpTooltip],\n host: {\n // Used only for styling, since the host directive isn’t added to the DOM.\n // This acts as the styling entry point.\n ngpTooltip: '',\n },\n})\nexport class NgpTooltipTextContentComponent {\n /**\n * The string content to display\n */\n readonly content = injectOverlayContext();\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\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<NgpTooltipTrigger<unknown>>(\n NgpTooltipTriggerStateToken,\n);\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n numberAttribute,\n OnDestroy,\n Signal,\n signal,\n ViewContainerRef,\n} from '@angular/core';\nimport { Placement } from '@floating-ui/dom';\nimport { setupOverflowListener } from 'ng-primitives/internal';\nimport {\n createOverlay,\n NgpOverlay,\n NgpOverlayConfig,\n NgpOverlayContent,\n} from 'ng-primitives/portal';\nimport { isString } from 'ng-primitives/utils';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { NgpTooltipTextContentComponent } from '../tooltip-text-content/tooltip-text-content.component';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\ntype TooltipInput<T> = NgpOverlayContent<T> | string | null | undefined;\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]': 'open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.aria-describedby]': 'overlay()?.ariaDescribedBy()',\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 trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the view container reference.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpOverlayContent<T> | string | null, TooltipInput<T>>(null, {\n alias: 'ngpTooltipTrigger',\n transform: (value: TooltipInput<T>) => (value && !isString(value) ? value : null),\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 500\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 | string | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Define whether the tooltip should only show when the trigger element overflows.\n * @default false\n */\n readonly showOnOverflow = input<boolean, BooleanInput>(this.config.showOnOverflow, {\n alias: 'ngpTooltipTriggerShowOnOverflow',\n transform: booleanAttribute,\n });\n\n /**\n * Provide context to the tooltip. This can be used to pass data to the tooltip content.\n */\n readonly context = input<T>(undefined, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * Define whether to use the text content of the trigger element as the tooltip content.\n * When enabled, the tooltip will display the text content of the trigger element.\n * @default true\n */\n readonly useTextContent = input<boolean, BooleanInput>(this.config.useTextContent, {\n alias: 'ngpTooltipTriggerUseTextContent',\n transform: booleanAttribute,\n });\n\n /**\n * The overlay that manages the tooltip\n * @internal\n */\n readonly overlay = signal<NgpOverlay<T | string> | null>(null);\n\n /**\n * The unique id of the tooltip.\n */\n readonly tooltipId = signal<string | undefined>(undefined);\n\n /**\n * The open state of the tooltip.\n * @internal\n */\n readonly open = computed(() => this.overlay()?.isOpen() ?? false);\n\n /**\n * Determine if the trigger element has overflow.\n */\n private readonly hasOverflow: Signal<boolean>;\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n constructor() {\n this.hasOverflow = setupOverflowListener(this.trigger.nativeElement, {\n disabled: computed(() => !this.state.showOnOverflow()),\n });\n }\n\n ngOnDestroy(): void {\n this.overlay()?.destroy();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // If the trigger is disabled, do not show the tooltip\n if (this.state.disabled() || this.open()) {\n // we mark this as show again to stop it dismissing\n this.overlay()?.cancelPendingClose();\n return;\n }\n\n // if we should only show when there is overflow, check if the trigger has overflow\n if (this.state.showOnOverflow() && !this.hasOverflow()) {\n // If the trigger does not have overflow, do not show the tooltip\n return;\n }\n\n // Create the overlay if it doesn't exist yet\n if (!this.overlay()) {\n this.createOverlay();\n }\n\n this.overlay()?.show();\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // If the trigger is disabled, do nothing\n if (this.state.disabled()) {\n return;\n }\n\n this.overlay()?.hide();\n }\n\n /**\n * Create the overlay that will contain the tooltip\n */\n private createOverlay(): void {\n // Determine the content and context based on useTextContent setting\n const shouldUseTextContent = this.state.useTextContent();\n let content = this.state.tooltip();\n let context: Signal<T | string | undefined> = this.state.context;\n\n if (!content) {\n if (!shouldUseTextContent) {\n if (ngDevMode) {\n throw new Error(\n '[ngpTooltipTrigger]: Tooltip must be a string, TemplateRef, or ComponentType. Alternatively, set useTextContent to true if none is provided.',\n );\n }\n\n return;\n }\n\n const textContent = this.trigger.nativeElement.textContent?.trim() || '';\n if (ngDevMode && !textContent) {\n console.warn(\n '[ngpTooltipTrigger]: useTextContent is enabled but trigger element has no text content',\n );\n return;\n }\n content = NgpTooltipTextContentComponent;\n context = signal(textContent);\n } else if (isString(content)) {\n context = signal(content);\n content = NgpTooltipTextContentComponent;\n }\n\n // Create config for the overlay\n const config: NgpOverlayConfig<T | string> = {\n content,\n triggerElement: this.trigger.nativeElement,\n injector: this.injector,\n context,\n container: this.state.container(),\n placement: this.state.placement(),\n offset: this.state.offset(),\n flip: this.state.flip(),\n showDelay: this.state.showDelay(),\n hideDelay: this.state.hideDelay(),\n closeOnEscape: true,\n closeOnOutsideClick: true,\n viewContainerRef: this.viewContainerRef,\n };\n\n // Create the overlay instance\n this.overlay.set(createOverlay(config));\n }\n\n /**\n * Set the tooltip id.\n */\n setTooltipId(id: string): void {\n this.tooltipId.set(id);\n }\n}\n","import { Directive } from '@angular/core';\nimport { setupOverlayArrow } from 'ng-primitives/portal';\n\n@Directive({\n selector: '[ngpTooltipArrow]',\n exportAs: 'ngpTooltipArrow',\n})\nexport class NgpTooltipArrow {\n constructor() {\n setupOverlayArrow();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAqDO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,cAAc,EAAE,KAAK;AACrB,IAAA,cAAc,EAAE,IAAI;CACrB;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,EAAE;AACjD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,mBAAmB,GAAA;AACjC,IAAA,OAAO,MAAM,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IA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export { NgpFocus } from './focus/focus';
3
3
  export { NgpHover } from './hover/hover';
4
4
  export { NgpMove, NgpMoveEvent } from './move/move';
5
5
  export { NgpPress } from './press/press';
6
+ export { setupInteractions } from './setup-interactions/setup-interactions';
@@ -1,6 +1,5 @@
1
1
  export { NgpExitAnimation, NgpExitAnimationRef, setupExitAnimation, } from './exit-animation/exit-animation';
2
2
  export { injectExitAnimationManager, NgpExitAnimationManager, provideExitAnimationManager, } from './exit-animation/exit-animation-manager';
3
- export { NgpButtonOptions, setupButton } from './interactions/button';
4
3
  export * from './interactions/index';
5
4
  export * from './signals/explicit-effect';
6
5
  export * from './style-injector/style-injector';
@@ -1,5 +1,4 @@
1
1
  export * from './focus';
2
2
  export * from './focus-visible';
3
3
  export * from './hover';
4
- export * from './interactions';
5
4
  export * from './press';
@@ -17,10 +17,10 @@ export interface NgpMenuConfig {
17
17
  */
18
18
  flip: boolean;
19
19
  /**
20
- * Define the container in to which the menu should be attached.
21
- * @default document.body
20
+ * Define the container element or selector in to which the menu should be attached.
21
+ * @default 'body'
22
22
  */
23
- container: HTMLElement | null;
23
+ container: HTMLElement | string | null;
24
24
  /**
25
25
  * Defines how the menu behaves when the window is scrolled.
26
26
  * @default scroll
@@ -52,7 +52,7 @@ export declare class NgpMenuTrigger<T = unknown> implements OnDestroy {
52
52
  * Define the container in which the menu should be attached.
53
53
  * @default document.body
54
54
  */
55
- readonly container: import("@angular/core").InputSignal<HTMLElement | null>;
55
+ readonly container: import("@angular/core").InputSignal<string | HTMLElement | null>;
56
56
  /**
57
57
  * Defines how the menu behaves when the window is scrolled.
58
58
  * @default 'block'
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.75.0",
5
+ "version": "0.76.0",
6
6
  "keywords": [
7
7
  "angular",
8
8
  "primitives",
@@ -71,22 +71,22 @@
71
71
  "types": "./accordion/index.d.ts",
72
72
  "default": "./fesm2022/ng-primitives-accordion.mjs"
73
73
  },
74
- "./autofill": {
75
- "types": "./autofill/index.d.ts",
76
- "default": "./fesm2022/ng-primitives-autofill.mjs"
77
- },
78
74
  "./avatar": {
79
75
  "types": "./avatar/index.d.ts",
80
76
  "default": "./fesm2022/ng-primitives-avatar.mjs"
81
77
  },
82
- "./button": {
83
- "types": "./button/index.d.ts",
84
- "default": "./fesm2022/ng-primitives-button.mjs"
78
+ "./autofill": {
79
+ "types": "./autofill/index.d.ts",
80
+ "default": "./fesm2022/ng-primitives-autofill.mjs"
85
81
  },
86
82
  "./checkbox": {
87
83
  "types": "./checkbox/index.d.ts",
88
84
  "default": "./fesm2022/ng-primitives-checkbox.mjs"
89
85
  },
86
+ "./button": {
87
+ "types": "./button/index.d.ts",
88
+ "default": "./fesm2022/ng-primitives-button.mjs"
89
+ },
90
90
  "./combobox": {
91
91
  "types": "./combobox/index.d.ts",
92
92
  "default": "./fesm2022/ng-primitives-combobox.mjs"
@@ -179,10 +179,6 @@
179
179
  "types": "./search/index.d.ts",
180
180
  "default": "./fesm2022/ng-primitives-search.mjs"
181
181
  },
182
- "./select": {
183
- "types": "./select/index.d.ts",
184
- "default": "./fesm2022/ng-primitives-select.mjs"
185
- },
186
182
  "./separator": {
187
183
  "types": "./separator/index.d.ts",
188
184
  "default": "./fesm2022/ng-primitives-separator.mjs"
@@ -223,13 +219,17 @@
223
219
  "types": "./toolbar/index.d.ts",
224
220
  "default": "./fesm2022/ng-primitives-toolbar.mjs"
225
221
  },
222
+ "./utils": {
223
+ "types": "./utils/index.d.ts",
224
+ "default": "./fesm2022/ng-primitives-utils.mjs"
225
+ },
226
226
  "./tooltip": {
227
227
  "types": "./tooltip/index.d.ts",
228
228
  "default": "./fesm2022/ng-primitives-tooltip.mjs"
229
229
  },
230
- "./utils": {
231
- "types": "./utils/index.d.ts",
232
- "default": "./fesm2022/ng-primitives-utils.mjs"
230
+ "./select": {
231
+ "types": "./select/index.d.ts",
232
+ "default": "./fesm2022/ng-primitives-select.mjs"
233
233
  }
234
234
  },
235
235
  "module": "fesm2022/ng-primitives.mjs",
@@ -27,10 +27,10 @@ export interface NgpPopoverConfig {
27
27
  */
28
28
  flip: boolean;
29
29
  /**
30
- * Define the container in to which the popover should be attached.
31
- * @default document.body
30
+ * Define the container element or selector in to which the popover should be attached.
31
+ * @default 'body'
32
32
  */
33
- container: HTMLElement | null;
33
+ container: HTMLElement | string | null;
34
34
  /**
35
35
  * Define whether the popover should close when clicking outside of it.
36
36
  * @default true
@@ -62,7 +62,7 @@ export declare class NgpPopoverTrigger<T = null> implements OnDestroy {
62
62
  * Define the container in which the popover should be attached.
63
63
  * @default document.body
64
64
  */
65
- readonly container: import("@angular/core").InputSignal<HTMLElement | null>;
65
+ readonly container: import("@angular/core").InputSignal<string | HTMLElement | null>;
66
66
  /**
67
67
  * Define whether the popover should close when clicking outside of it.
68
68
  * @default true
@@ -17,8 +17,8 @@ export interface NgpOverlayConfig<T = unknown> {
17
17
  viewContainerRef: ViewContainerRef;
18
18
  /** Context data to pass to the overlay content */
19
19
  context?: Signal<T | undefined>;
20
- /** Container element to attach the overlay to (defaults to document.body) */
21
- container?: HTMLElement | null;
20
+ /** Container element or selector to attach the overlay to (defaults to document.body) */
21
+ container?: HTMLElement | string | null;
22
22
  /** Preferred placement of the overlay relative to the trigger */
23
23
  placement?: Placement;
24
24
  /** Offset distance between the overlay and trigger in pixels */
@@ -183,6 +183,11 @@ export declare class NgpOverlay<T = unknown> {
183
183
  * @internal
184
184
  */
185
185
  unregisterArrow(): void;
186
+ /**
187
+ * Resolve the container element from the configuration
188
+ * @internal
189
+ */
190
+ private resolveContainer;
186
191
  }
187
192
  /**
188
193
  * Helper function to create an overlay in a single call
@@ -7,11 +7,11 @@ export interface NgpSelectConfig {
7
7
  */
8
8
  placement: Placement;
9
9
  /**
10
- * The container for the select dropdown.
10
+ * The container element or selector for the select dropdown.
11
11
  * This can be used to control where the dropdown is rendered in the DOM.
12
- * @default document.body
12
+ * @default 'body'
13
13
  */
14
- container: HTMLElement | null;
14
+ container: HTMLElement | string | null;
15
15
  }
16
16
  export declare const defaultSelectConfig: NgpSelectConfig;
17
17
  export declare const NgpSelectConfigToken: InjectionToken<NgpSelectConfig>;
package/select/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export { NgpSelectOption } from './select-option/select-option';
5
5
  export { NgpSelectPortal } from './select-portal/select-portal';
6
6
  export { NgpSelect } from './select/select';
7
7
  export { injectSelectState, provideSelectState } from './select/select-state';
8
+ export { provideSelectConfig, injectSelectConfig } from './config/select-config';
@@ -41,7 +41,7 @@ export declare class NgpSelect {
41
41
  /** The position of the dropdown. */
42
42
  readonly placement: import("@angular/core").InputSignal<Placement>;
43
43
  /** The container for the dropdown. */
44
- readonly container: import("@angular/core").InputSignal<HTMLElement | null>;
44
+ readonly container: import("@angular/core").InputSignal<string | HTMLElement | null>;
45
45
  /**
46
46
  * Store the select portal.
47
47
  * @internal
@@ -27,10 +27,10 @@ export interface NgpTooltipConfig {
27
27
  */
28
28
  flip: boolean;
29
29
  /**
30
- * Define the container in to which the tooltip should be attached.
31
- * @default document.body
30
+ * Define the container element or selector in to which the tooltip should be attached.
31
+ * @default 'body'
32
32
  */
33
- container: HTMLElement | null;
33
+ container: HTMLElement | string | null;
34
34
  /**
35
35
  * Whether the tooltip should only show when the trigger element overflows.
36
36
  * @default false
@@ -62,7 +62,7 @@ export declare class NgpTooltipTrigger<T = null> implements OnDestroy {
62
62
  * Define the container in which the tooltip should be attached.
63
63
  * @default document.body
64
64
  */
65
- readonly container: import("@angular/core").InputSignal<HTMLElement | null>;
65
+ readonly container: import("@angular/core").InputSignal<string | HTMLElement | null>;
66
66
  /**
67
67
  * Define whether the tooltip should only show when the trigger element overflows.
68
68
  * @default false