@aeris-ui/core 22.0.0-alpha.1 → 22.0.0-alpha.10

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