@aeris-ui/core 22.0.0-alpha.7 → 22.0.0-alpha.9

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 (263) hide show
  1. package/README.md +2 -2
  2. package/fesm2022/aeris-ui-core-accordion.mjs +646 -255
  3. package/fesm2022/aeris-ui-core-accordion.mjs.map +1 -1
  4. package/fesm2022/aeris-ui-core-animate-on-scroll.mjs +284 -103
  5. package/fesm2022/aeris-ui-core-animate-on-scroll.mjs.map +1 -1
  6. package/fesm2022/aeris-ui-core-auto-complete.mjs +1171 -428
  7. package/fesm2022/aeris-ui-core-auto-complete.mjs.map +1 -1
  8. package/fesm2022/aeris-ui-core-auto-focus.mjs +111 -61
  9. package/fesm2022/aeris-ui-core-auto-focus.mjs.map +1 -1
  10. package/fesm2022/aeris-ui-core-avatar.mjs +383 -101
  11. package/fesm2022/aeris-ui-core-avatar.mjs.map +1 -1
  12. package/fesm2022/aeris-ui-core-badge.mjs +562 -115
  13. package/fesm2022/aeris-ui-core-badge.mjs.map +1 -1
  14. package/fesm2022/aeris-ui-core-block-ui.mjs +205 -101
  15. package/fesm2022/aeris-ui-core-block-ui.mjs.map +1 -1
  16. package/fesm2022/aeris-ui-core-breadcrumb.mjs +547 -177
  17. package/fesm2022/aeris-ui-core-breadcrumb.mjs.map +1 -1
  18. package/fesm2022/aeris-ui-core-button-group.mjs +153 -38
  19. package/fesm2022/aeris-ui-core-button-group.mjs.map +1 -1
  20. package/fesm2022/aeris-ui-core-button.mjs +730 -110
  21. package/fesm2022/aeris-ui-core-button.mjs.map +1 -1
  22. package/fesm2022/aeris-ui-core-card.mjs +371 -101
  23. package/fesm2022/aeris-ui-core-card.mjs.map +1 -1
  24. package/fesm2022/aeris-ui-core-carousel.mjs +690 -353
  25. package/fesm2022/aeris-ui-core-carousel.mjs.map +1 -1
  26. package/fesm2022/aeris-ui-core-cascade-select.mjs +915 -423
  27. package/fesm2022/aeris-ui-core-cascade-select.mjs.map +1 -1
  28. package/fesm2022/aeris-ui-core-chart.mjs +455 -258
  29. package/fesm2022/aeris-ui-core-chart.mjs.map +1 -1
  30. package/fesm2022/aeris-ui-core-checkbox.mjs +432 -135
  31. package/fesm2022/aeris-ui-core-checkbox.mjs.map +1 -1
  32. package/fesm2022/aeris-ui-core-chip.mjs +430 -117
  33. package/fesm2022/aeris-ui-core-chip.mjs.map +1 -1
  34. package/fesm2022/aeris-ui-core-class-names.mjs +87 -65
  35. package/fesm2022/aeris-ui-core-class-names.mjs.map +1 -1
  36. package/fesm2022/aeris-ui-core-color-picker.mjs +1313 -683
  37. package/fesm2022/aeris-ui-core-color-picker.mjs.map +1 -1
  38. package/fesm2022/aeris-ui-core-compare.mjs +819 -310
  39. package/fesm2022/aeris-ui-core-compare.mjs.map +1 -1
  40. package/fesm2022/aeris-ui-core-confirm-dialog.mjs +1392 -551
  41. package/fesm2022/aeris-ui-core-confirm-dialog.mjs.map +1 -1
  42. package/fesm2022/aeris-ui-core-confirm-popup.mjs +1447 -744
  43. package/fesm2022/aeris-ui-core-confirm-popup.mjs.map +1 -1
  44. package/fesm2022/aeris-ui-core-context-menu.mjs +900 -450
  45. package/fesm2022/aeris-ui-core-context-menu.mjs.map +1 -1
  46. package/fesm2022/aeris-ui-core-date-picker.mjs +1656 -863
  47. package/fesm2022/aeris-ui-core-date-picker.mjs.map +1 -1
  48. package/fesm2022/aeris-ui-core-dialog.mjs +1066 -355
  49. package/fesm2022/aeris-ui-core-dialog.mjs.map +1 -1
  50. package/fesm2022/aeris-ui-core-divider.mjs +204 -43
  51. package/fesm2022/aeris-ui-core-divider.mjs.map +1 -1
  52. package/fesm2022/aeris-ui-core-drawer.mjs +1002 -326
  53. package/fesm2022/aeris-ui-core-drawer.mjs.map +1 -1
  54. package/fesm2022/aeris-ui-core-dynamic-dialog.mjs +402 -249
  55. package/fesm2022/aeris-ui-core-dynamic-dialog.mjs.map +1 -1
  56. package/fesm2022/aeris-ui-core-editor.mjs +934 -572
  57. package/fesm2022/aeris-ui-core-editor.mjs.map +1 -1
  58. package/fesm2022/aeris-ui-core-file-upload.mjs +1339 -514
  59. package/fesm2022/aeris-ui-core-file-upload.mjs.map +1 -1
  60. package/fesm2022/aeris-ui-core-filter-service.mjs +258 -301
  61. package/fesm2022/aeris-ui-core-filter-service.mjs.map +1 -1
  62. package/fesm2022/aeris-ui-core-fluid.mjs +68 -21
  63. package/fesm2022/aeris-ui-core-fluid.mjs.map +1 -1
  64. package/fesm2022/aeris-ui-core-focus-trap.mjs +206 -182
  65. package/fesm2022/aeris-ui-core-focus-trap.mjs.map +1 -1
  66. package/fesm2022/aeris-ui-core-form-field.mjs +672 -170
  67. package/fesm2022/aeris-ui-core-form-field.mjs.map +1 -1
  68. package/fesm2022/aeris-ui-core-galleria.mjs +1987 -797
  69. package/fesm2022/aeris-ui-core-galleria.mjs.map +1 -1
  70. package/fesm2022/aeris-ui-core-glass.mjs +110 -33
  71. package/fesm2022/aeris-ui-core-glass.mjs.map +1 -1
  72. package/fesm2022/aeris-ui-core-icon-field.mjs +426 -103
  73. package/fesm2022/aeris-ui-core-icon-field.mjs.map +1 -1
  74. package/fesm2022/aeris-ui-core-inplace.mjs +452 -130
  75. package/fesm2022/aeris-ui-core-inplace.mjs.map +1 -1
  76. package/fesm2022/aeris-ui-core-input-group.mjs +413 -112
  77. package/fesm2022/aeris-ui-core-input-group.mjs.map +1 -1
  78. package/fesm2022/aeris-ui-core-input-mask.mjs +650 -248
  79. package/fesm2022/aeris-ui-core-input-mask.mjs.map +1 -1
  80. package/fesm2022/aeris-ui-core-input-number.mjs +902 -334
  81. package/fesm2022/aeris-ui-core-input-number.mjs.map +1 -1
  82. package/fesm2022/aeris-ui-core-input-otp.mjs +667 -253
  83. package/fesm2022/aeris-ui-core-input-otp.mjs.map +1 -1
  84. package/fesm2022/aeris-ui-core-input-text.mjs +618 -152
  85. package/fesm2022/aeris-ui-core-input-text.mjs.map +1 -1
  86. package/fesm2022/aeris-ui-core-key-filter.mjs +263 -201
  87. package/fesm2022/aeris-ui-core-key-filter.mjs.map +1 -1
  88. package/fesm2022/aeris-ui-core-mega-menu.mjs +601 -388
  89. package/fesm2022/aeris-ui-core-mega-menu.mjs.map +1 -1
  90. package/fesm2022/aeris-ui-core-menu.mjs +1032 -495
  91. package/fesm2022/aeris-ui-core-menu.mjs.map +1 -1
  92. package/fesm2022/aeris-ui-core-menubar.mjs +960 -491
  93. package/fesm2022/aeris-ui-core-menubar.mjs.map +1 -1
  94. package/fesm2022/aeris-ui-core-message.mjs +477 -145
  95. package/fesm2022/aeris-ui-core-message.mjs.map +1 -1
  96. package/fesm2022/aeris-ui-core-meter-group.mjs +587 -196
  97. package/fesm2022/aeris-ui-core-meter-group.mjs.map +1 -1
  98. package/fesm2022/aeris-ui-core-multi-select.mjs +1550 -552
  99. package/fesm2022/aeris-ui-core-multi-select.mjs.map +1 -1
  100. package/fesm2022/aeris-ui-core-order-list.mjs +518 -202
  101. package/fesm2022/aeris-ui-core-order-list.mjs.map +1 -1
  102. package/fesm2022/aeris-ui-core-organization-chart.mjs +455 -177
  103. package/fesm2022/aeris-ui-core-organization-chart.mjs.map +1 -1
  104. package/fesm2022/aeris-ui-core-paginator.mjs +329 -127
  105. package/fesm2022/aeris-ui-core-paginator.mjs.map +1 -1
  106. package/fesm2022/aeris-ui-core-panel.mjs +596 -196
  107. package/fesm2022/aeris-ui-core-panel.mjs.map +1 -1
  108. package/fesm2022/aeris-ui-core-password.mjs +894 -247
  109. package/fesm2022/aeris-ui-core-password.mjs.map +1 -1
  110. package/fesm2022/aeris-ui-core-pick-list.mjs +1280 -659
  111. package/fesm2022/aeris-ui-core-pick-list.mjs.map +1 -1
  112. package/fesm2022/aeris-ui-core-popover.mjs +892 -386
  113. package/fesm2022/aeris-ui-core-popover.mjs.map +1 -1
  114. package/fesm2022/aeris-ui-core-progress-bar.mjs +549 -176
  115. package/fesm2022/aeris-ui-core-progress-bar.mjs.map +1 -1
  116. package/fesm2022/aeris-ui-core-progress-spinner.mjs +410 -133
  117. package/fesm2022/aeris-ui-core-progress-spinner.mjs.map +1 -1
  118. package/fesm2022/aeris-ui-core-radio-button.mjs +386 -119
  119. package/fesm2022/aeris-ui-core-radio-button.mjs.map +1 -1
  120. package/fesm2022/aeris-ui-core-rating.mjs +502 -225
  121. package/fesm2022/aeris-ui-core-rating.mjs.map +1 -1
  122. package/fesm2022/aeris-ui-core-scroll-panel.mjs +457 -154
  123. package/fesm2022/aeris-ui-core-scroll-panel.mjs.map +1 -1
  124. package/fesm2022/aeris-ui-core-scroll-top.mjs +204 -63
  125. package/fesm2022/aeris-ui-core-scroll-top.mjs.map +1 -1
  126. package/fesm2022/aeris-ui-core-select.mjs +1794 -643
  127. package/fesm2022/aeris-ui-core-select.mjs.map +1 -1
  128. package/fesm2022/aeris-ui-core-skeleton.mjs +149 -45
  129. package/fesm2022/aeris-ui-core-skeleton.mjs.map +1 -1
  130. package/fesm2022/aeris-ui-core-slider.mjs +868 -404
  131. package/fesm2022/aeris-ui-core-slider.mjs.map +1 -1
  132. package/fesm2022/aeris-ui-core-speed-dial.mjs +800 -329
  133. package/fesm2022/aeris-ui-core-speed-dial.mjs.map +1 -1
  134. package/fesm2022/aeris-ui-core-split-button.mjs +918 -257
  135. package/fesm2022/aeris-ui-core-split-button.mjs.map +1 -1
  136. package/fesm2022/aeris-ui-core-splitter.mjs +812 -352
  137. package/fesm2022/aeris-ui-core-splitter.mjs.map +1 -1
  138. package/fesm2022/aeris-ui-core-stepper.mjs +697 -254
  139. package/fesm2022/aeris-ui-core-stepper.mjs.map +1 -1
  140. package/fesm2022/aeris-ui-core-style-class.mjs +587 -342
  141. package/fesm2022/aeris-ui-core-style-class.mjs.map +1 -1
  142. package/fesm2022/aeris-ui-core-table.mjs +1984 -865
  143. package/fesm2022/aeris-ui-core-table.mjs.map +1 -1
  144. package/fesm2022/aeris-ui-core-tabs.mjs +686 -324
  145. package/fesm2022/aeris-ui-core-tabs.mjs.map +1 -1
  146. package/fesm2022/aeris-ui-core-textarea.mjs +846 -212
  147. package/fesm2022/aeris-ui-core-textarea.mjs.map +1 -1
  148. package/fesm2022/aeris-ui-core-theme-builder.mjs +1258 -1413
  149. package/fesm2022/aeris-ui-core-theme-builder.mjs.map +1 -1
  150. package/fesm2022/aeris-ui-core-theming.mjs +132 -147
  151. package/fesm2022/aeris-ui-core-theming.mjs.map +1 -1
  152. package/fesm2022/aeris-ui-core-tiered-menu.mjs +885 -465
  153. package/fesm2022/aeris-ui-core-tiered-menu.mjs.map +1 -1
  154. package/fesm2022/aeris-ui-core-timeline.mjs +407 -131
  155. package/fesm2022/aeris-ui-core-timeline.mjs.map +1 -1
  156. package/fesm2022/aeris-ui-core-toast.mjs +855 -615
  157. package/fesm2022/aeris-ui-core-toast.mjs.map +1 -1
  158. package/fesm2022/aeris-ui-core-toggle-switch.mjs +390 -127
  159. package/fesm2022/aeris-ui-core-toggle-switch.mjs.map +1 -1
  160. package/fesm2022/aeris-ui-core-toolbar.mjs +458 -121
  161. package/fesm2022/aeris-ui-core-toolbar.mjs.map +1 -1
  162. package/fesm2022/aeris-ui-core-tooltip.mjs +623 -345
  163. package/fesm2022/aeris-ui-core-tooltip.mjs.map +1 -1
  164. package/fesm2022/aeris-ui-core-tree-select.mjs +1356 -601
  165. package/fesm2022/aeris-ui-core-tree-select.mjs.map +1 -1
  166. package/fesm2022/aeris-ui-core-tree-table.mjs +2001 -942
  167. package/fesm2022/aeris-ui-core-tree-table.mjs.map +1 -1
  168. package/fesm2022/aeris-ui-core-tree.mjs +1103 -658
  169. package/fesm2022/aeris-ui-core-tree.mjs.map +1 -1
  170. package/fesm2022/aeris-ui-core.mjs +861 -842
  171. package/fesm2022/aeris-ui-core.mjs.map +1 -1
  172. package/package.json +1 -1
  173. package/schematics/runtime/theme-builder/aeris-theme.js +28 -16
  174. package/schematics/runtime/theme-builder/aeris-theme.js.map +1 -1
  175. package/styles/_fallback-colors.scss +3 -3
  176. package/styles/_tokens.scss +5 -5
  177. package/styles/aeris.css +12 -16
  178. package/styles/controls.css +1 -1
  179. package/types/aeris-ui-core-accordion.d.ts +166 -93
  180. package/types/aeris-ui-core-animate-on-scroll.d.ts +71 -31
  181. package/types/aeris-ui-core-auto-complete.d.ts +326 -149
  182. package/types/aeris-ui-core-auto-focus.d.ts +24 -16
  183. package/types/aeris-ui-core-avatar.d.ts +112 -42
  184. package/types/aeris-ui-core-badge.d.ts +160 -47
  185. package/types/aeris-ui-core-block-ui.d.ts +47 -27
  186. package/types/aeris-ui-core-breadcrumb.d.ts +162 -92
  187. package/types/aeris-ui-core-button-group.d.ts +37 -16
  188. package/types/aeris-ui-core-button.d.ts +226 -64
  189. package/types/aeris-ui-core-card.d.ts +74 -37
  190. package/types/aeris-ui-core-carousel.d.ts +197 -117
  191. package/types/aeris-ui-core-cascade-select.d.ts +252 -131
  192. package/types/aeris-ui-core-chart.d.ts +134 -84
  193. package/types/aeris-ui-core-checkbox.d.ts +139 -55
  194. package/types/aeris-ui-core-chip.d.ts +116 -51
  195. package/types/aeris-ui-core-class-names.d.ts +22 -20
  196. package/types/aeris-ui-core-color-picker.d.ts +347 -150
  197. package/types/aeris-ui-core-compare.d.ts +224 -101
  198. package/types/aeris-ui-core-confirm-dialog.d.ts +441 -249
  199. package/types/aeris-ui-core-confirm-popup.d.ts +440 -268
  200. package/types/aeris-ui-core-context-menu.d.ts +262 -150
  201. package/types/aeris-ui-core-date-picker.d.ts +488 -226
  202. package/types/aeris-ui-core-dialog.d.ts +288 -121
  203. package/types/aeris-ui-core-divider.d.ts +58 -20
  204. package/types/aeris-ui-core-drawer.d.ts +273 -116
  205. package/types/aeris-ui-core-dynamic-dialog.d.ts +157 -140
  206. package/types/aeris-ui-core-editor.d.ts +243 -124
  207. package/types/aeris-ui-core-file-upload.d.ts +366 -197
  208. package/types/aeris-ui-core-filter-service.d.ts +48 -52
  209. package/types/aeris-ui-core-fluid.d.ts +12 -9
  210. package/types/aeris-ui-core-focus-trap.d.ts +39 -31
  211. package/types/aeris-ui-core-form-field.d.ts +158 -62
  212. package/types/aeris-ui-core-galleria.d.ts +589 -256
  213. package/types/aeris-ui-core-glass.d.ts +24 -11
  214. package/types/aeris-ui-core-icon-field.d.ts +94 -34
  215. package/types/aeris-ui-core-inplace.d.ts +123 -62
  216. package/types/aeris-ui-core-input-group.d.ts +84 -35
  217. package/types/aeris-ui-core-input-mask.d.ts +194 -71
  218. package/types/aeris-ui-core-input-number.d.ts +272 -90
  219. package/types/aeris-ui-core-input-otp.d.ts +190 -82
  220. package/types/aeris-ui-core-input-text.d.ts +185 -62
  221. package/types/aeris-ui-core-key-filter.d.ts +53 -39
  222. package/types/aeris-ui-core-mega-menu.d.ts +174 -123
  223. package/types/aeris-ui-core-menu.d.ts +275 -172
  224. package/types/aeris-ui-core-menubar.d.ts +272 -160
  225. package/types/aeris-ui-core-message.d.ts +132 -61
  226. package/types/aeris-ui-core-meter-group.d.ts +162 -90
  227. package/types/aeris-ui-core-multi-select.d.ts +435 -187
  228. package/types/aeris-ui-core-order-list.d.ts +143 -66
  229. package/types/aeris-ui-core-organization-chart.d.ts +132 -77
  230. package/types/aeris-ui-core-paginator.d.ts +92 -46
  231. package/types/aeris-ui-core-panel.d.ts +149 -78
  232. package/types/aeris-ui-core-password.d.ts +257 -108
  233. package/types/aeris-ui-core-pick-list.d.ts +373 -179
  234. package/types/aeris-ui-core-popover.d.ts +218 -107
  235. package/types/aeris-ui-core-progress-bar.d.ts +156 -73
  236. package/types/aeris-ui-core-progress-spinner.d.ts +110 -48
  237. package/types/aeris-ui-core-radio-button.d.ts +124 -51
  238. package/types/aeris-ui-core-rating.d.ts +149 -76
  239. package/types/aeris-ui-core-scroll-panel.d.ts +142 -64
  240. package/types/aeris-ui-core-scroll-top.d.ts +64 -29
  241. package/types/aeris-ui-core-select.d.ts +474 -226
  242. package/types/aeris-ui-core-skeleton.d.ts +39 -17
  243. package/types/aeris-ui-core-slider.d.ts +270 -116
  244. package/types/aeris-ui-core-speed-dial.d.ts +240 -112
  245. package/types/aeris-ui-core-split-button.d.ts +265 -115
  246. package/types/aeris-ui-core-splitter.d.ts +224 -106
  247. package/types/aeris-ui-core-stepper.d.ts +183 -91
  248. package/types/aeris-ui-core-style-class.d.ts +141 -71
  249. package/types/aeris-ui-core-table.d.ts +595 -308
  250. package/types/aeris-ui-core-tabs.d.ts +163 -90
  251. package/types/aeris-ui-core-textarea.d.ts +261 -81
  252. package/types/aeris-ui-core-theme-builder.d.ts +466 -451
  253. package/types/aeris-ui-core-theming.d.ts +42 -49
  254. package/types/aeris-ui-core-tiered-menu.d.ts +249 -147
  255. package/types/aeris-ui-core-timeline.d.ts +108 -71
  256. package/types/aeris-ui-core-toast.d.ts +219 -155
  257. package/types/aeris-ui-core-toggle-switch.d.ts +125 -52
  258. package/types/aeris-ui-core-toolbar.d.ts +98 -41
  259. package/types/aeris-ui-core-tooltip.d.ts +157 -92
  260. package/types/aeris-ui-core-tree-select.d.ts +359 -179
  261. package/types/aeris-ui-core-tree-table.d.ts +565 -290
  262. package/types/aeris-ui-core-tree.d.ts +269 -165
  263. package/types/aeris-ui-core.d.ts +161 -125
@@ -1,930 +1,949 @@
1
- import { DOCUMENT } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, DestroyRef, ElementRef, Renderer2, input, output, effect, Directive } from '@angular/core';
4
-
1
+ import { DOCUMENT } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { DestroyRef, Directive, ElementRef, InjectionToken, Renderer2, effect, inject, input, output } from "@angular/core";
5
4
  function aerisInternalDisplayInvalid(invalid, touched) {
6
- return invalid && (touched ?? true);
5
+ return invalid && (touched ?? true);
7
6
  }
8
-
9
7
  function aerisInternalClampOverlayPoint(point, width, height, viewportWidth, viewportHeight, margin, viewportLeft = 0, viewportTop = 0) {
10
- const padding = normalizePadding(margin);
11
- return {
12
- x: clamp(point.x, viewportLeft + padding.left, Math.max(viewportLeft + padding.left, viewportLeft + viewportWidth - width - padding.right)),
13
- y: clamp(point.y, viewportTop + padding.top, Math.max(viewportTop + padding.top, viewportTop + viewportHeight - height - padding.bottom)),
14
- };
8
+ const padding = normalizePadding(margin);
9
+ return {
10
+ x: clamp(point.x, viewportLeft + padding.left, Math.max(viewportLeft + padding.left, viewportLeft + viewportWidth - width - padding.right)),
11
+ y: clamp(point.y, viewportTop + padding.top, Math.max(viewportTop + padding.top, viewportTop + viewportHeight - height - padding.bottom))
12
+ };
15
13
  }
16
14
  function aerisInternalPositionAnchoredOverlay(options) {
17
- const bounds = resolveBounds(options);
18
- const placement = resolvePlacement(options, bounds);
19
- const point = rawPosition(placement, options);
20
- const clampedPoint = aerisInternalClampOverlayPoint(point, options.width, options.height, bounds.right - bounds.left, bounds.bottom - bounds.top, 0, bounds.left, bounds.top);
21
- return {
22
- placement,
23
- ...(options.tetherToAnchor
24
- ? tetheredPoint(placement, point, clampedPoint)
25
- : clampedPoint),
26
- };
15
+ const bounds = resolveBounds(options);
16
+ const placement = resolvePlacement(options, bounds);
17
+ const point = rawPosition(placement, options);
18
+ const clampedPoint = aerisInternalClampOverlayPoint(point, options.width, options.height, bounds.right - bounds.left, bounds.bottom - bounds.top, 0, bounds.left, bounds.top);
19
+ return {
20
+ placement,
21
+ ...options.tetherToAnchor ? tetheredPoint(placement, point, clampedPoint) : clampedPoint
22
+ };
27
23
  }
28
24
  function tetheredPoint(placement, point, clampedPoint) {
29
- return placement === 'top' || placement === 'bottom'
30
- ? { x: clampedPoint.x, y: point.y }
31
- : { x: point.x, y: clampedPoint.y };
25
+ return placement === "top" || placement === "bottom" ? {
26
+ x: clampedPoint.x,
27
+ y: point.y
28
+ } : {
29
+ x: point.x,
30
+ y: clampedPoint.y
31
+ };
32
32
  }
33
33
  function resolvePlacement(options, bounds) {
34
- const spaces = {
35
- bottom: bounds.bottom - options.target.bottom - options.offset,
36
- top: options.target.top - bounds.top - options.offset,
37
- right: bounds.right - options.target.right - options.offset,
38
- left: options.target.left - bounds.left - options.offset,
39
- };
40
- const preferred = options.placement === 'auto' ? 'bottom' : options.placement;
41
- const candidates = placementCandidates(preferred, options.tetherToAnchor ?? false);
42
- const fitting = candidates.find((placement) => spaces[placement] >=
43
- (placement === 'top' || placement === 'bottom' ? options.height : options.width));
44
- return (fitting ??
45
- candidates.reduce((best, placement) => (spaces[placement] > spaces[best] ? placement : best)));
34
+ const spaces = {
35
+ bottom: bounds.bottom - options.target.bottom - options.offset,
36
+ top: options.target.top - bounds.top - options.offset,
37
+ right: bounds.right - options.target.right - options.offset,
38
+ left: options.target.left - bounds.left - options.offset
39
+ };
40
+ const candidates = placementCandidates(options.placement === "auto" ? "bottom" : options.placement, options.tetherToAnchor ?? false);
41
+ return candidates.find((placement) => spaces[placement] >= (placement === "top" || placement === "bottom" ? options.height : options.width)) ?? candidates.reduce((best, placement) => spaces[placement] > spaces[best] ? placement : best);
46
42
  }
47
43
  function resolveBounds(options) {
48
- const padding = normalizePadding(options.collisionPadding ?? options.margin);
49
- const left = options.viewportLeft ?? 0;
50
- const top = options.viewportTop ?? 0;
51
- return {
52
- top: top + padding.top,
53
- right: left + options.viewportWidth - padding.right,
54
- bottom: top + options.viewportHeight - padding.bottom,
55
- left: left + padding.left,
56
- };
44
+ const padding = normalizePadding(options.collisionPadding ?? options.margin);
45
+ const left = options.viewportLeft ?? 0;
46
+ const top = options.viewportTop ?? 0;
47
+ return {
48
+ top: top + padding.top,
49
+ right: left + options.viewportWidth - padding.right,
50
+ bottom: top + options.viewportHeight - padding.bottom,
51
+ left: left + padding.left
52
+ };
57
53
  }
58
54
  function normalizePadding(padding) {
59
- if (typeof padding === 'number') {
60
- const value = Math.max(0, padding);
61
- return { top: value, right: value, bottom: value, left: value };
62
- }
63
- return {
64
- top: Math.max(0, padding.top ?? 0),
65
- right: Math.max(0, padding.right ?? 0),
66
- bottom: Math.max(0, padding.bottom ?? 0),
67
- left: Math.max(0, padding.left ?? 0),
68
- };
55
+ if (typeof padding === "number") {
56
+ const value = Math.max(0, padding);
57
+ return {
58
+ top: value,
59
+ right: value,
60
+ bottom: value,
61
+ left: value
62
+ };
63
+ }
64
+ return {
65
+ top: Math.max(0, padding.top ?? 0),
66
+ right: Math.max(0, padding.right ?? 0),
67
+ bottom: Math.max(0, padding.bottom ?? 0),
68
+ left: Math.max(0, padding.left ?? 0)
69
+ };
69
70
  }
70
71
  function placementCandidates(preferred, preserveAxis) {
71
- if (preserveAxis) {
72
- if (preferred === 'top')
73
- return ['top', 'bottom'];
74
- if (preferred === 'bottom')
75
- return ['bottom', 'top'];
76
- if (preferred === 'right')
77
- return ['right', 'left'];
78
- return ['left', 'right'];
79
- }
80
- switch (preferred) {
81
- case 'top':
82
- return ['top', 'bottom', 'right', 'left'];
83
- case 'right':
84
- return ['right', 'left', 'bottom', 'top'];
85
- case 'bottom':
86
- return ['bottom', 'top', 'right', 'left'];
87
- case 'left':
88
- return ['left', 'right', 'bottom', 'top'];
89
- }
72
+ if (preserveAxis) {
73
+ if (preferred === "top") return ["top", "bottom"];
74
+ if (preferred === "bottom") return ["bottom", "top"];
75
+ if (preferred === "right") return ["right", "left"];
76
+ return ["left", "right"];
77
+ }
78
+ switch (preferred) {
79
+ case "top": return [
80
+ "top",
81
+ "bottom",
82
+ "right",
83
+ "left"
84
+ ];
85
+ case "right": return [
86
+ "right",
87
+ "left",
88
+ "bottom",
89
+ "top"
90
+ ];
91
+ case "bottom": return [
92
+ "bottom",
93
+ "top",
94
+ "right",
95
+ "left"
96
+ ];
97
+ case "left": return [
98
+ "left",
99
+ "right",
100
+ "bottom",
101
+ "top"
102
+ ];
103
+ }
90
104
  }
91
105
  function rawPosition(placement, options) {
92
- if (placement === 'top' || placement === 'bottom') {
93
- return {
94
- x: aligned(options.target.left, options.target.width, options.width, options.alignment),
95
- y: placement === 'bottom'
96
- ? options.target.bottom + options.offset
97
- : options.target.top - options.height - options.offset,
98
- };
99
- }
100
- return {
101
- x: placement === 'right'
102
- ? options.target.right + options.offset
103
- : options.target.left - options.width - options.offset,
104
- y: aligned(options.target.top, options.target.height, options.height, options.alignment),
105
- };
106
+ if (placement === "top" || placement === "bottom") return {
107
+ x: aligned(options.target.left, options.target.width, options.width, options.alignment),
108
+ y: placement === "bottom" ? options.target.bottom + options.offset : options.target.top - options.height - options.offset
109
+ };
110
+ return {
111
+ x: placement === "right" ? options.target.right + options.offset : options.target.left - options.width - options.offset,
112
+ y: aligned(options.target.top, options.target.height, options.height, options.alignment)
113
+ };
106
114
  }
107
115
  function aligned(start, targetSize, overlaySize, alignment) {
108
- if (alignment === 'start')
109
- return start;
110
- if (alignment === 'end')
111
- return start + targetSize - overlaySize;
112
- return start + targetSize / 2 - overlaySize / 2;
116
+ if (alignment === "start") return start;
117
+ if (alignment === "end") return start + targetSize - overlaySize;
118
+ return start + targetSize / 2 - overlaySize / 2;
113
119
  }
114
120
  function clamp(value, minimum, maximum) {
115
- return Math.min(Math.max(value, minimum), maximum);
121
+ return Math.min(Math.max(value, minimum), maximum);
116
122
  }
117
-
118
123
  let nextAppendToZIndex = 1100;
119
- const positionedTargets = new WeakMap();
120
- const AERIS_OVERLAY_APPEND_TO = new InjectionToken('AERIS_OVERLAY_APPEND_TO', { factory: () => undefined });
124
+ const positionedTargets = /* @__PURE__ */ new WeakMap();
125
+ const AERIS_OVERLAY_APPEND_TO = new InjectionToken("AERIS_OVERLAY_APPEND_TO", { factory: () => void 0 });
121
126
  function aerisInternalResolveAppendTo(appendTo, document) {
122
- if (!appendTo || appendTo === 'self')
123
- return 'self';
124
- if (appendTo === 'body')
125
- return document.body;
126
- if (isHtmlElement(appendTo))
127
- return appendTo;
128
- const nativeElement = elementRefNativeElement(appendTo);
129
- return isHtmlElement(nativeElement) ? nativeElement : 'self';
130
- }
131
- class ɵAerisAppendTo {
132
- document = inject(DOCUMENT);
133
- destroyRef = inject(DestroyRef);
134
- element = inject(ElementRef).nativeElement;
135
- renderer = inject(Renderer2);
136
- defaultAppendTo = inject(AERIS_OVERLAY_APPEND_TO);
137
- frame = null;
138
- originCaptured = false;
139
- originParent = null;
140
- originNextSibling = null;
141
- restoringToOrigin = false;
142
- unconstrainedPanelWidth = 0;
143
- unconstrainedPanelHeight = 0;
144
- aerisInternalAppendTo = input(/* @ts-ignore */
145
- ...(ngDevMode ? [undefined, { debugName: "aerisInternalAppendTo" }] : /* istanbul ignore next */ []));
146
- aerisInternalAppendToDefault = input('self', /* @ts-ignore */
147
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToDefault" }] : /* istanbul ignore next */ []));
148
- aerisInternalAppendToAnchor = input(null, /* @ts-ignore */
149
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToAnchor" }] : /* istanbul ignore next */ []));
150
- aerisInternalAppendToOffset = input(7, /* @ts-ignore */
151
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToOffset" }] : /* istanbul ignore next */ []));
152
- aerisInternalAppendToMatchWidth = input(false, /* @ts-ignore */
153
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToMatchWidth" }] : /* istanbul ignore next */ []));
154
- aerisInternalAppendToPlacement = input('auto', /* @ts-ignore */
155
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToPlacement" }] : /* istanbul ignore next */ []));
156
- aerisInternalAppendToAlignment = input('auto', /* @ts-ignore */
157
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToAlignment" }] : /* istanbul ignore next */ []));
158
- aerisInternalAppendToCollisionPadding = input(8, /* @ts-ignore */
159
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToCollisionPadding" }] : /* istanbul ignore next */ []));
160
- aerisInternalAppendToPositionSelf = input(true, /* @ts-ignore */
161
- ...(ngDevMode ? [{ debugName: "aerisInternalAppendToPositionSelf" }] : /* istanbul ignore next */ []));
162
- aerisInternalAppendToOutside = output();
163
- constructor() {
164
- effect((onCleanup) => {
165
- const target = aerisInternalResolveAppendTo(this.aerisInternalAppendTo() ?? this.defaultAppendTo ?? this.aerisInternalAppendToDefault(), this.document);
166
- const anchor = this.aerisInternalAppendToAnchor();
167
- const automaticallyPortaled = this.aerisInternalAppendTo() === undefined &&
168
- target === 'self' &&
169
- !!anchor &&
170
- this.hasClippingAncestor(anchor);
171
- const effectiveTarget = automaticallyPortaled ? this.document.body : target;
172
- this.captureOrigin();
173
- if (effectiveTarget === 'self')
174
- this.restoreToOrigin();
175
- if (effectiveTarget === 'self' && (!anchor || !this.aerisInternalAppendToPositionSelf())) {
176
- this.element.removeAttribute('data-aeris-append-to');
177
- this.element.removeAttribute('data-aeris-auto-portaled');
178
- return;
179
- }
180
- const positioningTarget = effectiveTarget === 'self' ? this.element.parentElement : effectiveTarget;
181
- if (!positioningTarget)
182
- return;
183
- const inheritedStyles = this.preserveInheritedStyles();
184
- const positioningStyles = this.preserveInlineStyles([
185
- 'position',
186
- 'inset',
187
- 'inset-block-start',
188
- 'inset-inline-start',
189
- 'right',
190
- 'bottom',
191
- 'left',
192
- 'top',
193
- 'min-width',
194
- 'max-width',
195
- 'max-height',
196
- 'overflow-x',
197
- 'overflow-y',
198
- 'overscroll-behavior',
199
- 'z-index',
200
- ]);
201
- const targetPosition = this.ensurePositionedTarget(positioningTarget);
202
- if (effectiveTarget !== 'self') {
203
- this.renderer.appendChild(effectiveTarget, this.element);
204
- this.applyInheritedStyles(inheritedStyles);
205
- this.renderer.setAttribute(this.element, 'data-aeris-append-to', effectiveTarget === this.document.body ? 'body' : 'target');
206
- if (automaticallyPortaled) {
207
- this.renderer.setAttribute(this.element, 'data-aeris-auto-portaled', 'true');
208
- }
209
- else {
210
- this.element.removeAttribute('data-aeris-auto-portaled');
211
- }
212
- this.bringToFront();
213
- }
214
- else {
215
- this.element.removeAttribute('data-aeris-append-to');
216
- this.element.removeAttribute('data-aeris-auto-portaled');
217
- }
218
- const reposition = () => this.schedulePosition(anchor, positioningTarget);
219
- const pointerdown = (event) => {
220
- const eventTarget = event.target;
221
- if (!isDomNode(eventTarget))
222
- return;
223
- if (this.element.contains(eventTarget) || anchor?.contains(eventTarget))
224
- return;
225
- this.aerisInternalAppendToOutside.emit(event);
226
- };
227
- const view = this.document.defaultView;
228
- const visualViewport = view?.visualViewport;
229
- view?.addEventListener('resize', reposition);
230
- visualViewport?.addEventListener('resize', reposition);
231
- visualViewport?.addEventListener('scroll', reposition);
232
- this.document.addEventListener('scroll', reposition, true);
233
- this.document.addEventListener('pointerdown', pointerdown, true);
234
- const resizeObserver = typeof ResizeObserver === 'undefined' || !anchor ? null : new ResizeObserver(reposition);
235
- if (anchor)
236
- resizeObserver?.observe(anchor);
237
- resizeObserver?.observe(this.element);
238
- if (anchor && view)
239
- this.positionConnectedOverlay(anchor, positioningTarget, view);
240
- onCleanup(() => {
241
- view?.removeEventListener('resize', reposition);
242
- visualViewport?.removeEventListener('resize', reposition);
243
- visualViewport?.removeEventListener('scroll', reposition);
244
- this.document.removeEventListener('scroll', reposition, true);
245
- this.document.removeEventListener('pointerdown', pointerdown, true);
246
- resizeObserver?.disconnect();
247
- this.cancelFrame();
248
- this.restoreInlineStyles(positioningStyles);
249
- this.element.removeAttribute('data-placement');
250
- this.element.removeAttribute('data-positioned');
251
- this.element.removeAttribute('data-viewport-constrained');
252
- this.element.removeAttribute('data-viewport-constrained-width');
253
- this.restoreInheritedStyles(inheritedStyles);
254
- targetPosition.restore();
255
- this.element.removeAttribute('data-aeris-append-to');
256
- this.element.removeAttribute('data-aeris-auto-portaled');
257
- if (effectiveTarget !== 'self')
258
- this.element.remove();
259
- });
260
- });
261
- this.destroyRef.onDestroy(() => {
262
- this.element.remove();
263
- queueMicrotask(() => this.element.remove());
264
- });
265
- }
266
- restore() {
267
- this.restoreToOrigin();
268
- }
269
- schedulePosition(anchor, target) {
270
- if (!anchor || this.frame !== null)
271
- return;
272
- const view = this.document.defaultView;
273
- if (!view)
274
- return;
275
- this.frame = view.requestAnimationFrame(() => {
276
- this.frame = null;
277
- this.positionConnectedOverlay(anchor, target, view);
278
- });
279
- }
280
- positionConnectedOverlay(anchor, target, view) {
281
- if (!anchor.isConnected || !this.element.isConnected)
282
- return;
283
- const anchorRect = anchor.getBoundingClientRect();
284
- this.element.style.position = target === this.document.body ? 'fixed' : 'absolute';
285
- this.element.style.inset = 'auto';
286
- this.element.style.insetBlockStart = 'auto';
287
- this.element.style.insetInlineStart = 'auto';
288
- this.element.style.right = 'auto';
289
- this.element.style.bottom = 'auto';
290
- const viewport = view.visualViewport;
291
- const viewportLeft = viewport?.offsetLeft ?? 0;
292
- const viewportTop = viewport?.offsetTop ?? 0;
293
- const collisionPadding = this.collisionPadding(view);
294
- const availableWidth = Math.max(0, (viewport?.width ?? view.innerWidth) -
295
- (collisionPadding.left ?? 0) -
296
- (collisionPadding.right ?? 0));
297
- if (this.aerisInternalAppendToMatchWidth()) {
298
- this.element.style.minWidth = `${Math.min(anchorRect.width, availableWidth)}px`;
299
- }
300
- const availableHeight = Math.max(0, (viewport?.height ?? view.innerHeight) -
301
- (collisionPadding.top ?? 0) -
302
- (collisionPadding.bottom ?? 0));
303
- let panelRect = this.element.getBoundingClientRect();
304
- const wasWidthConstrained = this.element.hasAttribute('data-viewport-constrained-width');
305
- const naturalWidth = wasWidthConstrained
306
- ? Math.max(this.unconstrainedPanelWidth, this.element.scrollWidth)
307
- : panelRect.width;
308
- this.unconstrainedPanelWidth = naturalWidth;
309
- if (naturalWidth > availableWidth && availableWidth > 0) {
310
- this.element.style.maxWidth = `${availableWidth}px`;
311
- this.element.style.overflowX = 'auto';
312
- this.element.style.overscrollBehavior = 'contain';
313
- this.element.setAttribute('data-viewport-constrained-width', 'true');
314
- panelRect = this.element.getBoundingClientRect();
315
- }
316
- else if (wasWidthConstrained) {
317
- this.element.style.removeProperty('max-width');
318
- this.element.style.removeProperty('overflow-x');
319
- this.element.removeAttribute('data-viewport-constrained-width');
320
- panelRect = this.element.getBoundingClientRect();
321
- }
322
- const wasHeightConstrained = this.element.hasAttribute('data-viewport-constrained');
323
- const naturalHeight = wasHeightConstrained
324
- ? Math.max(this.unconstrainedPanelHeight, this.element.scrollHeight)
325
- : panelRect.height;
326
- this.unconstrainedPanelHeight = naturalHeight;
327
- const direction = view.getComputedStyle(anchor).direction;
328
- const configuredAlignment = this.aerisInternalAppendToAlignment();
329
- const alignment = configuredAlignment === 'auto'
330
- ? direction === 'rtl'
331
- ? 'end'
332
- : 'start'
333
- : configuredAlignment;
334
- const position = (height = panelRect.height || this.element.offsetHeight) => aerisInternalPositionAnchoredOverlay({
335
- target: anchorRect,
336
- width: panelRect.width || this.element.offsetWidth || anchorRect.width,
337
- height,
338
- placement: this.aerisInternalAppendToPlacement(),
339
- alignment,
340
- offset: this.aerisInternalAppendToOffset(),
341
- margin: 8,
342
- viewportWidth: viewport?.width ?? view.innerWidth,
343
- viewportHeight: viewport?.height ?? view.innerHeight,
344
- viewportLeft,
345
- viewportTop,
346
- collisionPadding,
347
- tetherToAnchor: true,
348
- });
349
- let point = position(naturalHeight);
350
- const viewportBounds = {
351
- top: viewportTop + (collisionPadding.top ?? 0),
352
- bottom: viewportTop + (viewport?.height ?? view.innerHeight) - (collisionPadding.bottom ?? 0),
353
- };
354
- const anchorIntersectsViewport = anchorRect.bottom > viewportBounds.top && anchorRect.top < viewportBounds.bottom;
355
- const placementHeight = anchorIntersectsViewport && point.placement === 'bottom'
356
- ? viewportBounds.bottom - anchorRect.bottom - this.aerisInternalAppendToOffset()
357
- : anchorIntersectsViewport && point.placement === 'top'
358
- ? anchorRect.top - viewportBounds.top - this.aerisInternalAppendToOffset()
359
- : availableHeight;
360
- const constrainedHeight = Math.max(0, Math.min(availableHeight, placementHeight));
361
- if (naturalHeight > constrainedHeight && constrainedHeight > 0) {
362
- this.element.style.maxHeight = `${Math.floor(constrainedHeight)}px`;
363
- this.element.style.overflowY = 'auto';
364
- this.element.style.overscrollBehavior = 'contain';
365
- this.element.setAttribute('data-viewport-constrained', 'true');
366
- panelRect = this.element.getBoundingClientRect();
367
- }
368
- else if (wasHeightConstrained) {
369
- this.element.style.removeProperty('max-height');
370
- this.element.style.removeProperty('overflow-y');
371
- this.element.removeAttribute('data-viewport-constrained');
372
- panelRect = this.element.getBoundingClientRect();
373
- }
374
- point = position();
375
- if (!this.element.hasAttribute('data-viewport-constrained') &&
376
- !this.element.hasAttribute('data-viewport-constrained-width')) {
377
- this.element.style.removeProperty('overscroll-behavior');
378
- }
379
- if (target === this.document.body) {
380
- this.element.style.left = `${point.x}px`;
381
- this.element.style.top = `${point.y}px`;
382
- }
383
- else {
384
- const targetRect = target.getBoundingClientRect();
385
- this.element.style.left = `${point.x - targetRect.left - target.clientLeft + target.scrollLeft}px`;
386
- this.element.style.top = `${point.y - targetRect.top - target.clientTop + target.scrollTop}px`;
387
- }
388
- this.element.setAttribute('data-placement', point.placement);
389
- this.element.setAttribute('data-positioned', 'true');
390
- }
391
- collisionPadding(view) {
392
- const configured = this.aerisInternalAppendToCollisionPadding();
393
- const padding = typeof configured === 'number'
394
- ? { top: configured, right: configured, bottom: configured, left: configured }
395
- : configured;
396
- const rootStyles = view.getComputedStyle(this.document.documentElement);
397
- const value = (side) => {
398
- const safeArea = Number.parseFloat(rootStyles.getPropertyValue(`--aeris-safe-area-${side}`)) || 0;
399
- return Math.max(0, padding[side] ?? 0) + safeArea;
400
- };
401
- return {
402
- top: value('top'),
403
- right: value('right'),
404
- bottom: value('bottom'),
405
- left: value('left'),
406
- };
407
- }
408
- preserveInheritedStyles() {
409
- const view = this.document.defaultView;
410
- if (!view)
411
- return new Map();
412
- const computed = view.getComputedStyle(this.element);
413
- const preserved = new Map();
414
- const properties = ['color', 'direction', 'font'];
415
- for (let index = 0; index < computed.length; index += 1) {
416
- const property = computed.item(index);
417
- if (property.startsWith('--aeris-') || property.startsWith('--_aeris-')) {
418
- properties.push(property);
419
- }
420
- }
421
- for (const property of properties) {
422
- const value = computed.getPropertyValue(property);
423
- if (!value)
424
- continue;
425
- preserved.set(property, {
426
- source: value,
427
- previous: this.element.style.getPropertyValue(property),
428
- });
429
- }
430
- return preserved;
431
- }
432
- applyInheritedStyles(preserved) {
433
- const computed = this.document.defaultView?.getComputedStyle(this.element);
434
- if (!computed)
435
- return;
436
- for (const [property, value] of preserved) {
437
- if (computed.getPropertyValue(property) !== value.source) {
438
- this.element.style.setProperty(property, value.source);
439
- }
440
- }
441
- }
442
- restoreInheritedStyles(preserved) {
443
- for (const [property, value] of preserved) {
444
- if (value.previous)
445
- this.element.style.setProperty(property, value.previous);
446
- else
447
- this.element.style.removeProperty(property);
448
- }
449
- }
450
- preserveInlineStyles(properties) {
451
- return new Map(properties.map((property) => [property, this.element.style.getPropertyValue(property)]));
452
- }
453
- restoreInlineStyles(previous) {
454
- for (const [property, value] of previous) {
455
- if (value)
456
- this.element.style.setProperty(property, value);
457
- else
458
- this.element.style.removeProperty(property);
459
- }
460
- }
461
- bringToFront() {
462
- const computedZIndex = Number.parseInt(this.document.defaultView?.getComputedStyle(this.element).zIndex ?? '', 10);
463
- const zIndex = Math.max(Number.isFinite(computedZIndex) ? computedZIndex : 0, nextAppendToZIndex);
464
- nextAppendToZIndex = zIndex + 1;
465
- this.element.style.zIndex = String(zIndex);
466
- }
467
- ensurePositionedTarget(target) {
468
- if (target === this.document.body || !this.document.defaultView) {
469
- return { restore: () => undefined };
470
- }
471
- const existing = positionedTargets.get(target);
472
- if (existing) {
473
- existing.count += 1;
474
- return { restore: () => this.releasePositionedTarget(target) };
475
- }
476
- if (this.document.defaultView.getComputedStyle(target).position !== 'static') {
477
- return { restore: () => undefined };
478
- }
479
- const previous = target.style.position;
480
- target.style.position = 'relative';
481
- positionedTargets.set(target, { count: 1, previous });
482
- return { restore: () => this.releasePositionedTarget(target) };
483
- }
484
- releasePositionedTarget(target) {
485
- const entry = positionedTargets.get(target);
486
- if (!entry)
487
- return;
488
- entry.count -= 1;
489
- if (entry.count > 0)
490
- return;
491
- target.style.position = entry.previous;
492
- positionedTargets.delete(target);
493
- }
494
- hasClippingAncestor(anchor) {
495
- const view = this.document.defaultView;
496
- if (!view)
497
- return false;
498
- let ancestor = anchor.parentElement;
499
- while (ancestor &&
500
- ancestor !== this.document.body &&
501
- ancestor !== this.document.documentElement) {
502
- const style = view.getComputedStyle(ancestor);
503
- if (isClippingOverflow(style.overflow) ||
504
- isClippingOverflow(style.overflowX) ||
505
- isClippingOverflow(style.overflowY) ||
506
- hasPaintContainment(style.contain) ||
507
- (style.clipPath && style.clipPath !== 'none')) {
508
- return true;
509
- }
510
- ancestor = ancestor.parentElement;
511
- }
512
- return false;
513
- }
514
- cancelFrame() {
515
- if (this.frame === null)
516
- return;
517
- this.document.defaultView?.cancelAnimationFrame(this.frame);
518
- this.frame = null;
519
- }
520
- captureOrigin() {
521
- if (this.originCaptured)
522
- return;
523
- this.originCaptured = true;
524
- this.originParent = this.element.parentNode;
525
- this.originNextSibling = this.element.nextSibling;
526
- }
527
- restoreToOrigin() {
528
- if (this.restoringToOrigin ||
529
- !this.originParent ||
530
- this.element.parentNode === this.originParent)
531
- return;
532
- // Reparenting a focused panel can synchronously dispatch blur/focusout and close it again.
533
- this.restoringToOrigin = true;
534
- try {
535
- this.renderer.insertBefore(this.originParent, this.element, this.originNextSibling?.parentNode === this.originParent ? this.originNextSibling : null);
536
- }
537
- finally {
538
- this.restoringToOrigin = false;
539
- }
540
- }
541
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ɵAerisAppendTo, deps: [], target: i0.ɵɵFactoryTarget.Directive });
542
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.6", type: ɵAerisAppendTo, isStandalone: true, selector: "[aerisInternalAppendTo]", inputs: { aerisInternalAppendTo: { classPropertyName: "aerisInternalAppendTo", publicName: "aerisInternalAppendTo", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToDefault: { classPropertyName: "aerisInternalAppendToDefault", publicName: "aerisInternalAppendToDefault", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToAnchor: { classPropertyName: "aerisInternalAppendToAnchor", publicName: "aerisInternalAppendToAnchor", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToOffset: { classPropertyName: "aerisInternalAppendToOffset", publicName: "aerisInternalAppendToOffset", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToMatchWidth: { classPropertyName: "aerisInternalAppendToMatchWidth", publicName: "aerisInternalAppendToMatchWidth", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToPlacement: { classPropertyName: "aerisInternalAppendToPlacement", publicName: "aerisInternalAppendToPlacement", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToAlignment: { classPropertyName: "aerisInternalAppendToAlignment", publicName: "aerisInternalAppendToAlignment", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToCollisionPadding: { classPropertyName: "aerisInternalAppendToCollisionPadding", publicName: "aerisInternalAppendToCollisionPadding", isSignal: true, isRequired: false, transformFunction: null }, aerisInternalAppendToPositionSelf: { classPropertyName: "aerisInternalAppendToPositionSelf", publicName: "aerisInternalAppendToPositionSelf", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { aerisInternalAppendToOutside: "aerisInternalAppendToOutside" }, ngImport: i0 });
543
- }
544
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: ɵAerisAppendTo, decorators: [{
545
- type: Directive,
546
- args: [{ selector: '[aerisInternalAppendTo]' }]
547
- }], ctorParameters: () => [], propDecorators: { aerisInternalAppendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendTo", required: false }] }], aerisInternalAppendToDefault: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToDefault", required: false }] }], aerisInternalAppendToAnchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToAnchor", required: false }] }], aerisInternalAppendToOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToOffset", required: false }] }], aerisInternalAppendToMatchWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToMatchWidth", required: false }] }], aerisInternalAppendToPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToPlacement", required: false }] }], aerisInternalAppendToAlignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToAlignment", required: false }] }], aerisInternalAppendToCollisionPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToCollisionPadding", required: false }] }], aerisInternalAppendToPositionSelf: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendToPositionSelf", required: false }] }], aerisInternalAppendToOutside: [{ type: i0.Output, args: ["aerisInternalAppendToOutside"] }] } });
127
+ if (!appendTo || appendTo === "self") return "self";
128
+ if (appendTo === "body") return document.body;
129
+ if (isHtmlElement(appendTo)) return appendTo;
130
+ const nativeElement = elementRefNativeElement(appendTo);
131
+ return isHtmlElement(nativeElement) ? nativeElement : "self";
132
+ }
133
+ var ɵAerisAppendTo = class ɵAerisAppendTo {
134
+ document = inject(DOCUMENT);
135
+ destroyRef = inject(DestroyRef);
136
+ element = inject(ElementRef).nativeElement;
137
+ renderer = inject(Renderer2);
138
+ defaultAppendTo = inject(AERIS_OVERLAY_APPEND_TO);
139
+ frame = null;
140
+ originCaptured = false;
141
+ originParent = null;
142
+ originNextSibling = null;
143
+ restoringToOrigin = false;
144
+ unconstrainedPanelWidth = 0;
145
+ unconstrainedPanelHeight = 0;
146
+ aerisInternalAppendTo = input(...ngDevMode ? [void 0, { debugName: "aerisInternalAppendTo" }] : /* istanbul ignore next */ []);
147
+ aerisInternalAppendToDefault = input("self", ...ngDevMode ? [{ debugName: "aerisInternalAppendToDefault" }] : /* istanbul ignore next */ []);
148
+ aerisInternalAppendToAnchor = input(null, ...ngDevMode ? [{ debugName: "aerisInternalAppendToAnchor" }] : /* istanbul ignore next */ []);
149
+ aerisInternalAppendToOffset = input(7, ...ngDevMode ? [{ debugName: "aerisInternalAppendToOffset" }] : /* istanbul ignore next */ []);
150
+ aerisInternalAppendToMatchWidth = input(false, ...ngDevMode ? [{ debugName: "aerisInternalAppendToMatchWidth" }] : /* istanbul ignore next */ []);
151
+ aerisInternalAppendToPlacement = input("auto", ...ngDevMode ? [{ debugName: "aerisInternalAppendToPlacement" }] : /* istanbul ignore next */ []);
152
+ aerisInternalAppendToAlignment = input("auto", ...ngDevMode ? [{ debugName: "aerisInternalAppendToAlignment" }] : /* istanbul ignore next */ []);
153
+ aerisInternalAppendToCollisionPadding = input(8, ...ngDevMode ? [{ debugName: "aerisInternalAppendToCollisionPadding" }] : /* istanbul ignore next */ []);
154
+ aerisInternalAppendToPositionSelf = input(true, ...ngDevMode ? [{ debugName: "aerisInternalAppendToPositionSelf" }] : /* istanbul ignore next */ []);
155
+ aerisInternalAppendToOutside = output();
156
+ constructor() {
157
+ effect((onCleanup) => {
158
+ const target = aerisInternalResolveAppendTo(this.aerisInternalAppendTo() ?? this.defaultAppendTo ?? this.aerisInternalAppendToDefault(), this.document);
159
+ const anchor = this.aerisInternalAppendToAnchor();
160
+ const automaticallyPortaled = this.aerisInternalAppendTo() === void 0 && target === "self" && !!anchor && this.hasClippingAncestor(anchor);
161
+ const effectiveTarget = automaticallyPortaled ? this.document.body : target;
162
+ this.captureOrigin();
163
+ if (effectiveTarget === "self") this.restoreToOrigin();
164
+ if (effectiveTarget === "self" && (!anchor || !this.aerisInternalAppendToPositionSelf())) {
165
+ this.element.removeAttribute("data-aeris-append-to");
166
+ this.element.removeAttribute("data-aeris-auto-portaled");
167
+ return;
168
+ }
169
+ const positioningTarget = effectiveTarget === "self" ? this.element.parentElement : effectiveTarget;
170
+ if (!positioningTarget) return;
171
+ const inheritedStyles = this.preserveInheritedStyles();
172
+ const positioningStyles = this.preserveInlineStyles([
173
+ "position",
174
+ "inset",
175
+ "inset-block-start",
176
+ "inset-inline-start",
177
+ "right",
178
+ "bottom",
179
+ "left",
180
+ "top",
181
+ "min-width",
182
+ "max-width",
183
+ "max-height",
184
+ "overflow-x",
185
+ "overflow-y",
186
+ "overscroll-behavior",
187
+ "z-index"
188
+ ]);
189
+ const targetPosition = this.ensurePositionedTarget(positioningTarget);
190
+ if (effectiveTarget !== "self") {
191
+ this.renderer.appendChild(effectiveTarget, this.element);
192
+ this.applyInheritedStyles(inheritedStyles);
193
+ this.renderer.setAttribute(this.element, "data-aeris-append-to", effectiveTarget === this.document.body ? "body" : "target");
194
+ if (automaticallyPortaled) this.renderer.setAttribute(this.element, "data-aeris-auto-portaled", "true");
195
+ else this.element.removeAttribute("data-aeris-auto-portaled");
196
+ this.bringToFront();
197
+ } else {
198
+ this.element.removeAttribute("data-aeris-append-to");
199
+ this.element.removeAttribute("data-aeris-auto-portaled");
200
+ }
201
+ const reposition = () => this.schedulePosition(anchor, positioningTarget);
202
+ const pointerdown = (event) => {
203
+ const eventTarget = event.target;
204
+ if (!isDomNode(eventTarget)) return;
205
+ if (this.element.contains(eventTarget) || anchor?.contains(eventTarget)) return;
206
+ this.aerisInternalAppendToOutside.emit(event);
207
+ };
208
+ const view = this.document.defaultView;
209
+ const visualViewport = view?.visualViewport;
210
+ view?.addEventListener("resize", reposition);
211
+ visualViewport?.addEventListener("resize", reposition);
212
+ visualViewport?.addEventListener("scroll", reposition);
213
+ this.document.addEventListener("scroll", reposition, true);
214
+ this.document.addEventListener("pointerdown", pointerdown, true);
215
+ const resizeObserver = typeof ResizeObserver === "undefined" || !anchor ? null : new ResizeObserver(reposition);
216
+ if (anchor) resizeObserver?.observe(anchor);
217
+ resizeObserver?.observe(this.element);
218
+ if (anchor && view) this.positionConnectedOverlay(anchor, positioningTarget, view);
219
+ onCleanup(() => {
220
+ view?.removeEventListener("resize", reposition);
221
+ visualViewport?.removeEventListener("resize", reposition);
222
+ visualViewport?.removeEventListener("scroll", reposition);
223
+ this.document.removeEventListener("scroll", reposition, true);
224
+ this.document.removeEventListener("pointerdown", pointerdown, true);
225
+ resizeObserver?.disconnect();
226
+ this.cancelFrame();
227
+ this.restoreInlineStyles(positioningStyles);
228
+ this.element.removeAttribute("data-placement");
229
+ this.element.removeAttribute("data-positioned");
230
+ this.element.removeAttribute("data-viewport-constrained");
231
+ this.element.removeAttribute("data-viewport-constrained-width");
232
+ this.restoreInheritedStyles(inheritedStyles);
233
+ targetPosition.restore();
234
+ this.element.removeAttribute("data-aeris-append-to");
235
+ this.element.removeAttribute("data-aeris-auto-portaled");
236
+ if (effectiveTarget !== "self") this.element.remove();
237
+ });
238
+ });
239
+ this.destroyRef.onDestroy(() => {
240
+ this.element.remove();
241
+ queueMicrotask(() => this.element.remove());
242
+ });
243
+ }
244
+ restore() {
245
+ this.restoreToOrigin();
246
+ }
247
+ schedulePosition(anchor, target) {
248
+ if (!anchor || this.frame !== null) return;
249
+ const view = this.document.defaultView;
250
+ if (!view) return;
251
+ this.frame = view.requestAnimationFrame(() => {
252
+ this.frame = null;
253
+ this.positionConnectedOverlay(anchor, target, view);
254
+ });
255
+ }
256
+ positionConnectedOverlay(anchor, target, view) {
257
+ if (!anchor.isConnected || !this.element.isConnected) return;
258
+ const anchorRect = anchor.getBoundingClientRect();
259
+ this.element.style.position = target === this.document.body ? "fixed" : "absolute";
260
+ this.element.style.inset = "auto";
261
+ this.element.style.insetBlockStart = "auto";
262
+ this.element.style.insetInlineStart = "auto";
263
+ this.element.style.right = "auto";
264
+ this.element.style.bottom = "auto";
265
+ const viewport = view.visualViewport;
266
+ const viewportLeft = viewport?.offsetLeft ?? 0;
267
+ const viewportTop = viewport?.offsetTop ?? 0;
268
+ const collisionPadding = this.collisionPadding(view);
269
+ const availableWidth = Math.max(0, (viewport?.width ?? view.innerWidth) - (collisionPadding.left ?? 0) - (collisionPadding.right ?? 0));
270
+ if (this.aerisInternalAppendToMatchWidth()) this.element.style.minWidth = `${Math.min(anchorRect.width, availableWidth)}px`;
271
+ const availableHeight = Math.max(0, (viewport?.height ?? view.innerHeight) - (collisionPadding.top ?? 0) - (collisionPadding.bottom ?? 0));
272
+ let panelRect = this.element.getBoundingClientRect();
273
+ const wasWidthConstrained = this.element.hasAttribute("data-viewport-constrained-width");
274
+ const naturalWidth = wasWidthConstrained ? Math.max(this.unconstrainedPanelWidth, this.element.scrollWidth) : panelRect.width;
275
+ this.unconstrainedPanelWidth = naturalWidth;
276
+ if (naturalWidth > availableWidth && availableWidth > 0) {
277
+ this.element.style.maxWidth = `${availableWidth}px`;
278
+ this.element.style.overflowX = "auto";
279
+ this.element.style.overscrollBehavior = "contain";
280
+ this.element.setAttribute("data-viewport-constrained-width", "true");
281
+ panelRect = this.element.getBoundingClientRect();
282
+ } else if (wasWidthConstrained) {
283
+ this.element.style.removeProperty("max-width");
284
+ this.element.style.removeProperty("overflow-x");
285
+ this.element.removeAttribute("data-viewport-constrained-width");
286
+ panelRect = this.element.getBoundingClientRect();
287
+ }
288
+ const wasHeightConstrained = this.element.hasAttribute("data-viewport-constrained");
289
+ const naturalHeight = wasHeightConstrained ? Math.max(this.unconstrainedPanelHeight, this.element.scrollHeight) : panelRect.height;
290
+ this.unconstrainedPanelHeight = naturalHeight;
291
+ const direction = view.getComputedStyle(anchor).direction;
292
+ const configuredAlignment = this.aerisInternalAppendToAlignment();
293
+ const alignment = configuredAlignment === "auto" ? direction === "rtl" ? "end" : "start" : configuredAlignment;
294
+ const position = (height = panelRect.height || this.element.offsetHeight) => aerisInternalPositionAnchoredOverlay({
295
+ target: anchorRect,
296
+ width: panelRect.width || this.element.offsetWidth || anchorRect.width,
297
+ height,
298
+ placement: this.aerisInternalAppendToPlacement(),
299
+ alignment,
300
+ offset: this.aerisInternalAppendToOffset(),
301
+ margin: 8,
302
+ viewportWidth: viewport?.width ?? view.innerWidth,
303
+ viewportHeight: viewport?.height ?? view.innerHeight,
304
+ viewportLeft,
305
+ viewportTop,
306
+ collisionPadding,
307
+ tetherToAnchor: true
308
+ });
309
+ let point = position(naturalHeight);
310
+ const viewportBounds = {
311
+ top: viewportTop + (collisionPadding.top ?? 0),
312
+ bottom: viewportTop + (viewport?.height ?? view.innerHeight) - (collisionPadding.bottom ?? 0)
313
+ };
314
+ const anchorIntersectsViewport = anchorRect.bottom > viewportBounds.top && anchorRect.top < viewportBounds.bottom;
315
+ const placementHeight = anchorIntersectsViewport && point.placement === "bottom" ? viewportBounds.bottom - anchorRect.bottom - this.aerisInternalAppendToOffset() : anchorIntersectsViewport && point.placement === "top" ? anchorRect.top - viewportBounds.top - this.aerisInternalAppendToOffset() : availableHeight;
316
+ const constrainedHeight = Math.max(0, Math.min(availableHeight, placementHeight));
317
+ if (naturalHeight > constrainedHeight && constrainedHeight > 0) {
318
+ this.element.style.maxHeight = `${Math.floor(constrainedHeight)}px`;
319
+ this.element.style.overflowY = "auto";
320
+ this.element.style.overscrollBehavior = "contain";
321
+ this.element.setAttribute("data-viewport-constrained", "true");
322
+ panelRect = this.element.getBoundingClientRect();
323
+ } else if (wasHeightConstrained) {
324
+ this.element.style.removeProperty("max-height");
325
+ this.element.style.removeProperty("overflow-y");
326
+ this.element.removeAttribute("data-viewport-constrained");
327
+ panelRect = this.element.getBoundingClientRect();
328
+ }
329
+ point = position();
330
+ if (!this.element.hasAttribute("data-viewport-constrained") && !this.element.hasAttribute("data-viewport-constrained-width")) this.element.style.removeProperty("overscroll-behavior");
331
+ if (target === this.document.body) {
332
+ this.element.style.left = `${point.x}px`;
333
+ this.element.style.top = `${point.y}px`;
334
+ } else {
335
+ const targetRect = target.getBoundingClientRect();
336
+ this.element.style.left = `${point.x - targetRect.left - target.clientLeft + target.scrollLeft}px`;
337
+ this.element.style.top = `${point.y - targetRect.top - target.clientTop + target.scrollTop}px`;
338
+ }
339
+ this.element.setAttribute("data-placement", point.placement);
340
+ this.element.setAttribute("data-positioned", "true");
341
+ }
342
+ collisionPadding(view) {
343
+ const configured = this.aerisInternalAppendToCollisionPadding();
344
+ const padding = typeof configured === "number" ? {
345
+ top: configured,
346
+ right: configured,
347
+ bottom: configured,
348
+ left: configured
349
+ } : configured;
350
+ const rootStyles = view.getComputedStyle(this.document.documentElement);
351
+ const value = (side) => {
352
+ const safeArea = Number.parseFloat(rootStyles.getPropertyValue(`--aeris-safe-area-${side}`)) || 0;
353
+ return Math.max(0, padding[side] ?? 0) + safeArea;
354
+ };
355
+ return {
356
+ top: value("top"),
357
+ right: value("right"),
358
+ bottom: value("bottom"),
359
+ left: value("left")
360
+ };
361
+ }
362
+ preserveInheritedStyles() {
363
+ const view = this.document.defaultView;
364
+ if (!view) return /* @__PURE__ */ new Map();
365
+ const computed = view.getComputedStyle(this.element);
366
+ const preserved = /* @__PURE__ */ new Map();
367
+ const properties = [
368
+ "color",
369
+ "direction",
370
+ "font"
371
+ ];
372
+ for (let index = 0; index < computed.length; index += 1) {
373
+ const property = computed.item(index);
374
+ if (property.startsWith("--aeris-") || property.startsWith("--_aeris-")) properties.push(property);
375
+ }
376
+ for (const property of properties) {
377
+ const value = computed.getPropertyValue(property);
378
+ if (!value) continue;
379
+ preserved.set(property, {
380
+ source: value,
381
+ previous: this.element.style.getPropertyValue(property)
382
+ });
383
+ }
384
+ return preserved;
385
+ }
386
+ applyInheritedStyles(preserved) {
387
+ const computed = this.document.defaultView?.getComputedStyle(this.element);
388
+ if (!computed) return;
389
+ for (const [property, value] of preserved) if (computed.getPropertyValue(property) !== value.source) this.element.style.setProperty(property, value.source);
390
+ }
391
+ restoreInheritedStyles(preserved) {
392
+ for (const [property, value] of preserved) if (value.previous) this.element.style.setProperty(property, value.previous);
393
+ else this.element.style.removeProperty(property);
394
+ }
395
+ preserveInlineStyles(properties) {
396
+ return new Map(properties.map((property) => [property, this.element.style.getPropertyValue(property)]));
397
+ }
398
+ restoreInlineStyles(previous) {
399
+ for (const [property, value] of previous) if (value) this.element.style.setProperty(property, value);
400
+ else this.element.style.removeProperty(property);
401
+ }
402
+ bringToFront() {
403
+ const computedZIndex = Number.parseInt(this.document.defaultView?.getComputedStyle(this.element).zIndex ?? "", 10);
404
+ const zIndex = Math.max(Number.isFinite(computedZIndex) ? computedZIndex : 0, nextAppendToZIndex);
405
+ nextAppendToZIndex = zIndex + 1;
406
+ this.element.style.zIndex = String(zIndex);
407
+ }
408
+ ensurePositionedTarget(target) {
409
+ if (target === this.document.body || !this.document.defaultView) return { restore: () => void 0 };
410
+ const existing = positionedTargets.get(target);
411
+ if (existing) {
412
+ existing.count += 1;
413
+ return { restore: () => this.releasePositionedTarget(target) };
414
+ }
415
+ if (this.document.defaultView.getComputedStyle(target).position !== "static") return { restore: () => void 0 };
416
+ const previous = target.style.position;
417
+ target.style.position = "relative";
418
+ positionedTargets.set(target, {
419
+ count: 1,
420
+ previous
421
+ });
422
+ return { restore: () => this.releasePositionedTarget(target) };
423
+ }
424
+ releasePositionedTarget(target) {
425
+ const entry = positionedTargets.get(target);
426
+ if (!entry) return;
427
+ entry.count -= 1;
428
+ if (entry.count > 0) return;
429
+ target.style.position = entry.previous;
430
+ positionedTargets.delete(target);
431
+ }
432
+ hasClippingAncestor(anchor) {
433
+ const view = this.document.defaultView;
434
+ if (!view) return false;
435
+ let ancestor = anchor.parentElement;
436
+ while (ancestor && ancestor !== this.document.body && ancestor !== this.document.documentElement) {
437
+ const style = view.getComputedStyle(ancestor);
438
+ if (isClippingOverflow(style.overflow) || isClippingOverflow(style.overflowX) || isClippingOverflow(style.overflowY) || hasPaintContainment(style.contain) || style.clipPath && style.clipPath !== "none") return true;
439
+ ancestor = ancestor.parentElement;
440
+ }
441
+ return false;
442
+ }
443
+ cancelFrame() {
444
+ if (this.frame === null) return;
445
+ this.document.defaultView?.cancelAnimationFrame(this.frame);
446
+ this.frame = null;
447
+ }
448
+ captureOrigin() {
449
+ if (this.originCaptured) return;
450
+ this.originCaptured = true;
451
+ this.originParent = this.element.parentNode;
452
+ this.originNextSibling = this.element.nextSibling;
453
+ }
454
+ restoreToOrigin() {
455
+ if (this.restoringToOrigin || !this.originParent || this.element.parentNode === this.originParent) return;
456
+ this.restoringToOrigin = true;
457
+ try {
458
+ this.renderer.insertBefore(this.originParent, this.element, this.originNextSibling?.parentNode === this.originParent ? this.originNextSibling : null);
459
+ } finally {
460
+ this.restoringToOrigin = false;
461
+ }
462
+ }
463
+ static ɵfac = i0.ɵɵngDeclareFactory({
464
+ minVersion: "12.0.0",
465
+ version: "22.2.1",
466
+ ngImport: i0,
467
+ type: ɵAerisAppendTo,
468
+ deps: [],
469
+ target: i0.ɵɵFactoryTarget.Directive
470
+ });
471
+ static ɵdir = i0.ɵɵngDeclareDirective({
472
+ minVersion: "17.1.0",
473
+ version: "22.2.1",
474
+ type: ɵAerisAppendTo,
475
+ isStandalone: true,
476
+ selector: "[aerisInternalAppendTo]",
477
+ inputs: {
478
+ aerisInternalAppendTo: {
479
+ classPropertyName: "aerisInternalAppendTo",
480
+ publicName: "aerisInternalAppendTo",
481
+ isSignal: true,
482
+ isRequired: false,
483
+ transformFunction: null
484
+ },
485
+ aerisInternalAppendToDefault: {
486
+ classPropertyName: "aerisInternalAppendToDefault",
487
+ publicName: "aerisInternalAppendToDefault",
488
+ isSignal: true,
489
+ isRequired: false,
490
+ transformFunction: null
491
+ },
492
+ aerisInternalAppendToAnchor: {
493
+ classPropertyName: "aerisInternalAppendToAnchor",
494
+ publicName: "aerisInternalAppendToAnchor",
495
+ isSignal: true,
496
+ isRequired: false,
497
+ transformFunction: null
498
+ },
499
+ aerisInternalAppendToOffset: {
500
+ classPropertyName: "aerisInternalAppendToOffset",
501
+ publicName: "aerisInternalAppendToOffset",
502
+ isSignal: true,
503
+ isRequired: false,
504
+ transformFunction: null
505
+ },
506
+ aerisInternalAppendToMatchWidth: {
507
+ classPropertyName: "aerisInternalAppendToMatchWidth",
508
+ publicName: "aerisInternalAppendToMatchWidth",
509
+ isSignal: true,
510
+ isRequired: false,
511
+ transformFunction: null
512
+ },
513
+ aerisInternalAppendToPlacement: {
514
+ classPropertyName: "aerisInternalAppendToPlacement",
515
+ publicName: "aerisInternalAppendToPlacement",
516
+ isSignal: true,
517
+ isRequired: false,
518
+ transformFunction: null
519
+ },
520
+ aerisInternalAppendToAlignment: {
521
+ classPropertyName: "aerisInternalAppendToAlignment",
522
+ publicName: "aerisInternalAppendToAlignment",
523
+ isSignal: true,
524
+ isRequired: false,
525
+ transformFunction: null
526
+ },
527
+ aerisInternalAppendToCollisionPadding: {
528
+ classPropertyName: "aerisInternalAppendToCollisionPadding",
529
+ publicName: "aerisInternalAppendToCollisionPadding",
530
+ isSignal: true,
531
+ isRequired: false,
532
+ transformFunction: null
533
+ },
534
+ aerisInternalAppendToPositionSelf: {
535
+ classPropertyName: "aerisInternalAppendToPositionSelf",
536
+ publicName: "aerisInternalAppendToPositionSelf",
537
+ isSignal: true,
538
+ isRequired: false,
539
+ transformFunction: null
540
+ }
541
+ },
542
+ outputs: { aerisInternalAppendToOutside: "aerisInternalAppendToOutside" },
543
+ ngImport: i0
544
+ });
545
+ };
546
+ i0.ɵɵngDeclareClassMetadata({
547
+ minVersion: "12.0.0",
548
+ version: "22.2.1",
549
+ ngImport: i0,
550
+ type: ɵAerisAppendTo,
551
+ decorators: [{
552
+ type: Directive,
553
+ args: [{ selector: "[aerisInternalAppendTo]" }]
554
+ }],
555
+ ctorParameters: () => [],
556
+ propDecorators: {
557
+ aerisInternalAppendTo: [{
558
+ type: i0.Input,
559
+ args: [{
560
+ isSignal: true,
561
+ alias: "aerisInternalAppendTo",
562
+ required: false
563
+ }]
564
+ }],
565
+ aerisInternalAppendToDefault: [{
566
+ type: i0.Input,
567
+ args: [{
568
+ isSignal: true,
569
+ alias: "aerisInternalAppendToDefault",
570
+ required: false
571
+ }]
572
+ }],
573
+ aerisInternalAppendToAnchor: [{
574
+ type: i0.Input,
575
+ args: [{
576
+ isSignal: true,
577
+ alias: "aerisInternalAppendToAnchor",
578
+ required: false
579
+ }]
580
+ }],
581
+ aerisInternalAppendToOffset: [{
582
+ type: i0.Input,
583
+ args: [{
584
+ isSignal: true,
585
+ alias: "aerisInternalAppendToOffset",
586
+ required: false
587
+ }]
588
+ }],
589
+ aerisInternalAppendToMatchWidth: [{
590
+ type: i0.Input,
591
+ args: [{
592
+ isSignal: true,
593
+ alias: "aerisInternalAppendToMatchWidth",
594
+ required: false
595
+ }]
596
+ }],
597
+ aerisInternalAppendToPlacement: [{
598
+ type: i0.Input,
599
+ args: [{
600
+ isSignal: true,
601
+ alias: "aerisInternalAppendToPlacement",
602
+ required: false
603
+ }]
604
+ }],
605
+ aerisInternalAppendToAlignment: [{
606
+ type: i0.Input,
607
+ args: [{
608
+ isSignal: true,
609
+ alias: "aerisInternalAppendToAlignment",
610
+ required: false
611
+ }]
612
+ }],
613
+ aerisInternalAppendToCollisionPadding: [{
614
+ type: i0.Input,
615
+ args: [{
616
+ isSignal: true,
617
+ alias: "aerisInternalAppendToCollisionPadding",
618
+ required: false
619
+ }]
620
+ }],
621
+ aerisInternalAppendToPositionSelf: [{
622
+ type: i0.Input,
623
+ args: [{
624
+ isSignal: true,
625
+ alias: "aerisInternalAppendToPositionSelf",
626
+ required: false
627
+ }]
628
+ }],
629
+ aerisInternalAppendToOutside: [{
630
+ type: i0.Output,
631
+ args: ["aerisInternalAppendToOutside"]
632
+ }]
633
+ }
634
+ });
548
635
  function elementRefNativeElement(value) {
549
- if ('nativeElement' in value)
550
- return value.nativeElement;
551
- if ('elementRef' in value) {
552
- const node = value.elementRef.nativeElement;
553
- if (isHtmlElement(node))
554
- return node;
555
- if (typeof node === 'object' && node !== null && 'parentElement' in node) {
556
- return node.parentElement;
557
- }
558
- }
559
- return null;
636
+ if ("nativeElement" in value) return value.nativeElement;
637
+ if ("elementRef" in value) {
638
+ const node = value.elementRef.nativeElement;
639
+ if (isHtmlElement(node)) return node;
640
+ if (typeof node === "object" && node !== null && "parentElement" in node) return node.parentElement;
641
+ }
642
+ return null;
560
643
  }
561
644
  function isHtmlElement(value) {
562
- return typeof value === 'object' && value !== null && 'nodeType' in value && value.nodeType === 1;
645
+ return typeof value === "object" && value !== null && "nodeType" in value && value.nodeType === 1;
563
646
  }
564
647
  function isDomNode(value) {
565
- return typeof value === 'object' && value !== null && 'nodeType' in value;
648
+ return typeof value === "object" && value !== null && "nodeType" in value;
566
649
  }
567
650
  function isClippingOverflow(value) {
568
- return /^(auto|clip|hidden|overlay|scroll)$/.test(value.trim());
651
+ return /^(auto|clip|hidden|overlay|scroll)$/.test(value.trim());
569
652
  }
570
653
  function hasPaintContainment(value) {
571
- return value
572
- .trim()
573
- .split(/\s+/)
574
- .some((token) => token === 'paint' || token === 'content' || token === 'strict');
654
+ return value.trim().split(/\s+/).some((token) => token === "paint" || token === "content" || token === "strict");
575
655
  }
576
-
577
656
  function filterSelectOptions(options, query, fields, matchMode, locale) {
578
- const normalizedQuery = query.trim().toLocaleLowerCase(locale);
579
- if (!normalizedQuery)
580
- return options;
581
- return options.filter((option) => fields.some((field) => {
582
- const candidate = option[field]?.toLocaleLowerCase(locale) ?? '';
583
- return matchesSelectFilter(candidate, normalizedQuery, matchMode);
584
- }));
657
+ const normalizedQuery = query.trim().toLocaleLowerCase(locale);
658
+ if (!normalizedQuery) return options;
659
+ return options.filter((option) => fields.some((field) => {
660
+ return matchesSelectFilter(option[field]?.toLocaleLowerCase(locale) ?? "", normalizedQuery, matchMode);
661
+ }));
585
662
  }
586
663
  function groupSelectOptions(options) {
587
- const groups = new Map();
588
- for (const option of options) {
589
- const label = option.group?.trim() || null;
590
- const group = groups.get(label);
591
- if (group)
592
- group.push(option);
593
- else
594
- groups.set(label, [option]);
595
- }
596
- return Array.from(groups, ([label, groupedOptions]) => ({
597
- label,
598
- options: groupedOptions,
599
- }));
664
+ const groups = /* @__PURE__ */ new Map();
665
+ for (const option of options) {
666
+ const label = option.group?.trim() || null;
667
+ const group = groups.get(label);
668
+ if (group) group.push(option);
669
+ else groups.set(label, [option]);
670
+ }
671
+ return Array.from(groups, ([label, groupedOptions]) => ({
672
+ label,
673
+ options: groupedOptions
674
+ }));
600
675
  }
601
676
  function selectVirtualRange(optionCount, start, panelMaxHeight, itemSize, buffer) {
602
- const safeItemSize = Math.max(1, itemSize);
603
- const safeBuffer = Math.max(0, buffer);
604
- const safeStart = Math.max(0, Math.min(start, optionCount));
605
- const visibleCount = Math.ceil(selectPanelPixels(panelMaxHeight) / safeItemSize) + safeBuffer * 2;
606
- const end = Math.min(optionCount, safeStart + visibleCount);
607
- return {
608
- start: safeStart,
609
- end,
610
- topPadding: safeStart * safeItemSize,
611
- bottomPadding: Math.max(0, (optionCount - end) * safeItemSize),
612
- };
677
+ const safeItemSize = Math.max(1, itemSize);
678
+ const safeBuffer = Math.max(0, buffer);
679
+ const safeStart = Math.max(0, Math.min(start, optionCount));
680
+ const visibleCount = Math.ceil(selectPanelPixels(panelMaxHeight) / safeItemSize) + safeBuffer * 2;
681
+ const end = Math.min(optionCount, safeStart + visibleCount);
682
+ return {
683
+ start: safeStart,
684
+ end,
685
+ topPadding: safeStart * safeItemSize,
686
+ bottomPadding: Math.max(0, (optionCount - end) * safeItemSize)
687
+ };
613
688
  }
614
689
  function nextEnabledSelectValue(options, currentValue, direction) {
615
- if (!options.length || options.every((option) => option.disabled))
616
- return null;
617
- let index = options.findIndex((option) => option.value === currentValue);
618
- if (index < 0)
619
- index = direction === 1 ? -1 : 0;
620
- do {
621
- index = (index + direction + options.length) % options.length;
622
- } while (options[index]?.disabled);
623
- return options[index]?.value ?? null;
690
+ if (!options.length || options.every((option) => option.disabled)) return null;
691
+ let index = options.findIndex((option) => option.value === currentValue);
692
+ if (index < 0) index = direction === 1 ? -1 : 0;
693
+ do
694
+ index = (index + direction + options.length) % options.length;
695
+ while (options[index]?.disabled);
696
+ return options[index]?.value ?? null;
624
697
  }
625
698
  function boundarySelectValue(options, boundary) {
626
- if (boundary === 'start') {
627
- return options.find((option) => !option.disabled)?.value ?? null;
628
- }
629
- for (let index = options.length - 1; index >= 0; index -= 1) {
630
- const option = options[index];
631
- if (option && !option.disabled)
632
- return option.value;
633
- }
634
- return null;
699
+ if (boundary === "start") return options.find((option) => !option.disabled)?.value ?? null;
700
+ for (let index = options.length - 1; index >= 0; index -= 1) {
701
+ const option = options[index];
702
+ if (option && !option.disabled) return option.value;
703
+ }
704
+ return null;
635
705
  }
636
706
  function matchesSelectFilter(candidate, query, matchMode) {
637
- switch (matchMode) {
638
- case 'startsWith':
639
- return candidate.startsWith(query);
640
- case 'endsWith':
641
- return candidate.endsWith(query);
642
- case 'equals':
643
- return candidate === query;
644
- case 'contains':
645
- return candidate.includes(query);
646
- default:
647
- return false;
648
- }
707
+ switch (matchMode) {
708
+ case "startsWith": return candidate.startsWith(query);
709
+ case "endsWith": return candidate.endsWith(query);
710
+ case "equals": return candidate === query;
711
+ case "contains": return candidate.includes(query);
712
+ default: return false;
713
+ }
649
714
  }
650
715
  function selectPanelPixels(value) {
651
- const normalized = value.trim();
652
- const amount = Number.parseFloat(normalized);
653
- if (!Number.isFinite(amount))
654
- return 288;
655
- return normalized.endsWith('rem') ? amount * 16 : amount;
716
+ const normalized = value.trim();
717
+ const amount = Number.parseFloat(normalized);
718
+ if (!Number.isFinite(amount)) return 288;
719
+ return normalized.endsWith("rem") ? amount * 16 : amount;
656
720
  }
657
-
658
- const scrollLockStates = new WeakMap();
659
- const overlayStacks = new WeakMap();
721
+ const scrollLockStates = /* @__PURE__ */ new WeakMap();
722
+ const overlayStacks = /* @__PURE__ */ new WeakMap();
660
723
  function ɵregisterAerisOverlay(document, token) {
661
- const stack = overlayStacks.get(document) ?? [];
662
- const existingIndex = stack.indexOf(token);
663
- if (existingIndex >= 0)
664
- stack.splice(existingIndex, 1);
665
- stack.push(token);
666
- overlayStacks.set(document, stack);
724
+ const stack = overlayStacks.get(document) ?? [];
725
+ const existingIndex = stack.indexOf(token);
726
+ if (existingIndex >= 0) stack.splice(existingIndex, 1);
727
+ stack.push(token);
728
+ overlayStacks.set(document, stack);
667
729
  }
668
730
  function ɵunregisterAerisOverlay(document, token) {
669
- const stack = overlayStacks.get(document);
670
- if (!stack)
671
- return;
672
- const index = stack.indexOf(token);
673
- if (index >= 0)
674
- stack.splice(index, 1);
675
- if (stack.length === 0)
676
- overlayStacks.delete(document);
731
+ const stack = overlayStacks.get(document);
732
+ if (!stack) return;
733
+ const index = stack.indexOf(token);
734
+ if (index >= 0) stack.splice(index, 1);
735
+ if (stack.length === 0) overlayStacks.delete(document);
677
736
  }
678
737
  function ɵisTopmostAerisOverlay(document, token) {
679
- const stack = overlayStacks.get(document);
680
- return stack?.at(-1) === token;
738
+ return overlayStacks.get(document)?.at(-1) === token;
681
739
  }
682
740
  function ɵlockAerisDocumentScroll(document) {
683
- const existing = scrollLockStates.get(document);
684
- if (existing) {
685
- existing.count += 1;
686
- return;
687
- }
688
- const body = document.body;
689
- const state = {
690
- count: 1,
691
- overflow: body.style.overflow,
692
- paddingInlineEnd: body.style.getPropertyValue('padding-inline-end'),
693
- };
694
- scrollLockStates.set(document, state);
695
- const view = document.defaultView;
696
- const root = document.documentElement;
697
- if (view && root.clientWidth) {
698
- const scrollbarWidth = view.innerWidth - root.clientWidth;
699
- if (scrollbarWidth > 0) {
700
- const currentPadding = Number.parseFloat(view.getComputedStyle(body).paddingInlineEnd) || 0;
701
- body.style.setProperty('padding-inline-end', `${currentPadding + scrollbarWidth}px`);
702
- }
703
- }
704
- body.style.overflow = 'hidden';
741
+ const existing = scrollLockStates.get(document);
742
+ if (existing) {
743
+ existing.count += 1;
744
+ return;
745
+ }
746
+ const body = document.body;
747
+ const state = {
748
+ count: 1,
749
+ overflow: body.style.overflow,
750
+ paddingInlineEnd: body.style.getPropertyValue("padding-inline-end")
751
+ };
752
+ scrollLockStates.set(document, state);
753
+ const view = document.defaultView;
754
+ const root = document.documentElement;
755
+ if (view && root.clientWidth) {
756
+ const scrollbarWidth = view.innerWidth - root.clientWidth;
757
+ if (scrollbarWidth > 0) {
758
+ const currentPadding = Number.parseFloat(view.getComputedStyle(body).paddingInlineEnd) || 0;
759
+ body.style.setProperty("padding-inline-end", `${currentPadding + scrollbarWidth}px`);
760
+ }
761
+ }
762
+ body.style.overflow = "hidden";
705
763
  }
706
764
  function ɵunlockAerisDocumentScroll(document) {
707
- const state = scrollLockStates.get(document);
708
- if (!state)
709
- return;
710
- state.count -= 1;
711
- if (state.count > 0)
712
- return;
713
- const body = document.body;
714
- body.style.overflow = state.overflow;
715
- if (state.paddingInlineEnd) {
716
- body.style.setProperty('padding-inline-end', state.paddingInlineEnd);
717
- }
718
- else {
719
- body.style.removeProperty('padding-inline-end');
720
- }
721
- scrollLockStates.delete(document);
765
+ const state = scrollLockStates.get(document);
766
+ if (!state) return;
767
+ state.count -= 1;
768
+ if (state.count > 0) return;
769
+ const body = document.body;
770
+ body.style.overflow = state.overflow;
771
+ if (state.paddingInlineEnd) body.style.setProperty("padding-inline-end", state.paddingInlineEnd);
772
+ else body.style.removeProperty("padding-inline-end");
773
+ scrollLockStates.delete(document);
722
774
  }
723
-
724
775
  const BASE_FOCUSABLE_SELECTORS = [
725
- 'a[href]',
726
- 'area[href]',
727
- 'button',
728
- 'input',
729
- 'select',
730
- 'textarea',
731
- 'iframe',
732
- 'object',
733
- 'embed',
734
- 'audio[controls]',
735
- 'video[controls]',
736
- 'summary',
737
- '[tabindex]',
776
+ "a[href]",
777
+ "area[href]",
778
+ "button",
779
+ "input",
780
+ "select",
781
+ "textarea",
782
+ "iframe",
783
+ "object",
784
+ "embed",
785
+ "audio[controls]",
786
+ "video[controls]",
787
+ "summary",
788
+ "[tabindex]"
738
789
  ];
739
790
  function aerisInternalIsFocusable(element, options = {}) {
740
- if (!element ||
741
- element.tabIndex < 0 ||
742
- element.matches(':disabled') ||
743
- element.hidden ||
744
- element.inert ||
745
- element.closest('[hidden], [inert], [aria-hidden="true"]')) {
746
- return false;
747
- }
748
- if (element instanceof HTMLInputElement && element.type === 'hidden')
749
- return false;
750
- const closedDetails = element.closest('details:not([open])');
751
- if (closedDetails) {
752
- const summary = Array.from(closedDetails.children).find((child) => child instanceof HTMLElement && child.tagName === 'SUMMARY');
753
- if (!summary?.contains(element))
754
- return false;
755
- }
756
- if (!options.checkComputedVisibility)
757
- return true;
758
- const view = element.ownerDocument.defaultView;
759
- for (let current = element; current; current = current.parentElement) {
760
- const style = view?.getComputedStyle(current);
761
- if (style?.visibility === 'hidden' ||
762
- style?.visibility === 'collapse' ||
763
- style?.display === 'none') {
764
- return false;
765
- }
766
- }
767
- return true;
791
+ if (!element || element.tabIndex < 0 || element.matches(":disabled") || element.hidden || element.inert || element.closest("[hidden], [inert], [aria-hidden=\"true\"]")) return false;
792
+ if (element instanceof HTMLInputElement && element.type === "hidden") return false;
793
+ const closedDetails = element.closest("details:not([open])");
794
+ if (closedDetails) {
795
+ if (!Array.from(closedDetails.children).find((child) => child instanceof HTMLElement && child.tagName === "SUMMARY")?.contains(element)) return false;
796
+ }
797
+ if (!options.checkComputedVisibility) return true;
798
+ const view = element.ownerDocument.defaultView;
799
+ for (let current = element; current; current = current.parentElement) {
800
+ const style = view?.getComputedStyle(current);
801
+ if (style?.visibility === "hidden" || style?.visibility === "collapse" || style?.display === "none") return false;
802
+ }
803
+ return true;
768
804
  }
769
805
  function aerisInternalFocusableElements(root, options = {}) {
770
- const selectors = options.includeContentEditable
771
- ? [...BASE_FOCUSABLE_SELECTORS, '[contenteditable]:not([contenteditable="false"])']
772
- : BASE_FOCUSABLE_SELECTORS;
773
- return Array.from(root.querySelectorAll(selectors.join(',')))
774
- .filter((element) => aerisInternalIsFocusable(element, options))
775
- .sort((left, right) => {
776
- const leftOrder = left.tabIndex > 0 ? left.tabIndex : Number.MAX_SAFE_INTEGER;
777
- const rightOrder = right.tabIndex > 0 ? right.tabIndex : Number.MAX_SAFE_INTEGER;
778
- return leftOrder - rightOrder;
779
- });
806
+ const selectors = options.includeContentEditable ? [...BASE_FOCUSABLE_SELECTORS, "[contenteditable]:not([contenteditable=\"false\"])"] : BASE_FOCUSABLE_SELECTORS;
807
+ return Array.from(root.querySelectorAll(selectors.join(","))).filter((element) => aerisInternalIsFocusable(element, options)).sort((left, right) => {
808
+ return (left.tabIndex > 0 ? left.tabIndex : Number.MAX_SAFE_INTEGER) - (right.tabIndex > 0 ? right.tabIndex : Number.MAX_SAFE_INTEGER);
809
+ });
780
810
  }
781
811
  function aerisInternalFocusInitialElement(root, selector, focusOptions, options = {}) {
782
- let requested = null;
783
- if (selector) {
784
- try {
785
- requested = root.querySelector(selector);
786
- }
787
- catch {
788
- // Invalid consumer selectors fall back to the first focusable element.
789
- }
790
- }
791
- const target = aerisInternalIsFocusable(requested, options)
792
- ? requested
793
- : (aerisInternalFocusableElements(root, options)[0] ?? root);
794
- target.focus(focusOptions);
812
+ let requested = null;
813
+ if (selector) try {
814
+ requested = root.querySelector(selector);
815
+ } catch {}
816
+ (aerisInternalIsFocusable(requested, options) ? requested : aerisInternalFocusableElements(root, options)[0] ?? root).focus(focusOptions);
795
817
  }
796
818
  function aerisInternalTrapTabFocus(event, root, activeElement, options = {}) {
797
- const focusable = aerisInternalFocusableElements(root, options);
798
- if (focusable.length === 0) {
799
- event.preventDefault();
800
- root.focus();
801
- return;
802
- }
803
- const first = focusable[0];
804
- const last = focusable.at(-1);
805
- if (event.shiftKey && activeElement === first) {
806
- event.preventDefault();
807
- last?.focus();
808
- }
809
- else if (!event.shiftKey && activeElement === last) {
810
- event.preventDefault();
811
- first?.focus();
812
- }
819
+ const focusable = aerisInternalFocusableElements(root, options);
820
+ if (focusable.length === 0) {
821
+ event.preventDefault();
822
+ root.focus();
823
+ return;
824
+ }
825
+ const first = focusable[0];
826
+ const last = focusable.at(-1);
827
+ if (event.shiftKey && activeElement === first) {
828
+ event.preventDefault();
829
+ last?.focus();
830
+ } else if (!event.shiftKey && activeElement === last) {
831
+ event.preventDefault();
832
+ first?.focus();
833
+ }
813
834
  }
814
-
815
835
  function aerisInternalColumnSeparatorValues(widths, minColumnWidth) {
816
- const percentages = widths.map((width) => width?.trim().endsWith('%') ? Number.parseFloat(width) : Number.NaN);
817
- if (percentages.every(Number.isFinite)) {
818
- let position = 0;
819
- return percentages.slice(0, -1).map((width) => {
820
- position += width;
821
- return { min: 0, max: 100, now: Math.min(100, Math.max(0, position)) };
822
- });
823
- }
824
- const pixels = widths.map(aerisInternalColumnWidthPixels);
825
- const total = pixels.reduce((sum, width) => sum + width, 0);
826
- let position = 0;
827
- return pixels.slice(0, -1).map((width, index) => {
828
- position += width;
829
- return {
830
- min: minColumnWidth * (index + 1),
831
- max: Math.max(minColumnWidth * (index + 1), total - minColumnWidth * (pixels.length - index - 1)),
832
- now: position,
833
- };
834
- });
836
+ const percentages = widths.map((width) => width?.trim().endsWith("%") ? Number.parseFloat(width) : NaN);
837
+ if (percentages.every(Number.isFinite)) {
838
+ let position = 0;
839
+ return percentages.slice(0, -1).map((width) => {
840
+ position += width;
841
+ return {
842
+ min: 0,
843
+ max: 100,
844
+ now: Math.min(100, Math.max(0, position))
845
+ };
846
+ });
847
+ }
848
+ const pixels = widths.map(aerisInternalColumnWidthPixels);
849
+ const total = pixels.reduce((sum, width) => sum + width, 0);
850
+ let position = 0;
851
+ return pixels.slice(0, -1).map((width, index) => {
852
+ position += width;
853
+ return {
854
+ min: minColumnWidth * (index + 1),
855
+ max: Math.max(minColumnWidth * (index + 1), total - minColumnWidth * (pixels.length - index - 1)),
856
+ now: position
857
+ };
858
+ });
835
859
  }
836
860
  function aerisInternalPixelWidth(width) {
837
- return `${Math.round(width * 100) / 100}px`;
861
+ return `${Math.round(width * 100) / 100}px`;
838
862
  }
839
863
  function aerisInternalColumnWidthPixels(width) {
840
- if (!width)
841
- return 160;
842
- const value = Number.parseFloat(width);
843
- if (!Number.isFinite(value))
844
- return 160;
845
- return width.trim().endsWith('rem') ? value * 16 : value;
864
+ if (!width) return 160;
865
+ const value = Number.parseFloat(width);
866
+ if (!Number.isFinite(value)) return 160;
867
+ return width.trim().endsWith("rem") ? value * 16 : value;
846
868
  }
847
869
  function aerisInternalClampColumnResizeDelta(delta, width, adjacentWidth, minimumWidth) {
848
- const minimum = Math.max(0, minimumWidth);
849
- const minimumDelta = Math.min(0, minimum - width);
850
- const maximumDelta = Math.max(0, adjacentWidth - minimum);
851
- return Math.min(maximumDelta, Math.max(minimumDelta, delta));
870
+ const minimum = Math.max(0, minimumWidth);
871
+ const minimumDelta = Math.min(0, minimum - width);
872
+ const maximumDelta = Math.max(0, adjacentWidth - minimum);
873
+ return Math.min(maximumDelta, Math.max(minimumDelta, delta));
852
874
  }
853
875
  function aerisInternalSetColumnPairWidths(columns, field, adjacentField, width, adjacentWidth) {
854
- const nextWidth = aerisInternalPixelWidth(width);
855
- const nextAdjacentWidth = aerisInternalPixelWidth(adjacentWidth);
856
- return columns.map((column) => {
857
- if (column.field === field)
858
- return { ...column, width: nextWidth };
859
- if (column.field === adjacentField)
860
- return { ...column, width: nextAdjacentWidth };
861
- return column;
862
- });
876
+ const nextWidth = aerisInternalPixelWidth(width);
877
+ const nextAdjacentWidth = aerisInternalPixelWidth(adjacentWidth);
878
+ return columns.map((column) => {
879
+ if (column.field === field) return {
880
+ ...column,
881
+ width: nextWidth
882
+ };
883
+ if (column.field === adjacentField) return {
884
+ ...column,
885
+ width: nextAdjacentWidth
886
+ };
887
+ return column;
888
+ });
863
889
  }
864
890
  function aerisInternalMeasureColumnWidths(header) {
865
- const widths = new Map();
866
- const row = header?.closest('tr');
867
- if (!row)
868
- return widths;
869
- row.querySelectorAll('th[data-field]').forEach((cell) => {
870
- const field = cell.dataset['field'];
871
- const width = cell.getBoundingClientRect().width;
872
- if (field && width > 0)
873
- widths.set(field, width);
874
- });
875
- return widths;
891
+ const widths = /* @__PURE__ */ new Map();
892
+ const row = header?.closest("tr");
893
+ if (!row) return widths;
894
+ row.querySelectorAll("th[data-field]").forEach((cell) => {
895
+ const field = cell.dataset["field"];
896
+ const width = cell.getBoundingClientRect().width;
897
+ if (field && width > 0) widths.set(field, width);
898
+ });
899
+ return widths;
876
900
  }
877
901
  function aerisInternalApplyMeasuredColumnWidths(columns, widths) {
878
- return columns.map((column) => {
879
- const width = widths.get(column.field);
880
- return width == null ? column : { ...column, width: aerisInternalPixelWidth(width) };
881
- });
902
+ return columns.map((column) => {
903
+ const width = widths.get(column.field);
904
+ return width == null ? column : {
905
+ ...column,
906
+ width: aerisInternalPixelWidth(width)
907
+ };
908
+ });
882
909
  }
883
910
  function aerisInternalColumnResizeDirection(element) {
884
- return element.ownerDocument.defaultView?.getComputedStyle(element).direction === 'rtl' ? -1 : 1;
911
+ return element.ownerDocument.defaultView?.getComputedStyle(element).direction === "rtl" ? -1 : 1;
885
912
  }
886
913
  function aerisInternalListenForColumnResize(document, move, end) {
887
- document.addEventListener('pointermove', move);
888
- document.addEventListener('pointerup', end);
889
- document.addEventListener('pointercancel', end);
890
- return () => {
891
- document.removeEventListener('pointermove', move);
892
- document.removeEventListener('pointerup', end);
893
- document.removeEventListener('pointercancel', end);
894
- };
914
+ document.addEventListener("pointermove", move);
915
+ document.addEventListener("pointerup", end);
916
+ document.addEventListener("pointercancel", end);
917
+ return () => {
918
+ document.removeEventListener("pointermove", move);
919
+ document.removeEventListener("pointerup", end);
920
+ document.removeEventListener("pointercancel", end);
921
+ };
895
922
  }
896
-
897
923
  function aerisInternalCreateFrameScheduler(callback) {
898
- let frame = null;
899
- const request = globalThis.requestAnimationFrame?.bind(globalThis);
900
- const cancelFrame = globalThis.cancelAnimationFrame?.bind(globalThis);
901
- return {
902
- schedule: () => {
903
- if (!request) {
904
- callback();
905
- return;
906
- }
907
- if (frame !== null)
908
- return;
909
- frame = request(() => {
910
- frame = null;
911
- callback();
912
- });
913
- },
914
- cancel: () => {
915
- if (frame === null)
916
- return;
917
- cancelFrame?.(frame);
918
- frame = null;
919
- },
920
- };
921
- }
922
-
923
- const AERIS_UI_VERSION = '22.0.0-alpha.7';
924
-
925
- /**
926
- * Generated bundle index. Do not edit.
927
- */
928
-
924
+ let frame = null;
925
+ const request = globalThis.requestAnimationFrame?.bind(globalThis);
926
+ const cancelFrame = globalThis.cancelAnimationFrame?.bind(globalThis);
927
+ return {
928
+ schedule: () => {
929
+ if (!request) {
930
+ callback();
931
+ return;
932
+ }
933
+ if (frame !== null) return;
934
+ frame = request(() => {
935
+ frame = null;
936
+ callback();
937
+ });
938
+ },
939
+ cancel: () => {
940
+ if (frame === null) return;
941
+ cancelFrame?.(frame);
942
+ frame = null;
943
+ }
944
+ };
945
+ }
946
+ const AERIS_UI_VERSION = "22.0.0-alpha.9";
929
947
  export { AERIS_OVERLAY_APPEND_TO, AERIS_UI_VERSION, aerisInternalApplyMeasuredColumnWidths, aerisInternalClampColumnResizeDelta, aerisInternalClampOverlayPoint, aerisInternalColumnResizeDirection, aerisInternalColumnSeparatorValues, aerisInternalColumnWidthPixels, aerisInternalCreateFrameScheduler, aerisInternalFocusInitialElement, aerisInternalFocusableElements, aerisInternalIsFocusable, aerisInternalListenForColumnResize, aerisInternalMeasureColumnWidths, aerisInternalPixelWidth, aerisInternalPositionAnchoredOverlay, aerisInternalSetColumnPairWidths, aerisInternalTrapTabFocus, boundarySelectValue, filterSelectOptions, groupSelectOptions, nextEnabledSelectValue, selectVirtualRange, ɵAerisAppendTo, aerisInternalDisplayInvalid as ɵaerisDisplayInvalid, aerisInternalResolveAppendTo as ɵaerisResolveAppendTo, ɵisTopmostAerisOverlay, ɵlockAerisDocumentScroll, ɵregisterAerisOverlay, ɵunlockAerisDocumentScroll, ɵunregisterAerisOverlay };
930
- //# sourceMappingURL=aeris-ui-core.mjs.map
948
+
949
+ //# sourceMappingURL=aeris-ui-core.mjs.map