@raintonic/formaui 0.2.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/CHANGELOG.md +7 -0
- package/README.md +145 -0
- package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs +806 -0
- package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-form-field.mjs +86 -0
- package/fesm2022/raintonic-formaui-cdk-form-field.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-overlay.mjs +1757 -0
- package/fesm2022/raintonic-formaui-cdk-overlay.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs +287 -0
- package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-accordion.mjs +217 -0
- package/fesm2022/raintonic-formaui-components-accordion.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-alert.mjs +161 -0
- package/fesm2022/raintonic-formaui-components-alert.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-autocomplete.mjs +726 -0
- package/fesm2022/raintonic-formaui-components-autocomplete.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-avatar.mjs +92 -0
- package/fesm2022/raintonic-formaui-components-avatar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-badge.mjs +107 -0
- package/fesm2022/raintonic-formaui-components-badge.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-big-menu.mjs +68 -0
- package/fesm2022/raintonic-formaui-components-big-menu.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-breadcrumb.mjs +55 -0
- package/fesm2022/raintonic-formaui-components-breadcrumb.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-button-group.mjs +103 -0
- package/fesm2022/raintonic-formaui-components-button-group.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-button.mjs +241 -0
- package/fesm2022/raintonic-formaui-components-button.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-card.mjs +270 -0
- package/fesm2022/raintonic-formaui-components-card.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-checkbox.mjs +295 -0
- package/fesm2022/raintonic-formaui-components-checkbox.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-data-table.mjs +631 -0
- package/fesm2022/raintonic-formaui-components-data-table.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-date-picker.mjs +1331 -0
- package/fesm2022/raintonic-formaui-components-date-picker.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-divider.mjs +41 -0
- package/fesm2022/raintonic-formaui-components-divider.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-drawer.mjs +190 -0
- package/fesm2022/raintonic-formaui-components-drawer.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-dynamic-form.mjs +266 -0
- package/fesm2022/raintonic-formaui-components-dynamic-form.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-empty-state.mjs +33 -0
- package/fesm2022/raintonic-formaui-components-empty-state.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-file-upload.mjs +246 -0
- package/fesm2022/raintonic-formaui-components-file-upload.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-form-field.mjs +482 -0
- package/fesm2022/raintonic-formaui-components-form-field.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-icon.mjs +117 -0
- package/fesm2022/raintonic-formaui-components-icon.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-input.mjs +327 -0
- package/fesm2022/raintonic-formaui-components-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-list.mjs +149 -0
- package/fesm2022/raintonic-formaui-components-list.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-menu.mjs +896 -0
- package/fesm2022/raintonic-formaui-components-menu.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-number-input.mjs +345 -0
- package/fesm2022/raintonic-formaui-components-number-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-paginator.mjs +139 -0
- package/fesm2022/raintonic-formaui-components-paginator.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-password-input.mjs +306 -0
- package/fesm2022/raintonic-formaui-components-password-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-popover.mjs +451 -0
- package/fesm2022/raintonic-formaui-components-popover.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-progressbar.mjs +148 -0
- package/fesm2022/raintonic-formaui-components-progressbar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-radio.mjs +260 -0
- package/fesm2022/raintonic-formaui-components-radio.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-select.mjs +1011 -0
- package/fesm2022/raintonic-formaui-components-select.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-side-panel.mjs +150 -0
- package/fesm2022/raintonic-formaui-components-side-panel.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-sidebar.mjs +257 -0
- package/fesm2022/raintonic-formaui-components-sidebar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-skeleton.mjs +50 -0
- package/fesm2022/raintonic-formaui-components-skeleton.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-slider.mjs +347 -0
- package/fesm2022/raintonic-formaui-components-slider.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-spinner.mjs +63 -0
- package/fesm2022/raintonic-formaui-components-spinner.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-stepper.mjs +317 -0
- package/fesm2022/raintonic-formaui-components-stepper.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tab.mjs +197 -0
- package/fesm2022/raintonic-formaui-components-tab.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tag.mjs +78 -0
- package/fesm2022/raintonic-formaui-components-tag.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-time-picker.mjs +644 -0
- package/fesm2022/raintonic-formaui-components-time-picker.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-toggle.mjs +171 -0
- package/fesm2022/raintonic-formaui-components-toggle.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-toolbar.mjs +140 -0
- package/fesm2022/raintonic-formaui-components-toolbar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tooltip.mjs +555 -0
- package/fesm2022/raintonic-formaui-components-tooltip.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree-select.mjs +314 -0
- package/fesm2022/raintonic-formaui-components-tree-select.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree-table.mjs +103 -0
- package/fesm2022/raintonic-formaui-components-tree-table.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree.mjs +430 -0
- package/fesm2022/raintonic-formaui-components-tree.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-core.mjs +62 -0
- package/fesm2022/raintonic-formaui-core.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-dialog.mjs +798 -0
- package/fesm2022/raintonic-formaui-services-dialog.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-notification.mjs +391 -0
- package/fesm2022/raintonic-formaui-services-notification.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-theme.mjs +248 -0
- package/fesm2022/raintonic-formaui-services-theme.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-test-utils.mjs +66 -0
- package/fesm2022/raintonic-formaui-test-utils.mjs.map +1 -0
- package/fesm2022/raintonic-formaui.mjs +15 -0
- package/fesm2022/raintonic-formaui.mjs.map +1 -0
- package/llms-full.txt +1627 -0
- package/llms.txt +60 -0
- package/package.json +251 -0
- package/styles/_fonts-entry.scss +3 -0
- package/styles/fonts/dm-mono-400-latin.woff2 +0 -0
- package/styles/fonts/inter-tight-latin-italic.woff2 +0 -0
- package/styles/fonts/inter-tight-latin.woff2 +0 -0
- package/styles/index.scss +127 -0
- package/styles/partials/_constants.scss +29 -0
- package/styles/partials/_fonts.scss +36 -0
- package/styles/partials/_grid.scss +171 -0
- package/styles/partials/_mixins.scss +145 -0
- package/styles/partials/_motion.scss +252 -0
- package/styles/partials/_theme.scss +275 -0
- package/styles/partials/_typography.scss +112 -0
- package/styles/partials/_utilities.scss +480 -0
- package/styles/partials/themes/_dark.scss +254 -0
- package/styles/partials/themes/_light.scss +254 -0
- package/types/raintonic-formaui-cdk-drag-drop.d.ts +196 -0
- package/types/raintonic-formaui-cdk-drag-drop.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-form-field.d.ts +62 -0
- package/types/raintonic-formaui-cdk-form-field.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-overlay.d.ts +843 -0
- package/types/raintonic-formaui-cdk-overlay.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-virtual-scroll.d.ts +112 -0
- package/types/raintonic-formaui-cdk-virtual-scroll.d.ts.map +1 -0
- package/types/raintonic-formaui-components-accordion.d.ts +124 -0
- package/types/raintonic-formaui-components-accordion.d.ts.map +1 -0
- package/types/raintonic-formaui-components-alert.d.ts +143 -0
- package/types/raintonic-formaui-components-alert.d.ts.map +1 -0
- package/types/raintonic-formaui-components-autocomplete.d.ts +193 -0
- package/types/raintonic-formaui-components-autocomplete.d.ts.map +1 -0
- package/types/raintonic-formaui-components-avatar.d.ts +52 -0
- package/types/raintonic-formaui-components-avatar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-badge.d.ts +47 -0
- package/types/raintonic-formaui-components-badge.d.ts.map +1 -0
- package/types/raintonic-formaui-components-big-menu.d.ts +62 -0
- package/types/raintonic-formaui-components-big-menu.d.ts.map +1 -0
- package/types/raintonic-formaui-components-breadcrumb.d.ts +26 -0
- package/types/raintonic-formaui-components-breadcrumb.d.ts.map +1 -0
- package/types/raintonic-formaui-components-button-group.d.ts +61 -0
- package/types/raintonic-formaui-components-button-group.d.ts.map +1 -0
- package/types/raintonic-formaui-components-button.d.ts +116 -0
- package/types/raintonic-formaui-components-button.d.ts.map +1 -0
- package/types/raintonic-formaui-components-card.d.ts +191 -0
- package/types/raintonic-formaui-components-card.d.ts.map +1 -0
- package/types/raintonic-formaui-components-checkbox.d.ts +132 -0
- package/types/raintonic-formaui-components-checkbox.d.ts.map +1 -0
- package/types/raintonic-formaui-components-data-table.d.ts +368 -0
- package/types/raintonic-formaui-components-data-table.d.ts.map +1 -0
- package/types/raintonic-formaui-components-date-picker.d.ts +341 -0
- package/types/raintonic-formaui-components-date-picker.d.ts.map +1 -0
- package/types/raintonic-formaui-components-divider.d.ts +21 -0
- package/types/raintonic-formaui-components-divider.d.ts.map +1 -0
- package/types/raintonic-formaui-components-drawer.d.ts +48 -0
- package/types/raintonic-formaui-components-drawer.d.ts.map +1 -0
- package/types/raintonic-formaui-components-dynamic-form.d.ts +412 -0
- package/types/raintonic-formaui-components-dynamic-form.d.ts.map +1 -0
- package/types/raintonic-formaui-components-empty-state.d.ts +14 -0
- package/types/raintonic-formaui-components-empty-state.d.ts.map +1 -0
- package/types/raintonic-formaui-components-file-upload.d.ts +77 -0
- package/types/raintonic-formaui-components-file-upload.d.ts.map +1 -0
- package/types/raintonic-formaui-components-form-field.d.ts +271 -0
- package/types/raintonic-formaui-components-form-field.d.ts.map +1 -0
- package/types/raintonic-formaui-components-icon.d.ts +61 -0
- package/types/raintonic-formaui-components-icon.d.ts.map +1 -0
- package/types/raintonic-formaui-components-input.d.ts +149 -0
- package/types/raintonic-formaui-components-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-list.d.ts +48 -0
- package/types/raintonic-formaui-components-list.d.ts.map +1 -0
- package/types/raintonic-formaui-components-menu.d.ts +403 -0
- package/types/raintonic-formaui-components-menu.d.ts.map +1 -0
- package/types/raintonic-formaui-components-number-input.d.ts +127 -0
- package/types/raintonic-formaui-components-number-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-paginator.d.ts +37 -0
- package/types/raintonic-formaui-components-paginator.d.ts.map +1 -0
- package/types/raintonic-formaui-components-password-input.d.ts +111 -0
- package/types/raintonic-formaui-components-password-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-popover.d.ts +131 -0
- package/types/raintonic-formaui-components-popover.d.ts.map +1 -0
- package/types/raintonic-formaui-components-progressbar.d.ts +111 -0
- package/types/raintonic-formaui-components-progressbar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-radio.d.ts +95 -0
- package/types/raintonic-formaui-components-radio.d.ts.map +1 -0
- package/types/raintonic-formaui-components-select.d.ts +307 -0
- package/types/raintonic-formaui-components-select.d.ts.map +1 -0
- package/types/raintonic-formaui-components-side-panel.d.ts +51 -0
- package/types/raintonic-formaui-components-side-panel.d.ts.map +1 -0
- package/types/raintonic-formaui-components-sidebar.d.ts +174 -0
- package/types/raintonic-formaui-components-sidebar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-skeleton.d.ts +20 -0
- package/types/raintonic-formaui-components-skeleton.d.ts.map +1 -0
- package/types/raintonic-formaui-components-slider.d.ts +108 -0
- package/types/raintonic-formaui-components-slider.d.ts.map +1 -0
- package/types/raintonic-formaui-components-spinner.d.ts +42 -0
- package/types/raintonic-formaui-components-spinner.d.ts.map +1 -0
- package/types/raintonic-formaui-components-stepper.d.ts +126 -0
- package/types/raintonic-formaui-components-stepper.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tab.d.ts +96 -0
- package/types/raintonic-formaui-components-tab.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tag.d.ts +34 -0
- package/types/raintonic-formaui-components-tag.d.ts.map +1 -0
- package/types/raintonic-formaui-components-time-picker.d.ts +172 -0
- package/types/raintonic-formaui-components-time-picker.d.ts.map +1 -0
- package/types/raintonic-formaui-components-toggle.d.ts +70 -0
- package/types/raintonic-formaui-components-toggle.d.ts.map +1 -0
- package/types/raintonic-formaui-components-toolbar.d.ts +128 -0
- package/types/raintonic-formaui-components-toolbar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tooltip.d.ts +268 -0
- package/types/raintonic-formaui-components-tooltip.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree-select.d.ts +80 -0
- package/types/raintonic-formaui-components-tree-select.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree-table.d.ts +90 -0
- package/types/raintonic-formaui-components-tree-table.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree.d.ts +104 -0
- package/types/raintonic-formaui-components-tree.d.ts.map +1 -0
- package/types/raintonic-formaui-core.d.ts +115 -0
- package/types/raintonic-formaui-core.d.ts.map +1 -0
- package/types/raintonic-formaui-services-dialog.d.ts +451 -0
- package/types/raintonic-formaui-services-dialog.d.ts.map +1 -0
- package/types/raintonic-formaui-services-notification.d.ts +221 -0
- package/types/raintonic-formaui-services-notification.d.ts.map +1 -0
- package/types/raintonic-formaui-services-theme.d.ts +126 -0
- package/types/raintonic-formaui-services-theme.d.ts.map +1 -0
- package/types/raintonic-formaui-test-utils.d.ts +24 -0
- package/types/raintonic-formaui-test-utils.d.ts.map +1 -0
- package/types/raintonic-formaui.d.ts +4 -0
- package/types/raintonic-formaui.d.ts.map +1 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, numberAttribute, booleanAttribute, signal, inject, ElementRef, EnvironmentInjector, effect, createComponent, HostListener, Directive } from '@angular/core';
|
|
3
|
+
import { FuiOverlayService } from '@raintonic/formaui/cdk/overlay';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Constants for validation
|
|
7
|
+
*/
|
|
8
|
+
const TOOLTIP_POSITIONS = [
|
|
9
|
+
'top',
|
|
10
|
+
'top-start',
|
|
11
|
+
'top-end',
|
|
12
|
+
'bottom',
|
|
13
|
+
'bottom-start',
|
|
14
|
+
'bottom-end',
|
|
15
|
+
'left',
|
|
16
|
+
'left-start',
|
|
17
|
+
'left-end',
|
|
18
|
+
'right',
|
|
19
|
+
'right-start',
|
|
20
|
+
'right-end',
|
|
21
|
+
];
|
|
22
|
+
const TOOLTIP_SIZES = ['sm', 'md', 'lg'];
|
|
23
|
+
const TOOLTIP_TRIGGERS = ['hover', 'focus', 'click', 'manual'];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @component FuiTooltipComponent
|
|
27
|
+
* @selector fui-tooltip
|
|
28
|
+
* @description Internal tooltip component rendered by FuiTooltipDirective via the overlay system.
|
|
29
|
+
* Not intended for direct use; created programmatically by the directive.
|
|
30
|
+
*
|
|
31
|
+
* @input content - (required) Tooltip text content.
|
|
32
|
+
* @input position - (required) Tooltip position relative to the trigger element.
|
|
33
|
+
* @input size - (required) Tooltip size variant.
|
|
34
|
+
* @input maxWidth - (required) Maximum CSS width of the tooltip.
|
|
35
|
+
* @input arrow - (required) Whether to render an arrow indicator.
|
|
36
|
+
* @input tooltipId - (required) Unique ID for ARIA accessibility linking.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <!-- Used internally by FuiTooltipDirective -->
|
|
40
|
+
* <button fuiTooltip="Save your changes">Save</button>
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
class FuiTooltipComponent {
|
|
45
|
+
/**
|
|
46
|
+
* Tooltip content text
|
|
47
|
+
*/
|
|
48
|
+
content = input.required(...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/**
|
|
50
|
+
* Tooltip position
|
|
51
|
+
*/
|
|
52
|
+
position = input.required(...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
53
|
+
/**
|
|
54
|
+
* Tooltip size
|
|
55
|
+
*/
|
|
56
|
+
size = input.required(...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
57
|
+
/**
|
|
58
|
+
* Maximum width of the tooltip
|
|
59
|
+
*/
|
|
60
|
+
maxWidth = input.required(...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
61
|
+
/**
|
|
62
|
+
* Whether to show arrow
|
|
63
|
+
*/
|
|
64
|
+
arrow = input.required(...(ngDevMode ? [{ debugName: "arrow" }] : /* istanbul ignore next */ []));
|
|
65
|
+
/**
|
|
66
|
+
* Tooltip ID for accessibility
|
|
67
|
+
*/
|
|
68
|
+
tooltipId = input.required(...(ngDevMode ? [{ debugName: "tooltipId" }] : /* istanbul ignore next */ []));
|
|
69
|
+
/**
|
|
70
|
+
* Computed CSS classes for the tooltip
|
|
71
|
+
*/
|
|
72
|
+
computedClasses = computed(() => {
|
|
73
|
+
const classes = ['fui-tooltip', `fui-tooltip--${this.size()}`, `fui-tooltip--${this.position()}`];
|
|
74
|
+
if (this.arrow()) {
|
|
75
|
+
classes.push('fui-tooltip--with-arrow');
|
|
76
|
+
}
|
|
77
|
+
return classes.join(' ');
|
|
78
|
+
}, ...(ngDevMode ? [{ debugName: "computedClasses" }] : /* istanbul ignore next */ []));
|
|
79
|
+
/**
|
|
80
|
+
* Computed arrow classes based on position
|
|
81
|
+
*/
|
|
82
|
+
arrowClasses = computed(() => {
|
|
83
|
+
const position = this.position();
|
|
84
|
+
const baseClass = 'fui-tooltip__arrow';
|
|
85
|
+
if (position.startsWith('top')) {
|
|
86
|
+
return `${baseClass} ${baseClass}--bottom`;
|
|
87
|
+
}
|
|
88
|
+
else if (position.startsWith('bottom')) {
|
|
89
|
+
return `${baseClass} ${baseClass}--top`;
|
|
90
|
+
}
|
|
91
|
+
else if (position.startsWith('left')) {
|
|
92
|
+
return `${baseClass} ${baseClass}--right`;
|
|
93
|
+
}
|
|
94
|
+
else if (position.startsWith('right')) {
|
|
95
|
+
return `${baseClass} ${baseClass}--left`;
|
|
96
|
+
}
|
|
97
|
+
return baseClass;
|
|
98
|
+
}, ...(ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []));
|
|
99
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
100
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: FuiTooltipComponent, isStandalone: true, selector: "fui-tooltip", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: true, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: true, transformFunction: null }, arrow: { classPropertyName: "arrow", publicName: "arrow", isSignal: true, isRequired: true, transformFunction: null }, tooltipId: { classPropertyName: "tooltipId", publicName: "tooltipId", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "computedClasses()", "id": "tooltipId()", "attr.role": "\"tooltip\"", "style.max-width": "maxWidth()" }, classAttribute: "fui-tooltip" }, ngImport: i0, template: "<div class=\"fui-tooltip__content\">\r\n {{ content() }}\r\n</div>\r\n@if (arrow()) {\r\n <div [class]=\"arrowClasses()\"></div>\r\n}\r\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}::ng-deep .fui-tooltip{--fui-tooltip-border-radius: var(--fui-border-radius-sm);--fui-tooltip-shadow: var(--fui-shadow-03);--fui-tooltip-font-size: var(--fui-font-size-02);--fui-tooltip-padding-x: var(--fui-spacing-04);--fui-tooltip-padding-y: var(--fui-spacing-03);z-index:var(--fui-z-tooltip, 1000);display:block;font-family:var(--fui-font-family-sans);font-weight:var(--fui-font-weight-regular);line-height:var(--fui-line-height-body);border-radius:var(--fui-tooltip-border-radius);background-color:var(--fui-tooltip-background);color:var(--fui-tooltip-text);box-shadow:var(--fui-tooltip-shadow);transition:opacity var(--fui-duration-fast-01) var(--fui-ease-standard) 0ms;opacity:0;animation:fui-tooltip-fade-in var(--fui-duration-fast-02) ease-out forwards}::ng-deep .fui-tooltip__content{padding:var(--fui-tooltip-padding-y) var(--fui-tooltip-padding-x);word-wrap:break-word;-webkit-hyphens:auto;hyphens:auto}::ng-deep .fui-tooltip__arrow{position:absolute;width:0;height:0;border-style:solid;border-color:transparent;--arrow-size: 6px}::ng-deep .fui-tooltip__arrow--top{bottom:100%;left:50%;transform:translate(-50%);border-width:0 var(--arrow-size) var(--arrow-size) var(--arrow-size);border-bottom-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip__arrow--bottom{top:100%;left:50%;transform:translate(-50%);border-width:var(--arrow-size) var(--arrow-size) 0 var(--arrow-size);border-top-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip__arrow--left{right:100%;top:50%;transform:translateY(-50%);border-width:var(--arrow-size) var(--arrow-size) var(--arrow-size) 0;border-right-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip__arrow--right{left:100%;top:50%;transform:translateY(-50%);border-width:var(--arrow-size) 0 var(--arrow-size) var(--arrow-size);border-left-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip--right{transform:translate(-50%)}::ng-deep .fui-tooltip--top-start .fui-tooltip__arrow,::ng-deep .fui-tooltip--bottom-start .fui-tooltip__arrow{left:var(--fui-spacing-04);transform:none}::ng-deep .fui-tooltip--top-end .fui-tooltip__arrow,::ng-deep .fui-tooltip--bottom-end .fui-tooltip__arrow{right:var(--fui-spacing-04);left:auto;transform:none}::ng-deep .fui-tooltip--left-start .fui-tooltip__arrow,::ng-deep .fui-tooltip--right-start .fui-tooltip__arrow{top:var(--fui-spacing-04);transform:none}::ng-deep .fui-tooltip--left-end .fui-tooltip__arrow,::ng-deep .fui-tooltip--right-end .fui-tooltip__arrow{bottom:var(--fui-spacing-04);top:auto;transform:none}::ng-deep .fui-tooltip--sm{font-size:var(--fui-font-size-01)}::ng-deep .fui-tooltip--sm .fui-tooltip__content{padding:var(--fui-spacing-02) var(--fui-spacing-03)}::ng-deep .fui-tooltip--sm .fui-tooltip__arrow{--arrow-size: 4px}::ng-deep .fui-tooltip--md{font-size:var(--fui-font-size-02)}::ng-deep .fui-tooltip--md .fui-tooltip__content{padding:var(--fui-spacing-03) var(--fui-spacing-04)}::ng-deep .fui-tooltip--md .fui-tooltip__arrow{--arrow-size: 6px}::ng-deep .fui-tooltip--lg{font-size:var(--fui-font-size-03)}::ng-deep .fui-tooltip--lg .fui-tooltip__content{padding:var(--fui-spacing-04) var(--fui-spacing-05)}::ng-deep .fui-tooltip--lg .fui-tooltip__arrow{--arrow-size: 8px}@media(prefers-contrast:more){::ng-deep .fui-tooltip{border:2px solid var(--fui-text-primary);box-shadow:var(--fui-shadow-04)}}@media(prefers-reduced-motion:reduce){::ng-deep .fui-tooltip{animation:none;opacity:1}}@media print{::ng-deep .fui-tooltip{display:none!important}}@keyframes fui-tooltip-fade-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
101
|
+
}
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTooltipComponent, decorators: [{
|
|
103
|
+
type: Component,
|
|
104
|
+
args: [{ selector: 'fui-tooltip', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
105
|
+
class: 'fui-tooltip',
|
|
106
|
+
'[class]': 'computedClasses()',
|
|
107
|
+
'[id]': 'tooltipId()',
|
|
108
|
+
'[attr.role]': '"tooltip"',
|
|
109
|
+
'[style.max-width]': 'maxWidth()',
|
|
110
|
+
}, template: "<div class=\"fui-tooltip__content\">\r\n {{ content() }}\r\n</div>\r\n@if (arrow()) {\r\n <div [class]=\"arrowClasses()\"></div>\r\n}\r\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}::ng-deep .fui-tooltip{--fui-tooltip-border-radius: var(--fui-border-radius-sm);--fui-tooltip-shadow: var(--fui-shadow-03);--fui-tooltip-font-size: var(--fui-font-size-02);--fui-tooltip-padding-x: var(--fui-spacing-04);--fui-tooltip-padding-y: var(--fui-spacing-03);z-index:var(--fui-z-tooltip, 1000);display:block;font-family:var(--fui-font-family-sans);font-weight:var(--fui-font-weight-regular);line-height:var(--fui-line-height-body);border-radius:var(--fui-tooltip-border-radius);background-color:var(--fui-tooltip-background);color:var(--fui-tooltip-text);box-shadow:var(--fui-tooltip-shadow);transition:opacity var(--fui-duration-fast-01) var(--fui-ease-standard) 0ms;opacity:0;animation:fui-tooltip-fade-in var(--fui-duration-fast-02) ease-out forwards}::ng-deep .fui-tooltip__content{padding:var(--fui-tooltip-padding-y) var(--fui-tooltip-padding-x);word-wrap:break-word;-webkit-hyphens:auto;hyphens:auto}::ng-deep .fui-tooltip__arrow{position:absolute;width:0;height:0;border-style:solid;border-color:transparent;--arrow-size: 6px}::ng-deep .fui-tooltip__arrow--top{bottom:100%;left:50%;transform:translate(-50%);border-width:0 var(--arrow-size) var(--arrow-size) var(--arrow-size);border-bottom-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip__arrow--bottom{top:100%;left:50%;transform:translate(-50%);border-width:var(--arrow-size) var(--arrow-size) 0 var(--arrow-size);border-top-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip__arrow--left{right:100%;top:50%;transform:translateY(-50%);border-width:var(--arrow-size) var(--arrow-size) var(--arrow-size) 0;border-right-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip__arrow--right{left:100%;top:50%;transform:translateY(-50%);border-width:var(--arrow-size) 0 var(--arrow-size) var(--arrow-size);border-left-color:var(--fui-tooltip-background)}::ng-deep .fui-tooltip--right{transform:translate(-50%)}::ng-deep .fui-tooltip--top-start .fui-tooltip__arrow,::ng-deep .fui-tooltip--bottom-start .fui-tooltip__arrow{left:var(--fui-spacing-04);transform:none}::ng-deep .fui-tooltip--top-end .fui-tooltip__arrow,::ng-deep .fui-tooltip--bottom-end .fui-tooltip__arrow{right:var(--fui-spacing-04);left:auto;transform:none}::ng-deep .fui-tooltip--left-start .fui-tooltip__arrow,::ng-deep .fui-tooltip--right-start .fui-tooltip__arrow{top:var(--fui-spacing-04);transform:none}::ng-deep .fui-tooltip--left-end .fui-tooltip__arrow,::ng-deep .fui-tooltip--right-end .fui-tooltip__arrow{bottom:var(--fui-spacing-04);top:auto;transform:none}::ng-deep .fui-tooltip--sm{font-size:var(--fui-font-size-01)}::ng-deep .fui-tooltip--sm .fui-tooltip__content{padding:var(--fui-spacing-02) var(--fui-spacing-03)}::ng-deep .fui-tooltip--sm .fui-tooltip__arrow{--arrow-size: 4px}::ng-deep .fui-tooltip--md{font-size:var(--fui-font-size-02)}::ng-deep .fui-tooltip--md .fui-tooltip__content{padding:var(--fui-spacing-03) var(--fui-spacing-04)}::ng-deep .fui-tooltip--md .fui-tooltip__arrow{--arrow-size: 6px}::ng-deep .fui-tooltip--lg{font-size:var(--fui-font-size-03)}::ng-deep .fui-tooltip--lg .fui-tooltip__content{padding:var(--fui-spacing-04) var(--fui-spacing-05)}::ng-deep .fui-tooltip--lg .fui-tooltip__arrow{--arrow-size: 8px}@media(prefers-contrast:more){::ng-deep .fui-tooltip{border:2px solid var(--fui-text-primary);box-shadow:var(--fui-shadow-04)}}@media(prefers-reduced-motion:reduce){::ng-deep .fui-tooltip{animation:none;opacity:1}}@media print{::ng-deep .fui-tooltip{display:none!important}}@keyframes fui-tooltip-fade-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}\n"] }]
|
|
111
|
+
}], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: true }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: true }] }], arrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrow", required: true }] }], tooltipId: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipId", required: true }] }] } });
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* # Tooltip Directive
|
|
115
|
+
*
|
|
116
|
+
* A professional tooltip directive that provides contextual information on hover, focus, or click.
|
|
117
|
+
* Follows Material Design patterns with full accessibility support and advanced positioning.
|
|
118
|
+
*
|
|
119
|
+
* ## Features
|
|
120
|
+
* - Multiple positioning options (12 positions)
|
|
121
|
+
* - Configurable trigger events (hover, focus, click, manual)
|
|
122
|
+
* - Multiple variants for different semantic meanings
|
|
123
|
+
* - Flexible sizing options
|
|
124
|
+
* - Smart positioning with collision detection
|
|
125
|
+
* - Customizable delays and animations
|
|
126
|
+
* - Full accessibility support (ARIA attributes, keyboard navigation)
|
|
127
|
+
* - Arrow indicator support
|
|
128
|
+
* - Responsive design with max-width control
|
|
129
|
+
* - Theme support (light/dark)
|
|
130
|
+
*
|
|
131
|
+
* ## Usage
|
|
132
|
+
*
|
|
133
|
+
* ### Basic Tooltip
|
|
134
|
+
* ```html
|
|
135
|
+
* <button fuiTooltip="Save your changes">Save</button>
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* ### Advanced Configuration
|
|
139
|
+
* ```html
|
|
140
|
+
* <button fuiTooltip="Delete this item permanently"
|
|
141
|
+
* fuiTooltipPosition="top"
|
|
142
|
+
* fuiTooltipVariant="error"
|
|
143
|
+
* fuiTooltipSize="lg"
|
|
144
|
+
* [fuiTooltipShowDelay]="500">
|
|
145
|
+
* Delete
|
|
146
|
+
* </button>
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* ### Click Trigger
|
|
150
|
+
* ```html
|
|
151
|
+
* <span fuiTooltip="Click to copy"
|
|
152
|
+
* fuiTooltipTrigger="click"
|
|
153
|
+
* fuiTooltipPosition="bottom">
|
|
154
|
+
* 📋 Copy to clipboard
|
|
155
|
+
* </span>
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* ### Manual Control
|
|
159
|
+
* ```html
|
|
160
|
+
* <div fuiTooltip="Manual tooltip"
|
|
161
|
+
* fuiTooltipTrigger="manual"
|
|
162
|
+
* [fuiTooltipShow]="showTooltip">
|
|
163
|
+
* Hover me
|
|
164
|
+
* </div>
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* import { FuiTooltipDirective } from '@raintonic/formaui/components/tooltip';
|
|
170
|
+
*
|
|
171
|
+
* @Component({
|
|
172
|
+
* standalone: true,
|
|
173
|
+
* imports: [FuiTooltipDirective],
|
|
174
|
+
* template: `
|
|
175
|
+
* <button fuiTooltip="This will save your work"
|
|
176
|
+
* fuiTooltipPosition="top"
|
|
177
|
+
* fuiTooltipVariant="info">
|
|
178
|
+
* Save Document
|
|
179
|
+
* </button>
|
|
180
|
+
* `
|
|
181
|
+
* })
|
|
182
|
+
* export class MyComponent { }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
class FuiTooltipDirective {
|
|
186
|
+
static _nextId = 0;
|
|
187
|
+
/**
|
|
188
|
+
* Tooltip content text
|
|
189
|
+
*/
|
|
190
|
+
fuiTooltip = input.required(...(ngDevMode ? [{ debugName: "fuiTooltip" }] : /* istanbul ignore next */ []));
|
|
191
|
+
/**
|
|
192
|
+
* Tooltip position relative to the trigger element
|
|
193
|
+
* @default 'top'
|
|
194
|
+
*/
|
|
195
|
+
fuiTooltipPosition = input('top', { ...(ngDevMode ? { debugName: "fuiTooltipPosition" } : /* istanbul ignore next */ {}), transform: (v) => (TOOLTIP_POSITIONS.includes(v) ? v : 'top') });
|
|
196
|
+
/**
|
|
197
|
+
* Tooltip size
|
|
198
|
+
* @default 'md'
|
|
199
|
+
*/
|
|
200
|
+
fuiTooltipSize = input('md', { ...(ngDevMode ? { debugName: "fuiTooltipSize" } : /* istanbul ignore next */ {}), transform: (v) => (TOOLTIP_SIZES.includes(v) ? v : 'md') });
|
|
201
|
+
/**
|
|
202
|
+
* Tooltip trigger event
|
|
203
|
+
* @default 'hover'
|
|
204
|
+
*/
|
|
205
|
+
fuiTooltipTrigger = input('hover', { ...(ngDevMode ? { debugName: "fuiTooltipTrigger" } : /* istanbul ignore next */ {}), transform: (v) => (TOOLTIP_TRIGGERS.includes(v) ? v : 'hover') });
|
|
206
|
+
/**
|
|
207
|
+
* Delay before showing tooltip (in milliseconds)
|
|
208
|
+
* @default 500
|
|
209
|
+
*/
|
|
210
|
+
fuiTooltipShowDelay = input(500, { ...(ngDevMode ? { debugName: "fuiTooltipShowDelay" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
211
|
+
/**
|
|
212
|
+
* Delay before hiding tooltip (in milliseconds)
|
|
213
|
+
* @default 0
|
|
214
|
+
*/
|
|
215
|
+
fuiTooltipHideDelay = input(0, { ...(ngDevMode ? { debugName: "fuiTooltipHideDelay" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
216
|
+
/**
|
|
217
|
+
* Whether the tooltip is disabled
|
|
218
|
+
* @default false
|
|
219
|
+
*/
|
|
220
|
+
fuiTooltipDisabled = input(false, { ...(ngDevMode ? { debugName: "fuiTooltipDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
221
|
+
/**
|
|
222
|
+
* Maximum width of the tooltip
|
|
223
|
+
* @default '200px'
|
|
224
|
+
*/
|
|
225
|
+
fuiTooltipMaxWidth = input('200px', ...(ngDevMode ? [{ debugName: "fuiTooltipMaxWidth" }] : /* istanbul ignore next */ []));
|
|
226
|
+
/**
|
|
227
|
+
* Offset distance from the trigger element (in pixels)
|
|
228
|
+
* @default 8
|
|
229
|
+
*/
|
|
230
|
+
fuiTooltipOffset = input(8, { ...(ngDevMode ? { debugName: "fuiTooltipOffset" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
231
|
+
/**
|
|
232
|
+
* Whether to show an arrow pointing to the trigger element
|
|
233
|
+
* @default true
|
|
234
|
+
*/
|
|
235
|
+
fuiTooltipArrow = input(true, { ...(ngDevMode ? { debugName: "fuiTooltipArrow" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
236
|
+
/**
|
|
237
|
+
* Manual control for showing/hiding tooltip (only works with trigger="manual")
|
|
238
|
+
* @default false
|
|
239
|
+
*/
|
|
240
|
+
fuiTooltipShow = input(false, { ...(ngDevMode ? { debugName: "fuiTooltipShow" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
241
|
+
// Internal state
|
|
242
|
+
_isVisible = signal(false, ...(ngDevMode ? [{ debugName: "_isVisible" }] : /* istanbul ignore next */ []));
|
|
243
|
+
_tooltipId = signal('', ...(ngDevMode ? [{ debugName: "_tooltipId" }] : /* istanbul ignore next */ []));
|
|
244
|
+
_overlayRef = null;
|
|
245
|
+
_tooltipComponent = null;
|
|
246
|
+
_showTimeout = null;
|
|
247
|
+
_hideTimeout = null;
|
|
248
|
+
_isHoveringTooltip = false;
|
|
249
|
+
// Computed properties
|
|
250
|
+
isVisible = computed(() => this._isVisible(), ...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
|
|
251
|
+
tooltipId = computed(() => this._tooltipId(), ...(ngDevMode ? [{ debugName: "tooltipId" }] : /* istanbul ignore next */ []));
|
|
252
|
+
// Injected dependencies
|
|
253
|
+
_elementRef = inject(ElementRef);
|
|
254
|
+
_overlayService = inject(FuiOverlayService);
|
|
255
|
+
_environmentInjector = inject(EnvironmentInjector);
|
|
256
|
+
constructor() {
|
|
257
|
+
// Generate unique tooltip ID
|
|
258
|
+
this._tooltipId.set(`fui-tooltip-${FuiTooltipDirective._nextId++}`);
|
|
259
|
+
// Handle manual control
|
|
260
|
+
effect(() => {
|
|
261
|
+
if (this.fuiTooltipTrigger() === 'manual') {
|
|
262
|
+
if (this.fuiTooltipShow()) {
|
|
263
|
+
this._showTooltip();
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
this._hideTooltip();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// Handle disabled state
|
|
271
|
+
effect(() => {
|
|
272
|
+
if (this.fuiTooltipDisabled() && this._isVisible()) {
|
|
273
|
+
this._hideTooltip();
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
ngOnDestroy() {
|
|
278
|
+
this._clearTimeouts();
|
|
279
|
+
this._destroyTooltip();
|
|
280
|
+
}
|
|
281
|
+
onMouseEnter() {
|
|
282
|
+
if (this.fuiTooltipTrigger() === 'hover' && !this.fuiTooltipDisabled()) {
|
|
283
|
+
this._scheduleShow();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
onMouseLeave() {
|
|
287
|
+
if (this.fuiTooltipTrigger() === 'hover' && !this.fuiTooltipDisabled()) {
|
|
288
|
+
this._scheduleHide();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
onFocus() {
|
|
292
|
+
if ((this.fuiTooltipTrigger() === 'focus' || this.fuiTooltipTrigger() === 'hover') && !this.fuiTooltipDisabled()) {
|
|
293
|
+
this._scheduleShow();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
onBlur() {
|
|
297
|
+
if ((this.fuiTooltipTrigger() === 'focus' || this.fuiTooltipTrigger() === 'hover') && !this.fuiTooltipDisabled()) {
|
|
298
|
+
this._scheduleHide();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
onClick() {
|
|
302
|
+
if (this.fuiTooltipTrigger() === 'click' && !this.fuiTooltipDisabled()) {
|
|
303
|
+
if (this._isVisible()) {
|
|
304
|
+
this._hideTooltip();
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
this._showTooltip();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
onKeydown(event) {
|
|
312
|
+
if (event.key === 'Escape' && this._isVisible()) {
|
|
313
|
+
this._hideTooltip();
|
|
314
|
+
event.preventDefault();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Programmatically show the tooltip
|
|
319
|
+
*/
|
|
320
|
+
show() {
|
|
321
|
+
if (!this.fuiTooltipDisabled()) {
|
|
322
|
+
this._showTooltip();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Programmatically hide the tooltip
|
|
327
|
+
*/
|
|
328
|
+
hide() {
|
|
329
|
+
this._hideTooltip();
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Toggle tooltip visibility
|
|
333
|
+
*/
|
|
334
|
+
toggle() {
|
|
335
|
+
if (this._isVisible()) {
|
|
336
|
+
this.hide();
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
this.show();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
_scheduleShow() {
|
|
343
|
+
this._clearTimeouts();
|
|
344
|
+
if (this.fuiTooltipShowDelay() > 0) {
|
|
345
|
+
this._showTimeout = window.setTimeout(() => {
|
|
346
|
+
this._showTooltip();
|
|
347
|
+
}, this.fuiTooltipShowDelay());
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
this._showTooltip();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
_scheduleHide() {
|
|
354
|
+
this._clearTimeouts();
|
|
355
|
+
if (this.fuiTooltipHideDelay() > 0) {
|
|
356
|
+
this._hideTimeout = window.setTimeout(() => {
|
|
357
|
+
if (!this._isHoveringTooltip) {
|
|
358
|
+
this._hideTooltip();
|
|
359
|
+
}
|
|
360
|
+
}, this.fuiTooltipHideDelay());
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
if (!this._isHoveringTooltip) {
|
|
364
|
+
this._hideTooltip();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
_showTooltip() {
|
|
369
|
+
if (this._isVisible() || this.fuiTooltipDisabled() || !this.fuiTooltip().trim()) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
this._createTooltip();
|
|
373
|
+
this._isVisible.set(true);
|
|
374
|
+
// Add click outside listener for click trigger
|
|
375
|
+
if (this.fuiTooltipTrigger() === 'click') {
|
|
376
|
+
setTimeout(() => {
|
|
377
|
+
document.addEventListener('click', this._onDocumentClick, true);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
_hideTooltip() {
|
|
382
|
+
if (!this._isVisible()) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
this._isVisible.set(false);
|
|
386
|
+
this._destroyTooltip();
|
|
387
|
+
document.removeEventListener('click', this._onDocumentClick, true);
|
|
388
|
+
}
|
|
389
|
+
_createTooltip() {
|
|
390
|
+
if (this._overlayRef) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
// Create tooltip component first
|
|
394
|
+
this._tooltipComponent = createComponent(FuiTooltipComponent, {
|
|
395
|
+
environmentInjector: this._environmentInjector,
|
|
396
|
+
});
|
|
397
|
+
// Set tooltip properties immediately
|
|
398
|
+
this._tooltipComponent.setInput('content', this.fuiTooltip());
|
|
399
|
+
this._tooltipComponent.setInput('position', this.fuiTooltipPosition());
|
|
400
|
+
this._tooltipComponent.setInput('size', this.fuiTooltipSize());
|
|
401
|
+
this._tooltipComponent.setInput('maxWidth', this.fuiTooltipMaxWidth());
|
|
402
|
+
this._tooltipComponent.setInput('arrow', this.fuiTooltipArrow());
|
|
403
|
+
this._tooltipComponent.setInput('tooltipId', this.tooltipId());
|
|
404
|
+
// Trigger change detection to ensure component is rendered with correct props
|
|
405
|
+
this._tooltipComponent.changeDetectorRef.detectChanges();
|
|
406
|
+
// Now create overlay with positioning strategy
|
|
407
|
+
const positions = this._getPositionsForTooltipPosition(this.fuiTooltipPosition());
|
|
408
|
+
const positionStrategy = this._overlayService
|
|
409
|
+
.position()
|
|
410
|
+
.connectedTo(this._elementRef, positions)
|
|
411
|
+
.withPush(true)
|
|
412
|
+
.withViewportMargin(8);
|
|
413
|
+
// Create overlay
|
|
414
|
+
this._overlayRef = this._overlayService.create({
|
|
415
|
+
positionStrategy,
|
|
416
|
+
scrollStrategy: this._overlayService.scrollStrategies.reposition(20),
|
|
417
|
+
panelClass: 'fui-tooltip-panel',
|
|
418
|
+
});
|
|
419
|
+
// Attach component to overlay
|
|
420
|
+
this._overlayRef.attach(this._tooltipComponent);
|
|
421
|
+
// Set up hover events for tooltip persistence
|
|
422
|
+
const tooltipElement = this._tooltipComponent.location.nativeElement;
|
|
423
|
+
tooltipElement.addEventListener('mouseenter', () => {
|
|
424
|
+
this._isHoveringTooltip = true;
|
|
425
|
+
this._clearTimeouts();
|
|
426
|
+
});
|
|
427
|
+
tooltipElement.addEventListener('mouseleave', () => {
|
|
428
|
+
this._isHoveringTooltip = false;
|
|
429
|
+
if (this.fuiTooltipTrigger() === 'hover') {
|
|
430
|
+
this._scheduleHide();
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
_getPositionsForTooltipPosition(position) {
|
|
435
|
+
const offset = this.fuiTooltipOffset();
|
|
436
|
+
const positionMap = {
|
|
437
|
+
top: [
|
|
438
|
+
{ originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -offset },
|
|
439
|
+
{ originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: offset },
|
|
440
|
+
],
|
|
441
|
+
'top-start': [
|
|
442
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -offset },
|
|
443
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: offset },
|
|
444
|
+
],
|
|
445
|
+
'top-end': [
|
|
446
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -offset },
|
|
447
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: offset },
|
|
448
|
+
],
|
|
449
|
+
bottom: [
|
|
450
|
+
{ originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: offset },
|
|
451
|
+
{ originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -offset },
|
|
452
|
+
],
|
|
453
|
+
'bottom-start': [
|
|
454
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: offset },
|
|
455
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -offset },
|
|
456
|
+
],
|
|
457
|
+
'bottom-end': [
|
|
458
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: offset },
|
|
459
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -offset },
|
|
460
|
+
],
|
|
461
|
+
left: [
|
|
462
|
+
{ originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -offset },
|
|
463
|
+
{ originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: offset },
|
|
464
|
+
],
|
|
465
|
+
'left-start': [
|
|
466
|
+
{ originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top', offsetX: -offset },
|
|
467
|
+
{ originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: offset },
|
|
468
|
+
],
|
|
469
|
+
'left-end': [
|
|
470
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom', offsetX: -offset },
|
|
471
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: offset },
|
|
472
|
+
],
|
|
473
|
+
right: [
|
|
474
|
+
{ originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: offset },
|
|
475
|
+
{ originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -offset },
|
|
476
|
+
],
|
|
477
|
+
'right-start': [
|
|
478
|
+
{ originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: offset },
|
|
479
|
+
{ originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top', offsetX: -offset },
|
|
480
|
+
],
|
|
481
|
+
'right-end': [
|
|
482
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: offset },
|
|
483
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom', offsetX: -offset },
|
|
484
|
+
],
|
|
485
|
+
};
|
|
486
|
+
return positionMap[position] || positionMap.top;
|
|
487
|
+
}
|
|
488
|
+
_destroyTooltip() {
|
|
489
|
+
if (this._overlayRef) {
|
|
490
|
+
this._overlayRef.dispose();
|
|
491
|
+
this._overlayRef = null;
|
|
492
|
+
}
|
|
493
|
+
if (this._tooltipComponent) {
|
|
494
|
+
this._tooltipComponent.destroy();
|
|
495
|
+
this._tooltipComponent = null;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
_clearTimeouts() {
|
|
499
|
+
if (this._showTimeout) {
|
|
500
|
+
clearTimeout(this._showTimeout);
|
|
501
|
+
this._showTimeout = null;
|
|
502
|
+
}
|
|
503
|
+
if (this._hideTimeout) {
|
|
504
|
+
clearTimeout(this._hideTimeout);
|
|
505
|
+
this._hideTimeout = null;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
_onDocumentClick = (event) => {
|
|
509
|
+
const target = event.target;
|
|
510
|
+
const triggerElement = this._elementRef.nativeElement;
|
|
511
|
+
const tooltipElement = this._tooltipComponent?.location.nativeElement;
|
|
512
|
+
if (target && !triggerElement.contains(target) && !tooltipElement?.contains(target)) {
|
|
513
|
+
this._hideTooltip();
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
517
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.6", type: FuiTooltipDirective, isStandalone: true, selector: "[fuiTooltip]", inputs: { fuiTooltip: { classPropertyName: "fuiTooltip", publicName: "fuiTooltip", isSignal: true, isRequired: true, transformFunction: null }, fuiTooltipPosition: { classPropertyName: "fuiTooltipPosition", publicName: "fuiTooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipSize: { classPropertyName: "fuiTooltipSize", publicName: "fuiTooltipSize", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipTrigger: { classPropertyName: "fuiTooltipTrigger", publicName: "fuiTooltipTrigger", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipShowDelay: { classPropertyName: "fuiTooltipShowDelay", publicName: "fuiTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipHideDelay: { classPropertyName: "fuiTooltipHideDelay", publicName: "fuiTooltipHideDelay", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipDisabled: { classPropertyName: "fuiTooltipDisabled", publicName: "fuiTooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipMaxWidth: { classPropertyName: "fuiTooltipMaxWidth", publicName: "fuiTooltipMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipOffset: { classPropertyName: "fuiTooltipOffset", publicName: "fuiTooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipArrow: { classPropertyName: "fuiTooltipArrow", publicName: "fuiTooltipArrow", isSignal: true, isRequired: false, transformFunction: null }, fuiTooltipShow: { classPropertyName: "fuiTooltipShow", publicName: "fuiTooltipShow", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "focus": "onFocus()", "blur": "onBlur()", "click": "onClick()", "keydown": "onKeydown($event)" }, properties: { "attr.aria-describedby": "isVisible() ? tooltipId() : null" } }, ngImport: i0 });
|
|
518
|
+
}
|
|
519
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTooltipDirective, decorators: [{
|
|
520
|
+
type: Directive,
|
|
521
|
+
args: [{
|
|
522
|
+
selector: '[fuiTooltip]',
|
|
523
|
+
standalone: true,
|
|
524
|
+
host: {
|
|
525
|
+
'[attr.aria-describedby]': 'isVisible() ? tooltipId() : null',
|
|
526
|
+
},
|
|
527
|
+
}]
|
|
528
|
+
}], ctorParameters: () => [], propDecorators: { fuiTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltip", required: true }] }], fuiTooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipPosition", required: false }] }], fuiTooltipSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipSize", required: false }] }], fuiTooltipTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipTrigger", required: false }] }], fuiTooltipShowDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipShowDelay", required: false }] }], fuiTooltipHideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipHideDelay", required: false }] }], fuiTooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipDisabled", required: false }] }], fuiTooltipMaxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipMaxWidth", required: false }] }], fuiTooltipOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipOffset", required: false }] }], fuiTooltipArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipArrow", required: false }] }], fuiTooltipShow: [{ type: i0.Input, args: [{ isSignal: true, alias: "fuiTooltipShow", required: false }] }], onMouseEnter: [{
|
|
529
|
+
type: HostListener,
|
|
530
|
+
args: ['mouseenter']
|
|
531
|
+
}], onMouseLeave: [{
|
|
532
|
+
type: HostListener,
|
|
533
|
+
args: ['mouseleave']
|
|
534
|
+
}], onFocus: [{
|
|
535
|
+
type: HostListener,
|
|
536
|
+
args: ['focus']
|
|
537
|
+
}], onBlur: [{
|
|
538
|
+
type: HostListener,
|
|
539
|
+
args: ['blur']
|
|
540
|
+
}], onClick: [{
|
|
541
|
+
type: HostListener,
|
|
542
|
+
args: ['click']
|
|
543
|
+
}], onKeydown: [{
|
|
544
|
+
type: HostListener,
|
|
545
|
+
args: ['keydown', ['$event']]
|
|
546
|
+
}] } });
|
|
547
|
+
|
|
548
|
+
// Public API for tooltip component
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Generated bundle index. Do not edit.
|
|
552
|
+
*/
|
|
553
|
+
|
|
554
|
+
export { FuiTooltipComponent, FuiTooltipDirective, TOOLTIP_POSITIONS, TOOLTIP_SIZES, TOOLTIP_TRIGGERS };
|
|
555
|
+
//# sourceMappingURL=raintonic-formaui-components-tooltip.mjs.map
|