@siemens/element-ng 49.11.0 → 49.13.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.
- package/carousel/package.json +4 -0
- package/fesm2022/siemens-element-ng-ag-grid.mjs +6 -5
- package/fesm2022/siemens-element-ng-ag-grid.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-application-header.mjs +51 -32
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-autocomplete.mjs +9 -13
- package/fesm2022/siemens-element-ng-autocomplete.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-breadcrumb-router.mjs +3 -3
- package/fesm2022/siemens-element-ng-breadcrumb-router.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-breadcrumb.mjs +3 -3
- package/fesm2022/siemens-element-ng-breadcrumb.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-card.mjs +2 -2
- package/fesm2022/siemens-element-ng-card.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-carousel.mjs +541 -0
- package/fesm2022/siemens-element-ng-carousel.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-chat-messages.mjs +18 -21
- package/fesm2022/siemens-element-ng-chat-messages.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-content-action-bar.mjs +2 -2
- package/fesm2022/siemens-element-ng-content-action-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-dashboard.mjs +34 -35
- package/fesm2022/siemens-element-ng-dashboard.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-date-range-filter.mjs +10 -8
- package/fesm2022/siemens-element-ng-date-range-filter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datepicker.mjs +10 -9
- package/fesm2022/siemens-element-ng-datepicker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-electron-titlebar.mjs +3 -3
- package/fesm2022/siemens-element-ng-electron-titlebar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-empty-state.mjs +2 -2
- package/fesm2022/siemens-element-ng-empty-state.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-file-uploader.mjs +49 -47
- package/fesm2022/siemens-element-ng-file-uploader.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filter-bar.mjs +5 -5
- package/fesm2022/siemens-element-ng-filter-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filtered-search.mjs +6 -5
- package/fesm2022/siemens-element-ng-filtered-search.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-footer.mjs +3 -3
- package/fesm2022/siemens-element-ng-footer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-form.mjs +28 -49
- package/fesm2022/siemens-element-ng-form.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-formly.mjs +24 -23
- package/fesm2022/siemens-element-ng-formly.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-header-dropdown.mjs +37 -21
- package/fesm2022/siemens-element-ng-header-dropdown.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-help-button.mjs +3 -3
- package/fesm2022/siemens-element-ng-help-button.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-inline-notification.mjs +3 -3
- package/fesm2022/siemens-element-ng-inline-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ip-input.mjs +1 -1
- package/fesm2022/siemens-element-ng-ip-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-language-switcher.mjs +3 -3
- package/fesm2022/siemens-element-ng-language-switcher.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs +4 -3
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-menu.mjs +2 -2
- package/fesm2022/siemens-element-ng-menu.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs +8 -7
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs +13 -12
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar.mjs +6 -8
- package/fesm2022/siemens-element-ng-navbar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-notification-item.mjs +3 -3
- package/fesm2022/siemens-element-ng-notification-item.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pagination.mjs +4 -1
- package/fesm2022/siemens-element-ng-pagination.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-toggle.mjs +3 -3
- package/fesm2022/siemens-element-ng-password-toggle.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-phone-number.mjs +63 -42
- package/fesm2022/siemens-element-ng-phone-number.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pills-input.mjs +4 -4
- package/fesm2022/siemens-element-ng-pills-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover-legacy.mjs +3 -3
- package/fesm2022/siemens-element-ng-popover-legacy.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover.mjs +3 -3
- package/fesm2022/siemens-element-ng-popover.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-result-details-list.mjs +3 -3
- package/fesm2022/siemens-element-ng-result-details-list.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-side-panel.mjs +5 -5
- package/fesm2022/siemens-element-ng-side-panel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-sort-bar.mjs +3 -3
- package/fesm2022/siemens-element-ng-sort-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-split.mjs +3 -3
- package/fesm2022/siemens-element-ng-split.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-bar.mjs +3 -3
- package/fesm2022/siemens-element-ng-status-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs.mjs +33 -6
- package/fesm2022/siemens-element-ng-tabs.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-threshold.mjs +5 -5
- package/fesm2022/siemens-element-ng-threshold.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-toast-notification.mjs +3 -3
- package/fesm2022/siemens-element-ng-toast-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tooltip.mjs +180 -77
- package/fesm2022/siemens-element-ng-tooltip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tree-view.mjs +6 -6
- package/fesm2022/siemens-element-ng-tree-view.mjs.map +1 -1
- package/package.json +12 -8
- package/template-i18n.json +7 -0
- package/types/siemens-element-ng-application-header.d.ts +15 -8
- package/types/siemens-element-ng-autocomplete.d.ts +19 -19
- package/types/siemens-element-ng-carousel.d.ts +209 -0
- package/types/siemens-element-ng-chat-messages.d.ts +1 -2
- package/types/siemens-element-ng-dashboard.d.ts +4 -4
- package/types/siemens-element-ng-date-range-filter.d.ts +1 -1
- package/types/siemens-element-ng-file-uploader.d.ts +6 -8
- package/types/siemens-element-ng-form.d.ts +1 -3
- package/types/siemens-element-ng-header-dropdown.d.ts +8 -3
- package/types/siemens-element-ng-navbar.d.ts +1 -2
- package/types/siemens-element-ng-phone-number.d.ts +2 -2
- package/types/siemens-element-ng-tabs.d.ts +4 -0
- package/types/siemens-element-ng-tooltip.d.ts +10 -26
- package/types/siemens-element-ng-translate.d.ts +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-element-ng-toast-notification.mjs","sources":["../../../../projects/element-ng/toast-notification/si-toast.model.ts","../../../../projects/element-ng/toast-notification/si-toast-notification/si-toast-notification.component.ts","../../../../projects/element-ng/toast-notification/si-toast-notification/si-toast-notification.component.html","../../../../projects/element-ng/toast-notification/si-toast-token.model.ts","../../../../projects/element-ng/toast-notification/si-toast-notification-drawer/si-toast-notification-drawer.component.ts","../../../../projects/element-ng/toast-notification/si-toast-notification-drawer/si-toast-notification-drawer.component.html","../../../../projects/element-ng/toast-notification/si-toast-notification.service.ts","../../../../projects/element-ng/toast-notification/index.ts","../../../../projects/element-ng/toast-notification/siemens-element-ng-toast-notification.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { StatusType } from '@siemens/element-ng/common';\nimport { Link } from '@siemens/element-ng/link';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\nimport { Subject } from 'rxjs';\n\nexport interface SiToast {\n state: StatusType;\n title: TranslatableString;\n message: TranslatableString;\n disableManualClose?: boolean;\n disableAutoClose?: boolean;\n timeout?: number;\n action?: Link;\n close?: () => void;\n translationParams?: { [key: string]: any };\n hidden?: Subject<void>;\n closeAriaLabel?: TranslatableString;\n}\n\nexport const SI_TOAST_AUTO_HIDE_DELAY = 6000;\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Component, computed, HostListener, inject, input, output, signal } from '@angular/core';\nimport { elementCancel } from '@siemens/element-icons';\nimport {\n addIcons,\n SiIconComponent,\n SiStatusIconComponent,\n STATUS_ICON_CONFIG\n} from '@siemens/element-ng/icon';\nimport { SiLinkModule } from '@siemens/element-ng/link';\nimport { SiTranslatePipe, t } from '@siemens/element-translate-ng/translate';\n\nimport { SI_TOAST_AUTO_HIDE_DELAY, SiToast } from '../si-toast.model';\n\n@Component({\n selector: 'si-toast-notification',\n imports: [SiLinkModule, SiIconComponent, SiStatusIconComponent, SiTranslatePipe],\n templateUrl: './si-toast-notification.component.html',\n styleUrl: './si-toast-notification.component.scss'\n})\nexport class SiToastNotificationComponent {\n private readonly statusIcons = inject(STATUS_ICON_CONFIG);\n readonly toast = input.required<SiToast>();\n\n private closeAriaLabelDefault = t(() => $localize`:@@SI_TOAST.CLOSE:Close`);\n protected readonly closeAriaLabel = computed(\n () => this.toast().closeAriaLabel ?? this.closeAriaLabelDefault\n );\n protected readonly icons = addIcons({ elementCancel });\n protected readonly status = computed(() => {\n const toast = this.toast();\n return Object.keys(this.statusIcons).includes(toast.state) ? toast.state : 'info';\n });\n protected readonly statusColor = computed(() => this.statusIcons[this.status()].color);\n protected readonly toastTimeoutInSeconds = computed(() => {\n const toast = this.toast();\n return toast.timeout ? toast.timeout / 1000 : SI_TOAST_AUTO_HIDE_DELAY / 1000;\n });\n protected readonly animationMode = signal('running');\n readonly paused = output<void>();\n readonly resumed = output<void>();\n\n @HostListener('mouseenter')\n protected onMouseEnter(): void {\n if (!this.toast().disableAutoClose) {\n this.animationMode.set('paused');\n this.paused.emit();\n }\n }\n\n @HostListener('mouseleave')\n protected onMouseLeave(): void {\n if (!this.toast().disableAutoClose) {\n this.animationMode.set('running');\n this.resumed.emit();\n }\n }\n\n protected close(): void {\n this.toast().close!();\n }\n}\n","@let toastValue = toast();\n@let autoClose = !toastValue.disableAutoClose;\n@let manualClose = !toastValue.disableManualClose;\n<div class=\"si-toast elevation-2\" [class.si-toast-auto-close]=\"autoClose\">\n @if (autoClose) {\n <div\n class=\"si-toast-timer-bar\"\n [style.--play-state]=\"animationMode()\"\n [style.--toast-timer-duration.s]=\"toastTimeoutInSeconds()\"\n ></div>\n }\n <div [class]=\"`bar ${statusColor()}`\"></div>\n <si-status-icon class=\"icon\" [status]=\"status()\" />\n\n <div class=\"toast-content px-4\">\n <p class=\"toast-title\"\n ><b>{{ toastValue.title | translate: toastValue.translationParams }}</b></p\n >\n @if (toastValue.message) {\n <p class=\"mt-4\">{{ toastValue.message | translate: toastValue.translationParams }}</p>\n }\n @if (toastValue.action) {\n <p [class.mt-3]=\"toastValue.message\" [class.mt-4]=\"!toastValue.message\">\n <a [siLink]=\"toastValue.action\">{{\n toastValue.action!.title | translate: toastValue.translationParams\n }}</a>\n </p>\n }\n </div>\n @if (manualClose) {\n <button\n type=\"button\"\n class=\"btn btn-icon btn-tertiary-ghost mt-n2 me-n2\"\n [attr.aria-label]=\"closeAriaLabel() | translate\"\n (click)=\"close()\"\n >\n <si-icon [icon]=\"icons.elementCancel\" />\n </button>\n }\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { InjectionToken, Signal } from '@angular/core';\n\nimport { SiToast } from './si-toast.model';\n\nexport interface ToastToken {\n toasts: Signal<SiToast[]>;\n pause: (toast: SiToast) => void;\n resume: (toast: SiToast) => void;\n}\n\nexport const SI_TOAST_TOKEN = new InjectionToken<ToastToken>('SI_TOAST_TOKEN');\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { areAnimationsDisabled } from '@siemens/element-ng/common';\n\nimport { SiToastNotificationComponent } from '../si-toast-notification/si-toast-notification.component';\nimport { SI_TOAST_TOKEN } from '../si-toast-token.model';\n\n@Component({\n selector: 'si-toast-notification-drawer',\n imports: [SiToastNotificationComponent],\n templateUrl: './si-toast-notification-drawer.component.html',\n styleUrl: './si-toast-notification-drawer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n 'aria-live': 'polite',\n '[class.animations-disabled]': 'animationsDisabled'\n }\n})\nexport class SiToastNotificationDrawerComponent {\n protected readonly token = inject(SI_TOAST_TOKEN);\n protected animationsDisabled = areAnimationsDisabled();\n}\n","@for (toast of token.toasts(); track toast) {\n <si-toast-notification\n class=\"position-relative\"\n animate.enter=\"toast-enter\"\n animate.leave=\"toast-leave\"\n [toast]=\"toast\"\n (paused)=\"token.pause(toast)\"\n (resumed)=\"token.resume(toast)\"\n />\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n ComponentRef,\n inject,\n Injectable,\n Injector,\n OnDestroy,\n PLATFORM_ID,\n Provider,\n signal\n} from '@angular/core';\nimport { isRTL, StatusType } from '@siemens/element-ng/common';\nimport { Link } from '@siemens/element-ng/link';\nimport { SiNoTranslateService, SiTranslateService } from '@siemens/element-translate-ng/translate';\nimport { Subject } from 'rxjs';\n\nimport { SiToastNotificationDrawerComponent } from './si-toast-notification-drawer/si-toast-notification-drawer.component';\nimport { SI_TOAST_TOKEN, ToastToken } from './si-toast-token.model';\nimport { SI_TOAST_AUTO_HIDE_DELAY, SiToast } from './si-toast.model';\n\n@Injectable({ providedIn: 'root' })\nexport class SiToastNotificationService implements OnDestroy {\n private readonly activeToastsSignal = signal<SiToast[]>([]);\n\n /** List of currently active toasts to see details or close them. */\n get activeToasts(): SiToast[] {\n return this.activeToastsSignal();\n }\n\n private token: ToastToken = {\n toasts: this.activeToastsSignal,\n pause: toast => this.pauseToastNotification(toast),\n resume: toast => this.resumeToastNotification(toast)\n };\n private readonly maxToasts = 3;\n\n private componentRef?: ComponentRef<SiToastNotificationDrawerComponent>;\n private overlayRef?: OverlayRef;\n\n private injector = inject(Injector);\n private overlay = inject(Overlay);\n private toastTimeoutMap = new Map<SiToast, any>();\n private toastTimerDefaults = new Map<\n SiToast,\n { pendingTimeout: number; initializeTime: number }\n >();\n\n constructor() {\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n this.addToastDrawer();\n }\n }\n\n ngOnDestroy(): void {\n this.overlayRef?.dispose();\n this.componentRef?.destroy();\n }\n\n /**\n * Queue a new toast to be shown.\n * @param action - Passing a Link object will optionally add a clickable link to the toast which can contain an action.\n * @returns the toast object\n */\n queueToastNotification(\n state: StatusType,\n title: string,\n message: string,\n disableAutoClose?: boolean,\n disableManualClose?: boolean,\n action?: Link\n ): SiToast {\n const toast: SiToast = {\n state,\n title,\n message,\n disableAutoClose,\n disableManualClose,\n action,\n hidden: new Subject()\n };\n return this.showToastNotification(toast);\n }\n\n /**\n * Show a toast notification\n * @param toast - The toast object of the toast to be shown, can also be constructed while calling this.\n */\n showToastNotification(toast: SiToast): SiToast {\n this.overlayRef?.setDirection(isRTL() ? 'rtl' : 'ltr');\n toast.timeout ??= SI_TOAST_AUTO_HIDE_DELAY;\n toast.hidden ??= new Subject();\n toast.close = () => this.hideToastNotification(toast);\n\n const toasts = this.activeToastsSignal().concat(toast);\n this.activeToastsSignal.set(toasts);\n if (toasts.length > this.maxToasts) {\n this.hideToastNotification(toasts[0]);\n }\n if (!toast.disableAutoClose && toast.timeout) {\n this.toastTimerDefaults.set(toast, {\n pendingTimeout: toast.timeout,\n initializeTime: Date.now()\n });\n this.toastTimeoutMap.set(\n toast,\n setTimeout(() => this.hideToastNotification(toast), toast.timeout)\n );\n }\n\n return toast;\n }\n\n /**\n * Hide a toast notification\n * @param toast - The toast object of the toast to be hidden, can be retrieved from {@link activeToasts} and is returned by {@link queueToastNotification}.\n */\n hideToastNotification(toast?: SiToast): void {\n const hiddenToasts: SiToast[] = [];\n const activeToasts: SiToast[] = [];\n this.activeToastsSignal().forEach(item => {\n if (!toast || item === toast) {\n hiddenToasts.push(item);\n } else {\n activeToasts.push(item);\n }\n });\n\n this.activeToastsSignal.set(activeToasts);\n\n hiddenToasts.forEach(item => {\n item.hidden?.next();\n item.hidden?.complete();\n this.toastTimerDefaults.delete(item);\n this.toastTimeoutMap.delete(item);\n });\n }\n\n private pauseToastNotification(toast: SiToast): void {\n if (!toast.disableAutoClose) {\n clearTimeout(this.toastTimeoutMap.get(toast));\n\n const initialTimeout = this.toastTimerDefaults.get(toast)?.initializeTime;\n const elapsedTime = initialTimeout ? Date.now() - initialTimeout : 0;\n this.toastTimerDefaults.get(toast)!.pendingTimeout -= elapsedTime;\n }\n }\n\n private resumeToastNotification(toast: SiToast): void {\n if (!toast.disableAutoClose) {\n this.toastTimerDefaults.get(toast)!.initializeTime = Date.now();\n this.toastTimeoutMap.set(\n toast,\n setTimeout(() => {\n this.hideToastNotification(toast);\n }, this.toastTimerDefaults.get(toast)!.pendingTimeout)\n );\n }\n }\n\n private addToastDrawer(): void {\n this.overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().end().bottom()\n });\n const portal = new ComponentPortal(\n SiToastNotificationDrawerComponent,\n null,\n this.buildInjector()\n );\n this.componentRef = this.overlayRef.attach(portal);\n }\n\n private buildInjector(): Injector {\n const providers: Provider[] = [{ provide: SI_TOAST_TOKEN, useValue: this.token }];\n if (!this.injector.get(SiTranslateService, null)) {\n // TODO remove once translation must be defined at application start\n // Notification service is provided in 'root'. If no translation is defined, SiNoTranslateService is not provided\n providers.push({ provide: SiTranslateService, useClass: SiNoTranslateService, deps: [] });\n }\n return Injector.create({ providers, parent: this.injector });\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-toast.model';\nexport * from './si-toast-notification.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBO,MAAM,wBAAwB,GAAG;;ACvBxC;;;AAGG;MAoBU,4BAA4B,CAAA;AACtB,IAAA,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAChD,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,gDAAW;IAElC,qBAAqB,GAAG,CAAC,CAAC,MAAM,SAAS,CAAA,CAAA,uBAAA,CAAyB,CAAC;AACxD,IAAA,cAAc,GAAG,QAAQ,CAC1C,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,cAAc,IAAI,IAAI,CAAC,qBAAqB,0DAChE;AACkB,IAAA,KAAK,GAAG,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;AACnC,IAAA,MAAM,GAAG,QAAQ,CAAC,MAAK;AACxC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM;AACnF,IAAA,CAAC,kDAAC;AACiB,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,uDAAC;AACnE,IAAA,qBAAqB,GAAG,QAAQ,CAAC,MAAK;AACvD,QAAA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AAS,GAAe,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;AACjF,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE;;;AAGhD,YAAA,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC3F;AACA,QAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9D;uGA9JW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA1B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AC1BlC;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-toast-notification.mjs","sources":["../../../../projects/element-ng/toast-notification/si-toast.model.ts","../../../../projects/element-ng/toast-notification/si-toast-notification/si-toast-notification.component.ts","../../../../projects/element-ng/toast-notification/si-toast-notification/si-toast-notification.component.html","../../../../projects/element-ng/toast-notification/si-toast-token.model.ts","../../../../projects/element-ng/toast-notification/si-toast-notification-drawer/si-toast-notification-drawer.component.ts","../../../../projects/element-ng/toast-notification/si-toast-notification-drawer/si-toast-notification-drawer.component.html","../../../../projects/element-ng/toast-notification/si-toast-notification.service.ts","../../../../projects/element-ng/toast-notification/index.ts","../../../../projects/element-ng/toast-notification/siemens-element-ng-toast-notification.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { StatusType } from '@siemens/element-ng/common';\nimport { Link } from '@siemens/element-ng/link';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\nimport { Subject } from 'rxjs';\n\nexport interface SiToast {\n state: StatusType;\n title: TranslatableString;\n message: TranslatableString;\n disableManualClose?: boolean;\n disableAutoClose?: boolean;\n timeout?: number;\n action?: Link;\n close?: () => void;\n translationParams?: { [key: string]: any };\n hidden?: Subject<void>;\n closeAriaLabel?: TranslatableString;\n}\n\nexport const SI_TOAST_AUTO_HIDE_DELAY = 6000;\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n HostListener,\n inject,\n input,\n output,\n signal\n} from '@angular/core';\nimport { elementCancel } from '@siemens/element-icons';\nimport {\n addIcons,\n SiIconComponent,\n SiStatusIconComponent,\n STATUS_ICON_CONFIG\n} from '@siemens/element-ng/icon';\nimport { SiLinkModule } from '@siemens/element-ng/link';\nimport { SiTranslatePipe, t } from '@siemens/element-translate-ng/translate';\n\nimport { SI_TOAST_AUTO_HIDE_DELAY, SiToast } from '../si-toast.model';\n\n@Component({\n selector: 'si-toast-notification',\n imports: [SiLinkModule, SiIconComponent, SiStatusIconComponent, SiTranslatePipe],\n templateUrl: './si-toast-notification.component.html',\n styleUrl: './si-toast-notification.component.scss',\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class SiToastNotificationComponent {\n private readonly statusIcons = inject(STATUS_ICON_CONFIG);\n readonly toast = input.required<SiToast>();\n\n private closeAriaLabelDefault = t(() => $localize`:@@SI_TOAST.CLOSE:Close`);\n protected readonly closeAriaLabel = computed(\n () => this.toast().closeAriaLabel ?? this.closeAriaLabelDefault\n );\n protected readonly icons = addIcons({ elementCancel });\n protected readonly status = computed(() => {\n const toast = this.toast();\n return Object.keys(this.statusIcons).includes(toast.state) ? toast.state : 'info';\n });\n protected readonly statusColor = computed(() => this.statusIcons[this.status()].color);\n protected readonly toastTimeoutInSeconds = computed(() => {\n const toast = this.toast();\n return toast.timeout ? toast.timeout / 1000 : SI_TOAST_AUTO_HIDE_DELAY / 1000;\n });\n protected readonly animationMode = signal('running');\n readonly paused = output<void>();\n readonly resumed = output<void>();\n\n @HostListener('mouseenter')\n protected onMouseEnter(): void {\n if (!this.toast().disableAutoClose) {\n this.animationMode.set('paused');\n this.paused.emit();\n }\n }\n\n @HostListener('mouseleave')\n protected onMouseLeave(): void {\n if (!this.toast().disableAutoClose) {\n this.animationMode.set('running');\n this.resumed.emit();\n }\n }\n\n protected close(): void {\n this.toast().close!();\n }\n}\n","@let toastValue = toast();\n@let autoClose = !toastValue.disableAutoClose;\n@let manualClose = !toastValue.disableManualClose;\n<div class=\"si-toast elevation-2\" [class.si-toast-auto-close]=\"autoClose\">\n @if (autoClose) {\n <div\n class=\"si-toast-timer-bar\"\n [style.--play-state]=\"animationMode()\"\n [style.--toast-timer-duration.s]=\"toastTimeoutInSeconds()\"\n ></div>\n }\n <div [class]=\"`bar ${statusColor()}`\"></div>\n <si-status-icon class=\"icon\" [status]=\"status()\" />\n\n <div class=\"toast-content px-4\">\n <p class=\"toast-title\"\n ><b>{{ toastValue.title | translate: toastValue.translationParams }}</b></p\n >\n @if (toastValue.message) {\n <p class=\"mt-4\">{{ toastValue.message | translate: toastValue.translationParams }}</p>\n }\n @if (toastValue.action) {\n <p [class.mt-3]=\"toastValue.message\" [class.mt-4]=\"!toastValue.message\">\n <a [siLink]=\"toastValue.action\">{{\n toastValue.action!.title | translate: toastValue.translationParams\n }}</a>\n </p>\n }\n </div>\n @if (manualClose) {\n <button\n type=\"button\"\n class=\"btn btn-icon btn-tertiary-ghost mt-n2 me-n2\"\n [attr.aria-label]=\"closeAriaLabel() | translate\"\n (click)=\"close()\"\n >\n <si-icon [icon]=\"icons.elementCancel\" />\n </button>\n }\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { InjectionToken, Signal } from '@angular/core';\n\nimport { SiToast } from './si-toast.model';\n\nexport interface ToastToken {\n toasts: Signal<SiToast[]>;\n pause: (toast: SiToast) => void;\n resume: (toast: SiToast) => void;\n}\n\nexport const SI_TOAST_TOKEN = new InjectionToken<ToastToken>('SI_TOAST_TOKEN');\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { areAnimationsDisabled } from '@siemens/element-ng/common';\n\nimport { SiToastNotificationComponent } from '../si-toast-notification/si-toast-notification.component';\nimport { SI_TOAST_TOKEN } from '../si-toast-token.model';\n\n@Component({\n selector: 'si-toast-notification-drawer',\n imports: [SiToastNotificationComponent],\n templateUrl: './si-toast-notification-drawer.component.html',\n styleUrl: './si-toast-notification-drawer.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n 'aria-live': 'polite',\n '[class.animations-disabled]': 'animationsDisabled'\n }\n})\nexport class SiToastNotificationDrawerComponent {\n protected readonly token = inject(SI_TOAST_TOKEN);\n protected animationsDisabled = areAnimationsDisabled();\n}\n","@for (toast of token.toasts(); track toast) {\n <si-toast-notification\n class=\"position-relative\"\n animate.enter=\"toast-enter\"\n animate.leave=\"toast-leave\"\n [toast]=\"toast\"\n (paused)=\"token.pause(toast)\"\n (resumed)=\"token.resume(toast)\"\n />\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n ComponentRef,\n inject,\n Injectable,\n Injector,\n OnDestroy,\n PLATFORM_ID,\n Provider,\n signal\n} from '@angular/core';\nimport { isRTL, StatusType } from '@siemens/element-ng/common';\nimport { Link } from '@siemens/element-ng/link';\nimport { SiNoTranslateService, SiTranslateService } from '@siemens/element-translate-ng/translate';\nimport { Subject } from 'rxjs';\n\nimport { SiToastNotificationDrawerComponent } from './si-toast-notification-drawer/si-toast-notification-drawer.component';\nimport { SI_TOAST_TOKEN, ToastToken } from './si-toast-token.model';\nimport { SI_TOAST_AUTO_HIDE_DELAY, SiToast } from './si-toast.model';\n\n@Injectable({ providedIn: 'root' })\nexport class SiToastNotificationService implements OnDestroy {\n private readonly activeToastsSignal = signal<SiToast[]>([]);\n\n /** List of currently active toasts to see details or close them. */\n get activeToasts(): SiToast[] {\n return this.activeToastsSignal();\n }\n\n private token: ToastToken = {\n toasts: this.activeToastsSignal,\n pause: toast => this.pauseToastNotification(toast),\n resume: toast => this.resumeToastNotification(toast)\n };\n private readonly maxToasts = 3;\n\n private componentRef?: ComponentRef<SiToastNotificationDrawerComponent>;\n private overlayRef?: OverlayRef;\n\n private injector = inject(Injector);\n private overlay = inject(Overlay);\n private toastTimeoutMap = new Map<SiToast, any>();\n private toastTimerDefaults = new Map<\n SiToast,\n { pendingTimeout: number; initializeTime: number }\n >();\n\n constructor() {\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n this.addToastDrawer();\n }\n }\n\n ngOnDestroy(): void {\n this.overlayRef?.dispose();\n this.componentRef?.destroy();\n }\n\n /**\n * Queue a new toast to be shown.\n * @param action - Passing a Link object will optionally add a clickable link to the toast which can contain an action.\n * @returns the toast object\n */\n queueToastNotification(\n state: StatusType,\n title: string,\n message: string,\n disableAutoClose?: boolean,\n disableManualClose?: boolean,\n action?: Link\n ): SiToast {\n const toast: SiToast = {\n state,\n title,\n message,\n disableAutoClose,\n disableManualClose,\n action,\n hidden: new Subject()\n };\n return this.showToastNotification(toast);\n }\n\n /**\n * Show a toast notification\n * @param toast - The toast object of the toast to be shown, can also be constructed while calling this.\n */\n showToastNotification(toast: SiToast): SiToast {\n this.overlayRef?.setDirection(isRTL() ? 'rtl' : 'ltr');\n toast.timeout ??= SI_TOAST_AUTO_HIDE_DELAY;\n toast.hidden ??= new Subject();\n toast.close = () => this.hideToastNotification(toast);\n\n const toasts = this.activeToastsSignal().concat(toast);\n this.activeToastsSignal.set(toasts);\n if (toasts.length > this.maxToasts) {\n this.hideToastNotification(toasts[0]);\n }\n if (!toast.disableAutoClose && toast.timeout) {\n this.toastTimerDefaults.set(toast, {\n pendingTimeout: toast.timeout,\n initializeTime: Date.now()\n });\n this.toastTimeoutMap.set(\n toast,\n setTimeout(() => this.hideToastNotification(toast), toast.timeout)\n );\n }\n\n return toast;\n }\n\n /**\n * Hide a toast notification\n * @param toast - The toast object of the toast to be hidden, can be retrieved from {@link activeToasts} and is returned by {@link queueToastNotification}.\n */\n hideToastNotification(toast?: SiToast): void {\n const hiddenToasts: SiToast[] = [];\n const activeToasts: SiToast[] = [];\n this.activeToastsSignal().forEach(item => {\n if (!toast || item === toast) {\n hiddenToasts.push(item);\n } else {\n activeToasts.push(item);\n }\n });\n\n this.activeToastsSignal.set(activeToasts);\n\n hiddenToasts.forEach(item => {\n item.hidden?.next();\n item.hidden?.complete();\n this.toastTimerDefaults.delete(item);\n this.toastTimeoutMap.delete(item);\n });\n }\n\n private pauseToastNotification(toast: SiToast): void {\n if (!toast.disableAutoClose) {\n clearTimeout(this.toastTimeoutMap.get(toast));\n\n const initialTimeout = this.toastTimerDefaults.get(toast)?.initializeTime;\n const elapsedTime = initialTimeout ? Date.now() - initialTimeout : 0;\n this.toastTimerDefaults.get(toast)!.pendingTimeout -= elapsedTime;\n }\n }\n\n private resumeToastNotification(toast: SiToast): void {\n if (!toast.disableAutoClose) {\n this.toastTimerDefaults.get(toast)!.initializeTime = Date.now();\n this.toastTimeoutMap.set(\n toast,\n setTimeout(() => {\n this.hideToastNotification(toast);\n }, this.toastTimerDefaults.get(toast)!.pendingTimeout)\n );\n }\n }\n\n private addToastDrawer(): void {\n this.overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().end().bottom()\n });\n const portal = new ComponentPortal(\n SiToastNotificationDrawerComponent,\n null,\n this.buildInjector()\n );\n this.componentRef = this.overlayRef.attach(portal);\n }\n\n private buildInjector(): Injector {\n const providers: Provider[] = [{ provide: SI_TOAST_TOKEN, useValue: this.token }];\n if (!this.injector.get(SiTranslateService, null)) {\n // TODO remove once translation must be defined at application start\n // Notification service is provided in 'root'. If no translation is defined, SiNoTranslateService is not provided\n providers.push({ provide: SiTranslateService, useClass: SiNoTranslateService, deps: [] });\n }\n return Injector.create({ providers, parent: this.injector });\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-toast.model';\nexport * from './si-toast-notification.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBO,MAAM,wBAAwB,GAAG;;ACvBxC;;;AAGG;MA8BU,4BAA4B,CAAA;AACtB,IAAA,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAChD,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,gDAAW;IAElC,qBAAqB,GAAG,CAAC,CAAC,MAAM,SAAS,CAAA,CAAA,uBAAA,CAAyB,CAAC;AACxD,IAAA,cAAc,GAAG,QAAQ,CAC1C,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,cAAc,IAAI,IAAI,CAAC,qBAAqB,0DAChE;AACkB,IAAA,KAAK,GAAG,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;AACnC,IAAA,MAAM,GAAG,QAAQ,CAAC,MAAK;AACxC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM;AACnF,IAAA,CAAC,kDAAC;AACiB,IAAA,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI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,CAAC,MAAM;AAChE,SAAA,CAAC;AACF,QAAA,MAAM,MAAM,GAAG,IAAI,eAAe,CAChC,kCAAkC,EAClC,IAAI,EACJ,IAAI,CAAC,aAAa,EAAE,CACrB;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;IACpD;IAEQ,aAAa,GAAA;AACnB,QAAA,MAAM,SAAS,GAAe,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;AACjF,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE;;;AAGhD,YAAA,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC3F;AACA,QAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9D;uGA9JW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA1B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AC1BlC;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, signal, inject, ElementRef, computed, TemplateRef, Component, Injector, Injectable, input, booleanAttribute,
|
|
3
|
-
import {
|
|
4
|
-
import { Overlay } from '@angular/cdk/overlay';
|
|
2
|
+
import { InjectionToken, signal, inject, ElementRef, afterRenderEffect, computed, TemplateRef, ChangeDetectionStrategy, Component, Injector, PLATFORM_ID, Injectable, input, booleanAttribute, effect, Directive, NgModule } from '@angular/core';
|
|
3
|
+
import { OverlayRef, Overlay } from '@angular/cdk/overlay';
|
|
5
4
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
6
|
-
import {
|
|
5
|
+
import { NgTemplateOutlet, NgComponentOutlet, isPlatformBrowser } from '@angular/common';
|
|
6
|
+
import { calculateOverlayArrowPosition, getOverlay, getPositionStrategy } from '@siemens/element-ng/common';
|
|
7
|
+
import { Subject, fromEvent, timer } from 'rxjs';
|
|
8
|
+
import { filter, takeUntil, delayWhen } from 'rxjs/operators';
|
|
7
9
|
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -12,14 +14,45 @@ import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
|
|
|
12
14
|
*/
|
|
13
15
|
const SI_TOOLTIP_CONFIG = new InjectionToken('SiTooltipConfig');
|
|
14
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Copyright (c) Siemens 2016 - 2026
|
|
19
|
+
* SPDX-License-Identifier: MIT
|
|
20
|
+
*/
|
|
15
21
|
class TooltipComponent {
|
|
16
22
|
tooltipPositionClass = signal('', ...(ngDevMode ? [{ debugName: "tooltipPositionClass" }] : []));
|
|
17
23
|
arrowPos = signal(undefined, ...(ngDevMode ? [{ debugName: "arrowPos" }] : []));
|
|
18
24
|
config = inject(SI_TOOLTIP_CONFIG);
|
|
19
25
|
elementRef = inject(ElementRef);
|
|
26
|
+
overlayRef = inject(OverlayRef);
|
|
27
|
+
lastPositionChange;
|
|
28
|
+
lastAnchor;
|
|
29
|
+
constructor() {
|
|
30
|
+
let isFirstRun = true;
|
|
31
|
+
afterRenderEffect(() => {
|
|
32
|
+
this.config.tooltip();
|
|
33
|
+
this.config.tooltipContext();
|
|
34
|
+
if (isFirstRun) {
|
|
35
|
+
isFirstRun = false;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.overlayRef.updatePosition();
|
|
39
|
+
if (this.lastPositionChange) {
|
|
40
|
+
this.updateTooltipPosition(this.lastPositionChange, this.lastAnchor);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
20
44
|
tooltipText = computed(() => {
|
|
21
45
|
const tooltip = this.config.tooltip();
|
|
22
|
-
|
|
46
|
+
if (typeof tooltip === 'string') {
|
|
47
|
+
return tooltip;
|
|
48
|
+
}
|
|
49
|
+
// When an ElementRef is provided, read its current text content whenever the
|
|
50
|
+
// tooltip is shown, so dynamic content is always reflected.
|
|
51
|
+
// The tooltip content is not updated while being displayed.
|
|
52
|
+
if (tooltip instanceof ElementRef) {
|
|
53
|
+
return tooltip.nativeElement.textContent.trim();
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
23
56
|
}, ...(ngDevMode ? [{ debugName: "tooltipText" }] : []));
|
|
24
57
|
tooltipTemplate = computed(() => {
|
|
25
58
|
const tooltip = this.config.tooltip();
|
|
@@ -27,10 +60,16 @@ class TooltipComponent {
|
|
|
27
60
|
}, ...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : []));
|
|
28
61
|
tooltipComponent = computed(() => {
|
|
29
62
|
const tooltip = this.config.tooltip();
|
|
30
|
-
return !(tooltip instanceof TemplateRef) &&
|
|
63
|
+
return !(tooltip instanceof TemplateRef) &&
|
|
64
|
+
!(tooltip instanceof ElementRef) &&
|
|
65
|
+
typeof tooltip !== 'string'
|
|
66
|
+
? tooltip
|
|
67
|
+
: null;
|
|
31
68
|
}, ...(ngDevMode ? [{ debugName: "tooltipComponent" }] : []));
|
|
32
69
|
/** @internal */
|
|
33
70
|
updateTooltipPosition(change, anchor) {
|
|
71
|
+
this.lastPositionChange = change;
|
|
72
|
+
this.lastAnchor = anchor;
|
|
34
73
|
const arrowClassTooltip = `tooltip-${change.connectionPair.overlayX}-${change.connectionPair.overlayY}`;
|
|
35
74
|
// need two updates as class changes affect the position
|
|
36
75
|
if (arrowClassTooltip !== this.tooltipPositionClass()) {
|
|
@@ -40,52 +79,133 @@ class TooltipComponent {
|
|
|
40
79
|
this.arrowPos.set(arrowPos);
|
|
41
80
|
}
|
|
42
81
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: TooltipComponent, isStandalone: true, selector: "si-tooltip", host: { attributes: { "animate.leave": "tooltip-leave" } }, ngImport: i0, template: "<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"config.id\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"config.tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n", styles: [":host .tooltip,:host{transition:opacity calc(.15s * var(--element-animations-enabled, 1)) ease-out,transform calc(.15s * var(--element-animations-enabled, 1)) ease-out}:host{opacity:1;transform:scale(1)}:host.tooltip-leave{opacity:0;transform:scale(.8)}@starting-style{:host .tooltip{opacity:0;transform:scale(.8)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
82
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.8", type: TooltipComponent, isStandalone: true, selector: "si-tooltip", host: { attributes: { "animate.leave": "tooltip-leave" } }, ngImport: i0, template: "<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"config.id\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"config.tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n", styles: [":host .tooltip,:host{transition:opacity calc(.15s * var(--element-animations-enabled, 1)) ease-out,transform calc(.15s * var(--element-animations-enabled, 1)) ease-out}:host{opacity:1;transform:scale(1)}:host.tooltip-leave{opacity:0;transform:scale(.8)}@starting-style{:host .tooltip{opacity:0;transform:scale(.8)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
44
83
|
}
|
|
45
84
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
46
85
|
type: Component,
|
|
47
|
-
args: [{ selector: 'si-tooltip', imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet], host: {
|
|
86
|
+
args: [{ selector: 'si-tooltip', imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet], changeDetection: ChangeDetectionStrategy.Default, host: {
|
|
48
87
|
'animate.leave': 'tooltip-leave'
|
|
49
88
|
}, template: "<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"config.id\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"config.tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n", styles: [":host .tooltip,:host{transition:opacity calc(.15s * var(--element-animations-enabled, 1)) ease-out,transform calc(.15s * var(--element-animations-enabled, 1)) ease-out}:host{opacity:1;transform:scale(1)}:host.tooltip-leave{opacity:0;transform:scale(.8)}@starting-style{:host .tooltip{opacity:0;transform:scale(.8)}}\n"] }]
|
|
50
|
-
}] });
|
|
89
|
+
}], ctorParameters: () => [] });
|
|
51
90
|
|
|
52
91
|
/**
|
|
53
92
|
* Copyright (c) Siemens 2016 - 2026
|
|
54
93
|
* SPDX-License-Identifier: MIT
|
|
55
94
|
*/
|
|
56
95
|
/**
|
|
57
|
-
* TooltipRef
|
|
96
|
+
* A no-op TooltipRef used on platform server where DOM APIs are unavailable.
|
|
97
|
+
*
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
class NoopTooltipRef {
|
|
101
|
+
destroy() { }
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* BrowserTooltipRef is attached to a specific element.
|
|
58
105
|
* Use it to show or hide a tooltip for that element.
|
|
59
106
|
*
|
|
60
107
|
* @internal
|
|
61
108
|
*/
|
|
62
|
-
class
|
|
109
|
+
class BrowserTooltipRef {
|
|
110
|
+
config;
|
|
111
|
+
destroy$ = new Subject();
|
|
112
|
+
isFocused = false;
|
|
113
|
+
isHovered = false;
|
|
63
114
|
overlayRef;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
115
|
+
positionSubscription;
|
|
116
|
+
constructor(config) {
|
|
117
|
+
this.config = config;
|
|
118
|
+
const nativeElement = this.config.element.nativeElement;
|
|
119
|
+
fromEvent(nativeElement, 'focus')
|
|
120
|
+
.pipe(filter(event => event instanceof FocusEvent), takeUntil(this.destroy$))
|
|
121
|
+
.subscribe(event => this.onFocus(event));
|
|
122
|
+
fromEvent(nativeElement, 'mouseenter')
|
|
123
|
+
.pipe(delayWhen(() =>
|
|
124
|
+
// UX Guideline: tooltips on hover should be delayed by 500ms
|
|
125
|
+
timer(500).pipe(takeUntil(fromEvent(nativeElement, 'mouseleave')), takeUntil(fromEvent(nativeElement, 'focusout')) // user started using keyboard
|
|
126
|
+
)), takeUntil(this.destroy$))
|
|
127
|
+
.subscribe(() => this.onMouseEnter());
|
|
128
|
+
fromEvent(nativeElement, 'focusout')
|
|
129
|
+
.pipe(takeUntil(this.destroy$))
|
|
130
|
+
.subscribe(() => this.onFocusOut());
|
|
131
|
+
fromEvent(nativeElement, 'mouseleave')
|
|
132
|
+
.pipe(takeUntil(this.destroy$))
|
|
133
|
+
.subscribe(() => this.onMouseLeave());
|
|
134
|
+
fromEvent(nativeElement, 'touchstart')
|
|
135
|
+
.pipe(takeUntil(this.destroy$))
|
|
136
|
+
.subscribe(() => this.onTouchStart());
|
|
137
|
+
// The tooltip may be created lazily, after the element is already focused or
|
|
138
|
+
// hovered (e.g. when validation errors appear on blur while the pointer still
|
|
139
|
+
// hovers the element). In that case the initial `focus`/`mouseenter` was
|
|
140
|
+
// missed, so show the tooltip immediately based on the live `:focus-visible`
|
|
141
|
+
// and `:hover` state.
|
|
142
|
+
if (nativeElement === document.activeElement && nativeElement.matches(':focus-visible')) {
|
|
143
|
+
this.isFocused = true;
|
|
144
|
+
this.show();
|
|
145
|
+
}
|
|
146
|
+
else if (nativeElement.matches(':hover')) {
|
|
147
|
+
this.onMouseEnter();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
onFocus(event) {
|
|
151
|
+
if (event.target instanceof Element) {
|
|
152
|
+
if (event.target.matches(':focus-visible')) {
|
|
153
|
+
this.isFocused = true;
|
|
154
|
+
this.show();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
onFocusOut() {
|
|
159
|
+
this.isFocused = false;
|
|
160
|
+
this.isHovered = false;
|
|
161
|
+
this.hide();
|
|
162
|
+
}
|
|
163
|
+
onMouseEnter() {
|
|
164
|
+
this.isHovered = true;
|
|
165
|
+
this.show();
|
|
166
|
+
}
|
|
167
|
+
onMouseLeave() {
|
|
168
|
+
this.isHovered = false;
|
|
169
|
+
this.hide();
|
|
170
|
+
}
|
|
171
|
+
onTouchStart() {
|
|
172
|
+
// On touch devices a tooltip is not useful and would obscure the content the
|
|
173
|
+
// user just tapped. Reset the hover/focus state so it is hidden immediately.
|
|
174
|
+
this.isFocused = false;
|
|
175
|
+
this.isHovered = false;
|
|
176
|
+
this.hide();
|
|
177
|
+
}
|
|
178
|
+
getOrCreateOverlay() {
|
|
179
|
+
this.overlayRef ??= getOverlay(this.config.element, this.config.overlay, false, this.config.placement, false, true, this.config.scrollStrategy?.());
|
|
180
|
+
return this.overlayRef;
|
|
70
181
|
}
|
|
71
|
-
subscription;
|
|
72
182
|
show() {
|
|
73
|
-
|
|
183
|
+
const overlayRef = this.getOrCreateOverlay();
|
|
184
|
+
if (overlayRef.hasAttached()) {
|
|
74
185
|
return;
|
|
75
186
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
187
|
+
const injector = Injector.create({
|
|
188
|
+
parent: this.config.injector,
|
|
189
|
+
providers: [{ provide: OverlayRef, useValue: overlayRef }]
|
|
190
|
+
});
|
|
191
|
+
const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, injector);
|
|
192
|
+
const tooltipRef = overlayRef.attach(toolTipPortal);
|
|
193
|
+
const positionStrategy = getPositionStrategy(overlayRef);
|
|
194
|
+
this.positionSubscription?.unsubscribe();
|
|
195
|
+
this.positionSubscription = positionStrategy?.positionChanges.subscribe(change => tooltipRef.instance.updateTooltipPosition(change, this.config.element));
|
|
81
196
|
}
|
|
82
197
|
hide() {
|
|
83
|
-
this.
|
|
84
|
-
|
|
198
|
+
if (this.isFocused || this.isHovered) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
this.overlayRef?.detach();
|
|
202
|
+
this.positionSubscription?.unsubscribe();
|
|
85
203
|
}
|
|
86
204
|
destroy() {
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
205
|
+
this.destroy$.next();
|
|
206
|
+
this.destroy$.complete();
|
|
207
|
+
this.overlayRef?.dispose();
|
|
208
|
+
this.positionSubscription?.unsubscribe();
|
|
89
209
|
}
|
|
90
210
|
}
|
|
91
211
|
/**
|
|
@@ -98,7 +218,11 @@ class TooltipRef {
|
|
|
98
218
|
// We cannot provide this in root, as people may override the cdk overlay creation.
|
|
99
219
|
class SiTooltipService {
|
|
100
220
|
overlay = inject(Overlay);
|
|
221
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
101
222
|
createTooltip(config) {
|
|
223
|
+
if (!this.isBrowser) {
|
|
224
|
+
return new NoopTooltipRef();
|
|
225
|
+
}
|
|
102
226
|
const injector = Injector.create({
|
|
103
227
|
parent: config.injector,
|
|
104
228
|
providers: [
|
|
@@ -112,7 +236,11 @@ class SiTooltipService {
|
|
|
112
236
|
}
|
|
113
237
|
]
|
|
114
238
|
});
|
|
115
|
-
return new
|
|
239
|
+
return new BrowserTooltipRef({
|
|
240
|
+
...config,
|
|
241
|
+
injector,
|
|
242
|
+
overlay: this.overlay
|
|
243
|
+
});
|
|
116
244
|
}
|
|
117
245
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiTooltipService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
118
246
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiTooltipService });
|
|
@@ -152,53 +280,33 @@ class SiTooltipDirective {
|
|
|
152
280
|
tooltipContext = input(...(ngDevMode ? [undefined, { debugName: "tooltipContext" }] : []));
|
|
153
281
|
describedBy = `__tooltip_${SiTooltipDirective.idCounter++}`;
|
|
154
282
|
tooltipRef;
|
|
155
|
-
showTimeout;
|
|
156
283
|
tooltipService = inject(SiTooltipService);
|
|
157
284
|
elementRef = inject(ElementRef);
|
|
158
|
-
|
|
285
|
+
constructor() {
|
|
286
|
+
effect(() => {
|
|
287
|
+
const tooltip = this.siTooltip();
|
|
288
|
+
const disabled = this.isDisabled();
|
|
289
|
+
if (tooltip && !disabled) {
|
|
290
|
+
this.tooltipRef ??= this.tooltipService.createTooltip({
|
|
291
|
+
describedBy: this.describedBy,
|
|
292
|
+
element: this.elementRef,
|
|
293
|
+
placement: this.placement(),
|
|
294
|
+
tooltip: this.siTooltip,
|
|
295
|
+
tooltipContext: this.tooltipContext,
|
|
296
|
+
scrollStrategy: this.tooltipScrollStrategy
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
else if (this.tooltipRef) {
|
|
300
|
+
this.tooltipRef.destroy();
|
|
301
|
+
this.tooltipRef = undefined;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
159
305
|
ngOnDestroy() {
|
|
160
|
-
this.clearShowTimeout();
|
|
161
306
|
this.tooltipRef?.destroy();
|
|
162
307
|
}
|
|
163
|
-
clearShowTimeout() {
|
|
164
|
-
if (this.showTimeout) {
|
|
165
|
-
clearTimeout(this.showTimeout);
|
|
166
|
-
this.showTimeout = undefined;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
showTooltip(immediate = false) {
|
|
170
|
-
const siTooltip = this.siTooltip();
|
|
171
|
-
if (this.isDisabled() || !siTooltip) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
this.clearShowTimeout();
|
|
175
|
-
const delay = immediate ? 0 : 500;
|
|
176
|
-
this.showTimeout = setTimeout(() => {
|
|
177
|
-
this.tooltipRef ??= this.tooltipService.createTooltip({
|
|
178
|
-
describedBy: this.describedBy,
|
|
179
|
-
element: this.elementRef,
|
|
180
|
-
placement: this.placement(),
|
|
181
|
-
tooltip: this.siTooltip,
|
|
182
|
-
tooltipContext: this.tooltipContext,
|
|
183
|
-
scrollStrategy: this.tooltipScrollStrategy()
|
|
184
|
-
});
|
|
185
|
-
this.tooltipRef.show();
|
|
186
|
-
}, delay);
|
|
187
|
-
}
|
|
188
|
-
focusIn(event) {
|
|
189
|
-
if (this.isBrowser && event.target.matches(':focus-visible')) {
|
|
190
|
-
this.showTooltip(true);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
show() {
|
|
194
|
-
this.showTooltip(false);
|
|
195
|
-
}
|
|
196
|
-
hide() {
|
|
197
|
-
this.clearShowTimeout();
|
|
198
|
-
this.tooltipRef?.hide();
|
|
199
|
-
}
|
|
200
308
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
201
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: SiTooltipDirective, isStandalone: true, selector: "[siTooltip]", inputs: { siTooltip: { classPropertyName: "siTooltip", publicName: "siTooltip", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipScrollStrategy: { classPropertyName: "tooltipScrollStrategy", publicName: "tooltipScrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, tooltipContext: { classPropertyName: "tooltipContext", publicName: "tooltipContext", isSignal: true, isRequired: false, transformFunction: null } }, host: {
|
|
309
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: SiTooltipDirective, isStandalone: true, selector: "[siTooltip]", inputs: { siTooltip: { classPropertyName: "siTooltip", publicName: "siTooltip", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipScrollStrategy: { classPropertyName: "tooltipScrollStrategy", publicName: "tooltipScrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, tooltipContext: { classPropertyName: "tooltipContext", publicName: "tooltipContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-describedby": "isDisabled() ? null : describedBy" } }, providers: [SiTooltipService], ngImport: i0 });
|
|
202
310
|
}
|
|
203
311
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiTooltipDirective, decorators: [{
|
|
204
312
|
type: Directive,
|
|
@@ -206,15 +314,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
206
314
|
selector: '[siTooltip]',
|
|
207
315
|
providers: [SiTooltipService],
|
|
208
316
|
host: {
|
|
209
|
-
'[attr.aria-describedby]': 'isDisabled() ? null : describedBy'
|
|
210
|
-
'(focus)': 'focusIn($event)',
|
|
211
|
-
'(mouseenter)': 'show()',
|
|
212
|
-
'(touchstart)': 'hide()',
|
|
213
|
-
'(focusout)': 'hide()',
|
|
214
|
-
'(mouseleave)': 'hide()'
|
|
317
|
+
'[attr.aria-describedby]': 'isDisabled() ? null : describedBy'
|
|
215
318
|
}
|
|
216
319
|
}]
|
|
217
|
-
}], propDecorators: { siTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "siTooltip", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], tooltipScrollStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipScrollStrategy", required: false }] }], tooltipContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipContext", required: false }] }] } });
|
|
320
|
+
}], ctorParameters: () => [], propDecorators: { siTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "siTooltip", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], tooltipScrollStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipScrollStrategy", required: false }] }], tooltipContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipContext", required: false }] }] } });
|
|
218
321
|
|
|
219
322
|
/**
|
|
220
323
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-element-ng-tooltip.mjs","sources":["../../../../projects/element-ng/tooltip/si-tooltip.model.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.html","../../../../projects/element-ng/tooltip/si-tooltip.service.ts","../../../../projects/element-ng/tooltip/si-tooltip.directive.ts","../../../../projects/element-ng/tooltip/si-tooltip.module.ts","../../../../projects/element-ng/tooltip/index.ts","../../../../projects/element-ng/tooltip/siemens-element-ng-tooltip.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { InjectionToken, TemplateRef, Type } from '@angular/core';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nexport type SiTooltipContent = TranslatableString | TemplateRef<any> | Type<any> | null | undefined;\n\nexport interface SiTooltipConfig {\n id: string;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n}\n\nexport const SI_TOOLTIP_CONFIG = new InjectionToken<SiTooltipConfig>('SiTooltipConfig');\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ConnectedOverlayPositionChange } from '@angular/cdk/overlay';\nimport { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, ElementRef, inject, signal, TemplateRef } from '@angular/core';\nimport { calculateOverlayArrowPosition, OverlayArrowPosition } from '@siemens/element-ng/common';\nimport { SiTranslatePipe } from '@siemens/element-translate-ng/translate';\n\nimport { SI_TOOLTIP_CONFIG } from './si-tooltip.model';\n\n@Component({\n selector: 'si-tooltip',\n imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet],\n templateUrl: './si-tooltip.component.html',\n styleUrl: './si-tooltip.component.scss',\n host: {\n 'animate.leave': 'tooltip-leave'\n }\n})\nexport class TooltipComponent {\n protected readonly tooltipPositionClass = signal('');\n protected readonly arrowPos = signal<OverlayArrowPosition | undefined>(undefined);\n\n protected readonly config = inject(SI_TOOLTIP_CONFIG);\n private readonly elementRef = inject(ElementRef);\n\n protected readonly tooltipText = computed<string | null>(() => {\n const tooltip = this.config.tooltip();\n return typeof tooltip === 'string' ? tooltip : null;\n });\n\n protected readonly tooltipTemplate = computed<TemplateRef<any> | null>(() => {\n const tooltip = this.config.tooltip();\n return tooltip instanceof TemplateRef ? tooltip : null;\n });\n\n protected readonly tooltipComponent = computed(() => {\n const tooltip = this.config.tooltip();\n return !(tooltip instanceof TemplateRef) && typeof tooltip !== 'string' ? tooltip : null;\n });\n\n /** @internal */\n updateTooltipPosition(change: ConnectedOverlayPositionChange, anchor?: ElementRef): void {\n const arrowClassTooltip = `tooltip-${change.connectionPair.overlayX}-${change.connectionPair.overlayY}`;\n // need two updates as class changes affect the position\n if (arrowClassTooltip !== this.tooltipPositionClass()) {\n this.tooltipPositionClass.set(arrowClassTooltip);\n }\n const arrowPos = calculateOverlayArrowPosition(change, this.elementRef, anchor);\n this.arrowPos.set(arrowPos);\n }\n}\n","<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"config.id\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"config.tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { ComponentRef, ElementRef, inject, Injectable, Injector } from '@angular/core';\nimport { getOverlay, getPositionStrategy, positions } from '@siemens/element-ng/common';\nimport { Subscription } from 'rxjs';\n\nimport { TooltipComponent } from './si-tooltip.component';\nimport { SI_TOOLTIP_CONFIG, SiTooltipContent } from './si-tooltip.model';\n\n/**\n * TooltipRef is attached to a specific element.\n * Use it to show or hide a tooltip for that element.\n *\n * @internal\n */\nclass TooltipRef {\n constructor(\n private overlayRef: OverlayRef,\n private element: ElementRef,\n private injector?: Injector\n ) {}\n\n private subscription?: Subscription;\n\n show(): void {\n if (this.overlayRef.hasAttached()) {\n return;\n }\n\n const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, this.injector);\n const tooltipRef: ComponentRef<TooltipComponent> = this.overlayRef.attach(toolTipPortal);\n\n const positionStrategy = getPositionStrategy(this.overlayRef);\n this.subscription?.unsubscribe();\n this.subscription = positionStrategy?.positionChanges.subscribe(change =>\n tooltipRef.instance.updateTooltipPosition(change, this.element)\n );\n }\n\n hide(): void {\n this.overlayRef.detach();\n this.subscription?.unsubscribe();\n }\n\n destroy(): void {\n this.overlayRef.dispose();\n this.subscription?.unsubscribe();\n }\n}\n\n/**\n * A service to create tooltips for specific elements.\n * Use this if the tooltip directive is not suitable.\n * Must not be used outside element-ng.\n *\n * @internal\n */\n// We cannot provide this in root, as people may override the cdk overlay creation.\n@Injectable()\nexport class SiTooltipService {\n private overlay = inject(Overlay);\n\n createTooltip(config: {\n describedBy: string;\n element: ElementRef;\n placement: keyof typeof positions;\n injector?: Injector;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n scrollStrategy?: ScrollStrategy;\n }): TooltipRef {\n const injector = Injector.create({\n parent: config.injector,\n providers: [\n {\n provide: SI_TOOLTIP_CONFIG,\n useValue: {\n id: config.describedBy,\n tooltip: config.tooltip,\n tooltipContext: config.tooltipContext\n }\n }\n ]\n });\n\n return new TooltipRef(\n getOverlay(\n config.element,\n this.overlay,\n false,\n config.placement,\n false,\n true,\n config.scrollStrategy\n ),\n config.element,\n injector\n );\n }\n}\n\nexport type { TooltipRef };\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n inject,\n input,\n OnDestroy,\n PLATFORM_ID,\n TemplateRef\n} from '@angular/core';\nimport { positions } from '@siemens/element-ng/common';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nimport { SiTooltipService, TooltipRef } from './si-tooltip.service';\n\n@Directive({\n selector: '[siTooltip]',\n providers: [SiTooltipService],\n host: {\n '[attr.aria-describedby]': 'isDisabled() ? null : describedBy',\n '(focus)': 'focusIn($event)',\n '(mouseenter)': 'show()',\n '(touchstart)': 'hide()',\n '(focusout)': 'hide()',\n '(mouseleave)': 'hide()'\n }\n})\nexport class SiTooltipDirective implements OnDestroy {\n private static idCounter = 0;\n\n /**\n * The tooltip text to be displayed\n *\n * @defaultValue ''\n */\n readonly siTooltip = input<TranslatableString | TemplateRef<any>>('');\n\n /**\n * The placement of the tooltip. One of 'top', 'start', end', 'bottom'\n *\n * @defaultValue 'auto'\n */\n readonly placement = input<keyof typeof positions>('auto');\n\n /**\n * Allows the tooltip to be disabled\n *\n * @defaultValue false\n */\n readonly isDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * Optional CDK scroll strategy used for the tooltip overlay.\n * If not provided, the default reposition strategy is used.\n */\n readonly tooltipScrollStrategy = input<ScrollStrategy>();\n\n /**\n * The context for the attached template\n */\n readonly tooltipContext = input();\n\n protected describedBy = `__tooltip_${SiTooltipDirective.idCounter++}`;\n\n private tooltipRef?: TooltipRef;\n private showTimeout?: ReturnType<typeof setTimeout>;\n private tooltipService = inject(SiTooltipService);\n private elementRef = inject(ElementRef);\n private isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n ngOnDestroy(): void {\n this.clearShowTimeout();\n this.tooltipRef?.destroy();\n }\n\n private clearShowTimeout(): void {\n if (this.showTimeout) {\n clearTimeout(this.showTimeout);\n this.showTimeout = undefined;\n }\n }\n\n private showTooltip(immediate = false): void {\n const siTooltip = this.siTooltip();\n if (this.isDisabled() || !siTooltip) {\n return;\n }\n\n this.clearShowTimeout();\n\n const delay = immediate ? 0 : 500;\n\n this.showTimeout = setTimeout(() => {\n this.tooltipRef ??= this.tooltipService.createTooltip({\n describedBy: this.describedBy,\n element: this.elementRef,\n placement: this.placement(),\n tooltip: this.siTooltip,\n tooltipContext: this.tooltipContext,\n scrollStrategy: this.tooltipScrollStrategy()\n });\n this.tooltipRef.show();\n }, delay);\n }\n\n protected focusIn(event: FocusEvent): void {\n if (this.isBrowser && (event.target as Element).matches(':focus-visible')) {\n this.showTooltip(true);\n }\n }\n\n protected show(): void {\n this.showTooltip(false);\n }\n\n protected hide(): void {\n this.clearShowTimeout();\n this.tooltipRef?.hide();\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiTooltipDirective } from './si-tooltip.directive';\n\n@NgModule({\n imports: [SiTooltipDirective],\n exports: [SiTooltipDirective]\n})\nexport class SiTooltipModule {}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-tooltip.module';\nexport * from './si-tooltip.directive';\nexport * from './si-tooltip.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAGG;AAYI,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAkB,iBAAiB,CAAC;;MCM1E,gBAAgB,CAAA;AACR,IAAA,oBAAoB,GAAG,MAAM,CAAC,EAAE,gEAAC;AACjC,IAAA,QAAQ,GAAG,MAAM,CAAmC,SAAS,oDAAC;AAE9D,IAAA,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;AACpC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAE7B,IAAA,WAAW,GAAG,QAAQ,CAAgB,MAAK;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;AACrC,QAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,G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;AAC9D,wBAAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,cAAc,EAAE,QAAQ;AACxB,wBAAA,cAAc,EAAE,QAAQ;AACxB,wBAAA,YAAY,EAAE,QAAQ;AACtB,wBAAA,cAAc,EAAE;AACjB;AACF,iBAAA;;;AChCD;;;AAGG;MASU,eAAe,CAAA;uGAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAf,eAAe,EAAA,OAAA,EAAA,CAHhB,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA;wGAEjB,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB;AAC7B,iBAAA;;;ACXD;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-tooltip.mjs","sources":["../../../../projects/element-ng/tooltip/si-tooltip.model.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.html","../../../../projects/element-ng/tooltip/si-tooltip.service.ts","../../../../projects/element-ng/tooltip/si-tooltip.directive.ts","../../../../projects/element-ng/tooltip/si-tooltip.module.ts","../../../../projects/element-ng/tooltip/index.ts","../../../../projects/element-ng/tooltip/siemens-element-ng-tooltip.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ElementRef, InjectionToken, TemplateRef, Type } from '@angular/core';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nexport type SiTooltipContent =\n | TranslatableString\n | TemplateRef<any>\n | Type<any>\n | ElementRef<Element>\n | null\n | undefined;\n\nexport interface SiTooltipConfig {\n id?: string;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n}\n\nexport const SI_TOOLTIP_CONFIG = new InjectionToken<SiTooltipConfig>('SiTooltipConfig');\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ConnectedOverlayPositionChange, OverlayRef } from '@angular/cdk/overlay';\nimport { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n afterRenderEffect,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n signal,\n TemplateRef\n} from '@angular/core';\nimport { calculateOverlayArrowPosition, OverlayArrowPosition } from '@siemens/element-ng/common';\nimport { SiTranslatePipe } from '@siemens/element-translate-ng/translate';\n\nimport { SI_TOOLTIP_CONFIG } from './si-tooltip.model';\n\n@Component({\n selector: 'si-tooltip',\n imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet],\n templateUrl: './si-tooltip.component.html',\n styleUrl: './si-tooltip.component.scss',\n changeDetection: ChangeDetectionStrategy.Default,\n host: {\n 'animate.leave': 'tooltip-leave'\n }\n})\nexport class TooltipComponent {\n protected readonly tooltipPositionClass = signal('');\n protected readonly arrowPos = signal<OverlayArrowPosition | undefined>(undefined);\n\n protected readonly config = inject(SI_TOOLTIP_CONFIG);\n private readonly elementRef = inject(ElementRef);\n private readonly overlayRef = inject(OverlayRef);\n\n private lastPositionChange?: ConnectedOverlayPositionChange;\n private lastAnchor?: ElementRef;\n\n constructor() {\n let isFirstRun = true;\n afterRenderEffect(() => {\n this.config.tooltip();\n this.config.tooltipContext();\n if (isFirstRun) {\n isFirstRun = false;\n return;\n }\n this.overlayRef.updatePosition();\n if (this.lastPositionChange) {\n this.updateTooltipPosition(this.lastPositionChange, this.lastAnchor);\n }\n });\n }\n\n protected readonly tooltipText = computed<string | null>(() => {\n const tooltip = this.config.tooltip();\n if (typeof tooltip === 'string') {\n return tooltip;\n }\n // When an ElementRef is provided, read its current text content whenever the\n // tooltip is shown, so dynamic content is always reflected.\n // The tooltip content is not updated while being displayed.\n if (tooltip instanceof ElementRef) {\n return tooltip.nativeElement.textContent.trim();\n }\n return null;\n });\n\n protected readonly tooltipTemplate = computed<TemplateRef<any> | null>(() => {\n const tooltip = this.config.tooltip();\n return tooltip instanceof TemplateRef ? tooltip : null;\n });\n\n protected readonly tooltipComponent = computed(() => {\n const tooltip = this.config.tooltip();\n return !(tooltip instanceof TemplateRef) &&\n !(tooltip instanceof ElementRef) &&\n typeof tooltip !== 'string'\n ? tooltip\n : null;\n });\n\n /** @internal */\n updateTooltipPosition(change: ConnectedOverlayPositionChange, anchor?: ElementRef): void {\n this.lastPositionChange = change;\n this.lastAnchor = anchor;\n const arrowClassTooltip = `tooltip-${change.connectionPair.overlayX}-${change.connectionPair.overlayY}`;\n // need two updates as class changes affect the position\n if (arrowClassTooltip !== this.tooltipPositionClass()) {\n this.tooltipPositionClass.set(arrowClassTooltip);\n }\n const arrowPos = calculateOverlayArrowPosition(change, this.elementRef, anchor);\n this.arrowPos.set(arrowPos);\n }\n}\n","<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"config.id\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"config.tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport { ComponentRef, ElementRef, inject, Injectable, Injector, PLATFORM_ID } from '@angular/core';\nimport { getOverlay, getPositionStrategy, positions } from '@siemens/element-ng/common';\nimport { fromEvent, Subject, Subscription, timer } from 'rxjs';\nimport { delayWhen, filter, takeUntil } from 'rxjs/operators';\n\nimport { TooltipComponent } from './si-tooltip.component';\nimport { SI_TOOLTIP_CONFIG, SiTooltipContent } from './si-tooltip.model';\n\n/** @internal */\ninterface TooltipRef {\n destroy(): void;\n}\n\n/**\n * A no-op TooltipRef used on platform server where DOM APIs are unavailable.\n *\n * @internal\n */\nclass NoopTooltipRef {\n destroy(): void {}\n}\n\n/**\n * BrowserTooltipRef is attached to a specific element.\n * Use it to show or hide a tooltip for that element.\n *\n * @internal\n */\nclass BrowserTooltipRef {\n private readonly destroy$ = new Subject<void>();\n private isFocused = false;\n private isHovered = false;\n private overlayRef?: OverlayRef;\n private positionSubscription?: Subscription;\n\n constructor(\n private config: {\n describedBy?: string;\n element: ElementRef;\n injector?: Injector;\n overlay: Overlay;\n placement: keyof typeof positions;\n scrollStrategy?: () => ScrollStrategy | undefined;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n }\n ) {\n const nativeElement = this.config.element.nativeElement;\n\n fromEvent(nativeElement, 'focus')\n .pipe(\n filter(event => event instanceof FocusEvent),\n takeUntil(this.destroy$)\n )\n .subscribe(event => this.onFocus(event));\n\n fromEvent(nativeElement, 'mouseenter')\n .pipe(\n delayWhen(() =>\n // UX Guideline: tooltips on hover should be delayed by 500ms\n timer(500).pipe(\n takeUntil(fromEvent(nativeElement, 'mouseleave')),\n takeUntil(fromEvent(nativeElement, 'focusout')) // user started using keyboard\n )\n ),\n takeUntil(this.destroy$)\n )\n .subscribe(() => this.onMouseEnter());\n\n fromEvent(nativeElement, 'focusout')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onFocusOut());\n\n fromEvent(nativeElement, 'mouseleave')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onMouseLeave());\n\n fromEvent(nativeElement, 'touchstart')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onTouchStart());\n\n // The tooltip may be created lazily, after the element is already focused or\n // hovered (e.g. when validation errors appear on blur while the pointer still\n // hovers the element). In that case the initial `focus`/`mouseenter` was\n // missed, so show the tooltip immediately based on the live `:focus-visible`\n // and `:hover` state.\n if (nativeElement === document.activeElement && nativeElement.matches(':focus-visible')) {\n this.isFocused = true;\n this.show();\n } else if (nativeElement.matches(':hover')) {\n this.onMouseEnter();\n }\n }\n\n private onFocus(event: FocusEvent): void {\n if (event.target instanceof Element) {\n if (event.target.matches(':focus-visible')) {\n this.isFocused = true;\n this.show();\n }\n }\n }\n\n private onFocusOut(): void {\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n }\n\n private onMouseEnter(): void {\n this.isHovered = true;\n this.show();\n }\n\n private onMouseLeave(): void {\n this.isHovered = false;\n this.hide();\n }\n\n private onTouchStart(): void {\n // On touch devices a tooltip is not useful and would obscure the content the\n // user just tapped. Reset the hover/focus state so it is hidden immediately.\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n }\n\n private getOrCreateOverlay(): OverlayRef {\n this.overlayRef ??= getOverlay(\n this.config.element,\n this.config.overlay,\n false,\n this.config.placement,\n false,\n true,\n this.config.scrollStrategy?.()\n );\n return this.overlayRef;\n }\n\n private show(): void {\n const overlayRef = this.getOrCreateOverlay();\n if (overlayRef.hasAttached()) {\n return;\n }\n\n const injector = Injector.create({\n parent: this.config.injector,\n providers: [{ provide: OverlayRef, useValue: overlayRef }]\n });\n\n const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, injector);\n const tooltipRef: ComponentRef<TooltipComponent> = overlayRef.attach(toolTipPortal);\n\n const positionStrategy = getPositionStrategy(overlayRef);\n this.positionSubscription?.unsubscribe();\n this.positionSubscription = positionStrategy?.positionChanges.subscribe(change =>\n tooltipRef.instance.updateTooltipPosition(change, this.config.element)\n );\n }\n\n private hide(): void {\n if (this.isFocused || this.isHovered) {\n return;\n }\n this.overlayRef?.detach();\n this.positionSubscription?.unsubscribe();\n }\n\n destroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n this.overlayRef?.dispose();\n this.positionSubscription?.unsubscribe();\n }\n}\n\n/**\n * A service to create tooltips for specific elements.\n * Use this if the tooltip directive is not suitable.\n * Must not be used outside element-ng.\n *\n * @internal\n */\n// We cannot provide this in root, as people may override the cdk overlay creation.\n@Injectable()\nexport class SiTooltipService {\n private overlay = inject(Overlay);\n private isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n createTooltip(config: {\n describedBy?: string;\n element: ElementRef;\n placement: keyof typeof positions;\n injector?: Injector;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n scrollStrategy?: () => ScrollStrategy | undefined;\n }): TooltipRef {\n if (!this.isBrowser) {\n return new NoopTooltipRef();\n }\n\n const injector = Injector.create({\n parent: config.injector,\n providers: [\n {\n provide: SI_TOOLTIP_CONFIG,\n useValue: {\n id: config.describedBy,\n tooltip: config.tooltip,\n tooltipContext: config.tooltipContext\n }\n }\n ]\n });\n\n return new BrowserTooltipRef({\n ...config,\n injector,\n overlay: this.overlay\n });\n }\n}\n\nexport type { TooltipRef };\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport {\n booleanAttribute,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n OnDestroy,\n TemplateRef\n} from '@angular/core';\nimport { positions } from '@siemens/element-ng/common';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nimport { SiTooltipService, TooltipRef } from './si-tooltip.service';\n\n@Directive({\n selector: '[siTooltip]',\n providers: [SiTooltipService],\n host: {\n '[attr.aria-describedby]': 'isDisabled() ? null : describedBy'\n }\n})\nexport class SiTooltipDirective implements OnDestroy {\n private static idCounter = 0;\n\n /**\n * The tooltip text to be displayed\n *\n * @defaultValue ''\n */\n readonly siTooltip = input<TranslatableString | TemplateRef<any>>('');\n\n /**\n * The placement of the tooltip. One of 'top', 'start', end', 'bottom'\n *\n * @defaultValue 'auto'\n */\n readonly placement = input<keyof typeof positions>('auto');\n\n /**\n * Allows the tooltip to be disabled\n *\n * @defaultValue false\n */\n readonly isDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * Optional CDK scroll strategy used for the tooltip overlay.\n * If not provided, the default reposition strategy is used.\n */\n readonly tooltipScrollStrategy = input<ScrollStrategy>();\n\n /**\n * The context for the attached template\n */\n readonly tooltipContext = input();\n\n protected describedBy = `__tooltip_${SiTooltipDirective.idCounter++}`;\n\n private tooltipRef?: TooltipRef;\n private tooltipService = inject(SiTooltipService);\n private elementRef = inject(ElementRef);\n\n constructor() {\n effect(() => {\n const tooltip = this.siTooltip();\n const disabled = this.isDisabled();\n\n if (tooltip && !disabled) {\n this.tooltipRef ??= this.tooltipService.createTooltip({\n describedBy: this.describedBy,\n element: this.elementRef,\n placement: this.placement(),\n tooltip: this.siTooltip,\n tooltipContext: this.tooltipContext,\n scrollStrategy: this.tooltipScrollStrategy\n });\n } else if (this.tooltipRef) {\n this.tooltipRef.destroy();\n this.tooltipRef = undefined;\n }\n });\n }\n\n ngOnDestroy(): void {\n this.tooltipRef?.destroy();\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiTooltipDirective } from './si-tooltip.directive';\n\n@NgModule({\n imports: [SiTooltipDirective],\n exports: [SiTooltipDirective]\n})\nexport class SiTooltipModule {}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-tooltip.module';\nexport * from './si-tooltip.directive';\nexport * from './si-tooltip.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;AAGG;AAkBI,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAkB,iBAAiB,C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