@ngneers/controls 0.0.1-pre5 → 0.0.1-pre7

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 (168) hide show
  1. package/fesm2022/ngneers-controls-accordion.mjs +33 -33
  2. package/fesm2022/ngneers-controls-accordion.mjs.map +1 -1
  3. package/fesm2022/ngneers-controls-api-ng.mjs +22 -19
  4. package/fesm2022/ngneers-controls-api-ng.mjs.map +1 -1
  5. package/fesm2022/ngneers-controls-api-resize.mjs +706 -0
  6. package/fesm2022/ngneers-controls-api-resize.mjs.map +1 -0
  7. package/fesm2022/ngneers-controls-avatar.mjs +13 -13
  8. package/fesm2022/ngneers-controls-avatar.mjs.map +1 -1
  9. package/fesm2022/ngneers-controls-base.mjs +89 -64
  10. package/fesm2022/ngneers-controls-base.mjs.map +1 -1
  11. package/fesm2022/ngneers-controls-breadcrumb.mjs +19 -19
  12. package/fesm2022/ngneers-controls-breadcrumb.mjs.map +1 -1
  13. package/fesm2022/ngneers-controls-button-group.mjs +8 -8
  14. package/fesm2022/ngneers-controls-button-group.mjs.map +1 -1
  15. package/fesm2022/ngneers-controls-button.mjs +15 -10
  16. package/fesm2022/ngneers-controls-button.mjs.map +1 -1
  17. package/fesm2022/{ngneers-controls-calendar-time-BEeJIqIX.mjs → ngneers-controls-calendar-time-CKAqRgOP.mjs} +9 -9
  18. package/fesm2022/{ngneers-controls-calendar-time-BEeJIqIX.mjs.map → ngneers-controls-calendar-time-CKAqRgOP.mjs.map} +1 -1
  19. package/fesm2022/ngneers-controls-calendar.mjs +56 -56
  20. package/fesm2022/ngneers-controls-calendar.mjs.map +1 -1
  21. package/fesm2022/ngneers-controls-checkbox.mjs +9 -9
  22. package/fesm2022/ngneers-controls-checkbox.mjs.map +1 -1
  23. package/fesm2022/ngneers-controls-chip.mjs +7 -7
  24. package/fesm2022/ngneers-controls-chip.mjs.map +1 -1
  25. package/fesm2022/ngneers-controls-default-icons.mjs +61 -0
  26. package/fesm2022/ngneers-controls-default-icons.mjs.map +1 -0
  27. package/fesm2022/ngneers-controls-defer.mjs +10 -10
  28. package/fesm2022/ngneers-controls-defer.mjs.map +1 -1
  29. package/fesm2022/ngneers-controls-dialog.mjs +38 -40
  30. package/fesm2022/ngneers-controls-dialog.mjs.map +1 -1
  31. package/fesm2022/ngneers-controls-directives.mjs +45 -39
  32. package/fesm2022/ngneers-controls-directives.mjs.map +1 -1
  33. package/fesm2022/ngneers-controls-drawer.mjs +29 -29
  34. package/fesm2022/ngneers-controls-drawer.mjs.map +1 -1
  35. package/fesm2022/ngneers-controls-edit-inplace.mjs +16 -16
  36. package/fesm2022/ngneers-controls-edit-inplace.mjs.map +1 -1
  37. package/fesm2022/ngneers-controls-filter.mjs +192 -44
  38. package/fesm2022/ngneers-controls-filter.mjs.map +1 -1
  39. package/fesm2022/{ngneers-controls-i18n-de-CdTPeBiR.mjs → ngneers-controls-i18n-de-CF0xTWEX.mjs} +9 -5
  40. package/fesm2022/ngneers-controls-i18n-de-CF0xTWEX.mjs.map +1 -0
  41. package/fesm2022/{ngneers-controls-i18n-en-Cfp2pOLY.mjs → ngneers-controls-i18n-en-8B7xAjH2.mjs} +9 -5
  42. package/fesm2022/ngneers-controls-i18n-en-8B7xAjH2.mjs.map +1 -0
  43. package/fesm2022/ngneers-controls-i18n.mjs +5 -5
  44. package/fesm2022/ngneers-controls-i18n.mjs.map +1 -1
  45. package/fesm2022/ngneers-controls-icon.mjs +111 -47
  46. package/fesm2022/ngneers-controls-icon.mjs.map +1 -1
  47. package/fesm2022/ngneers-controls-inplace.mjs +18 -18
  48. package/fesm2022/ngneers-controls-inplace.mjs.map +1 -1
  49. package/fesm2022/ngneers-controls-input-field.mjs +16 -16
  50. package/fesm2022/ngneers-controls-input-field.mjs.map +1 -1
  51. package/fesm2022/ngneers-controls-input-mask.mjs +8 -8
  52. package/fesm2022/ngneers-controls-input-mask.mjs.map +1 -1
  53. package/fesm2022/ngneers-controls-input.mjs +6 -6
  54. package/fesm2022/ngneers-controls-input.mjs.map +1 -1
  55. package/fesm2022/ngneers-controls-item-view.mjs +33 -33
  56. package/fesm2022/ngneers-controls-item-view.mjs.map +1 -1
  57. package/fesm2022/ngneers-controls-list-box.mjs +31 -31
  58. package/fesm2022/ngneers-controls-list-box.mjs.map +1 -1
  59. package/fesm2022/ngneers-controls-menu.mjs +33 -33
  60. package/fesm2022/ngneers-controls-menu.mjs.map +1 -1
  61. package/fesm2022/ngneers-controls-message.mjs +4 -4
  62. package/fesm2022/ngneers-controls-message.mjs.map +1 -1
  63. package/fesm2022/ngneers-controls-paginator.mjs +13 -13
  64. package/fesm2022/ngneers-controls-paginator.mjs.map +1 -1
  65. package/fesm2022/ngneers-controls-popover.mjs +21 -16
  66. package/fesm2022/ngneers-controls-popover.mjs.map +1 -1
  67. package/fesm2022/ngneers-controls-progress.mjs +16 -16
  68. package/fesm2022/ngneers-controls-progress.mjs.map +1 -1
  69. package/fesm2022/ngneers-controls-scroll-shadow.mjs +54 -0
  70. package/fesm2022/ngneers-controls-scroll-shadow.mjs.map +1 -0
  71. package/fesm2022/ngneers-controls-scroller.mjs +74 -39
  72. package/fesm2022/ngneers-controls-scroller.mjs.map +1 -1
  73. package/fesm2022/ngneers-controls-select-button.mjs +7 -7
  74. package/fesm2022/ngneers-controls-select-button.mjs.map +1 -1
  75. package/fesm2022/ngneers-controls-select.mjs +48 -47
  76. package/fesm2022/ngneers-controls-select.mjs.map +1 -1
  77. package/fesm2022/ngneers-controls-slider.mjs +11 -11
  78. package/fesm2022/ngneers-controls-slider.mjs.map +1 -1
  79. package/fesm2022/ngneers-controls-spinner.mjs +7 -7
  80. package/fesm2022/ngneers-controls-spinner.mjs.map +1 -1
  81. package/fesm2022/ngneers-controls-splitter.mjs +141 -328
  82. package/fesm2022/ngneers-controls-splitter.mjs.map +1 -1
  83. package/fesm2022/ngneers-controls-switch.mjs +3 -3
  84. package/fesm2022/ngneers-controls-switch.mjs.map +1 -1
  85. package/fesm2022/ngneers-controls-table.mjs +1456 -82
  86. package/fesm2022/ngneers-controls-table.mjs.map +1 -1
  87. package/fesm2022/ngneers-controls-tabs.mjs +41 -40
  88. package/fesm2022/ngneers-controls-tabs.mjs.map +1 -1
  89. package/fesm2022/ngneers-controls-tag.mjs +4 -4
  90. package/fesm2022/ngneers-controls-tag.mjs.map +1 -1
  91. package/fesm2022/ngneers-controls-toast.mjs +19 -19
  92. package/fesm2022/ngneers-controls-toast.mjs.map +1 -1
  93. package/fesm2022/ngneers-controls-toggle-button.mjs +10 -10
  94. package/fesm2022/ngneers-controls-toggle-button.mjs.map +1 -1
  95. package/fesm2022/ngneers-controls-tooltip.mjs +74 -38
  96. package/fesm2022/ngneers-controls-tooltip.mjs.map +1 -1
  97. package/fesm2022/ngneers-controls-utils-ng.mjs +9 -9
  98. package/fesm2022/ngneers-controls-utils-ng.mjs.map +1 -1
  99. package/fesm2022/ngneers-controls-utils.mjs +1 -1
  100. package/fesm2022/ngneers-controls-utils.mjs.map +1 -1
  101. package/package.json +34 -12
  102. package/types/ngneers-controls-accordion.d.ts +6 -4
  103. package/types/ngneers-controls-api-ng.d.ts +7 -2
  104. package/types/ngneers-controls-api-resize.d.ts +318 -0
  105. package/types/ngneers-controls-api.d.ts +2 -2
  106. package/types/ngneers-controls-base.d.ts +8 -0
  107. package/types/ngneers-controls-breadcrumb.d.ts +6 -4
  108. package/types/ngneers-controls-button.d.ts +13 -8
  109. package/types/ngneers-controls-calendar.d.ts +5 -1
  110. package/types/ngneers-controls-checkbox.d.ts +6 -4
  111. package/types/ngneers-controls-chip.d.ts +3 -1
  112. package/types/ngneers-controls-default-icons.d.ts +5 -0
  113. package/types/ngneers-controls-directives.d.ts +7 -1
  114. package/types/ngneers-controls-drawer.d.ts +7 -1
  115. package/types/ngneers-controls-edit-inplace.d.ts +4 -0
  116. package/types/ngneers-controls-filter.d.ts +52 -3
  117. package/types/ngneers-controls-i18n.d.ts +4 -0
  118. package/types/ngneers-controls-icon.d.ts +23 -40
  119. package/types/ngneers-controls-input-field.d.ts +7 -1
  120. package/types/ngneers-controls-item-view.d.ts +4 -2
  121. package/types/ngneers-controls-list-box.d.ts +5 -1
  122. package/types/ngneers-controls-menu.d.ts +4 -2
  123. package/types/ngneers-controls-message.d.ts +3 -1
  124. package/types/ngneers-controls-paginator.d.ts +4 -0
  125. package/types/ngneers-controls-popover.d.ts +2 -1
  126. package/types/ngneers-controls-scroll-shadow.d.ts +16 -0
  127. package/types/ngneers-controls-scroller.d.ts +12 -2
  128. package/types/ngneers-controls-select.d.ts +11 -12
  129. package/types/ngneers-controls-spinner.d.ts +1 -1
  130. package/types/ngneers-controls-splitter.d.ts +29 -59
  131. package/types/ngneers-controls-table.d.ts +380 -24
  132. package/types/ngneers-controls-tabs.d.ts +4 -2
  133. package/types/ngneers-controls-tag.d.ts +3 -1
  134. package/types/ngneers-controls-toast.d.ts +5 -3
  135. package/types/ngneers-controls-toggle-button.d.ts +5 -3
  136. package/types/ngneers-controls-tooltip.d.ts +7 -1
  137. package/fesm2022/ngneers-controls-i18n-de-CdTPeBiR.mjs.map +0 -1
  138. package/fesm2022/ngneers-controls-i18n-en-Cfp2pOLY.mjs.map +0 -1
  139. package/fesm2022/ngneers-controls-icon-calendar-z5xA9wTT.mjs +0 -4
  140. package/fesm2022/ngneers-controls-icon-calendar-z5xA9wTT.mjs.map +0 -1
  141. package/fesm2022/ngneers-controls-icon-check-DdAQ9k-T.mjs +0 -4
  142. package/fesm2022/ngneers-controls-icon-check-DdAQ9k-T.mjs.map +0 -1
  143. package/fesm2022/ngneers-controls-icon-chevron_down-HO-z-xOr.mjs +0 -4
  144. package/fesm2022/ngneers-controls-icon-chevron_down-HO-z-xOr.mjs.map +0 -1
  145. package/fesm2022/ngneers-controls-icon-chevron_left-CC5psi16.mjs +0 -4
  146. package/fesm2022/ngneers-controls-icon-chevron_left-CC5psi16.mjs.map +0 -1
  147. package/fesm2022/ngneers-controls-icon-chevron_right-BRxlzx4G.mjs +0 -4
  148. package/fesm2022/ngneers-controls-icon-chevron_right-BRxlzx4G.mjs.map +0 -1
  149. package/fesm2022/ngneers-controls-icon-chevron_up-cqhPO7g2.mjs +0 -4
  150. package/fesm2022/ngneers-controls-icon-chevron_up-cqhPO7g2.mjs.map +0 -1
  151. package/fesm2022/ngneers-controls-icon-ellipsis-DXIGA1sk.mjs +0 -4
  152. package/fesm2022/ngneers-controls-icon-ellipsis-DXIGA1sk.mjs.map +0 -1
  153. package/fesm2022/ngneers-controls-icon-filter-oU7E6Xgr.mjs +0 -4
  154. package/fesm2022/ngneers-controls-icon-filter-oU7E6Xgr.mjs.map +0 -1
  155. package/fesm2022/ngneers-controls-icon-filter_solid-CqIKuR4N.mjs +0 -4
  156. package/fesm2022/ngneers-controls-icon-filter_solid-CqIKuR4N.mjs.map +0 -1
  157. package/fesm2022/ngneers-controls-icon-magnifying_glass-T4Hzbkig.mjs +0 -4
  158. package/fesm2022/ngneers-controls-icon-magnifying_glass-T4Hzbkig.mjs.map +0 -1
  159. package/fesm2022/ngneers-controls-icon-minus-oGDEFO4E.mjs +0 -4
  160. package/fesm2022/ngneers-controls-icon-minus-oGDEFO4E.mjs.map +0 -1
  161. package/fesm2022/ngneers-controls-icon-sort-CRD4tafz.mjs +0 -4
  162. package/fesm2022/ngneers-controls-icon-sort-CRD4tafz.mjs.map +0 -1
  163. package/fesm2022/ngneers-controls-icon-sort_down-DiFB1P6R.mjs +0 -4
  164. package/fesm2022/ngneers-controls-icon-sort_down-DiFB1P6R.mjs.map +0 -1
  165. package/fesm2022/ngneers-controls-icon-sort_up-Bq_q3hIi.mjs +0 -4
  166. package/fesm2022/ngneers-controls-icon-sort_up-Bq_q3hIi.mjs.map +0 -1
  167. package/fesm2022/ngneers-controls-icon-xmark-BZKZORiu.mjs +0 -4
  168. package/fesm2022/ngneers-controls-icon-xmark-BZKZORiu.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ngneers-controls-toast.mjs","sources":["../../src/toast/defaults.ts","../../src/toast/toast.ts","../../src/toast/toast.html","../../src/toast/toast-host.ts","../../src/toast/toast-host.html","../../src/toast/toast-manager.ts","../../src/toast/provider.ts","../../src/toast/toast-creator.ts","../../src/toast/ngneers-controls-toast.ts"],"sourcesContent":["import type { NgnToastOptions } from './types';\r\n\r\nexport const DEFAULT_TOAST_OPTIONS: NgnToastOptions = {\r\n closable: false,\r\n autoHide: 5000,\r\n};\r\n","import { NgTemplateOutlet } from '@angular/common';\r\nimport {\r\n Component,\r\n ChangeDetectionStrategy,\r\n input,\r\n TemplateRef,\r\n output,\r\n type OnInit,\r\n} from '@angular/core';\r\nimport { NgnBase, provideSelf, NgnPt } from '@ngneers/controls/base';\r\nimport { NgnButton } from '@ngneers/controls/button';\r\nimport { NgnIcon } from '@ngneers/controls/icon';\r\nimport { toastControlTemplate } from '@ngneers/controls-themes/templates/toast';\r\n\r\nimport { DEFAULT_TOAST_OPTIONS } from './defaults';\r\n\r\nimport type { ContentTemplateType, HeaderTemplateType } from './types';\r\nimport type { IconType } from '@ngneers/controls-custom-types';\r\n\r\n/**\r\n * @category control\r\n */\r\n@Component({\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n selector: 'ngn-toast',\r\n templateUrl: './toast.html',\r\n imports: [NgTemplateOutlet, NgnPt, NgnButton, NgnIcon],\r\n providers: [provideSelf(NgnToast)],\r\n host: {\r\n '(mouseenter)': 'mouseEnter()',\r\n '(mouseleave)': 'mouseLeave()',\r\n '[animate.enter]': \"theme.class('anim-enter')\",\r\n '[animate.leave]': \"theme.class('anim-leave')\",\r\n role: 'alert',\r\n 'aria-live': 'assertive',\r\n },\r\n})\r\nexport class NgnToast extends NgnBase<'toast'> implements OnInit {\r\n protected readonly theme = this.injectThemeTemplate(toastControlTemplate, 'root');\r\n\r\n public readonly header = input<string>();\r\n public readonly content = input<string>();\r\n\r\n public readonly icon = input<IconType>();\r\n public readonly closeIcon = input<IconType>();\r\n public readonly closable = input<boolean | undefined>(DEFAULT_TOAST_OPTIONS.closable);\r\n public readonly autoHide = input<number | false | undefined>(DEFAULT_TOAST_OPTIONS.autoHide);\r\n\r\n public readonly templateContent = input<TemplateRef<ContentTemplateType> | null>();\r\n public readonly templateHeader = input<TemplateRef<HeaderTemplateType> | null>();\r\n\r\n public readonly closeToast = output<void>();\r\n private _closeTimeout?: number;\r\n\r\n public ngOnInit(): void {\r\n this.startHideTimer();\r\n }\r\n\r\n private startHideTimer() {\r\n const autoHide = this.autoHide();\r\n if (autoHide && autoHide > 0) {\r\n this._closeTimeout = setTimeout(() => this.close(), autoHide) as unknown as number;\r\n }\r\n }\r\n\r\n protected close() {\r\n this.closeToast.emit();\r\n if (this._closeTimeout) {\r\n clearTimeout(this._closeTimeout);\r\n }\r\n }\r\n\r\n protected mouseEnter(): void {\r\n if (this._closeTimeout) {\r\n clearTimeout(this._closeTimeout);\r\n this._closeTimeout = undefined;\r\n }\r\n }\r\n\r\n protected mouseLeave(): void {\r\n this.startHideTimer();\r\n }\r\n}\r\n","@if (templateHeader(); as headerTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"headerTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n header: header(),\r\n closable: !!closable(),\r\n closeToast: close.bind(this),\r\n }\"\r\n ></ng-container>\r\n} @else {\r\n <div [ptInt]=\"this\" [ptClass]=\"'defaultHeader'\">\r\n <span [ptInt]=\"this\" [ptClass]=\"'defaultHeaderText'\">\r\n @if (icon(); as icon) {\r\n <ngn-icon [icon]=\"icon\" />\r\n }\r\n {{ header() }}\r\n </span>\r\n @if (closable()) {\r\n <button ngnButton kind=\"icon\" (click)=\"close()\">\r\n <ngn-icon [defaultIcon]=\"'xmark'\" [icon]=\"closeIcon()\" />\r\n </button>\r\n }\r\n </div>\r\n}\r\n@if (templateContent(); as contentTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contentTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n content: content(),\r\n }\"\r\n ></ng-container>\r\n} @else {\r\n <div [ptInt]=\"this\" [ptClass]=\"'defaultContent'\">\r\n {{ content() }}\r\n </div>\r\n}\r\n","import {\r\n afterNextRender,\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n inject,\r\n} from '@angular/core';\r\nimport { NgnBase } from '@ngneers/controls/base';\r\nimport { toastControlTemplate } from '@ngneers/controls-themes/templates/toast';\r\n\r\nimport { NgnToast } from './toast';\r\nimport { NgnToastManager } from './toast-manager';\r\n\r\n/**\r\n * The host component that renders toasts.\r\n */\r\n@Component({\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n selector: 'ngn-toast-host',\r\n templateUrl: 'toast-host.html',\r\n imports: [NgnToast],\r\n host: {\r\n '[attr.popover]': '\"manual\"',\r\n },\r\n})\r\nexport class NgnToastHost extends NgnBase<'toast'> {\r\n protected readonly theme = this.injectThemeTemplate(toastControlTemplate, 'host');\r\n private readonly _toastManager = inject(NgnToastManager);\r\n private readonly _el = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n protected readonly toasts = this._toastManager.toasts;\r\n\r\n constructor() {\r\n super();\r\n afterNextRender(() => {\r\n this._el.nativeElement.showPopover();\r\n });\r\n }\r\n\r\n protected removeToast(id: number): void {\r\n this._toastManager.removeToast(id);\r\n }\r\n}\r\n","@for (toast of toasts(); track toast.id) {\r\n <ngn-toast\r\n [header]=\"toast.header\"\r\n [content]=\"toast.content\"\r\n [color]=\"toast.color\"\r\n [icon]=\"toast.icon\"\r\n [autoHide]=\"toast.autoHide\"\r\n [templateContent]=\"toast.contentTemplate\"\r\n [templateHeader]=\"toast.headerTemplate\"\r\n [closable]=\"!!toast.closable\"\r\n (closeToast)=\"removeToast(toast.id)\"\r\n />\r\n}\r\n","import {\r\n ApplicationRef,\r\n ComponentRef,\r\n createComponent,\r\n inject,\r\n Injectable,\r\n type OnDestroy,\r\n signal,\r\n} from '@angular/core';\r\nimport { Platform } from '@ngneers/controls/api/ng';\r\nimport { NgnError } from '@ngneers/controls/utils';\r\nimport { injectOrThrow } from '@ngneers/controls/utils-ng';\r\n\r\nimport { DEFAULT_TOAST_OPTIONS } from './defaults';\r\nimport { NGN_TOAST_USER_DEFAULTS } from './provider';\r\nimport { NgnToastHost } from './toast-host';\r\n\r\nimport type { NgnToastOptions } from './types';\r\n\r\ntype ToastFull = NgnToastOptions & { id: number };\r\n\r\n@Injectable()\r\nexport class NgnToastManager implements OnDestroy {\r\n private readonly _toasts = signal<ToastFull[]>([]);\r\n private readonly _appRef = inject(ApplicationRef);\r\n private readonly _userDefaults = injectOrThrow(\r\n NGN_TOAST_USER_DEFAULTS,\r\n 'NgnToastManager',\r\n 'Failed to inject NGN_TOAST_USER_DEFAULTS, make sure to use withToasts() to provide ngn toasts!'\r\n );\r\n private _nextId = 0;\r\n\r\n public readonly toasts = this._toasts.asReadonly();\r\n private _component?: ComponentRef<NgnToastHost>;\r\n\r\n constructor() {\r\n if (!inject(Platform).isBrowser) {\r\n return;\r\n }\r\n // Defer creation to avoid issues with Angular's injection tree during app initialization\r\n queueMicrotask(() => {\r\n // Create and attach the toast host component to the application's root\r\n this._component = createComponent(NgnToastHost, {\r\n environmentInjector: this._appRef.injector,\r\n });\r\n this._appRef.attachView(this._component.hostView);\r\n const hostEl = this._component.location.nativeElement as HTMLElement;\r\n const appRootEl = this._appRef.components[0]?.location.nativeElement as\r\n | undefined\r\n | HTMLElement;\r\n if (!appRootEl) {\r\n throw new NgnError(\r\n 'NgnToastManager',\r\n 'Failed to find application root element to attach toast host!'\r\n );\r\n }\r\n appRootEl.appendChild(hostEl);\r\n });\r\n }\r\n\r\n public ngOnDestroy(): void {\r\n if (this._component) {\r\n this._appRef.detachView(this._component.hostView);\r\n this._component.destroy();\r\n this._component = undefined;\r\n }\r\n }\r\n\r\n public removeToast(id: number): void {\r\n this._toasts.update(toasts => toasts.filter(t => t.id !== id));\r\n }\r\n\r\n public addToast(options: NgnToastOptions): number {\r\n const id = this._nextId++;\r\n const toast: ToastFull = { ...DEFAULT_TOAST_OPTIONS, ...this._userDefaults, ...options, id };\r\n this._toasts.update(toasts => [...toasts, toast]);\r\n return id;\r\n }\r\n}\r\n","import { InjectionToken, type Provider } from '@angular/core';\r\n\r\nimport { NgnToastManager } from './toast-manager';\r\n\r\nimport type { NgnToastOptionsMeta } from './types';\r\n\r\nexport type NgnToastFeature = {\r\n providers: Provider[];\r\n};\r\n\r\nexport const NGN_TOAST_USER_DEFAULTS = new InjectionToken<NgnToastOptionsMeta>(\r\n 'NGN_TOAST_USER_DEFAULTS'\r\n);\r\n\r\nexport function withToasts(defaultOptions?: NgnToastOptionsMeta): NgnToastFeature {\r\n return {\r\n providers: [\r\n NgnToastManager,\r\n {\r\n provide: NGN_TOAST_USER_DEFAULTS,\r\n useValue: defaultOptions || {},\r\n },\r\n ],\r\n };\r\n}\r\n","import { Injector, runInInjectionContext } from '@angular/core';\r\nimport { injectOrThrow } from '@ngneers/controls/utils-ng';\r\n\r\nimport { NgnToastManager } from './toast-manager';\r\n\r\nimport type { NgnToastOptions, NgnToastRef } from './types';\r\n\r\nclass ToastCreator {\r\n private readonly _manager: NgnToastManager;\r\n\r\n constructor() {\r\n this._manager = injectOrThrow(\r\n NgnToastManager,\r\n 'injectToastCreator',\r\n 'NgnToastManager not found. Make sure to use withToasts() to provide ngn toasts!'\r\n );\r\n }\r\n\r\n public show(options: NgnToastOptions): NgnToastRef {\r\n const id = this._manager.addToast(options);\r\n return {\r\n hide: () => this._manager.removeToast(id),\r\n };\r\n }\r\n}\r\n\r\nexport function injectToastCreator(injector?: Injector): ToastCreator {\r\n if (injector) {\r\n return runInInjectionContext(injector, () => injectToastCreator());\r\n }\r\n return new ToastCreator();\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,qBAAqB,GAAoB;AACpD,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,IAAI;CACf;;ACcD;;AAEG;AAgBG,MAAO,QAAS,SAAQ,OAAgB,CAA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AC,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,QAAA,OAAO,EAAE;IACX;uGAvDW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAAf,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B;;;MCXY,uBAAuB,GAAG,IAAI,cAAc,CACvD,yBAAyB;AAGrB,SAAU,UAAU,CAAC,cAAoC,EAAA;IAC7D,OAAO;AACL,QAAA,SAAS,EAAE;YACT,eAAe;AACf,YAAA;AACE,gBAAA,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,cAAc,IAAI,EAAE;AAC/B,aAAA;AACF,SAAA;KACF;AACH;;ACjBA,MAAM,YAAY,CAAA;AACC,IAAA,QAAQ;AAEzB,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,QAAQ,GAAG,aAAa,CAC3B,eAAe,EACf,oBAAoB,EACpB,iFAAiF,CAClF;IACH;AAEO,IAAA,IAAI,CAAC,OAAwB,EAAA;QAClC,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;SAC1C;IACH;AACD;AAEK,SAAU,kBAAkB,CAAC,QAAmB,EAAA;IACpD,IAAI,QAAQ,EAAE;QACZ,OAAO,qBAAqB,CAAC,QAAQ,EAAE,MAAM,kBAAkB,EAAE,CAAC;IACpE;IACA,OAAO,IAAI,YAAY,EAAE;AAC3B;;AC/BA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngneers-controls-toast.mjs","sources":["../../src/toast/defaults.ts","../../src/toast/toast.ts","../../src/toast/toast.html","../../src/toast/toast-host.ts","../../src/toast/toast-host.html","../../src/toast/toast-manager.ts","../../src/toast/provider.ts","../../src/toast/toast-creator.ts","../../src/toast/ngneers-controls-toast.ts"],"sourcesContent":["import type { NgnToastOptions } from './types';\r\n\r\nexport const DEFAULT_TOAST_OPTIONS: NgnToastOptions = {\r\n closable: false,\r\n autoHide: 5000,\r\n};\r\n","import { NgTemplateOutlet } from '@angular/common';\r\nimport {\r\n Component,\r\n ChangeDetectionStrategy,\r\n input,\r\n TemplateRef,\r\n output,\r\n type OnInit,\r\n} from '@angular/core';\r\nimport { NgnBase, provideSelf, NgnPt } from '@ngneers/controls/base';\r\nimport { NgnButton } from '@ngneers/controls/button';\r\nimport { NgnIcon } from '@ngneers/controls/icon';\r\nimport { toastControlTemplate } from '@ngneers/controls-themes/templates/toast';\r\n\r\nimport { DEFAULT_TOAST_OPTIONS } from './defaults';\r\n\r\nimport type { ContentTemplateType, HeaderTemplateType } from './types';\r\nimport type { IconType } from '@ngneers/controls-custom-types';\r\n\r\n/**\r\n * @category control\r\n */\r\n@Component({\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n selector: 'ngn-toast',\r\n templateUrl: './toast.html',\r\n imports: [NgTemplateOutlet, NgnPt, NgnButton, NgnIcon],\r\n providers: [provideSelf(NgnToast)],\r\n host: {\r\n '(mouseenter)': 'mouseEnter()',\r\n '(mouseleave)': 'mouseLeave()',\r\n '[animate.enter]': \"theme.class('anim-enter')\",\r\n '[animate.leave]': \"theme.class('anim-leave')\",\r\n role: 'alert',\r\n 'aria-live': 'assertive',\r\n },\r\n})\r\nexport class NgnToast extends NgnBase<'toast'> implements OnInit {\r\n protected readonly theme = this.injectThemeTemplate(toastControlTemplate, 'root');\r\n\r\n public readonly header = input<string>();\r\n public readonly content = input<string>();\r\n\r\n public readonly icon = input<IconType>();\r\n public readonly closeIcon = input<IconType>();\r\n public readonly closable = input<boolean | undefined>(DEFAULT_TOAST_OPTIONS.closable);\r\n public readonly autoHide = input<number | false | undefined>(DEFAULT_TOAST_OPTIONS.autoHide);\r\n\r\n public readonly templateContent = input<TemplateRef<ContentTemplateType> | null>();\r\n public readonly templateHeader = input<TemplateRef<HeaderTemplateType> | null>();\r\n\r\n public readonly closeToast = output<void>();\r\n private _closeTimeout?: number;\r\n\r\n public ngOnInit(): void {\r\n this.startHideTimer();\r\n }\r\n\r\n private startHideTimer() {\r\n const autoHide = this.autoHide();\r\n if (autoHide && autoHide > 0) {\r\n this._closeTimeout = setTimeout(() => this.close(), autoHide) as unknown as number;\r\n }\r\n }\r\n\r\n protected close() {\r\n this.closeToast.emit();\r\n if (this._closeTimeout) {\r\n clearTimeout(this._closeTimeout);\r\n }\r\n }\r\n\r\n protected mouseEnter(): void {\r\n if (this._closeTimeout) {\r\n clearTimeout(this._closeTimeout);\r\n this._closeTimeout = undefined;\r\n }\r\n }\r\n\r\n protected mouseLeave(): void {\r\n this.startHideTimer();\r\n }\r\n}\r\n","@if (templateHeader(); as headerTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"headerTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n header: header(),\r\n closable: !!closable(),\r\n closeToast: close.bind(this),\r\n }\"\r\n ></ng-container>\r\n} @else {\r\n <div [ptInt]=\"this\" [ptClass]=\"'defaultHeader'\">\r\n <span [ptInt]=\"this\" [ptClass]=\"'defaultHeaderText'\">\r\n @if (icon(); as icon) {\r\n <ngn-icon [icon]=\"icon\" />\r\n }\r\n {{ header() }}\r\n </span>\r\n @if (closable()) {\r\n <button ngnButton kind=\"icon\" (click)=\"close()\">\r\n <ngn-icon [defaultIcon]=\"'toast-close'\" [icon]=\"closeIcon()\" />\r\n </button>\r\n }\r\n </div>\r\n}\r\n@if (templateContent(); as contentTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contentTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n content: content(),\r\n }\"\r\n ></ng-container>\r\n} @else {\r\n <div [ptInt]=\"this\" [ptClass]=\"'defaultContent'\">\r\n {{ content() }}\r\n </div>\r\n}\r\n","import {\r\n afterNextRender,\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n inject,\r\n} from '@angular/core';\r\nimport { NgnBase } from '@ngneers/controls/base';\r\nimport { toastControlTemplate } from '@ngneers/controls-themes/templates/toast';\r\n\r\nimport { NgnToast } from './toast';\r\nimport { NgnToastManager } from './toast-manager';\r\n\r\n/**\r\n * The host component that renders toasts.\r\n */\r\n@Component({\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n selector: 'ngn-toast-host',\r\n templateUrl: 'toast-host.html',\r\n imports: [NgnToast],\r\n host: {\r\n '[attr.popover]': '\"manual\"',\r\n },\r\n})\r\nexport class NgnToastHost extends NgnBase<'toast'> {\r\n protected readonly theme = this.injectThemeTemplate(toastControlTemplate, 'host');\r\n private readonly _toastManager = inject(NgnToastManager);\r\n private readonly _el = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n protected readonly toasts = this._toastManager.toasts;\r\n\r\n constructor() {\r\n super();\r\n afterNextRender(() => {\r\n this._el.nativeElement.showPopover();\r\n });\r\n }\r\n\r\n protected removeToast(id: number): void {\r\n this._toastManager.removeToast(id);\r\n }\r\n}\r\n","@for (toast of toasts(); track toast.id) {\r\n <ngn-toast\r\n [header]=\"toast.header\"\r\n [content]=\"toast.content\"\r\n [color]=\"toast.color\"\r\n [icon]=\"toast.icon\"\r\n [autoHide]=\"toast.autoHide\"\r\n [templateContent]=\"toast.contentTemplate\"\r\n [templateHeader]=\"toast.headerTemplate\"\r\n [closable]=\"!!toast.closable\"\r\n (closeToast)=\"removeToast(toast.id)\"\r\n />\r\n}\r\n","import {\r\n ApplicationRef,\r\n ComponentRef,\r\n createComponent,\r\n inject,\r\n Injectable,\r\n type OnDestroy,\r\n signal,\r\n} from '@angular/core';\r\nimport { Platform } from '@ngneers/controls/api/ng';\r\nimport { NgnError } from '@ngneers/controls/utils';\r\nimport { injectOrThrow } from '@ngneers/controls/utils-ng';\r\n\r\nimport { DEFAULT_TOAST_OPTIONS } from './defaults';\r\nimport { NGN_TOAST_USER_DEFAULTS } from './provider';\r\nimport { NgnToastHost } from './toast-host';\r\n\r\nimport type { NgnToastOptions } from './types';\r\n\r\ntype ToastFull = NgnToastOptions & { id: number };\r\n\r\n@Injectable()\r\nexport class NgnToastManager implements OnDestroy {\r\n private readonly _toasts = signal<ToastFull[]>([]);\r\n private readonly _appRef = inject(ApplicationRef);\r\n private readonly _userDefaults = injectOrThrow(\r\n NGN_TOAST_USER_DEFAULTS,\r\n 'NgnToastManager',\r\n 'Failed to inject NGN_TOAST_USER_DEFAULTS, make sure to use withToasts() to provide ngn toasts!'\r\n );\r\n private _nextId = 0;\r\n\r\n public readonly toasts = this._toasts.asReadonly();\r\n private _component?: ComponentRef<NgnToastHost>;\r\n\r\n constructor() {\r\n if (!inject(Platform).isBrowser) {\r\n return;\r\n }\r\n // Defer creation to avoid issues with Angular's injection tree during app initialization\r\n queueMicrotask(() => {\r\n // Create and attach the toast host component to the application's root\r\n this._component = createComponent(NgnToastHost, {\r\n environmentInjector: this._appRef.injector,\r\n });\r\n this._appRef.attachView(this._component.hostView);\r\n const hostEl = this._component.location.nativeElement as HTMLElement;\r\n const appRootEl = this._appRef.components[0]?.location.nativeElement as\r\n | undefined\r\n | HTMLElement;\r\n if (!appRootEl) {\r\n throw new NgnError(\r\n 'NgnToastManager',\r\n 'Failed to find application root element to attach toast host!'\r\n );\r\n }\r\n appRootEl.appendChild(hostEl);\r\n });\r\n }\r\n\r\n public ngOnDestroy(): void {\r\n if (this._component) {\r\n this._appRef.detachView(this._component.hostView);\r\n this._component.destroy();\r\n this._component = undefined;\r\n }\r\n }\r\n\r\n public removeToast(id: number): void {\r\n this._toasts.update(toasts => toasts.filter(t => t.id !== id));\r\n }\r\n\r\n public addToast(options: NgnToastOptions): number {\r\n const id = this._nextId++;\r\n const toast: ToastFull = { ...DEFAULT_TOAST_OPTIONS, ...this._userDefaults, ...options, id };\r\n this._toasts.update(toasts => [...toasts, toast]);\r\n return id;\r\n }\r\n}\r\n","import { InjectionToken, type Provider } from '@angular/core';\r\n\r\nimport { NgnToastManager } from './toast-manager';\r\n\r\nimport type { NgnToastOptionsMeta } from './types';\r\n\r\nexport type NgnToastFeature = {\r\n providers: Provider[];\r\n};\r\n\r\nexport const NGN_TOAST_USER_DEFAULTS = new InjectionToken<NgnToastOptionsMeta>(\r\n 'NGN_TOAST_USER_DEFAULTS'\r\n);\r\n\r\nexport function withToasts(defaultOptions?: NgnToastOptionsMeta): NgnToastFeature {\r\n return {\r\n providers: [\r\n NgnToastManager,\r\n {\r\n provide: NGN_TOAST_USER_DEFAULTS,\r\n useValue: defaultOptions || {},\r\n },\r\n ],\r\n };\r\n}\r\n","import { Injector, runInInjectionContext } from '@angular/core';\r\nimport { injectOrThrow } from '@ngneers/controls/utils-ng';\r\n\r\nimport { NgnToastManager } from './toast-manager';\r\n\r\nimport type { NgnToastOptions, NgnToastRef } from './types';\r\n\r\nclass ToastCreator {\r\n private readonly _manager: NgnToastManager;\r\n\r\n constructor() {\r\n this._manager = injectOrThrow(\r\n NgnToastManager,\r\n 'injectToastCreator',\r\n 'NgnToastManager not found. Make sure to use withToasts() to provide ngn toasts!'\r\n );\r\n }\r\n\r\n public show(options: NgnToastOptions): NgnToastRef {\r\n const id = this._manager.addToast(options);\r\n return {\r\n hide: () => this._manager.removeToast(id),\r\n };\r\n }\r\n}\r\n\r\nexport function injectToastCreator(injector?: Injector): ToastCreator {\r\n if (injector) {\r\n return runInInjectionContext(injector, () => injectToastCreator());\r\n }\r\n return new ToastCreator();\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,qBAAqB,GAAoB;AACpD,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,IAAI;CACf;;ACcD;;AAEG;AAgBG,MAAO,QAAS,SAAQ,OAAgB,CAAA;IACzB,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,MAA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EAAE,KAAK,CAAC,CAAC;AACjD,QAAA,OAAO,EAAE;IACX;wGAvDW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAAf,eAAe,EAAA,CAAA;;4FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B;;;MCXY,uBAAuB,GAAG,IAAI,cAAc,CACvD,yBAAyB;AAGrB,SAAU,UAAU,CAAC,cAAoC,EAAA;IAC7D,OAAO;AACL,QAAA,SAAS,EAAE;YACT,eAAe;AACf,YAAA;AACE,gBAAA,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,cAAc,IAAI,EAAE;AAC/B,aAAA;AACF,SAAA;KACF;AACH;;ACjBA,MAAM,YAAY,CAAA;AACC,IAAA,QAAQ;AAEzB,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,QAAQ,GAAG,aAAa,CAC3B,eAAe,EACf,oBAAoB,EACpB,iFAAiF,CAClF;IACH;AAEO,IAAA,IAAI,CAAC,OAAwB,EAAA;QAClC,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;SAC1C;IACH;AACD;AAEK,SAAU,kBAAkB,CAAC,QAAmB,EAAA;IACpD,IAAI,QAAQ,EAAE;QACZ,OAAO,qBAAqB,CAAC,QAAQ,EAAE,MAAM,kBAAkB,EAAE,CAAC;IACpE;IACA,OAAO,IAAI,YAAY,EAAE;AAC3B;;AC/BA;;AAEG;;;;"}
@@ -17,44 +17,44 @@ class NgnToggleButton extends ValueControlBase {
17
17
  * Optional labels for on and off states.
18
18
  * If not provided, the {@link label} input will be used.
19
19
  */
20
- labelOn = input(...(ngDevMode ? [undefined, { debugName: "labelOn" }] : []));
20
+ labelOn = input(...(ngDevMode ? [undefined, { debugName: "labelOn" }] : /* istanbul ignore next */ []));
21
21
  /**
22
22
  * Optional labels for on and off states.
23
23
  * If not provided, the {@link label} input will be used.
24
24
  */
25
- labelOff = input(...(ngDevMode ? [undefined, { debugName: "labelOff" }] : []));
25
+ labelOff = input(...(ngDevMode ? [undefined, { debugName: "labelOff" }] : /* istanbul ignore next */ []));
26
26
  /**
27
27
  * Optional icon for the button. Can be used instead of the label or in combination with it.
28
28
  * If {@link iconOn} and {@link iconOff} are provided, they will take precedence over this input for their respective states.
29
29
  */
30
- icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
30
+ icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
31
31
  /**
32
32
  * Optional icons for on and off states.
33
33
  * If not provided, the {@link icon} input will be used.
34
34
  */
35
- iconOn = input(...(ngDevMode ? [undefined, { debugName: "iconOn" }] : []));
35
+ iconOn = input(...(ngDevMode ? [undefined, { debugName: "iconOn" }] : /* istanbul ignore next */ []));
36
36
  /**
37
37
  * Optional icons for on and off states.
38
38
  * If not provided, the {@link icon} input will be used.
39
39
  */
40
- iconOff = input(...(ngDevMode ? [undefined, { debugName: "iconOff" }] : []));
40
+ iconOff = input(...(ngDevMode ? [undefined, { debugName: "iconOff" }] : /* istanbul ignore next */ []));
41
41
  /**
42
42
  * If true, the button will always have the width of the longest possible content.
43
43
  * @default false
44
44
  */
45
- fixedWidth = input(false, ...(ngDevMode ? [{ debugName: "fixedWidth" }] : []));
45
+ fixedWidth = input(false, ...(ngDevMode ? [{ debugName: "fixedWidth" }] : /* istanbul ignore next */ []));
46
46
  toggle() {
47
47
  if (this.disabled() || this.readonly()) {
48
48
  return;
49
49
  }
50
50
  this.value.update(v => !v);
51
51
  }
52
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: NgnToggleButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
53
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: NgnToggleButton, isStandalone: true, selector: "ngn-toggle-button", inputs: { labelOn: { classPropertyName: "labelOn", publicName: "labelOn", isSignal: true, isRequired: false, transformFunction: null }, labelOff: { classPropertyName: "labelOff", publicName: "labelOff", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconOn: { classPropertyName: "iconOn", publicName: "iconOn", isSignal: true, isRequired: false, transformFunction: null }, iconOff: { classPropertyName: "iconOff", publicName: "iconOff", isSignal: true, isRequired: false, transformFunction: null }, fixedWidth: { classPropertyName: "fixedWidth", publicName: "fixedWidth", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideSelf(NgnToggleButton)], usesInheritance: true, ngImport: i0, template: "<button\r\n [ptInt]=\"this\"\r\n [ptClass]=\"'button'\"\r\n (click)=\"toggle()\"\r\n [disabled]=\"disabled()\"\r\n [ariaReadOnly]=\"readonly()\"\r\n (blur)=\"touched.set(true)\"\r\n>\r\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\r\n @let renderedIcon = (value() ? iconOn() : iconOff()) ?? icon();\r\n @if (renderedIcon) {\r\n <ngn-icon [icon]=\"renderedIcon\" />\r\n }\r\n {{ (value() ? labelOn() : labelOff()) ?? label() }}\r\n </span>\r\n @if (fixedWidth()) {\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder-active'\">\r\n @let renderedIconOn = iconOn() ?? icon();\r\n @if (renderedIconOn) {\r\n <ngn-icon [icon]=\"renderedIconOn\" />\r\n }\r\n {{ labelOn() ?? label() }}\r\n </span>\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder'\">\r\n @let renderedIconOff = iconOff() ?? icon();\r\n @if (renderedIconOff) {\r\n <ngn-icon [icon]=\"renderedIconOff\" />\r\n }\r\n {{ labelOff() ?? label() }}\r\n </span>\r\n }\r\n</button>\r\n", dependencies: [{ kind: "directive", type: NgnPt, selector: "[ptInt]", inputs: ["ptInt", "ptClass"] }, { kind: "component", type: NgnIcon, selector: "ngn-icon", inputs: ["defaultIcon", "icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
52
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: NgnToggleButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
53
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: NgnToggleButton, isStandalone: true, selector: "ngn-toggle-button", inputs: { labelOn: { classPropertyName: "labelOn", publicName: "labelOn", isSignal: true, isRequired: false, transformFunction: null }, labelOff: { classPropertyName: "labelOff", publicName: "labelOff", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconOn: { classPropertyName: "iconOn", publicName: "iconOn", isSignal: true, isRequired: false, transformFunction: null }, iconOff: { classPropertyName: "iconOff", publicName: "iconOff", isSignal: true, isRequired: false, transformFunction: null }, fixedWidth: { classPropertyName: "fixedWidth", publicName: "fixedWidth", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideSelf(NgnToggleButton)], usesInheritance: true, ngImport: i0, template: "<button\r\n [ptInt]=\"this\"\r\n [ptClass]=\"'button'\"\r\n (click)=\"toggle()\"\r\n [disabled]=\"disabled()\"\r\n [attr.aria-pressed]=\"value()\"\r\n [attr.aria-readonly]=\"readonly() || null\"\r\n [attr.aria-label]=\"label()\"\r\n [attr.aria-labelledby]=\"labelledBy()\"\r\n (blur)=\"touched.set(true)\"\r\n>\r\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\r\n @let renderedIcon = (value() ? iconOn() : iconOff()) ?? icon();\r\n @if (renderedIcon) {\r\n <ngn-icon [icon]=\"renderedIcon\" />\r\n }\r\n {{ (value() ? labelOn() : labelOff()) ?? label() }}\r\n </span>\r\n @if (fixedWidth()) {\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder-active'\">\r\n @let renderedIconOn = iconOn() ?? icon();\r\n @if (renderedIconOn) {\r\n <ngn-icon [icon]=\"renderedIconOn\" />\r\n }\r\n {{ labelOn() ?? label() }}\r\n </span>\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder'\">\r\n @let renderedIconOff = iconOff() ?? icon();\r\n @if (renderedIconOff) {\r\n <ngn-icon [icon]=\"renderedIconOff\" />\r\n }\r\n {{ labelOff() ?? label() }}\r\n </span>\r\n }\r\n</button>\r\n", dependencies: [{ kind: "directive", type: NgnPt, selector: "[ptInt]", inputs: ["ptInt", "ptClass"] }, { kind: "component", type: NgnIcon, selector: "ngn-icon", inputs: ["defaultIcon", "icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
54
54
  }
55
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: NgnToggleButton, decorators: [{
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: NgnToggleButton, decorators: [{
56
56
  type: Component,
57
- args: [{ selector: 'ngn-toggle-button', providers: [provideSelf(NgnToggleButton)], changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgnPt, NgnIcon], template: "<button\r\n [ptInt]=\"this\"\r\n [ptClass]=\"'button'\"\r\n (click)=\"toggle()\"\r\n [disabled]=\"disabled()\"\r\n [ariaReadOnly]=\"readonly()\"\r\n (blur)=\"touched.set(true)\"\r\n>\r\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\r\n @let renderedIcon = (value() ? iconOn() : iconOff()) ?? icon();\r\n @if (renderedIcon) {\r\n <ngn-icon [icon]=\"renderedIcon\" />\r\n }\r\n {{ (value() ? labelOn() : labelOff()) ?? label() }}\r\n </span>\r\n @if (fixedWidth()) {\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder-active'\">\r\n @let renderedIconOn = iconOn() ?? icon();\r\n @if (renderedIconOn) {\r\n <ngn-icon [icon]=\"renderedIconOn\" />\r\n }\r\n {{ labelOn() ?? label() }}\r\n </span>\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder'\">\r\n @let renderedIconOff = iconOff() ?? icon();\r\n @if (renderedIconOff) {\r\n <ngn-icon [icon]=\"renderedIconOff\" />\r\n }\r\n {{ labelOff() ?? label() }}\r\n </span>\r\n }\r\n</button>\r\n" }]
57
+ args: [{ selector: 'ngn-toggle-button', providers: [provideSelf(NgnToggleButton)], changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgnPt, NgnIcon], template: "<button\r\n [ptInt]=\"this\"\r\n [ptClass]=\"'button'\"\r\n (click)=\"toggle()\"\r\n [disabled]=\"disabled()\"\r\n [attr.aria-pressed]=\"value()\"\r\n [attr.aria-readonly]=\"readonly() || null\"\r\n [attr.aria-label]=\"label()\"\r\n [attr.aria-labelledby]=\"labelledBy()\"\r\n (blur)=\"touched.set(true)\"\r\n>\r\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\r\n @let renderedIcon = (value() ? iconOn() : iconOff()) ?? icon();\r\n @if (renderedIcon) {\r\n <ngn-icon [icon]=\"renderedIcon\" />\r\n }\r\n {{ (value() ? labelOn() : labelOff()) ?? label() }}\r\n </span>\r\n @if (fixedWidth()) {\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder-active'\">\r\n @let renderedIconOn = iconOn() ?? icon();\r\n @if (renderedIconOn) {\r\n <ngn-icon [icon]=\"renderedIconOn\" />\r\n }\r\n {{ labelOn() ?? label() }}\r\n </span>\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder'\">\r\n @let renderedIconOff = iconOff() ?? icon();\r\n @if (renderedIconOff) {\r\n <ngn-icon [icon]=\"renderedIconOff\" />\r\n }\r\n {{ labelOff() ?? label() }}\r\n </span>\r\n }\r\n</button>\r\n" }]
58
58
  }], propDecorators: { labelOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelOn", required: false }] }], labelOff: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelOff", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], iconOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOn", required: false }] }], iconOff: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOff", required: false }] }], fixedWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fixedWidth", required: false }] }] } });
59
59
 
60
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ngneers-controls-toggle-button.mjs","sources":["../../src/toggle-button/toggle-button.ts","../../src/toggle-button/toggle-button.html","../../src/toggle-button/ngneers-controls-toggle-button.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { provideSelf, ValueControlBase, NgnPt } from '@ngneers/controls/base';\r\nimport { NgnIcon } from '@ngneers/controls/icon';\r\nimport { toggleButtonControlTemplate } from '@ngneers/controls-themes/templates/toggle-button';\r\n\r\nimport type { IconType } from '@ngneers/controls-custom-types';\r\n\r\n/**\r\n * @category control\r\n */\r\n@Component({\r\n selector: 'ngn-toggle-button',\r\n providers: [provideSelf(NgnToggleButton)],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [NgnPt, NgnIcon],\r\n templateUrl: './toggle-button.html',\r\n})\r\nexport class NgnToggleButton extends ValueControlBase<'toggleButton', boolean> {\r\n protected readonly theme = this.injectThemeTemplate(toggleButtonControlTemplate, {\r\n root: true,\r\n active: () => this.value(),\r\n invalid: () => this.invalid(),\r\n });\r\n\r\n /**\r\n * Optional labels for on and off states.\r\n * If not provided, the {@link label} input will be used.\r\n */\r\n public readonly labelOn = input<string>();\r\n /**\r\n * Optional labels for on and off states.\r\n * If not provided, the {@link label} input will be used.\r\n */\r\n public readonly labelOff = input<string>();\r\n /**\r\n * Optional icon for the button. Can be used instead of the label or in combination with it.\r\n * If {@link iconOn} and {@link iconOff} are provided, they will take precedence over this input for their respective states.\r\n */\r\n public readonly icon = input<IconType>();\r\n /**\r\n * Optional icons for on and off states.\r\n * If not provided, the {@link icon} input will be used.\r\n */\r\n public readonly iconOn = input<IconType>();\r\n /**\r\n * Optional icons for on and off states.\r\n * If not provided, the {@link icon} input will be used.\r\n */\r\n public readonly iconOff = input<IconType>();\r\n /**\r\n * If true, the button will always have the width of the longest possible content.\r\n * @default false\r\n */\r\n public readonly fixedWidth = input<boolean>(false);\r\n\r\n public toggle() {\r\n if (this.disabled() || this.readonly()) {\r\n return;\r\n }\r\n this.value.update(v => !v);\r\n }\r\n}\r\n","<button\r\n [ptInt]=\"this\"\r\n [ptClass]=\"'button'\"\r\n (click)=\"toggle()\"\r\n [disabled]=\"disabled()\"\r\n [ariaReadOnly]=\"readonly()\"\r\n (blur)=\"touched.set(true)\"\r\n>\r\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\r\n @let renderedIcon = (value() ? iconOn() : iconOff()) ?? icon();\r\n @if (renderedIcon) {\r\n <ngn-icon [icon]=\"renderedIcon\" />\r\n }\r\n {{ (value() ? labelOn() : labelOff()) ?? label() }}\r\n </span>\r\n @if (fixedWidth()) {\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder-active'\">\r\n @let renderedIconOn = iconOn() ?? icon();\r\n @if (renderedIconOn) {\r\n <ngn-icon [icon]=\"renderedIconOn\" />\r\n }\r\n {{ labelOn() ?? label() }}\r\n </span>\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder'\">\r\n @let renderedIconOff = iconOff() ?? icon();\r\n @if (renderedIconOff) {\r\n <ngn-icon [icon]=\"renderedIconOff\" />\r\n }\r\n {{ labelOff() ?? label() }}\r\n </span>\r\n }\r\n</button>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAOA;;AAEG;AAQG,MAAO,eAAgB,SAAQ,gBAAyC,CAAA;AACzD,IAAA,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,EAAE;AAC/E,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,MA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EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAGb,eAAe,EAAA,UAAA,EAAA,CAAA;kBAP3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,EAAA,SAAA,EAClB,CAAC,WAAW,CAAA,eAAA,CAAiB,CAAC,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAA,QAAA,EAAA,yhCAAA,EAAA;;;AEd3B;;AAEG;;;;"}
1
+ {"version":3,"file":"ngneers-controls-toggle-button.mjs","sources":["../../src/toggle-button/toggle-button.ts","../../src/toggle-button/toggle-button.html","../../src/toggle-button/ngneers-controls-toggle-button.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nimport { provideSelf, ValueControlBase, NgnPt } from '@ngneers/controls/base';\r\nimport { NgnIcon } from '@ngneers/controls/icon';\r\nimport { toggleButtonControlTemplate } from '@ngneers/controls-themes/templates/toggle-button';\r\n\r\nimport type { IconType } from '@ngneers/controls-custom-types';\r\n\r\n/**\r\n * @category control\r\n */\r\n@Component({\r\n selector: 'ngn-toggle-button',\r\n providers: [provideSelf(NgnToggleButton)],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [NgnPt, NgnIcon],\r\n templateUrl: './toggle-button.html',\r\n})\r\nexport class NgnToggleButton extends ValueControlBase<'toggleButton', boolean> {\r\n protected readonly theme = this.injectThemeTemplate(toggleButtonControlTemplate, {\r\n root: true,\r\n active: () => this.value(),\r\n invalid: () => this.invalid(),\r\n });\r\n\r\n /**\r\n * Optional labels for on and off states.\r\n * If not provided, the {@link label} input will be used.\r\n */\r\n public readonly labelOn = input<string>();\r\n /**\r\n * Optional labels for on and off states.\r\n * If not provided, the {@link label} input will be used.\r\n */\r\n public readonly labelOff = input<string>();\r\n /**\r\n * Optional icon for the button. Can be used instead of the label or in combination with it.\r\n * If {@link iconOn} and {@link iconOff} are provided, they will take precedence over this input for their respective states.\r\n */\r\n public readonly icon = input<IconType>();\r\n /**\r\n * Optional icons for on and off states.\r\n * If not provided, the {@link icon} input will be used.\r\n */\r\n public readonly iconOn = input<IconType>();\r\n /**\r\n * Optional icons for on and off states.\r\n * If not provided, the {@link icon} input will be used.\r\n */\r\n public readonly iconOff = input<IconType>();\r\n /**\r\n * If true, the button will always have the width of the longest possible content.\r\n * @default false\r\n */\r\n public readonly fixedWidth = input<boolean>(false);\r\n\r\n public toggle() {\r\n if (this.disabled() || this.readonly()) {\r\n return;\r\n }\r\n this.value.update(v => !v);\r\n }\r\n}\r\n","<button\r\n [ptInt]=\"this\"\r\n [ptClass]=\"'button'\"\r\n (click)=\"toggle()\"\r\n [disabled]=\"disabled()\"\r\n [attr.aria-pressed]=\"value()\"\r\n [attr.aria-readonly]=\"readonly() || null\"\r\n [attr.aria-label]=\"label()\"\r\n [attr.aria-labelledby]=\"labelledBy()\"\r\n (blur)=\"touched.set(true)\"\r\n>\r\n <span [ptInt]=\"this\" [ptClass]=\"'label'\">\r\n @let renderedIcon = (value() ? iconOn() : iconOff()) ?? icon();\r\n @if (renderedIcon) {\r\n <ngn-icon [icon]=\"renderedIcon\" />\r\n }\r\n {{ (value() ? labelOn() : labelOff()) ?? label() }}\r\n </span>\r\n @if (fixedWidth()) {\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder-active'\">\r\n @let renderedIconOn = iconOn() ?? icon();\r\n @if (renderedIconOn) {\r\n <ngn-icon [icon]=\"renderedIconOn\" />\r\n }\r\n {{ labelOn() ?? label() }}\r\n </span>\r\n <span inert [ptInt]=\"this\" [ptClass]=\"'placeholder'\">\r\n @let renderedIconOff = iconOff() ?? icon();\r\n @if (renderedIconOff) {\r\n <ngn-icon [icon]=\"renderedIconOff\" />\r\n }\r\n {{ labelOff() ?? label() }}\r\n </span>\r\n }\r\n</button>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAOA;;AAEG;AAQG,MAAO,eAAgB,SAAQ,gBAAyC,CAAA;AACzD,IAAA,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,EAAE;AAC/E,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,MAAM,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE;AAC1B,QAAA,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE;AAC9B,KAAA,CAAC;AAEF;;;AAGG;IACa,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AACzC;;;AAGG;IACa,QAAQ,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,UAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC1C;;;AAGG;IACa,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAY;AACxC;;;AAGG;IACa,MAAM,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,QAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAY;AAC1C;;;AAGG;IACa,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAY;AAC3C;;;A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AAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EALf,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECZ3C,4pCAmCA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDrBY,KAAK,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAGb,eAAe,EAAA,UAAA,EAAA,CAAA;kBAP3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,EAAA,SAAA,EAClB,CAAC,WAAW,CAAA,eAAA,CAAiB,CAAC,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAA,QAAA,EAAA,4pCAAA,EAAA;;;AEd3B;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ViewContainerRef, signal, input, computed, effect, TemplateRef, Directive, viewChild, DOCUMENT, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { inject, ViewContainerRef, signal, input, computed, effect, afterRenderEffect, TemplateRef, Directive, viewChild, DOCUMENT, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { NGN_CONFIG, abortSignalOnDestroy, autoPositionElement, splitPlacement } from '@ngneers/controls/api/ng';
4
4
  import { NgnBase, provideSelf, NgnPt } from '@ngneers/controls/base';
5
5
  import { NgnDefer } from '@ngneers/controls/defer';
@@ -42,87 +42,93 @@ class NgnTooltip extends NgnBase {
42
42
  theme = null;
43
43
  _viewContainerRef = inject(ViewContainerRef);
44
44
  _config = inject(NGN_CONFIG);
45
- _tooltip = signal(null, ...(ngDevMode ? [{ debugName: "_tooltip" }] : []));
45
+ _tooltip = signal(null, ...(ngDevMode ? [{ debugName: "_tooltip" }] : /* istanbul ignore next */ []));
46
46
  /**
47
47
  * The content of the tooltip, can be a string or a TemplateRef.
48
48
  * If the value is falsy, the tooltip will not be shown.
49
49
  * @alias ngnTooltip
50
50
  */
51
- content = input(null, { ...(ngDevMode ? { debugName: "content" } : {}), alias: 'ngnTooltip' });
51
+ content = input(null, { ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), alias: 'ngnTooltip' });
52
52
  /**
53
53
  * If set to `true`, the tooltip will only be shown if the anchor element is truncated. `""` is equivalent to `true`.
54
54
  * @alias ngnTooltipShowOnlyIfTruncated
55
55
  * @default false
56
56
  */
57
- showOnlyIfTruncated = input(false, { ...(ngDevMode ? { debugName: "showOnlyIfTruncated" } : {}), alias: 'ngnTooltipShowOnlyIfTruncated' });
57
+ showOnlyIfTruncated = input(false, { ...(ngDevMode ? { debugName: "showOnlyIfTruncated" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipShowOnlyIfTruncated' });
58
58
  /**
59
59
  * The size constraints for the tooltip.
60
60
  * This can be used to limit the width and height of the tooltip.
61
61
  * If not provided, the tooltip is only constrained by the size of the screen.
62
62
  * @alias ngnTooltipSize
63
63
  */
64
- size = input(null, { ...(ngDevMode ? { debugName: "size" } : {}), alias: 'ngnTooltipSize' });
64
+ size = input(null, { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipSize' });
65
65
  /**
66
66
  * The options for the tooltip.
67
67
  * This is a shorthand for setting multiple options at once.
68
68
  * The individual options take precedence over the options set here.
69
69
  * @alias ngnTooltipOptions
70
70
  */
71
- options = input(null, { ...(ngDevMode ? { debugName: "options" } : {}), alias: 'ngnTooltipOptions' });
71
+ options = input(null, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipOptions' });
72
72
  /**
73
73
  * The placement of the tooltip relative to the anchor element.
74
74
  * @alias ngnTooltipPlacement
75
75
  * @default 'bottom'
76
76
  */
77
- placement = input(null, { ...(ngDevMode ? { debugName: "placement" } : {}), alias: 'ngnTooltipPlacement' });
77
+ placement = input(null, { ...(ngDevMode ? { debugName: "placement" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipPlacement' });
78
78
  /**
79
79
  * The offset in Pixels of the tooltip from the anchor element.
80
80
  * @alias ngnTooltipOffset
81
81
  * @default 4
82
82
  */
83
- offset = input(null, { ...(ngDevMode ? { debugName: "offset" } : {}), alias: 'ngnTooltipOffset' });
83
+ offset = input(null, { ...(ngDevMode ? { debugName: "offset" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipOffset' });
84
84
  /**
85
85
  * The delay before the tooltip is shown. If a number is provided, it is interpreted as milliseconds.
86
86
  * @alias ngnTooltipShowDelay
87
87
  * @default '0.5s'
88
88
  */
89
- showDelay = input(null, { ...(ngDevMode ? { debugName: "showDelay" } : {}), alias: 'ngnTooltipShowDelay' });
89
+ showDelay = input(null, { ...(ngDevMode ? { debugName: "showDelay" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipShowDelay' });
90
90
  /**
91
91
  * The delay before the tooltip is hidden. If a number is provided, it is interpreted as milliseconds.
92
92
  * @alias ngnTooltipHideDelay
93
93
  * @default '0.1s'
94
94
  */
95
- hideDelay = input(null, { ...(ngDevMode ? { debugName: "hideDelay" } : {}), alias: 'ngnTooltipHideDelay' });
95
+ hideDelay = input(null, { ...(ngDevMode ? { debugName: "hideDelay" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipHideDelay' });
96
96
  /**
97
97
  * Whether to show an arrow pointing to the anchor element. `""` is equivalent to `true`.
98
98
  * @alias ngnTooltipShowArrow
99
99
  * @default true
100
100
  */
101
- showArrow = input(null, { ...(ngDevMode ? { debugName: "showArrow" } : {}), alias: 'ngnTooltipShowArrow' });
101
+ showArrow = input(null, { ...(ngDevMode ? { debugName: "showArrow" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipShowArrow' });
102
102
  /**
103
103
  * Shows the tooltip on hover.
104
104
  * @alias ngnTooltipShowOnHover
105
105
  * @default true
106
106
  */
107
- showOnHover = input(null, { ...(ngDevMode ? { debugName: "showOnHover" } : {}), alias: 'ngnTooltipShowOnHover' });
107
+ showOnHover = input(null, { ...(ngDevMode ? { debugName: "showOnHover" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipShowOnHover' });
108
108
  /**
109
109
  * Shows the tooltip on focus.
110
110
  * @alias ngnTooltipShowOnFocus
111
111
  * @default true
112
112
  */
113
- showOnFocus = input(null, { ...(ngDevMode ? { debugName: "showOnFocus" } : {}), alias: 'ngnTooltipShowOnFocus' });
113
+ showOnFocus = input(null, { ...(ngDevMode ? { debugName: "showOnFocus" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipShowOnFocus' });
114
114
  /**
115
115
  * Hides the tooltip (without delay) when the mouse hovers over the tooltip.
116
116
  * @alias ngnTooltipHideOnTooltipHover
117
117
  * @default false
118
118
  */
119
- hideOnTooltipHover = input(null, { ...(ngDevMode ? { debugName: "hideOnTooltipHover" } : {}), alias: 'ngnTooltipHideOnTooltipHover' });
119
+ hideOnTooltipHover = input(null, { ...(ngDevMode ? { debugName: "hideOnTooltipHover" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipHideOnTooltipHover' });
120
120
  /**
121
121
  * Hides the tooltip (without delay) when the user clicks on the tooltip.
122
122
  * @alias ngnTooltipHideOnClick
123
123
  * @default true
124
124
  */
125
- hideOnClick = input(null, { ...(ngDevMode ? { debugName: "hideOnClick" } : {}), alias: 'ngnTooltipHideOnClick' });
125
+ hideOnClick = input(null, { ...(ngDevMode ? { debugName: "hideOnClick" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipHideOnClick' });
126
+ /**
127
+ * Whether to automatically manage ARIA attributes for the tooltip.
128
+ * @alias ngnTooltipAutoAriaMode
129
+ * @default 'description'
130
+ */
131
+ autoAriaMode = input(null, { ...(ngDevMode ? { debugName: "autoAriaMode" } : /* istanbul ignore next */ {}), alias: 'ngnTooltipAutoAriaMode' });
126
132
  effectiveOptions = computed(() => {
127
133
  const defaults = this._config.defaults.tooltip;
128
134
  return {
@@ -137,9 +143,10 @@ class NgnTooltip extends NgnBase {
137
143
  this.options()?.hideOnTooltipHover ??
138
144
  defaults.hideOnTooltipHover) !== false,
139
145
  hideOnClick: (this.hideOnClick() ?? this.options()?.hideOnClick ?? defaults.hideOnClick) !== false,
146
+ autoAriaMode: this.autoAriaMode() ?? this.options()?.autoAriaMode ?? defaults.autoAriaMode,
140
147
  };
141
- }, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : []));
142
- tooltip = computed(() => this._tooltip()?.instance, ...(ngDevMode ? [{ debugName: "tooltip" }] : []));
148
+ }, ...(ngDevMode ? [{ debugName: "effectiveOptions" }] : /* istanbul ignore next */ []));
149
+ tooltip = computed(() => this._tooltip()?.instance, ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
143
150
  constructor() {
144
151
  super();
145
152
  const abortSignal = abortSignalOnDestroy();
@@ -163,6 +170,34 @@ class NgnTooltip extends NgnBase {
163
170
  effect(() => this._tooltip()?.setInput('showOnlyIfTruncated', this.showOnlyIfTruncated()));
164
171
  effect(() => this._tooltip()?.setInput('size', this.size()));
165
172
  effect(() => this._tooltip()?.setInput('options', this.effectiveOptions()));
173
+ afterRenderEffect(() => {
174
+ const el = this.element.nativeElement;
175
+ const content = this.content();
176
+ const autoAriaMode = this.effectiveOptions().autoAriaMode;
177
+ el.removeAttribute('aria-label');
178
+ el.removeAttribute('aria-description');
179
+ el.removeAttribute('aria-labelledby');
180
+ el.removeAttribute('aria-describedby');
181
+ if (autoAriaMode === 'none' || !content) {
182
+ return;
183
+ }
184
+ const tooltip = this.tooltip();
185
+ const isShown = tooltip?.isShown() ?? false;
186
+ if (typeof content === 'string') {
187
+ if (isShown && tooltip) {
188
+ const attr = autoAriaMode === 'label' ? 'aria-labelledby' : 'aria-describedby';
189
+ el.setAttribute(attr, tooltip.id);
190
+ }
191
+ else {
192
+ const attr = autoAriaMode === 'label' ? 'aria-label' : 'aria-description';
193
+ el.setAttribute(attr, content);
194
+ }
195
+ }
196
+ else if (content instanceof TemplateRef && isShown && tooltip) {
197
+ const attr = autoAriaMode === 'label' ? 'aria-labelledby' : 'aria-describedby';
198
+ el.setAttribute(attr, tooltip.id);
199
+ }
200
+ });
166
201
  }
167
202
  ngOnDestroy() {
168
203
  this._tooltip()?.destroy();
@@ -227,17 +262,17 @@ class NgnTooltip extends NgnBase {
227
262
  tooltip.setInput('content', null);
228
263
  }
229
264
  }
230
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: NgnTooltip, deps: [], target: i0.ɵɵFactoryTarget.Directive });
231
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.0", type: NgnTooltip, isStandalone: true, selector: "[ngnTooltip]", inputs: { content: { classPropertyName: "content", publicName: "ngnTooltip", isSignal: true, isRequired: false, transformFunction: null }, showOnlyIfTruncated: { classPropertyName: "showOnlyIfTruncated", publicName: "ngnTooltipShowOnlyIfTruncated", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "ngnTooltipSize", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "ngnTooltipOptions", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "ngnTooltipPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "ngnTooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "ngnTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "ngnTooltipHideDelay", isSignal: true, isRequired: false, transformFunction: null }, showArrow: { classPropertyName: "showArrow", publicName: "ngnTooltipShowArrow", isSignal: true, isRequired: false, transformFunction: null }, showOnHover: { classPropertyName: "showOnHover", publicName: "ngnTooltipShowOnHover", isSignal: true, isRequired: false, transformFunction: null }, showOnFocus: { classPropertyName: "showOnFocus", publicName: "ngnTooltipShowOnFocus", isSignal: true, isRequired: false, transformFunction: null }, hideOnTooltipHover: { classPropertyName: "hideOnTooltipHover", publicName: "ngnTooltipHideOnTooltipHover", isSignal: true, isRequired: false, transformFunction: null }, hideOnClick: { classPropertyName: "hideOnClick", publicName: "ngnTooltipHideOnClick", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideSelf(NgnTooltip)], exportAs: ["ngnTooltip"], usesInheritance: true, ngImport: i0 });
265
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: NgnTooltip, deps: [], target: i0.ɵɵFactoryTarget.Directive });
266
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.10", type: NgnTooltip, isStandalone: true, selector: "[ngnTooltip]", inputs: { content: { classPropertyName: "content", publicName: "ngnTooltip", isSignal: true, isRequired: false, transformFunction: null }, showOnlyIfTruncated: { classPropertyName: "showOnlyIfTruncated", publicName: "ngnTooltipShowOnlyIfTruncated", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "ngnTooltipSize", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "ngnTooltipOptions", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "ngnTooltipPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "ngnTooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "ngnTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "ngnTooltipHideDelay", isSignal: true, isRequired: false, transformFunction: null }, showArrow: { classPropertyName: "showArrow", publicName: "ngnTooltipShowArrow", isSignal: true, isRequired: false, transformFunction: null }, showOnHover: { classPropertyName: "showOnHover", publicName: "ngnTooltipShowOnHover", isSignal: true, isRequired: false, transformFunction: null }, showOnFocus: { classPropertyName: "showOnFocus", publicName: "ngnTooltipShowOnFocus", isSignal: true, isRequired: false, transformFunction: null }, hideOnTooltipHover: { classPropertyName: "hideOnTooltipHover", publicName: "ngnTooltipHideOnTooltipHover", isSignal: true, isRequired: false, transformFunction: null }, hideOnClick: { classPropertyName: "hideOnClick", publicName: "ngnTooltipHideOnClick", isSignal: true, isRequired: false, transformFunction: null }, autoAriaMode: { classPropertyName: "autoAriaMode", publicName: "ngnTooltipAutoAriaMode", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideSelf(NgnTooltip)], exportAs: ["ngnTooltip"], usesInheritance: true, ngImport: i0 });
232
267
  }
233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: NgnTooltip, decorators: [{
268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: NgnTooltip, decorators: [{
234
269
  type: Directive,
235
270
  args: [{
236
271
  selector: '[ngnTooltip]',
237
272
  exportAs: 'ngnTooltip',
238
273
  providers: [provideSelf(NgnTooltip)],
239
274
  }]
240
- }], ctorParameters: () => [], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltip", required: false }] }], showOnlyIfTruncated: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowOnlyIfTruncated", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipSize", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipOptions", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipPlacement", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipOffset", required: false }] }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowDelay", required: false }] }], hideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipHideDelay", required: false }] }], showArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowArrow", required: false }] }], showOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowOnHover", required: false }] }], showOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowOnFocus", required: false }] }], hideOnTooltipHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipHideOnTooltipHover", required: false }] }], hideOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipHideOnClick", required: false }] }] } });
275
+ }], ctorParameters: () => [], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltip", required: false }] }], showOnlyIfTruncated: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowOnlyIfTruncated", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipSize", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipOptions", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipPlacement", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipOffset", required: false }] }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowDelay", required: false }] }], hideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipHideDelay", required: false }] }], showArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowArrow", required: false }] }], showOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowOnHover", required: false }] }], showOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipShowOnFocus", required: false }] }], hideOnTooltipHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipHideOnTooltipHover", required: false }] }], hideOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipHideOnClick", required: false }] }], autoAriaMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngnTooltipAutoAriaMode", required: false }] }] } });
241
276
  class TooltipComponent extends NgnBase {
242
277
  _showHideTimeout;
243
278
  theme = this.injectThemeTemplate(tooltipControlTemplate, {
@@ -249,43 +284,43 @@ class TooltipComponent extends NgnBase {
249
284
  /**
250
285
  * The anchor element to which the tooltip is attached.
251
286
  */
252
- anchor = input.required(...(ngDevMode ? [{ debugName: "anchor" }] : []));
287
+ anchor = input.required(...(ngDevMode ? [{ debugName: "anchor" }] : /* istanbul ignore next */ []));
253
288
  /**
254
289
  * The text content of the tooltip.
255
290
  */
256
- text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : []));
291
+ text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : /* istanbul ignore next */ []));
257
292
  /**
258
293
  * The content template of the tooltip.
259
294
  */
260
- content = input(...(ngDevMode ? [undefined, { debugName: "content" }] : []));
295
+ content = input(...(ngDevMode ? [undefined, { debugName: "content" }] : /* istanbul ignore next */ []));
261
296
  /**
262
297
  * If set to `true`, the tooltip will only be shown if the anchor element is truncated. `""` is equivalent to `true`.
263
298
  * @default `false`
264
299
  */
265
- showOnlyIfTruncated = input(false, ...(ngDevMode ? [{ debugName: "showOnlyIfTruncated" }] : []));
300
+ showOnlyIfTruncated = input(false, ...(ngDevMode ? [{ debugName: "showOnlyIfTruncated" }] : /* istanbul ignore next */ []));
266
301
  /**
267
302
  * The size constraints for the tooltip.
268
303
  * This can be used to limit the width and height of the tooltip.
269
304
  * If not provided, the tooltip is only constrained by the size of the screen.
270
305
  */
271
- size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : []));
306
+ size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : /* istanbul ignore next */ []));
272
307
  /**
273
308
  * The options for the tooltip.
274
309
  *
275
310
  */
276
- options = input(this._config.defaults.tooltip, ...(ngDevMode ? [{ debugName: "options" }] : []));
277
- showDelayMs = computed(() => getTimeSpanMilliseconds(this.options().showDelay), ...(ngDevMode ? [{ debugName: "showDelayMs" }] : []));
278
- hideDelayMs = computed(() => getTimeSpanMilliseconds(this.options().hideDelay), ...(ngDevMode ? [{ debugName: "hideDelayMs" }] : []));
279
- position = signal({ x: 0, y: 0 }, ...(ngDevMode ? [{ debugName: "position" }] : []));
280
- positionClass = signal('', ...(ngDevMode ? [{ debugName: "positionClass" }] : []));
281
- relativeAnchorElementPosition = signal(undefined, ...(ngDevMode ? [{ debugName: "relativeAnchorElementPosition" }] : []));
282
- _isShown = signal(false, ...(ngDevMode ? [{ debugName: "_isShown" }] : []));
283
- _isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : []));
311
+ options = input(this._config.defaults.tooltip, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
312
+ showDelayMs = computed(() => getTimeSpanMilliseconds(this.options().showDelay), ...(ngDevMode ? [{ debugName: "showDelayMs" }] : /* istanbul ignore next */ []));
313
+ hideDelayMs = computed(() => getTimeSpanMilliseconds(this.options().hideDelay), ...(ngDevMode ? [{ debugName: "hideDelayMs" }] : /* istanbul ignore next */ []));
314
+ position = signal({ x: 0, y: 0 }, ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
315
+ positionClass = signal('', ...(ngDevMode ? [{ debugName: "positionClass" }] : /* istanbul ignore next */ []));
316
+ relativeAnchorElementPosition = signal(undefined, ...(ngDevMode ? [{ debugName: "relativeAnchorElementPosition" }] : /* istanbul ignore next */ []));
317
+ _isShown = signal(false, ...(ngDevMode ? [{ debugName: "_isShown" }] : /* istanbul ignore next */ []));
318
+ _isClosing = signal(false, ...(ngDevMode ? [{ debugName: "_isClosing" }] : /* istanbul ignore next */ []));
284
319
  id = generateElementId();
285
320
  isShown = this._isShown.asReadonly();
286
321
  isClosing = this._isClosing.asReadonly();
287
322
  _defaultContentTemplate = viewChild.required('defaultContentTemplate');
288
- contentTemplate = computed(() => this.content() ?? this._defaultContentTemplate(), ...(ngDevMode ? [{ debugName: "contentTemplate" }] : []));
323
+ contentTemplate = computed(() => this.content() ?? this._defaultContentTemplate(), ...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
289
324
  _autoPos = computedWithPrevious(prev => {
290
325
  prev?.stop();
291
326
  const element = this.element.nativeElement;
@@ -409,10 +444,10 @@ class TooltipComponent extends NgnBase {
409
444
  toPixels(value) {
410
445
  return value !== undefined ? `${value}px` : undefined;
411
446
  }
412
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
413
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.0", type: TooltipComponent, isStandalone: true, selector: "ngn-tooltip", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: true, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, showOnlyIfTruncated: { classPropertyName: "showOnlyIfTruncated", publicName: "showOnlyIfTruncated", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "toggle": "onToggle($event)", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick($event)" }, properties: { "class": "positionClass()", "style.--anchor-start": "toPixels(relativeAnchorElementPosition()?.start)", "style.--anchor-center": "toPixels(relativeAnchorElementPosition()?.center)", "style.--anchor-end": "toPixels(relativeAnchorElementPosition()?.end)", "style.left": "toPixels(position().x)", "style.top": "toPixels(position().y)", "attr.popover": "'hint'", "attr.id": "id", "attr.role": "'tooltip'" } }, providers: [provideSelf(TooltipComponent)], viewQueries: [{ propertyName: "_defaultContentTemplate", first: true, predicate: ["defaultContentTemplate"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [ptInt]=\"this\" [ptClass]=\"'content'\">\r\n <ngn-defer [lazyContent]=\"contentTemplate()\" [open]=\"isShown()\" [cache]=\"false\"></ngn-defer>\r\n</div>\r\n\r\n<ng-template #defaultContentTemplate>\r\n <span [ptInt]=\"this\" [ptClass]=\"'text'\">{{ text() }}</span>\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: NgnPt, selector: "[ptInt]", inputs: ["ptInt", "ptClass"] }, { kind: "component", type: NgnDefer, selector: "ngn-defer", inputs: ["lazyContent", "lazyContentContext", "open", "lazy", "cache", "hiddenOnClosed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
447
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
448
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.10", type: TooltipComponent, isStandalone: true, selector: "ngn-tooltip", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: true, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, showOnlyIfTruncated: { classPropertyName: "showOnlyIfTruncated", publicName: "showOnlyIfTruncated", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "toggle": "onToggle($event)", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick($event)" }, properties: { "class": "positionClass()", "style.--anchor-start": "toPixels(relativeAnchorElementPosition()?.start)", "style.--anchor-center": "toPixels(relativeAnchorElementPosition()?.center)", "style.--anchor-end": "toPixels(relativeAnchorElementPosition()?.end)", "style.left": "toPixels(position().x)", "style.top": "toPixels(position().y)", "attr.popover": "'hint'", "attr.id": "id", "attr.role": "'tooltip'", "attr.aria-hidden": "isShown() ? null : true" } }, providers: [provideSelf(TooltipComponent)], viewQueries: [{ propertyName: "_defaultContentTemplate", first: true, predicate: ["defaultContentTemplate"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [ptInt]=\"this\" [ptClass]=\"'content'\">\r\n <ngn-defer [lazyContent]=\"contentTemplate()\" [open]=\"isShown()\" [cache]=\"false\"></ngn-defer>\r\n</div>\r\n\r\n<ng-template #defaultContentTemplate>\r\n <span [ptInt]=\"this\" [ptClass]=\"'text'\">{{ text() }}</span>\r\n</ng-template>\r\n", dependencies: [{ kind: "directive", type: NgnPt, selector: "[ptInt]", inputs: ["ptInt", "ptClass"] }, { kind: "component", type: NgnDefer, selector: "ngn-defer", inputs: ["lazyContent", "lazyContentContext", "open", "lazy", "cache", "hiddenOnClosed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
414
449
  }
415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TooltipComponent, decorators: [{
450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
416
451
  type: Component,
417
452
  args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ngn-tooltip', imports: [NgnPt, NgnDefer], providers: [provideSelf(TooltipComponent)], host: {
418
453
  '[class]': `positionClass()`,
@@ -428,6 +463,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
428
463
  '(mouseenter)': 'onMouseEnter()',
429
464
  '(mouseleave)': 'onMouseLeave()',
430
465
  '(click)': 'onClick($event)',
466
+ '[attr.aria-hidden]': `isShown() ? null : true`,
431
467
  }, template: "<div [ptInt]=\"this\" [ptClass]=\"'content'\">\r\n <ngn-defer [lazyContent]=\"contentTemplate()\" [open]=\"isShown()\" [cache]=\"false\"></ngn-defer>\r\n</div>\r\n\r\n<ng-template #defaultContentTemplate>\r\n <span [ptInt]=\"this\" [ptClass]=\"'text'\">{{ text() }}</span>\r\n</ng-template>\r\n" }]
432
468
  }], ctorParameters: () => [], propDecorators: { anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: true }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], showOnlyIfTruncated: [{ type: i0.Input, args: [{ isSignal: true, alias: "showOnlyIfTruncated", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], _defaultContentTemplate: [{ type: i0.ViewChild, args: ['defaultContentTemplate', { isSignal: true }] }] } });
433
469
  function isElementTruncated(element) {