@nanahoshi/mona-ui 0.27.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,29 +1,24 @@
1
- import { Directionality } from '@angular/cdk/bidi';
2
- import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { inject, DestroyRef, computed, signal, viewChild, TemplateRef, input, output, effect, untracked, ElementRef, Component, EnvironmentInjector, afterNextRender, createComponent, Directive } from '@angular/core';
5
- import { resolveComponentDirection } from '@nanahoshi/mona-ui/i18n';
6
- import { themeOverlaySurfaceClasses, HoverIntent, createElementControlId, listenForHover, resolveOverlaySide, overlaySidePositions, addAriaReference, onDisconnect, sideOfPosition, removeAriaReference } from '@nanahoshi/mona-ui/internal';
7
- import { PopupService, fadePopupAnimation, PopupCloseSource } from '@nanahoshi/mona-ui/popup';
8
- import { take, takeUntil } from 'rxjs';
9
- import { cva } from 'class-variance-authority';
10
- import { twMerge } from 'tailwind-merge';
11
-
1
+ import { Directionality } from "@angular/cdk/bidi";
2
+ import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, DestroyRef, Directive, ElementRef, EnvironmentInjector, TemplateRef, afterNextRender, computed, createComponent, effect, inject, input, output, signal, untracked, viewChild } from "@angular/core";
5
+ import { resolveComponentDirection } from "@nanahoshi/mona-ui/i18n";
6
+ import { HoverIntent, addAriaReference, createElementControlId, listenForHover, onDisconnect, overlaySidePositions, removeAriaReference, resolveOverlaySide, sideOfPosition, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
7
+ import { PopupCloseSource, PopupService, fadePopupAnimation } from "@nanahoshi/mona-ui/popup";
8
+ import { take, takeUntil } from "rxjs";
9
+ import { cva } from "class-variance-authority";
10
+ import { twMerge } from "tailwind-merge";
12
11
  const tooltipBaseThemeVariants = cva(`
13
12
  relative z-1 flex items-center justify-center
14
13
  ${themeOverlaySurfaceClasses} text-foreground
15
14
  border border-border shadow-(--shadow-overlay)
16
- `, {
17
- variants: {
18
- rounded: {
19
- full: "rounded-full",
20
- large: "rounded-lg",
21
- medium: "rounded-md",
22
- none: "rounded-none",
23
- small: "rounded-sm"
24
- }
25
- }
26
- });
15
+ `, { variants: { rounded: {
16
+ full: "rounded-full",
17
+ large: "rounded-lg",
18
+ medium: "rounded-md",
19
+ none: "rounded-none",
20
+ small: "rounded-sm"
21
+ } } });
27
22
  const tooltipArrowThemeVariants = cva(`
28
23
  absolute z-0 h-3 w-3 rotate-45 transform-center box-border
29
24
  pointer-events-none
@@ -50,477 +45,686 @@ const tooltipArrowThemeVariants = cva(`
50
45
  data-[position="right"]:border-t-0
51
46
  data-[position="right"]:[clip-path:inset(1px_1px_0_0)]
52
47
  `);
53
-
54
- /** The gap between a tooltip and its anchor, leaving room for the arrow. */
55
48
  const TOOLTIP_GAP$1 = 12;
56
- class TooltipComponent {
57
- #destroyRef;
58
- #directionality;
59
- #document;
60
- #intent;
61
- #popupService;
62
- #destroyed;
63
- #popupRef;
64
- constructor() {
65
- this.#destroyRef = inject(DestroyRef);
66
- this.#directionality = inject(Directionality, { optional: true });
67
- this.#document = inject(DOCUMENT);
68
- this.#intent = new HoverIntent({
69
- hide: () => this.#popupRef?.close(),
70
- hideDelay: () => this.hideDelay(),
71
- show: anchor => this.#open(anchor),
72
- showDelay: () => this.showDelay()
73
- });
74
- this.#popupService = inject(PopupService);
75
- this.#destroyed = false;
76
- this.#popupRef = null;
77
- this.arrowClasses = computed(() => {
78
- return tooltipArrowThemeVariants();
79
- }, /* @ts-ignore */
80
- ...(ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []));
81
- this.baseClasses = computed(() => {
82
- const rounded = this.rounded();
83
- return tooltipBaseThemeVariants({ rounded });
84
- }, /* @ts-ignore */
85
- ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
86
- this.currentArrowPosition = signal("top", /* @ts-ignore */
87
- ...(ngDevMode ? [{ debugName: "currentArrowPosition" }] : /* istanbul ignore next */ []));
88
- this.templateRef = viewChild.required(TemplateRef, /* @ts-ignore */
89
- ...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
90
- this.tooltipId = createElementControlId();
91
- /**
92
- * @description Whether the tooltip is disabled. When disabled, the tooltip will not be shown, and an open one
93
- * closes.
94
- */
95
- this.disabled = input(false, /* @ts-ignore */
96
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
97
- /**
98
- * @description Emitted when the tooltip popup is hidden.
99
- */
100
- this.hidden = output();
101
- /**
102
- * @description The delay in milliseconds before hiding the tooltip after the pointer or focus leaves. A pointer
103
- * that leaves always gets a short grace, so it can move onto the tooltip.
104
- */
105
- this.hideDelay = input(0, /* @ts-ignore */
106
- ...(ngDevMode ? [{ debugName: "hideDelay" }] : /* istanbul ignore next */ []));
107
- /**
108
- * @description The side of the target the tooltip opens on. `left` and `right` are physical; `start` and `end`
109
- * follow the text direction. It flips to the opposite side when there isn't room.
110
- */
111
- this.position = input("top", /* @ts-ignore */
112
- ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
113
- /**
114
- * @description The border radius of the tooltip.
115
- */
116
- this.rounded = input("medium", /* @ts-ignore */
117
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
118
- /**
119
- * @description The delay in milliseconds before showing the tooltip after the trigger event.
120
- */
121
- this.showDelay = input(0, /* @ts-ignore */
122
- ...(ngDevMode ? [{ debugName: "showDelay" }] : /* istanbul ignore next */ []));
123
- /**
124
- * @description Emitted when the tooltip popup is shown.
125
- */
126
- this.shown = output();
127
- /**
128
- * @description The target element(s) to which the tooltip is attached.
129
- * Can be an Element, ElementRef, or CSS selector string. A selector matches elements anywhere in the document,
130
- * including ones added later.
131
- */
132
- this.target = input.required(/* @ts-ignore */
133
- ...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
134
- effect(onCleanup => {
135
- const target = this.target();
136
- this.position();
137
- const stop = untracked(() => this.#listen(target));
138
- onCleanup(() => {
139
- stop();
140
- this.#intent.hideNow();
141
- });
142
- });
143
- effect(() => {
144
- if (this.disabled()) {
145
- untracked(() => this.#intent.hideNow());
146
- }
147
- });
148
- this.#destroyRef.onDestroy(() => {
149
- this.#destroyed = true;
150
- this.#intent.dispose();
151
- this.#popupRef?.close();
152
- });
153
- }
154
- #listen(target) {
155
- if (typeof target === "string") {
156
- return listenForHover(this.#document, node => node.closest(target), this.#intent);
157
- }
158
- const element = target instanceof ElementRef ? target.nativeElement : target;
159
- if (!(element instanceof HTMLElement)) {
160
- return () => undefined;
161
- }
162
- return listenForHover(element, node => (element.contains(node) ? element : null), this.#intent);
163
- }
164
- #open(anchor) {
165
- if (this.disabled() || this.#destroyed) {
166
- return;
167
- }
168
- const direction = resolveComponentDirection(anchor, this.#directionality);
169
- const side = resolveOverlaySide(this.position(), direction);
170
- this.currentArrowPosition.set(side);
171
- const popupRef = this.#popupService.create({
172
- anchor,
173
- animation: fadePopupAnimation,
174
- closeOnEscape: true,
175
- closeOnMouseLeave: false,
176
- closeOnOutsideClick: true,
177
- content: this.templateRef(),
178
- hasBackdrop: false,
179
- positions: overlaySidePositions(side, TOOLTIP_GAP$1, direction),
180
- restoreFocus: false,
181
- withPush: false
182
- });
183
- this.#popupRef = popupRef;
184
- addAriaReference(anchor, "aria-describedby", this.tooltipId);
185
- this.#intent.opened(anchor, popupRef.overlayRef.overlayElement);
186
- const stopWatching = onDisconnect(anchor, () => popupRef.close());
187
- popupRef.opened.pipe(take(1)).subscribe(() => {
188
- if (!this.#destroyed) {
189
- this.shown.emit();
190
- }
191
- });
192
- popupRef.positionChanges.pipe(takeUntil(popupRef.closeStart)).subscribe(position => {
193
- this.currentArrowPosition.set(sideOfPosition(position, direction));
194
- });
195
- popupRef.closeStart.pipe(take(1)).subscribe(event => {
196
- stopWatching();
197
- removeAriaReference(anchor, "aria-describedby", this.tooltipId);
198
- this.#intent.closed(anchor, event.via === PopupCloseSource.Escape);
199
- });
200
- popupRef.closed.pipe(take(1)).subscribe(() => {
201
- if (this.#popupRef === popupRef) {
202
- this.#popupRef = null;
203
- }
204
- if (!this.#destroyed) {
205
- this.hidden.emit();
206
- }
207
- });
208
- }
209
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
210
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: TooltipComponent, isStandalone: true, selector: "mona-tooltip", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "hideDelay", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "showDelay", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { hidden: "hidden", shown: "shown" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template>\n <div role=\"tooltip\" [id]=\"tooltipId\" [class]=\"baseClasses()\">\n <div>\n <ng-content></ng-content>\n </div>\n <div [class]=\"arrowClasses()\" [attr.data-position]=\"currentArrowPosition()\"></div>\n </div>\n</ng-template>\n", styles: [":host{display:contents}\n"] }); }
211
- }
212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipComponent, decorators: [{
213
- type: Component,
214
- args: [{ selector: "mona-tooltip", template: "<ng-template>\n <div role=\"tooltip\" [id]=\"tooltipId\" [class]=\"baseClasses()\">\n <div>\n <ng-content></ng-content>\n </div>\n <div [class]=\"arrowClasses()\" [attr.data-position]=\"currentArrowPosition()\"></div>\n </div>\n</ng-template>\n", styles: [":host{display:contents}\n"] }]
215
- }], ctorParameters: () => [], propDecorators: { templateRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], hidden: [{ type: i0.Output, args: ["hidden"] }], hideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideDelay", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDelay", required: false }] }], shown: [{ type: i0.Output, args: ["shown"] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: true }] }] } });
216
-
217
- /** The gap between a tooltip and its anchor, leaving room for the arrow. */
49
+ var TooltipComponent = class TooltipComponent {
50
+ #destroyRef;
51
+ #directionality;
52
+ #document;
53
+ #intent;
54
+ #popupService;
55
+ #destroyed;
56
+ #popupRef;
57
+ constructor() {
58
+ this.#destroyRef = inject(DestroyRef);
59
+ this.#directionality = inject(Directionality, { optional: true });
60
+ this.#document = inject(DOCUMENT);
61
+ this.#intent = new HoverIntent({
62
+ hide: () => this.#popupRef?.close(),
63
+ hideDelay: () => this.hideDelay(),
64
+ show: (anchor) => this.#open(anchor),
65
+ showDelay: () => this.showDelay()
66
+ });
67
+ this.#popupService = inject(PopupService);
68
+ this.#destroyed = false;
69
+ this.#popupRef = null;
70
+ this.arrowClasses = computed(() => {
71
+ return tooltipArrowThemeVariants();
72
+ }, ...ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []);
73
+ this.baseClasses = computed(() => {
74
+ const rounded = this.rounded();
75
+ return tooltipBaseThemeVariants({ rounded });
76
+ }, ...ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []);
77
+ this.currentArrowPosition = signal("top", ...ngDevMode ? [{ debugName: "currentArrowPosition" }] : /* istanbul ignore next */ []);
78
+ this.templateRef = viewChild.required(TemplateRef, ...ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []);
79
+ this.tooltipId = createElementControlId();
80
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
81
+ this.hidden = output();
82
+ this.hideDelay = input(0, ...ngDevMode ? [{ debugName: "hideDelay" }] : /* istanbul ignore next */ []);
83
+ this.position = input("top", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
84
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
85
+ this.showDelay = input(0, ...ngDevMode ? [{ debugName: "showDelay" }] : /* istanbul ignore next */ []);
86
+ this.shown = output();
87
+ this.target = input.required(...ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []);
88
+ effect((onCleanup) => {
89
+ const target = this.target();
90
+ this.position();
91
+ const stop = untracked(() => this.#listen(target));
92
+ onCleanup(() => {
93
+ stop();
94
+ this.#intent.hideNow();
95
+ });
96
+ });
97
+ effect(() => {
98
+ if (this.disabled()) untracked(() => this.#intent.hideNow());
99
+ });
100
+ this.#destroyRef.onDestroy(() => {
101
+ this.#destroyed = true;
102
+ this.#intent.dispose();
103
+ this.#popupRef?.close();
104
+ });
105
+ }
106
+ #listen(target) {
107
+ if (typeof target === "string") return listenForHover(this.#document, (node) => node.closest(target), this.#intent);
108
+ const element = target instanceof ElementRef ? target.nativeElement : target;
109
+ if (!(element instanceof HTMLElement)) return () => void 0;
110
+ return listenForHover(element, (node) => element.contains(node) ? element : null, this.#intent);
111
+ }
112
+ #open(anchor) {
113
+ if (this.disabled() || this.#destroyed) return;
114
+ const direction = resolveComponentDirection(anchor, this.#directionality);
115
+ const side = resolveOverlaySide(this.position(), direction);
116
+ this.currentArrowPosition.set(side);
117
+ const popupRef = this.#popupService.create({
118
+ anchor,
119
+ animation: fadePopupAnimation,
120
+ closeOnEscape: true,
121
+ closeOnMouseLeave: false,
122
+ closeOnOutsideClick: true,
123
+ content: this.templateRef(),
124
+ hasBackdrop: false,
125
+ positions: overlaySidePositions(side, TOOLTIP_GAP$1, direction),
126
+ restoreFocus: false,
127
+ withPush: false
128
+ });
129
+ this.#popupRef = popupRef;
130
+ addAriaReference(anchor, "aria-describedby", this.tooltipId);
131
+ this.#intent.opened(anchor, popupRef.overlayRef.overlayElement);
132
+ const stopWatching = onDisconnect(anchor, () => popupRef.close());
133
+ popupRef.opened.pipe(take(1)).subscribe(() => {
134
+ if (!this.#destroyed) this.shown.emit();
135
+ });
136
+ popupRef.positionChanges.pipe(takeUntil(popupRef.closeStart)).subscribe((position) => {
137
+ this.currentArrowPosition.set(sideOfPosition(position, direction));
138
+ });
139
+ popupRef.closeStart.pipe(take(1)).subscribe((event) => {
140
+ stopWatching();
141
+ removeAriaReference(anchor, "aria-describedby", this.tooltipId);
142
+ this.#intent.closed(anchor, event.via === PopupCloseSource.Escape);
143
+ });
144
+ popupRef.closed.pipe(take(1)).subscribe(() => {
145
+ if (this.#popupRef === popupRef) this.#popupRef = null;
146
+ if (!this.#destroyed) this.hidden.emit();
147
+ });
148
+ }
149
+ static {
150
+ this.ɵfac = i0.ɵɵngDeclareFactory({
151
+ minVersion: "12.0.0",
152
+ version: "22.2.6",
153
+ ngImport: i0,
154
+ type: TooltipComponent,
155
+ deps: [],
156
+ target: i0.ɵɵFactoryTarget.Component
157
+ });
158
+ }
159
+ static {
160
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
161
+ minVersion: "17.2.0",
162
+ version: "22.2.6",
163
+ type: TooltipComponent,
164
+ isStandalone: true,
165
+ selector: "mona-tooltip",
166
+ inputs: {
167
+ disabled: {
168
+ classPropertyName: "disabled",
169
+ publicName: "disabled",
170
+ isSignal: true,
171
+ isRequired: false,
172
+ transformFunction: null
173
+ },
174
+ hideDelay: {
175
+ classPropertyName: "hideDelay",
176
+ publicName: "hideDelay",
177
+ isSignal: true,
178
+ isRequired: false,
179
+ transformFunction: null
180
+ },
181
+ position: {
182
+ classPropertyName: "position",
183
+ publicName: "position",
184
+ isSignal: true,
185
+ isRequired: false,
186
+ transformFunction: null
187
+ },
188
+ rounded: {
189
+ classPropertyName: "rounded",
190
+ publicName: "rounded",
191
+ isSignal: true,
192
+ isRequired: false,
193
+ transformFunction: null
194
+ },
195
+ showDelay: {
196
+ classPropertyName: "showDelay",
197
+ publicName: "showDelay",
198
+ isSignal: true,
199
+ isRequired: false,
200
+ transformFunction: null
201
+ },
202
+ target: {
203
+ classPropertyName: "target",
204
+ publicName: "target",
205
+ isSignal: true,
206
+ isRequired: true,
207
+ transformFunction: null
208
+ }
209
+ },
210
+ outputs: {
211
+ hidden: "hidden",
212
+ shown: "shown"
213
+ },
214
+ viewQueries: [{
215
+ propertyName: "templateRef",
216
+ first: true,
217
+ predicate: TemplateRef,
218
+ descendants: true,
219
+ isSignal: true
220
+ }],
221
+ ngImport: i0,
222
+ template: "<ng-template>\n <div role=\"tooltip\" [id]=\"tooltipId\" [class]=\"baseClasses()\">\n <div>\n <ng-content></ng-content>\n </div>\n <div [class]=\"arrowClasses()\" [attr.data-position]=\"currentArrowPosition()\"></div>\n </div>\n</ng-template>\n",
223
+ styles: [":host{display:contents}\n"]
224
+ });
225
+ }
226
+ };
227
+ i0.ɵɵngDeclareClassMetadata({
228
+ minVersion: "12.0.0",
229
+ version: "22.2.6",
230
+ ngImport: i0,
231
+ type: TooltipComponent,
232
+ decorators: [{
233
+ type: Component,
234
+ args: [{
235
+ selector: "mona-tooltip",
236
+ template: "<ng-template>\n <div role=\"tooltip\" [id]=\"tooltipId\" [class]=\"baseClasses()\">\n <div>\n <ng-content></ng-content>\n </div>\n <div [class]=\"arrowClasses()\" [attr.data-position]=\"currentArrowPosition()\"></div>\n </div>\n</ng-template>\n",
237
+ styles: [":host{display:contents}\n"]
238
+ }]
239
+ }],
240
+ ctorParameters: () => [],
241
+ propDecorators: {
242
+ templateRef: [{
243
+ type: i0.ViewChild,
244
+ args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
245
+ }],
246
+ disabled: [{
247
+ type: i0.Input,
248
+ args: [{
249
+ isSignal: true,
250
+ alias: "disabled",
251
+ required: false
252
+ }]
253
+ }],
254
+ hidden: [{
255
+ type: i0.Output,
256
+ args: ["hidden"]
257
+ }],
258
+ hideDelay: [{
259
+ type: i0.Input,
260
+ args: [{
261
+ isSignal: true,
262
+ alias: "hideDelay",
263
+ required: false
264
+ }]
265
+ }],
266
+ position: [{
267
+ type: i0.Input,
268
+ args: [{
269
+ isSignal: true,
270
+ alias: "position",
271
+ required: false
272
+ }]
273
+ }],
274
+ rounded: [{
275
+ type: i0.Input,
276
+ args: [{
277
+ isSignal: true,
278
+ alias: "rounded",
279
+ required: false
280
+ }]
281
+ }],
282
+ showDelay: [{
283
+ type: i0.Input,
284
+ args: [{
285
+ isSignal: true,
286
+ alias: "showDelay",
287
+ required: false
288
+ }]
289
+ }],
290
+ shown: [{
291
+ type: i0.Output,
292
+ args: ["shown"]
293
+ }],
294
+ target: [{
295
+ type: i0.Input,
296
+ args: [{
297
+ isSignal: true,
298
+ alias: "target",
299
+ required: true
300
+ }]
301
+ }]
302
+ }
303
+ });
218
304
  const TOOLTIP_GAP = 12;
219
- /** Where the directive keeps an element's `title`, so the browser's own tooltip never shows next to it. */
220
305
  const TITLE_ATTRIBUTE = "data-mona-title";
221
- class TooltipDirective {
222
- #destroyRef;
223
- #directionality;
224
- #host;
225
- #injector;
226
- #intent;
227
- /** Elements named by their title, which the directive labels with `aria-label` once the title has moved. */
228
- #labelled;
229
- #popupService;
230
- #stripped;
231
- #suppressed;
232
- #tooltipId;
233
- #destroyed;
234
- #popupRef;
235
- constructor() {
236
- this.#destroyRef = inject(DestroyRef);
237
- this.#directionality = inject(Directionality, { optional: true });
238
- this.#host = inject(ElementRef);
239
- this.#injector = inject(EnvironmentInjector);
240
- this.#intent = new HoverIntent({
241
- hide: () => this.#popupRef?.close(),
242
- hideDelay: () => this.hideDelay(),
243
- show: anchor => this.#open(anchor),
244
- showDelay: () => this.showDelay()
245
- });
246
- /** Elements named by their title, which the directive labels with `aria-label` once the title has moved. */
247
- this.#labelled = new Set();
248
- this.#popupService = inject(PopupService);
249
- this.#stripped = new Set();
250
- this.#suppressed = computed(() => this.disabled() || this.tooltipDisabled(), /* @ts-ignore */
251
- ...(ngDevMode ? [{ debugName: "#suppressed" }] : /* istanbul ignore next */ []));
252
- this.#tooltipId = createElementControlId();
253
- this.#destroyed = false;
254
- this.#popupRef = null;
255
- /**
256
- * @description Reads the tooltip's text from the matched element, in place of its `title`, which then stays where
257
- * it is. An empty result shows nothing.
258
- * @default null
259
- */
260
- this.contentOf = input(null, /* @ts-ignore */
261
- ...(ngDevMode ? [{ debugName: "contentOf" }] : /* istanbul ignore next */ []));
262
- /**
263
- * @description Whether the tooltip is disabled. When disabled, the tooltip will not be shown, and an open one
264
- * closes. On a button or another control, `[disabled]` also reaches the control, so use {@link tooltipDisabled}
265
- * there.
266
- * @default false
267
- */
268
- this.disabled = input(false, /* @ts-ignore */
269
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
270
- /**
271
- * @description The filter to select elements that will have tooltips.
272
- * It can be a CSS selector that matches elements within the host element, including ones added later.
273
- * Only applies when `mode` is set to `content`.
274
- * @default "[title]"
275
- */
276
- this.filter = input("[title]", /* @ts-ignore */
277
- ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
278
- /**
279
- * @description Emitted when the tooltip popup is hidden.
280
- */
281
- this.hidden = output();
282
- /**
283
- * @description The delay in milliseconds before hiding the tooltip after the pointer or focus leaves. A pointer
284
- * that leaves always gets a short grace, so it can move onto the tooltip.
285
- * @default 0
286
- */
287
- this.hideDelay = input(0, /* @ts-ignore */
288
- ...(ngDevMode ? [{ debugName: "hideDelay" }] : /* istanbul ignore next */ []));
289
- /**
290
- * @description The mode of the tooltip.
291
- * "host" mode shows the host's tooltip content, or its title attribute.
292
- * "content" mode uses the title attribute of elements matching the filter.
293
- * @default "host"
294
- */
295
- this.mode = input("host", /* @ts-ignore */
296
- ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
297
- /**
298
- * @description The tooltip's content in host mode: text, or a template. Without it, the host's `title` is shown.
299
- */
300
- this.monaTooltip = input("", /* @ts-ignore */
301
- ...(ngDevMode ? [{ debugName: "monaTooltip" }] : /* istanbul ignore next */ []));
302
- /**
303
- * @description The side of the target the tooltip opens on. `left` and `right` are physical; `start` and `end`
304
- * follow the text direction. It flips to the opposite side when there isn't room.
305
- * @default "top"
306
- */
307
- this.position = input("top", /* @ts-ignore */
308
- ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
309
- /**
310
- * @description The border radius of the tooltip.
311
- * @default "medium"
312
- */
313
- this.rounded = input("medium", { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), alias: "tooltipRounded" });
314
- /**
315
- * @description The delay in milliseconds before showing the tooltip after the trigger event.
316
- * @default 0
317
- */
318
- this.showDelay = input(0, /* @ts-ignore */
319
- ...(ngDevMode ? [{ debugName: "showDelay" }] : /* istanbul ignore next */ []));
320
- /**
321
- * @description Emitted when the tooltip popup is shown.
322
- */
323
- this.shown = output();
324
- /**
325
- * @description Disables only the tooltip, like {@link disabled}, on an element whose own `disabled` would take the
326
- * same binding, such as a `monaButton` or a native control.
327
- * @default false
328
- */
329
- this.tooltipDisabled = input(false, /* @ts-ignore */
330
- ...(ngDevMode ? [{ debugName: "tooltipDisabled" }] : /* istanbul ignore next */ []));
331
- effect(onCleanup => {
332
- const mode = this.mode();
333
- const filter = this.filter();
334
- this.position();
335
- const stop = untracked(() => this.#listen(mode, filter));
336
- onCleanup(() => {
337
- stop();
338
- this.#intent.hideNow();
339
- });
340
- });
341
- effect(() => {
342
- if (this.#suppressed()) {
343
- untracked(() => this.#intent.hideNow());
344
- }
345
- });
346
- // The host's title moves aside at once, so the browser's tooltip never shows for it.
347
- afterNextRender({
348
- write: () => {
349
- if (this.mode() === "host") {
350
- this.#textOf(this.#host.nativeElement);
351
- }
352
- }
353
- });
354
- this.#destroyRef.onDestroy(() => {
355
- this.#destroyed = true;
356
- this.#intent.dispose();
357
- this.#popupRef?.close();
358
- for (const element of this.#stripped) {
359
- const title = element.getAttribute(TITLE_ATTRIBUTE);
360
- element.removeAttribute(TITLE_ATTRIBUTE);
361
- if (this.#labelled.has(element) && element.getAttribute("aria-label") === title) {
362
- element.removeAttribute("aria-label");
363
- }
364
- if (title != null && !element.hasAttribute("title")) {
365
- element.setAttribute("title", title);
366
- }
367
- }
368
- this.#labelled.clear();
369
- this.#stripped.clear();
370
- });
371
- }
372
- #contentFor(anchor) {
373
- const contentOf = this.contentOf();
374
- if (contentOf) {
375
- return contentOf(anchor);
376
- }
377
- return this.mode() === "host" ? this.monaTooltip() || this.#textOf(anchor) : this.#textOf(anchor);
378
- }
379
- #listen(mode, filter) {
380
- const host = this.#host.nativeElement;
381
- if (mode === "host") {
382
- return listenForHover(host, node => (host.contains(node) ? host : null), this.#intent);
383
- }
384
- // Elements whose title the directive has already moved aside no longer match a `[title]` filter.
385
- const selector = `${filter}, [${TITLE_ATTRIBUTE}]`;
386
- return listenForHover(host, node => {
387
- const match = node.closest(selector);
388
- return match && match !== host && host.contains(match) ? match : null;
389
- }, this.#intent);
390
- }
391
- #open(anchor) {
392
- if (this.#suppressed() || this.#destroyed) {
393
- return;
394
- }
395
- const content = this.#contentFor(anchor);
396
- if (!content) {
397
- return;
398
- }
399
- const direction = resolveComponentDirection(anchor, this.#directionality);
400
- const side = resolveOverlaySide(this.position(), direction);
401
- const component = createComponent(TooltipTemplateComponent, { environmentInjector: this.#injector });
402
- component.setInput("content", content);
403
- component.setInput("rounded", this.rounded());
404
- component.setInput("tooltipId", this.#tooltipId);
405
- component.instance.currentArrowPosition.set(side);
406
- component.changeDetectorRef.detectChanges();
407
- const popupRef = this.#popupService.create({
408
- anchor,
409
- animation: fadePopupAnimation,
410
- closeOnEscape: true,
411
- closeOnMouseLeave: false,
412
- closeOnOutsideClick: true,
413
- content: component.instance.templateRef(),
414
- hasBackdrop: false,
415
- positions: overlaySidePositions(side, TOOLTIP_GAP, direction),
416
- restoreFocus: false,
417
- withPush: false
418
- });
419
- this.#popupRef = popupRef;
420
- addAriaReference(anchor, "aria-describedby", this.#tooltipId);
421
- this.#intent.opened(anchor, popupRef.overlayRef.overlayElement);
422
- const stopWatching = onDisconnect(anchor, () => popupRef.close());
423
- popupRef.opened.pipe(take(1)).subscribe(() => {
424
- if (!this.#destroyed) {
425
- this.shown.emit();
426
- }
427
- });
428
- popupRef.positionChanges.pipe(takeUntil(popupRef.closeStart)).subscribe(position => {
429
- component.instance.currentArrowPosition.set(sideOfPosition(position, direction));
430
- });
431
- popupRef.closeStart.pipe(take(1)).subscribe(event => {
432
- stopWatching();
433
- removeAriaReference(anchor, "aria-describedby", this.#tooltipId);
434
- this.#intent.closed(anchor, event.via === PopupCloseSource.Escape);
435
- });
436
- popupRef.closed.pipe(take(1)).subscribe(() => {
437
- if (this.#popupRef === popupRef) {
438
- this.#popupRef = null;
439
- }
440
- component.destroy();
441
- if (!this.#destroyed) {
442
- this.hidden.emit();
443
- }
444
- });
445
- }
446
- /**
447
- * The tooltip text of an element. A `title` set on it (again) moves to `data-mona-title`, where it stays for
448
- * the directive's lifetime and is put back when the directive is destroyed. An element that has no other name,
449
- * such as an icon-only button, keeps the title as its name through `aria-label`.
450
- */
451
- #textOf(element) {
452
- const title = element.getAttribute("title");
453
- if (title != null) {
454
- const namedByTitle = this.#labelled.has(element) || !hasNameOfItsOwn(element);
455
- element.setAttribute(TITLE_ATTRIBUTE, title);
456
- element.removeAttribute("title");
457
- this.#stripped.add(element);
458
- if (namedByTitle && title.trim()) {
459
- element.setAttribute("aria-label", title);
460
- this.#labelled.add(element);
461
- }
462
- }
463
- return element.getAttribute(TITLE_ATTRIBUTE) ?? "";
464
- }
465
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
466
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TooltipDirective, isStandalone: true, selector: "[monaTooltip]", inputs: { contentOf: { classPropertyName: "contentOf", publicName: "contentOf", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "hideDelay", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, monaTooltip: { classPropertyName: "monaTooltip", publicName: "monaTooltip", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "tooltipRounded", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "showDelay", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { hidden: "hidden", shown: "shown" }, ngImport: i0 }); }
467
- }
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipDirective, decorators: [{
469
- type: Directive,
470
- args: [{
471
- selector: "[monaTooltip]"
472
- }]
473
- }], ctorParameters: () => [], propDecorators: { contentOf: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentOf", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], hidden: [{ type: i0.Output, args: ["hidden"] }], hideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideDelay", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], monaTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaTooltip", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipRounded", required: false }] }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDelay", required: false }] }], shown: [{ type: i0.Output, args: ["shown"] }], tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }] } });
474
- /** Whether an element is named by something other than its `title`: a label attribute, or text or images inside. */
306
+ var TooltipDirective = class TooltipDirective {
307
+ #destroyRef;
308
+ #directionality;
309
+ #host;
310
+ #injector;
311
+ #intent;
312
+ #labelled;
313
+ #popupService;
314
+ #stripped;
315
+ #suppressed;
316
+ #tooltipId;
317
+ #destroyed;
318
+ #popupRef;
319
+ constructor() {
320
+ this.#destroyRef = inject(DestroyRef);
321
+ this.#directionality = inject(Directionality, { optional: true });
322
+ this.#host = inject(ElementRef);
323
+ this.#injector = inject(EnvironmentInjector);
324
+ this.#intent = new HoverIntent({
325
+ hide: () => this.#popupRef?.close(),
326
+ hideDelay: () => this.hideDelay(),
327
+ show: (anchor) => this.#open(anchor),
328
+ showDelay: () => this.showDelay()
329
+ });
330
+ this.#labelled = /* @__PURE__ */ new Set();
331
+ this.#popupService = inject(PopupService);
332
+ this.#stripped = /* @__PURE__ */ new Set();
333
+ this.#suppressed = computed(() => this.disabled() || this.tooltipDisabled(), ...ngDevMode ? [{ debugName: "#suppressed" }] : /* istanbul ignore next */ []);
334
+ this.#tooltipId = createElementControlId();
335
+ this.#destroyed = false;
336
+ this.#popupRef = null;
337
+ this.contentOf = input(null, ...ngDevMode ? [{ debugName: "contentOf" }] : /* istanbul ignore next */ []);
338
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
339
+ this.filter = input("[title]", ...ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []);
340
+ this.hidden = output();
341
+ this.hideDelay = input(0, ...ngDevMode ? [{ debugName: "hideDelay" }] : /* istanbul ignore next */ []);
342
+ this.mode = input("host", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
343
+ this.monaTooltip = input("", ...ngDevMode ? [{ debugName: "monaTooltip" }] : /* istanbul ignore next */ []);
344
+ this.position = input("top", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
345
+ this.rounded = input("medium", {
346
+ ...ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {},
347
+ alias: "tooltipRounded"
348
+ });
349
+ this.showDelay = input(0, ...ngDevMode ? [{ debugName: "showDelay" }] : /* istanbul ignore next */ []);
350
+ this.shown = output();
351
+ this.tooltipDisabled = input(false, ...ngDevMode ? [{ debugName: "tooltipDisabled" }] : /* istanbul ignore next */ []);
352
+ effect((onCleanup) => {
353
+ const mode = this.mode();
354
+ const filter = this.filter();
355
+ this.position();
356
+ const stop = untracked(() => this.#listen(mode, filter));
357
+ onCleanup(() => {
358
+ stop();
359
+ this.#intent.hideNow();
360
+ });
361
+ });
362
+ effect(() => {
363
+ if (this.#suppressed()) untracked(() => this.#intent.hideNow());
364
+ });
365
+ afterNextRender({ write: () => {
366
+ if (this.mode() === "host") this.#textOf(this.#host.nativeElement);
367
+ } });
368
+ this.#destroyRef.onDestroy(() => {
369
+ this.#destroyed = true;
370
+ this.#intent.dispose();
371
+ this.#popupRef?.close();
372
+ for (const element of this.#stripped) {
373
+ const title = element.getAttribute(TITLE_ATTRIBUTE);
374
+ element.removeAttribute(TITLE_ATTRIBUTE);
375
+ if (this.#labelled.has(element) && element.getAttribute("aria-label") === title) element.removeAttribute("aria-label");
376
+ if (title != null && !element.hasAttribute("title")) element.setAttribute("title", title);
377
+ }
378
+ this.#labelled.clear();
379
+ this.#stripped.clear();
380
+ });
381
+ }
382
+ #contentFor(anchor) {
383
+ const contentOf = this.contentOf();
384
+ if (contentOf) return contentOf(anchor);
385
+ return this.mode() === "host" ? this.monaTooltip() || this.#textOf(anchor) : this.#textOf(anchor);
386
+ }
387
+ #listen(mode, filter) {
388
+ const host = this.#host.nativeElement;
389
+ if (mode === "host") return listenForHover(host, (node) => host.contains(node) ? host : null, this.#intent);
390
+ const selector = `${filter}, [${TITLE_ATTRIBUTE}]`;
391
+ return listenForHover(host, (node) => {
392
+ const match = node.closest(selector);
393
+ return match && match !== host && host.contains(match) ? match : null;
394
+ }, this.#intent);
395
+ }
396
+ #open(anchor) {
397
+ if (this.#suppressed() || this.#destroyed) return;
398
+ const content = this.#contentFor(anchor);
399
+ if (!content) return;
400
+ const direction = resolveComponentDirection(anchor, this.#directionality);
401
+ const side = resolveOverlaySide(this.position(), direction);
402
+ const component = createComponent(TooltipTemplateComponent, { environmentInjector: this.#injector });
403
+ component.setInput("content", content);
404
+ component.setInput("rounded", this.rounded());
405
+ component.setInput("tooltipId", this.#tooltipId);
406
+ component.instance.currentArrowPosition.set(side);
407
+ component.changeDetectorRef.detectChanges();
408
+ const popupRef = this.#popupService.create({
409
+ anchor,
410
+ animation: fadePopupAnimation,
411
+ closeOnEscape: true,
412
+ closeOnMouseLeave: false,
413
+ closeOnOutsideClick: true,
414
+ content: component.instance.templateRef(),
415
+ hasBackdrop: false,
416
+ positions: overlaySidePositions(side, TOOLTIP_GAP, direction),
417
+ restoreFocus: false,
418
+ withPush: false
419
+ });
420
+ this.#popupRef = popupRef;
421
+ addAriaReference(anchor, "aria-describedby", this.#tooltipId);
422
+ this.#intent.opened(anchor, popupRef.overlayRef.overlayElement);
423
+ const stopWatching = onDisconnect(anchor, () => popupRef.close());
424
+ popupRef.opened.pipe(take(1)).subscribe(() => {
425
+ if (!this.#destroyed) this.shown.emit();
426
+ });
427
+ popupRef.positionChanges.pipe(takeUntil(popupRef.closeStart)).subscribe((position) => {
428
+ component.instance.currentArrowPosition.set(sideOfPosition(position, direction));
429
+ });
430
+ popupRef.closeStart.pipe(take(1)).subscribe((event) => {
431
+ stopWatching();
432
+ removeAriaReference(anchor, "aria-describedby", this.#tooltipId);
433
+ this.#intent.closed(anchor, event.via === PopupCloseSource.Escape);
434
+ });
435
+ popupRef.closed.pipe(take(1)).subscribe(() => {
436
+ if (this.#popupRef === popupRef) this.#popupRef = null;
437
+ component.destroy();
438
+ if (!this.#destroyed) this.hidden.emit();
439
+ });
440
+ }
441
+ #textOf(element) {
442
+ const title = element.getAttribute("title");
443
+ if (title != null) {
444
+ const namedByTitle = this.#labelled.has(element) || !hasNameOfItsOwn(element);
445
+ element.setAttribute(TITLE_ATTRIBUTE, title);
446
+ element.removeAttribute("title");
447
+ this.#stripped.add(element);
448
+ if (namedByTitle && title.trim()) {
449
+ element.setAttribute("aria-label", title);
450
+ this.#labelled.add(element);
451
+ }
452
+ }
453
+ return element.getAttribute(TITLE_ATTRIBUTE) ?? "";
454
+ }
455
+ static {
456
+ this.ɵfac = i0.ɵɵngDeclareFactory({
457
+ minVersion: "12.0.0",
458
+ version: "22.2.6",
459
+ ngImport: i0,
460
+ type: TooltipDirective,
461
+ deps: [],
462
+ target: i0.ɵɵFactoryTarget.Directive
463
+ });
464
+ }
465
+ static {
466
+ this.ɵdir = i0.ɵɵngDeclareDirective({
467
+ minVersion: "17.1.0",
468
+ version: "22.2.6",
469
+ type: TooltipDirective,
470
+ isStandalone: true,
471
+ selector: "[monaTooltip]",
472
+ inputs: {
473
+ contentOf: {
474
+ classPropertyName: "contentOf",
475
+ publicName: "contentOf",
476
+ isSignal: true,
477
+ isRequired: false,
478
+ transformFunction: null
479
+ },
480
+ disabled: {
481
+ classPropertyName: "disabled",
482
+ publicName: "disabled",
483
+ isSignal: true,
484
+ isRequired: false,
485
+ transformFunction: null
486
+ },
487
+ filter: {
488
+ classPropertyName: "filter",
489
+ publicName: "filter",
490
+ isSignal: true,
491
+ isRequired: false,
492
+ transformFunction: null
493
+ },
494
+ hideDelay: {
495
+ classPropertyName: "hideDelay",
496
+ publicName: "hideDelay",
497
+ isSignal: true,
498
+ isRequired: false,
499
+ transformFunction: null
500
+ },
501
+ mode: {
502
+ classPropertyName: "mode",
503
+ publicName: "mode",
504
+ isSignal: true,
505
+ isRequired: false,
506
+ transformFunction: null
507
+ },
508
+ monaTooltip: {
509
+ classPropertyName: "monaTooltip",
510
+ publicName: "monaTooltip",
511
+ isSignal: true,
512
+ isRequired: false,
513
+ transformFunction: null
514
+ },
515
+ position: {
516
+ classPropertyName: "position",
517
+ publicName: "position",
518
+ isSignal: true,
519
+ isRequired: false,
520
+ transformFunction: null
521
+ },
522
+ rounded: {
523
+ classPropertyName: "rounded",
524
+ publicName: "tooltipRounded",
525
+ isSignal: true,
526
+ isRequired: false,
527
+ transformFunction: null
528
+ },
529
+ showDelay: {
530
+ classPropertyName: "showDelay",
531
+ publicName: "showDelay",
532
+ isSignal: true,
533
+ isRequired: false,
534
+ transformFunction: null
535
+ },
536
+ tooltipDisabled: {
537
+ classPropertyName: "tooltipDisabled",
538
+ publicName: "tooltipDisabled",
539
+ isSignal: true,
540
+ isRequired: false,
541
+ transformFunction: null
542
+ }
543
+ },
544
+ outputs: {
545
+ hidden: "hidden",
546
+ shown: "shown"
547
+ },
548
+ ngImport: i0
549
+ });
550
+ }
551
+ };
552
+ i0.ɵɵngDeclareClassMetadata({
553
+ minVersion: "12.0.0",
554
+ version: "22.2.6",
555
+ ngImport: i0,
556
+ type: TooltipDirective,
557
+ decorators: [{
558
+ type: Directive,
559
+ args: [{ selector: "[monaTooltip]" }]
560
+ }],
561
+ ctorParameters: () => [],
562
+ propDecorators: {
563
+ contentOf: [{
564
+ type: i0.Input,
565
+ args: [{
566
+ isSignal: true,
567
+ alias: "contentOf",
568
+ required: false
569
+ }]
570
+ }],
571
+ disabled: [{
572
+ type: i0.Input,
573
+ args: [{
574
+ isSignal: true,
575
+ alias: "disabled",
576
+ required: false
577
+ }]
578
+ }],
579
+ filter: [{
580
+ type: i0.Input,
581
+ args: [{
582
+ isSignal: true,
583
+ alias: "filter",
584
+ required: false
585
+ }]
586
+ }],
587
+ hidden: [{
588
+ type: i0.Output,
589
+ args: ["hidden"]
590
+ }],
591
+ hideDelay: [{
592
+ type: i0.Input,
593
+ args: [{
594
+ isSignal: true,
595
+ alias: "hideDelay",
596
+ required: false
597
+ }]
598
+ }],
599
+ mode: [{
600
+ type: i0.Input,
601
+ args: [{
602
+ isSignal: true,
603
+ alias: "mode",
604
+ required: false
605
+ }]
606
+ }],
607
+ monaTooltip: [{
608
+ type: i0.Input,
609
+ args: [{
610
+ isSignal: true,
611
+ alias: "monaTooltip",
612
+ required: false
613
+ }]
614
+ }],
615
+ position: [{
616
+ type: i0.Input,
617
+ args: [{
618
+ isSignal: true,
619
+ alias: "position",
620
+ required: false
621
+ }]
622
+ }],
623
+ rounded: [{
624
+ type: i0.Input,
625
+ args: [{
626
+ isSignal: true,
627
+ alias: "tooltipRounded",
628
+ required: false
629
+ }]
630
+ }],
631
+ showDelay: [{
632
+ type: i0.Input,
633
+ args: [{
634
+ isSignal: true,
635
+ alias: "showDelay",
636
+ required: false
637
+ }]
638
+ }],
639
+ shown: [{
640
+ type: i0.Output,
641
+ args: ["shown"]
642
+ }],
643
+ tooltipDisabled: [{
644
+ type: i0.Input,
645
+ args: [{
646
+ isSignal: true,
647
+ alias: "tooltipDisabled",
648
+ required: false
649
+ }]
650
+ }]
651
+ }
652
+ });
475
653
  function hasNameOfItsOwn(element) {
476
- if (element.hasAttribute("aria-labelledby") || element.getAttribute("aria-label")?.trim()) {
477
- return true;
478
- }
479
- if (element.labels?.length) {
480
- return true;
481
- }
482
- return !!element.textContent?.trim() || element.querySelector('img[alt]:not([alt=""])') != null;
654
+ if (element.hasAttribute("aria-labelledby") || element.getAttribute("aria-label")?.trim()) return true;
655
+ if (element.labels?.length) return true;
656
+ return !!element.textContent?.trim() || element.querySelector("img[alt]:not([alt=\"\"])") != null;
483
657
  }
484
- class TooltipTemplateComponent {
485
- constructor() {
486
- this.arrowClasses = computed(() => {
487
- return tooltipArrowThemeVariants();
488
- }, /* @ts-ignore */
489
- ...(ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []));
490
- this.baseClasses = computed(() => {
491
- const rounded = this.rounded();
492
- const userClasses = `p-2`;
493
- const variants = tooltipBaseThemeVariants({ rounded });
494
- return twMerge(variants, userClasses);
495
- }, /* @ts-ignore */
496
- ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
497
- this.contentTemplate = computed(() => {
498
- const content = this.content();
499
- return content instanceof TemplateRef ? content : null;
500
- }, /* @ts-ignore */
501
- ...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
502
- /**
503
- * @description The content displayed in the tooltip: text or a template.
504
- */
505
- this.content = input.required(/* @ts-ignore */
506
- ...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
507
- this.currentArrowPosition = signal("top", /* @ts-ignore */
508
- ...(ngDevMode ? [{ debugName: "currentArrowPosition" }] : /* istanbul ignore next */ []));
509
- /**
510
- * @description The border radius of the tooltip.
511
- */
512
- this.rounded = input("medium", /* @ts-ignore */
513
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
514
- this.templateRef = viewChild.required(TemplateRef, /* @ts-ignore */
515
- ...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
516
- /**
517
- * @description The unique id for the tooltip element, used for aria-describedby linkage.
518
- */
519
- this.tooltipId = input("", /* @ts-ignore */
520
- ...(ngDevMode ? [{ debugName: "tooltipId" }] : /* istanbul ignore next */ []));
521
- }
522
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
523
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TooltipTemplateComponent, isStandalone: true, selector: "ng-component", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, tooltipId: { classPropertyName: "tooltipId", publicName: "tooltipId", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
658
+ var TooltipTemplateComponent = class TooltipTemplateComponent {
659
+ constructor() {
660
+ this.arrowClasses = computed(() => {
661
+ return tooltipArrowThemeVariants();
662
+ }, ...ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []);
663
+ this.baseClasses = computed(() => {
664
+ const rounded = this.rounded();
665
+ const userClasses = `p-2`;
666
+ const variants = tooltipBaseThemeVariants({ rounded });
667
+ return twMerge(variants, userClasses);
668
+ }, ...ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []);
669
+ this.contentTemplate = computed(() => {
670
+ const content = this.content();
671
+ return content instanceof TemplateRef ? content : null;
672
+ }, ...ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []);
673
+ this.content = input.required(...ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []);
674
+ this.currentArrowPosition = signal("top", ...ngDevMode ? [{ debugName: "currentArrowPosition" }] : /* istanbul ignore next */ []);
675
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
676
+ this.templateRef = viewChild.required(TemplateRef, ...ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []);
677
+ this.tooltipId = input("", ...ngDevMode ? [{ debugName: "tooltipId" }] : /* istanbul ignore next */ []);
678
+ }
679
+ static {
680
+ this.ɵfac = i0.ɵɵngDeclareFactory({
681
+ minVersion: "12.0.0",
682
+ version: "22.2.6",
683
+ ngImport: i0,
684
+ type: TooltipTemplateComponent,
685
+ deps: [],
686
+ target: i0.ɵɵFactoryTarget.Component
687
+ });
688
+ }
689
+ static {
690
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
691
+ minVersion: "17.0.0",
692
+ version: "22.2.6",
693
+ type: TooltipTemplateComponent,
694
+ isStandalone: true,
695
+ selector: "ng-component",
696
+ inputs: {
697
+ content: {
698
+ classPropertyName: "content",
699
+ publicName: "content",
700
+ isSignal: true,
701
+ isRequired: true,
702
+ transformFunction: null
703
+ },
704
+ rounded: {
705
+ classPropertyName: "rounded",
706
+ publicName: "rounded",
707
+ isSignal: true,
708
+ isRequired: false,
709
+ transformFunction: null
710
+ },
711
+ tooltipId: {
712
+ classPropertyName: "tooltipId",
713
+ publicName: "tooltipId",
714
+ isSignal: true,
715
+ isRequired: false,
716
+ transformFunction: null
717
+ }
718
+ },
719
+ viewQueries: [{
720
+ propertyName: "templateRef",
721
+ first: true,
722
+ predicate: TemplateRef,
723
+ descendants: true,
724
+ isSignal: true
725
+ }],
726
+ ngImport: i0,
727
+ template: `
524
728
  <ng-template>
525
729
  <div role="tooltip" [id]="tooltipId()" [class]="baseClasses()">
526
730
  <div>
@@ -533,13 +737,31 @@ class TooltipTemplateComponent {
533
737
  <div [class]="arrowClasses()" [attr.data-position]="currentArrowPosition()"></div>
534
738
  </div>
535
739
  </ng-template>
536
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
537
- }
538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipTemplateComponent, decorators: [{
539
- type: Component,
540
- args: [{
541
- imports: [NgTemplateOutlet],
542
- template: `
740
+ `,
741
+ isInline: true,
742
+ dependencies: [{
743
+ kind: "directive",
744
+ type: NgTemplateOutlet,
745
+ selector: "[ngTemplateOutlet]",
746
+ inputs: [
747
+ "ngTemplateOutletContext",
748
+ "ngTemplateOutlet",
749
+ "ngTemplateOutletInjector"
750
+ ]
751
+ }]
752
+ });
753
+ }
754
+ };
755
+ i0.ɵɵngDeclareClassMetadata({
756
+ minVersion: "12.0.0",
757
+ version: "22.2.6",
758
+ ngImport: i0,
759
+ type: TooltipTemplateComponent,
760
+ decorators: [{
761
+ type: Component,
762
+ args: [{
763
+ imports: [NgTemplateOutlet],
764
+ template: `
543
765
  <ng-template>
544
766
  <div role="tooltip" [id]="tooltipId()" [class]="baseClasses()">
545
767
  <div>
@@ -553,51 +775,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
553
775
  </div>
554
776
  </ng-template>
555
777
  `
556
- }]
557
- }], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], templateRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], tooltipId: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipId", required: false }] }] } });
558
-
559
- /**
560
- * Gets the appropriate offset for a tooltip based on its position.
561
- * The offset ensures proper spacing between the tooltip and its anchor element.
562
- * @deprecated No longer used by the tooltip or popover, which keep the gap on the side they flip to and place
563
- * `left` and `right` physically in RTL. Kept for existing callers.
564
- */
778
+ }]
779
+ }],
780
+ propDecorators: {
781
+ content: [{
782
+ type: i0.Input,
783
+ args: [{
784
+ isSignal: true,
785
+ alias: "content",
786
+ required: true
787
+ }]
788
+ }],
789
+ rounded: [{
790
+ type: i0.Input,
791
+ args: [{
792
+ isSignal: true,
793
+ alias: "rounded",
794
+ required: false
795
+ }]
796
+ }],
797
+ templateRef: [{
798
+ type: i0.ViewChild,
799
+ args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
800
+ }],
801
+ tooltipId: [{
802
+ type: i0.Input,
803
+ args: [{
804
+ isSignal: true,
805
+ alias: "tooltipId",
806
+ required: false
807
+ }]
808
+ }]
809
+ }
810
+ });
565
811
  function getOffsetForPosition(position, arrowVisible) {
566
- const arrowOffset = arrowVisible ? 12 : 4;
567
- switch (position) {
568
- case "top":
569
- return { horizontal: 0, vertical: -arrowOffset };
570
- case "bottom":
571
- return { horizontal: 0, vertical: arrowOffset };
572
- case "right":
573
- return { horizontal: arrowOffset, vertical: 0 };
574
- case "left":
575
- return { horizontal: -arrowOffset, vertical: 0 };
576
- }
812
+ const arrowOffset = arrowVisible ? 12 : 4;
813
+ switch (position) {
814
+ case "top": return {
815
+ horizontal: 0,
816
+ vertical: -arrowOffset
817
+ };
818
+ case "bottom": return {
819
+ horizontal: 0,
820
+ vertical: arrowOffset
821
+ };
822
+ case "right": return {
823
+ horizontal: arrowOffset,
824
+ vertical: 0
825
+ };
826
+ case "left": return {
827
+ horizontal: -arrowOffset,
828
+ vertical: 0
829
+ };
830
+ }
577
831
  }
578
- /**
579
- * @deprecated No longer used by the tooltip or popover. Kept for existing callers.
580
- */
581
832
  function getPositionConnectionPoints(position) {
582
- switch (position) {
583
- case "top":
584
- return { anchor: "topcenter", popup: "bottomcenter" };
585
- case "bottom":
586
- return { anchor: "bottomcenter", popup: "topcenter" };
587
- case "right":
588
- return { anchor: "centerright", popup: "centerleft" };
589
- case "left":
590
- return { anchor: "centerleft", popup: "centerright" };
591
- }
833
+ switch (position) {
834
+ case "top": return {
835
+ anchor: "topcenter",
836
+ popup: "bottomcenter"
837
+ };
838
+ case "bottom": return {
839
+ anchor: "bottomcenter",
840
+ popup: "topcenter"
841
+ };
842
+ case "right": return {
843
+ anchor: "centerright",
844
+ popup: "centerleft"
845
+ };
846
+ case "left": return {
847
+ anchor: "centerleft",
848
+ popup: "centerright"
849
+ };
850
+ }
592
851
  }
593
-
594
- /*
595
- * Public API Surface of @nanahoshi/mona-ui/tooltip
596
- */
597
-
598
- /**
599
- * Generated bundle index. Do not edit.
600
- */
601
-
602
852
  export { TooltipComponent, TooltipDirective, getOffsetForPosition, getPositionConnectionPoints, tooltipArrowThemeVariants };
603
- //# sourceMappingURL=nanahoshi-mona-ui-tooltip.mjs.map
853
+
854
+ //# sourceMappingURL=nanahoshi-mona-ui-tooltip.mjs.map