@aeris-ui/core 22.0.0-alpha.4 → 22.0.0-alpha.6

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 (197) hide show
  1. package/README.md +2 -2
  2. package/fesm2022/aeris-ui-core-accordion.mjs +12 -12
  3. package/fesm2022/aeris-ui-core-accordion.mjs.map +1 -1
  4. package/fesm2022/aeris-ui-core-animate-on-scroll.mjs +3 -3
  5. package/fesm2022/aeris-ui-core-animate-on-scroll.mjs.map +1 -1
  6. package/fesm2022/aeris-ui-core-auto-complete.mjs +59 -54
  7. package/fesm2022/aeris-ui-core-auto-complete.mjs.map +1 -1
  8. package/fesm2022/aeris-ui-core-auto-focus.mjs +3 -3
  9. package/fesm2022/aeris-ui-core-auto-focus.mjs.map +1 -1
  10. package/fesm2022/aeris-ui-core-avatar.mjs +9 -9
  11. package/fesm2022/aeris-ui-core-avatar.mjs.map +1 -1
  12. package/fesm2022/aeris-ui-core-badge.mjs +10 -10
  13. package/fesm2022/aeris-ui-core-badge.mjs.map +1 -1
  14. package/fesm2022/aeris-ui-core-block-ui.mjs +3 -3
  15. package/fesm2022/aeris-ui-core-block-ui.mjs.map +1 -1
  16. package/fesm2022/aeris-ui-core-breadcrumb.mjs +12 -12
  17. package/fesm2022/aeris-ui-core-breadcrumb.mjs.map +1 -1
  18. package/fesm2022/aeris-ui-core-button-group.mjs +3 -3
  19. package/fesm2022/aeris-ui-core-button-group.mjs.map +1 -1
  20. package/fesm2022/aeris-ui-core-button.mjs +8 -8
  21. package/fesm2022/aeris-ui-core-button.mjs.map +1 -1
  22. package/fesm2022/aeris-ui-core-card.mjs +18 -18
  23. package/fesm2022/aeris-ui-core-card.mjs.map +1 -1
  24. package/fesm2022/aeris-ui-core-carousel.mjs +12 -12
  25. package/fesm2022/aeris-ui-core-carousel.mjs.map +1 -1
  26. package/fesm2022/aeris-ui-core-cascade-select.mjs +40 -39
  27. package/fesm2022/aeris-ui-core-cascade-select.mjs.map +1 -1
  28. package/fesm2022/aeris-ui-core-chart.mjs +3 -3
  29. package/fesm2022/aeris-ui-core-chart.mjs.map +1 -1
  30. package/fesm2022/aeris-ui-core-checkbox.mjs +5 -5
  31. package/fesm2022/aeris-ui-core-checkbox.mjs.map +1 -1
  32. package/fesm2022/aeris-ui-core-chip.mjs +9 -9
  33. package/fesm2022/aeris-ui-core-chip.mjs.map +1 -1
  34. package/fesm2022/aeris-ui-core-class-names.mjs +3 -3
  35. package/fesm2022/aeris-ui-core-class-names.mjs.map +1 -1
  36. package/fesm2022/aeris-ui-core-color-picker.mjs +10 -20
  37. package/fesm2022/aeris-ui-core-color-picker.mjs.map +1 -1
  38. package/fesm2022/aeris-ui-core-compare.mjs +12 -12
  39. package/fesm2022/aeris-ui-core-compare.mjs.map +1 -1
  40. package/fesm2022/aeris-ui-core-confirm-dialog.mjs +19 -19
  41. package/fesm2022/aeris-ui-core-confirm-dialog.mjs.map +1 -1
  42. package/fesm2022/aeris-ui-core-confirm-popup.mjs +19 -19
  43. package/fesm2022/aeris-ui-core-confirm-popup.mjs.map +1 -1
  44. package/fesm2022/aeris-ui-core-context-menu.mjs +15 -8
  45. package/fesm2022/aeris-ui-core-context-menu.mjs.map +1 -1
  46. package/fesm2022/aeris-ui-core-date-picker.mjs +306 -302
  47. package/fesm2022/aeris-ui-core-date-picker.mjs.map +1 -1
  48. package/fesm2022/aeris-ui-core-dialog.mjs +30 -24
  49. package/fesm2022/aeris-ui-core-dialog.mjs.map +1 -1
  50. package/fesm2022/aeris-ui-core-divider.mjs +3 -3
  51. package/fesm2022/aeris-ui-core-divider.mjs.map +1 -1
  52. package/fesm2022/aeris-ui-core-drawer.mjs +30 -24
  53. package/fesm2022/aeris-ui-core-drawer.mjs.map +1 -1
  54. package/fesm2022/aeris-ui-core-dynamic-dialog.mjs +7 -7
  55. package/fesm2022/aeris-ui-core-dynamic-dialog.mjs.map +1 -1
  56. package/fesm2022/aeris-ui-core-editor.mjs +3 -3
  57. package/fesm2022/aeris-ui-core-editor.mjs.map +1 -1
  58. package/fesm2022/aeris-ui-core-file-upload.mjs +24 -24
  59. package/fesm2022/aeris-ui-core-file-upload.mjs.map +1 -1
  60. package/fesm2022/aeris-ui-core-filter-service.mjs +3 -3
  61. package/fesm2022/aeris-ui-core-filter-service.mjs.map +1 -1
  62. package/fesm2022/aeris-ui-core-fluid.mjs +3 -3
  63. package/fesm2022/aeris-ui-core-fluid.mjs.map +1 -1
  64. package/fesm2022/aeris-ui-core-focus-trap.mjs +3 -3
  65. package/fesm2022/aeris-ui-core-focus-trap.mjs.map +1 -1
  66. package/fesm2022/aeris-ui-core-form-field.mjs +181 -0
  67. package/fesm2022/aeris-ui-core-form-field.mjs.map +1 -0
  68. package/fesm2022/aeris-ui-core-galleria.mjs +27 -27
  69. package/fesm2022/aeris-ui-core-galleria.mjs.map +1 -1
  70. package/fesm2022/aeris-ui-core-glass.mjs +3 -3
  71. package/fesm2022/aeris-ui-core-glass.mjs.map +1 -1
  72. package/fesm2022/aeris-ui-core-icon-field.mjs +12 -12
  73. package/fesm2022/aeris-ui-core-icon-field.mjs.map +1 -1
  74. package/fesm2022/aeris-ui-core-inplace.mjs +9 -9
  75. package/fesm2022/aeris-ui-core-inplace.mjs.map +1 -1
  76. package/fesm2022/aeris-ui-core-input-group.mjs +15 -15
  77. package/fesm2022/aeris-ui-core-input-group.mjs.map +1 -1
  78. package/fesm2022/aeris-ui-core-input-mask.mjs +5 -5
  79. package/fesm2022/aeris-ui-core-input-mask.mjs.map +1 -1
  80. package/fesm2022/aeris-ui-core-input-number.mjs +77 -22
  81. package/fesm2022/aeris-ui-core-input-number.mjs.map +1 -1
  82. package/fesm2022/aeris-ui-core-input-otp.mjs +6 -6
  83. package/fesm2022/aeris-ui-core-input-otp.mjs.map +1 -1
  84. package/fesm2022/aeris-ui-core-input-text.mjs +6 -6
  85. package/fesm2022/aeris-ui-core-input-text.mjs.map +1 -1
  86. package/fesm2022/aeris-ui-core-key-filter.mjs +3 -3
  87. package/fesm2022/aeris-ui-core-key-filter.mjs.map +1 -1
  88. package/fesm2022/aeris-ui-core-mega-menu.mjs +15 -7
  89. package/fesm2022/aeris-ui-core-mega-menu.mjs.map +1 -1
  90. package/fesm2022/aeris-ui-core-menu.mjs +38 -18
  91. package/fesm2022/aeris-ui-core-menu.mjs.map +1 -1
  92. package/fesm2022/aeris-ui-core-menubar.mjs +135 -15
  93. package/fesm2022/aeris-ui-core-menubar.mjs.map +1 -1
  94. package/fesm2022/aeris-ui-core-message.mjs +9 -9
  95. package/fesm2022/aeris-ui-core-message.mjs.map +1 -1
  96. package/fesm2022/aeris-ui-core-meter-group.mjs +15 -15
  97. package/fesm2022/aeris-ui-core-meter-group.mjs.map +1 -1
  98. package/fesm2022/aeris-ui-core-multi-select.mjs +34 -44
  99. package/fesm2022/aeris-ui-core-multi-select.mjs.map +1 -1
  100. package/fesm2022/aeris-ui-core-order-list.mjs +9 -9
  101. package/fesm2022/aeris-ui-core-order-list.mjs.map +1 -1
  102. package/fesm2022/aeris-ui-core-organization-chart.mjs +9 -9
  103. package/fesm2022/aeris-ui-core-organization-chart.mjs.map +1 -1
  104. package/fesm2022/aeris-ui-core-paginator.mjs +9 -5
  105. package/fesm2022/aeris-ui-core-paginator.mjs.map +1 -1
  106. package/fesm2022/aeris-ui-core-panel.mjs +15 -15
  107. package/fesm2022/aeris-ui-core-panel.mjs.map +1 -1
  108. package/fesm2022/aeris-ui-core-password.mjs +21 -17
  109. package/fesm2022/aeris-ui-core-password.mjs.map +1 -1
  110. package/fesm2022/aeris-ui-core-pick-list.mjs +9 -9
  111. package/fesm2022/aeris-ui-core-pick-list.mjs.map +1 -1
  112. package/fesm2022/aeris-ui-core-popover.mjs +30 -19
  113. package/fesm2022/aeris-ui-core-popover.mjs.map +1 -1
  114. package/fesm2022/aeris-ui-core-progress-bar.mjs +9 -9
  115. package/fesm2022/aeris-ui-core-progress-bar.mjs.map +1 -1
  116. package/fesm2022/aeris-ui-core-progress-spinner.mjs +6 -6
  117. package/fesm2022/aeris-ui-core-progress-spinner.mjs.map +1 -1
  118. package/fesm2022/aeris-ui-core-radio-button.mjs +5 -5
  119. package/fesm2022/aeris-ui-core-radio-button.mjs.map +1 -1
  120. package/fesm2022/aeris-ui-core-rating.mjs +3 -3
  121. package/fesm2022/aeris-ui-core-rating.mjs.map +1 -1
  122. package/fesm2022/aeris-ui-core-scroll-panel.mjs +3 -3
  123. package/fesm2022/aeris-ui-core-scroll-panel.mjs.map +1 -1
  124. package/fesm2022/aeris-ui-core-scroll-top.mjs +3 -3
  125. package/fesm2022/aeris-ui-core-scroll-top.mjs.map +1 -1
  126. package/fesm2022/aeris-ui-core-select.mjs +78 -66
  127. package/fesm2022/aeris-ui-core-select.mjs.map +1 -1
  128. package/fesm2022/aeris-ui-core-skeleton.mjs +3 -3
  129. package/fesm2022/aeris-ui-core-skeleton.mjs.map +1 -1
  130. package/fesm2022/aeris-ui-core-slider.mjs +3 -3
  131. package/fesm2022/aeris-ui-core-slider.mjs.map +1 -1
  132. package/fesm2022/aeris-ui-core-speed-dial.mjs +3 -3
  133. package/fesm2022/aeris-ui-core-speed-dial.mjs.map +1 -1
  134. package/fesm2022/aeris-ui-core-split-button.mjs +9 -5
  135. package/fesm2022/aeris-ui-core-split-button.mjs.map +1 -1
  136. package/fesm2022/aeris-ui-core-splitter.mjs +6 -6
  137. package/fesm2022/aeris-ui-core-splitter.mjs.map +1 -1
  138. package/fesm2022/aeris-ui-core-stepper.mjs +12 -12
  139. package/fesm2022/aeris-ui-core-stepper.mjs.map +1 -1
  140. package/fesm2022/aeris-ui-core-style-class.mjs +3 -3
  141. package/fesm2022/aeris-ui-core-style-class.mjs.map +1 -1
  142. package/fesm2022/aeris-ui-core-table.mjs +19 -19
  143. package/fesm2022/aeris-ui-core-table.mjs.map +1 -1
  144. package/fesm2022/aeris-ui-core-tabs.mjs +76 -25
  145. package/fesm2022/aeris-ui-core-tabs.mjs.map +1 -1
  146. package/fesm2022/aeris-ui-core-textarea.mjs +6 -6
  147. package/fesm2022/aeris-ui-core-textarea.mjs.map +1 -1
  148. package/fesm2022/aeris-ui-core-theme-builder.mjs.map +1 -1
  149. package/fesm2022/aeris-ui-core-theming.mjs +3 -3
  150. package/fesm2022/aeris-ui-core-theming.mjs.map +1 -1
  151. package/fesm2022/aeris-ui-core-tiered-menu.mjs +29 -10
  152. package/fesm2022/aeris-ui-core-tiered-menu.mjs.map +1 -1
  153. package/fesm2022/aeris-ui-core-timeline.mjs +15 -15
  154. package/fesm2022/aeris-ui-core-timeline.mjs.map +1 -1
  155. package/fesm2022/aeris-ui-core-toast.mjs +47 -36
  156. package/fesm2022/aeris-ui-core-toast.mjs.map +1 -1
  157. package/fesm2022/aeris-ui-core-toggle-switch.mjs +5 -5
  158. package/fesm2022/aeris-ui-core-toggle-switch.mjs.map +1 -1
  159. package/fesm2022/aeris-ui-core-toolbar.mjs +18 -18
  160. package/fesm2022/aeris-ui-core-toolbar.mjs.map +1 -1
  161. package/fesm2022/aeris-ui-core-tooltip.mjs +29 -30
  162. package/fesm2022/aeris-ui-core-tooltip.mjs.map +1 -1
  163. package/fesm2022/aeris-ui-core-tree-select.mjs +92 -66
  164. package/fesm2022/aeris-ui-core-tree-select.mjs.map +1 -1
  165. package/fesm2022/aeris-ui-core-tree-table.mjs +16 -16
  166. package/fesm2022/aeris-ui-core-tree-table.mjs.map +1 -1
  167. package/fesm2022/aeris-ui-core-tree.mjs +12 -12
  168. package/fesm2022/aeris-ui-core-tree.mjs.map +1 -1
  169. package/fesm2022/aeris-ui-core.mjs +305 -56
  170. package/fesm2022/aeris-ui-core.mjs.map +1 -1
  171. package/package.json +6 -2
  172. package/styles/aeris.css +63 -0
  173. package/styles/controls.css +9 -2
  174. package/types/aeris-ui-core-auto-complete.d.ts +4 -2
  175. package/types/aeris-ui-core-cascade-select.d.ts +4 -2
  176. package/types/aeris-ui-core-color-picker.d.ts +3 -2
  177. package/types/aeris-ui-core-context-menu.d.ts +3 -1
  178. package/types/aeris-ui-core-date-picker.d.ts +5 -2
  179. package/types/aeris-ui-core-dialog.d.ts +5 -3
  180. package/types/aeris-ui-core-drawer.d.ts +5 -3
  181. package/types/aeris-ui-core-form-field.d.ts +65 -0
  182. package/types/aeris-ui-core-input-number.d.ts +2 -0
  183. package/types/aeris-ui-core-mega-menu.d.ts +4 -2
  184. package/types/aeris-ui-core-menu.d.ts +3 -2
  185. package/types/aeris-ui-core-menubar.d.ts +27 -3
  186. package/types/aeris-ui-core-multi-select.d.ts +4 -2
  187. package/types/aeris-ui-core-paginator.d.ts +3 -2
  188. package/types/aeris-ui-core-password.d.ts +3 -2
  189. package/types/aeris-ui-core-popover.d.ts +2 -2
  190. package/types/aeris-ui-core-select.d.ts +6 -2
  191. package/types/aeris-ui-core-split-button.d.ts +3 -2
  192. package/types/aeris-ui-core-tabs.d.ts +23 -5
  193. package/types/aeris-ui-core-tiered-menu.d.ts +5 -3
  194. package/types/aeris-ui-core-toast.d.ts +3 -2
  195. package/types/aeris-ui-core-tooltip.d.ts +2 -4
  196. package/types/aeris-ui-core-tree-select.d.ts +4 -2
  197. package/types/aeris-ui-core.d.ts +44 -26
@@ -2,39 +2,87 @@ import { DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, inject, DestroyRef, ElementRef, Renderer2, input, output, effect, Directive } from '@angular/core';
4
4
 
5
- function aerisInternalClampOverlayPoint(point, width, height, viewportWidth, viewportHeight, margin) {
5
+ function aerisInternalClampOverlayPoint(point, width, height, viewportWidth, viewportHeight, margin, viewportLeft = 0, viewportTop = 0) {
6
+ const padding = normalizePadding(margin);
6
7
  return {
7
- x: clamp(point.x, margin, Math.max(margin, viewportWidth - width - margin)),
8
- y: clamp(point.y, margin, Math.max(margin, viewportHeight - height - margin)),
8
+ x: clamp(point.x, viewportLeft + padding.left, Math.max(viewportLeft + padding.left, viewportLeft + viewportWidth - width - padding.right)),
9
+ y: clamp(point.y, viewportTop + padding.top, Math.max(viewportTop + padding.top, viewportTop + viewportHeight - height - padding.bottom)),
9
10
  };
10
11
  }
11
12
  function aerisInternalPositionAnchoredOverlay(options) {
12
- const placement = resolvePlacement(options);
13
+ const bounds = resolveBounds(options);
14
+ const placement = resolvePlacement(options, bounds);
13
15
  const point = rawPosition(placement, options);
16
+ const clampedPoint = aerisInternalClampOverlayPoint(point, options.width, options.height, bounds.right - bounds.left, bounds.bottom - bounds.top, 0, bounds.left, bounds.top);
14
17
  return {
15
18
  placement,
16
- ...aerisInternalClampOverlayPoint(point, options.width, options.height, options.viewportWidth, options.viewportHeight, options.margin),
19
+ ...(options.tetherToAnchor
20
+ ? tetheredPoint(placement, point, clampedPoint)
21
+ : clampedPoint),
17
22
  };
18
23
  }
19
- function resolvePlacement(options) {
20
- if (options.placement !== 'auto')
21
- return options.placement;
24
+ function tetheredPoint(placement, point, clampedPoint) {
25
+ return placement === 'top' || placement === 'bottom'
26
+ ? { x: clampedPoint.x, y: point.y }
27
+ : { x: point.x, y: clampedPoint.y };
28
+ }
29
+ function resolvePlacement(options, bounds) {
22
30
  const spaces = {
23
- bottom: options.viewportHeight - options.target.bottom - options.offset,
24
- top: options.target.top - options.offset,
25
- right: options.viewportWidth - options.target.right - options.offset,
26
- left: options.target.left - options.offset,
31
+ bottom: bounds.bottom - options.target.bottom - options.offset,
32
+ top: options.target.top - bounds.top - options.offset,
33
+ right: bounds.right - options.target.right - options.offset,
34
+ left: options.target.left - bounds.left - options.offset,
35
+ };
36
+ const preferred = options.placement === 'auto' ? 'bottom' : options.placement;
37
+ const candidates = placementCandidates(preferred, options.tetherToAnchor ?? false);
38
+ const fitting = candidates.find((placement) => spaces[placement] >=
39
+ (placement === 'top' || placement === 'bottom' ? options.height : options.width));
40
+ return (fitting ??
41
+ candidates.reduce((best, placement) => (spaces[placement] > spaces[best] ? placement : best)));
42
+ }
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
+ };
53
+ }
54
+ function normalizePadding(padding) {
55
+ if (typeof padding === 'number') {
56
+ const value = Math.max(0, padding);
57
+ return { top: value, right: value, bottom: value, left: value };
58
+ }
59
+ return {
60
+ top: Math.max(0, padding.top ?? 0),
61
+ right: Math.max(0, padding.right ?? 0),
62
+ bottom: Math.max(0, padding.bottom ?? 0),
63
+ left: Math.max(0, padding.left ?? 0),
27
64
  };
28
- if (spaces.bottom >= options.height)
29
- return 'bottom';
30
- if (spaces.top >= options.height)
31
- return 'top';
32
- if (spaces.right >= options.width)
33
- return 'right';
34
- if (spaces.left >= options.width)
35
- return 'left';
36
- return (Object.entries(spaces).sort((left, right) => right[1] - left[1])[0]?.[0] ??
37
- 'bottom');
65
+ }
66
+ function placementCandidates(preferred, preserveAxis) {
67
+ if (preserveAxis) {
68
+ if (preferred === 'top')
69
+ return ['top', 'bottom'];
70
+ if (preferred === 'bottom')
71
+ return ['bottom', 'top'];
72
+ if (preferred === 'right')
73
+ return ['right', 'left'];
74
+ return ['left', 'right'];
75
+ }
76
+ switch (preferred) {
77
+ case 'top':
78
+ return ['top', 'bottom', 'right', 'left'];
79
+ case 'right':
80
+ return ['right', 'left', 'bottom', 'top'];
81
+ case 'bottom':
82
+ return ['bottom', 'top', 'right', 'left'];
83
+ case 'left':
84
+ return ['left', 'right', 'bottom', 'top'];
85
+ }
38
86
  }
39
87
  function rawPosition(placement, options) {
40
88
  if (placement === 'top' || placement === 'bottom') {
@@ -86,6 +134,8 @@ class ɵAerisAppendTo {
86
134
  originCaptured = false;
87
135
  originParent = null;
88
136
  originNextSibling = null;
137
+ unconstrainedPanelWidth = 0;
138
+ unconstrainedPanelHeight = 0;
89
139
  aerisInternalAppendTo = input(/* @ts-ignore */
90
140
  ...(ngDevMode ? [undefined, { debugName: "aerisInternalAppendTo" }] : /* istanbul ignore next */ []));
91
141
  aerisInternalAppendToAnchor = input(null, /* @ts-ignore */
@@ -94,17 +144,36 @@ class ɵAerisAppendTo {
94
144
  ...(ngDevMode ? [{ debugName: "aerisInternalAppendToOffset" }] : /* istanbul ignore next */ []));
95
145
  aerisInternalAppendToMatchWidth = input(false, /* @ts-ignore */
96
146
  ...(ngDevMode ? [{ debugName: "aerisInternalAppendToMatchWidth" }] : /* istanbul ignore next */ []));
147
+ aerisInternalAppendToPlacement = input('auto', /* @ts-ignore */
148
+ ...(ngDevMode ? [{ debugName: "aerisInternalAppendToPlacement" }] : /* istanbul ignore next */ []));
149
+ aerisInternalAppendToAlignment = input('auto', /* @ts-ignore */
150
+ ...(ngDevMode ? [{ debugName: "aerisInternalAppendToAlignment" }] : /* istanbul ignore next */ []));
151
+ aerisInternalAppendToCollisionPadding = input(8, /* @ts-ignore */
152
+ ...(ngDevMode ? [{ debugName: "aerisInternalAppendToCollisionPadding" }] : /* istanbul ignore next */ []));
153
+ aerisInternalAppendToPositionSelf = input(true, /* @ts-ignore */
154
+ ...(ngDevMode ? [{ debugName: "aerisInternalAppendToPositionSelf" }] : /* istanbul ignore next */ []));
97
155
  aerisInternalAppendToOutside = output();
98
156
  constructor() {
99
157
  effect((onCleanup) => {
100
158
  const target = aerisInternalResolveAppendTo(this.aerisInternalAppendTo() ?? this.defaultAppendTo, this.document);
101
159
  const anchor = this.aerisInternalAppendToAnchor();
160
+ const automaticallyPortaled = this.aerisInternalAppendTo() === undefined &&
161
+ target === 'self' &&
162
+ !!anchor &&
163
+ this.hasClippingAncestor(anchor);
164
+ const effectiveTarget = automaticallyPortaled ? this.document.body : target;
102
165
  this.captureOrigin();
103
- if (target === 'self') {
166
+ if (effectiveTarget === 'self')
104
167
  this.restoreToOrigin();
168
+ if (effectiveTarget === 'self' &&
169
+ (!anchor || !this.aerisInternalAppendToPositionSelf())) {
105
170
  this.element.removeAttribute('data-aeris-append-to');
171
+ this.element.removeAttribute('data-aeris-auto-portaled');
106
172
  return;
107
173
  }
174
+ const positioningTarget = effectiveTarget === 'self' ? this.element.parentElement : effectiveTarget;
175
+ if (!positioningTarget)
176
+ return;
108
177
  const inheritedStyles = this.preserveInheritedStyles();
109
178
  const positioningStyles = this.preserveInlineStyles([
110
179
  'position',
@@ -116,14 +185,31 @@ class ɵAerisAppendTo {
116
185
  'left',
117
186
  'top',
118
187
  'min-width',
188
+ 'max-width',
189
+ 'max-height',
190
+ 'overflow-x',
191
+ 'overflow-y',
192
+ 'overscroll-behavior',
119
193
  'z-index',
120
194
  ]);
121
- const targetPosition = this.ensurePositionedTarget(target);
122
- this.renderer.appendChild(target, this.element);
123
- this.applyInheritedStyles(inheritedStyles);
124
- this.renderer.setAttribute(this.element, 'data-aeris-append-to', target === this.document.body ? 'body' : 'target');
125
- this.bringToFront();
126
- const reposition = () => this.schedulePosition(anchor, target);
195
+ const targetPosition = this.ensurePositionedTarget(positioningTarget);
196
+ if (effectiveTarget !== 'self') {
197
+ this.renderer.appendChild(effectiveTarget, this.element);
198
+ this.applyInheritedStyles(inheritedStyles);
199
+ this.renderer.setAttribute(this.element, 'data-aeris-append-to', effectiveTarget === this.document.body ? 'body' : 'target');
200
+ if (automaticallyPortaled) {
201
+ this.renderer.setAttribute(this.element, 'data-aeris-auto-portaled', 'true');
202
+ }
203
+ else {
204
+ this.element.removeAttribute('data-aeris-auto-portaled');
205
+ }
206
+ this.bringToFront();
207
+ }
208
+ else {
209
+ this.element.removeAttribute('data-aeris-append-to');
210
+ this.element.removeAttribute('data-aeris-auto-portaled');
211
+ }
212
+ const reposition = () => this.schedulePosition(anchor, positioningTarget);
127
213
  const pointerdown = (event) => {
128
214
  const eventTarget = event.target;
129
215
  if (!isDomNode(eventTarget))
@@ -133,7 +219,10 @@ class ɵAerisAppendTo {
133
219
  this.aerisInternalAppendToOutside.emit(event);
134
220
  };
135
221
  const view = this.document.defaultView;
222
+ const visualViewport = view?.visualViewport;
136
223
  view?.addEventListener('resize', reposition);
224
+ visualViewport?.addEventListener('resize', reposition);
225
+ visualViewport?.addEventListener('scroll', reposition);
137
226
  this.document.addEventListener('scroll', reposition, true);
138
227
  this.document.addEventListener('pointerdown', pointerdown, true);
139
228
  const resizeObserver = typeof ResizeObserver === 'undefined' || !anchor ? null : new ResizeObserver(reposition);
@@ -141,9 +230,11 @@ class ɵAerisAppendTo {
141
230
  resizeObserver?.observe(anchor);
142
231
  resizeObserver?.observe(this.element);
143
232
  if (anchor && view)
144
- this.positionConnectedOverlay(anchor, target, view);
233
+ this.positionConnectedOverlay(anchor, positioningTarget, view);
145
234
  onCleanup(() => {
146
235
  view?.removeEventListener('resize', reposition);
236
+ visualViewport?.removeEventListener('resize', reposition);
237
+ visualViewport?.removeEventListener('scroll', reposition);
147
238
  this.document.removeEventListener('scroll', reposition, true);
148
239
  this.document.removeEventListener('pointerdown', pointerdown, true);
149
240
  resizeObserver?.disconnect();
@@ -151,10 +242,14 @@ class ɵAerisAppendTo {
151
242
  this.restoreInlineStyles(positioningStyles);
152
243
  this.element.removeAttribute('data-placement');
153
244
  this.element.removeAttribute('data-positioned');
245
+ this.element.removeAttribute('data-viewport-constrained');
246
+ this.element.removeAttribute('data-viewport-constrained-width');
154
247
  this.restoreInheritedStyles(inheritedStyles);
155
248
  targetPosition.restore();
156
249
  this.element.removeAttribute('data-aeris-append-to');
157
- this.element.remove();
250
+ this.element.removeAttribute('data-aeris-auto-portaled');
251
+ if (effectiveTarget !== 'self')
252
+ this.element.remove();
158
253
  });
159
254
  });
160
255
  this.destroyRef.onDestroy(() => {
@@ -166,9 +261,8 @@ class ɵAerisAppendTo {
166
261
  this.restoreToOrigin();
167
262
  }
168
263
  schedulePosition(anchor, target) {
169
- if (!anchor)
264
+ if (!anchor || this.frame !== null)
170
265
  return;
171
- this.cancelFrame();
172
266
  const view = this.document.defaultView;
173
267
  if (!view)
174
268
  return;
@@ -187,22 +281,97 @@ class ɵAerisAppendTo {
187
281
  this.element.style.insetInlineStart = 'auto';
188
282
  this.element.style.right = 'auto';
189
283
  this.element.style.bottom = 'auto';
284
+ const viewport = view.visualViewport;
285
+ const viewportLeft = viewport?.offsetLeft ?? 0;
286
+ const viewportTop = viewport?.offsetTop ?? 0;
287
+ const collisionPadding = this.collisionPadding(view);
288
+ const availableWidth = Math.max(0, (viewport?.width ?? view.innerWidth) -
289
+ (collisionPadding.left ?? 0) -
290
+ (collisionPadding.right ?? 0));
190
291
  if (this.aerisInternalAppendToMatchWidth()) {
191
- this.element.style.minWidth = `${anchorRect.width}px`;
292
+ this.element.style.minWidth = `${Math.min(anchorRect.width, availableWidth)}px`;
293
+ }
294
+ const availableHeight = Math.max(0, (viewport?.height ?? view.innerHeight) -
295
+ (collisionPadding.top ?? 0) -
296
+ (collisionPadding.bottom ?? 0));
297
+ let panelRect = this.element.getBoundingClientRect();
298
+ const wasWidthConstrained = this.element.hasAttribute('data-viewport-constrained-width');
299
+ const naturalWidth = wasWidthConstrained
300
+ ? Math.max(this.unconstrainedPanelWidth, this.element.scrollWidth)
301
+ : panelRect.width;
302
+ this.unconstrainedPanelWidth = naturalWidth;
303
+ if (naturalWidth > availableWidth && availableWidth > 0) {
304
+ this.element.style.maxWidth = `${availableWidth}px`;
305
+ this.element.style.overflowX = 'auto';
306
+ this.element.style.overscrollBehavior = 'contain';
307
+ this.element.setAttribute('data-viewport-constrained-width', 'true');
308
+ panelRect = this.element.getBoundingClientRect();
192
309
  }
193
- const panelRect = this.element.getBoundingClientRect();
310
+ else if (wasWidthConstrained) {
311
+ this.element.style.removeProperty('max-width');
312
+ this.element.style.removeProperty('overflow-x');
313
+ this.element.removeAttribute('data-viewport-constrained-width');
314
+ panelRect = this.element.getBoundingClientRect();
315
+ }
316
+ const wasHeightConstrained = this.element.hasAttribute('data-viewport-constrained');
317
+ const naturalHeight = wasHeightConstrained
318
+ ? Math.max(this.unconstrainedPanelHeight, this.element.scrollHeight)
319
+ : panelRect.height;
320
+ this.unconstrainedPanelHeight = naturalHeight;
194
321
  const direction = view.getComputedStyle(anchor).direction;
195
- const point = aerisInternalPositionAnchoredOverlay({
322
+ const configuredAlignment = this.aerisInternalAppendToAlignment();
323
+ const alignment = configuredAlignment === 'auto'
324
+ ? direction === 'rtl'
325
+ ? 'end'
326
+ : 'start'
327
+ : configuredAlignment;
328
+ const position = (height = panelRect.height || this.element.offsetHeight) => aerisInternalPositionAnchoredOverlay({
196
329
  target: anchorRect,
197
330
  width: panelRect.width || this.element.offsetWidth || anchorRect.width,
198
- height: panelRect.height || this.element.offsetHeight,
199
- placement: 'auto',
200
- alignment: direction === 'rtl' ? 'end' : 'start',
331
+ height,
332
+ placement: this.aerisInternalAppendToPlacement(),
333
+ alignment,
201
334
  offset: this.aerisInternalAppendToOffset(),
202
335
  margin: 8,
203
- viewportWidth: view.innerWidth,
204
- viewportHeight: view.innerHeight,
336
+ viewportWidth: viewport?.width ?? view.innerWidth,
337
+ viewportHeight: viewport?.height ?? view.innerHeight,
338
+ viewportLeft,
339
+ viewportTop,
340
+ collisionPadding,
341
+ tetherToAnchor: true,
205
342
  });
343
+ let point = position(naturalHeight);
344
+ const viewportBounds = {
345
+ top: viewportTop + (collisionPadding.top ?? 0),
346
+ bottom: viewportTop +
347
+ (viewport?.height ?? view.innerHeight) -
348
+ (collisionPadding.bottom ?? 0),
349
+ };
350
+ const anchorIntersectsViewport = anchorRect.bottom > viewportBounds.top && anchorRect.top < viewportBounds.bottom;
351
+ const placementHeight = anchorIntersectsViewport && point.placement === 'bottom'
352
+ ? viewportBounds.bottom - anchorRect.bottom - this.aerisInternalAppendToOffset()
353
+ : anchorIntersectsViewport && point.placement === 'top'
354
+ ? anchorRect.top - viewportBounds.top - this.aerisInternalAppendToOffset()
355
+ : availableHeight;
356
+ const constrainedHeight = Math.max(0, Math.min(availableHeight, placementHeight));
357
+ if (naturalHeight > constrainedHeight && constrainedHeight > 0) {
358
+ this.element.style.maxHeight = `${Math.floor(constrainedHeight)}px`;
359
+ this.element.style.overflowY = 'auto';
360
+ this.element.style.overscrollBehavior = 'contain';
361
+ this.element.setAttribute('data-viewport-constrained', 'true');
362
+ panelRect = this.element.getBoundingClientRect();
363
+ }
364
+ else if (wasHeightConstrained) {
365
+ this.element.style.removeProperty('max-height');
366
+ this.element.style.removeProperty('overflow-y');
367
+ this.element.removeAttribute('data-viewport-constrained');
368
+ panelRect = this.element.getBoundingClientRect();
369
+ }
370
+ point = position();
371
+ if (!this.element.hasAttribute('data-viewport-constrained') &&
372
+ !this.element.hasAttribute('data-viewport-constrained-width')) {
373
+ this.element.style.removeProperty('overscroll-behavior');
374
+ }
206
375
  if (target === this.document.body) {
207
376
  this.element.style.left = `${point.x}px`;
208
377
  this.element.style.top = `${point.y}px`;
@@ -215,6 +384,23 @@ class ɵAerisAppendTo {
215
384
  this.element.setAttribute('data-placement', point.placement);
216
385
  this.element.setAttribute('data-positioned', 'true');
217
386
  }
387
+ collisionPadding(view) {
388
+ const configured = this.aerisInternalAppendToCollisionPadding();
389
+ const padding = typeof configured === 'number'
390
+ ? { top: configured, right: configured, bottom: configured, left: configured }
391
+ : configured;
392
+ const rootStyles = view.getComputedStyle(this.document.documentElement);
393
+ const value = (side) => {
394
+ const safeArea = Number.parseFloat(rootStyles.getPropertyValue(`--aeris-safe-area-${side}`)) || 0;
395
+ return Math.max(0, padding[side] ?? 0) + safeArea;
396
+ };
397
+ return {
398
+ top: value('top'),
399
+ right: value('right'),
400
+ bottom: value('bottom'),
401
+ left: value('left'),
402
+ };
403
+ }
218
404
  preserveInheritedStyles() {
219
405
  const view = this.document.defaultView;
220
406
  if (!view)
@@ -301,6 +487,26 @@ class ɵAerisAppendTo {
301
487
  target.style.position = entry.previous;
302
488
  positionedTargets.delete(target);
303
489
  }
490
+ hasClippingAncestor(anchor) {
491
+ const view = this.document.defaultView;
492
+ if (!view)
493
+ return false;
494
+ let ancestor = anchor.parentElement;
495
+ while (ancestor &&
496
+ ancestor !== this.document.body &&
497
+ ancestor !== this.document.documentElement) {
498
+ const style = view.getComputedStyle(ancestor);
499
+ if (isClippingOverflow(style.overflow) ||
500
+ isClippingOverflow(style.overflowX) ||
501
+ isClippingOverflow(style.overflowY) ||
502
+ hasPaintContainment(style.contain) ||
503
+ (style.clipPath && style.clipPath !== 'none')) {
504
+ return true;
505
+ }
506
+ ancestor = ancestor.parentElement;
507
+ }
508
+ return false;
509
+ }
304
510
  cancelFrame() {
305
511
  if (this.frame === null)
306
512
  return;
@@ -319,13 +525,13 @@ class ɵAerisAppendTo {
319
525
  return;
320
526
  this.renderer.insertBefore(this.originParent, this.element, this.originNextSibling?.parentNode === this.originParent ? this.originNextSibling : null);
321
527
  }
322
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ɵAerisAppendTo, deps: [], target: i0.ɵɵFactoryTarget.Directive });
323
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.1", type: ɵAerisAppendTo, isStandalone: true, selector: "[aerisInternalAppendTo]", inputs: { aerisInternalAppendTo: { classPropertyName: "aerisInternalAppendTo", publicName: "aerisInternalAppendTo", 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 } }, outputs: { aerisInternalAppendToOutside: "aerisInternalAppendToOutside" }, ngImport: i0 });
528
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ɵAerisAppendTo, deps: [], target: i0.ɵɵFactoryTarget.Directive });
529
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: ɵAerisAppendTo, isStandalone: true, selector: "[aerisInternalAppendTo]", inputs: { aerisInternalAppendTo: { classPropertyName: "aerisInternalAppendTo", publicName: "aerisInternalAppendTo", 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 });
324
530
  }
325
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ɵAerisAppendTo, decorators: [{
531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ɵAerisAppendTo, decorators: [{
326
532
  type: Directive,
327
533
  args: [{ selector: '[aerisInternalAppendTo]' }]
328
- }], ctorParameters: () => [], propDecorators: { aerisInternalAppendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendTo", 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 }] }], aerisInternalAppendToOutside: [{ type: i0.Output, args: ["aerisInternalAppendToOutside"] }] } });
534
+ }], ctorParameters: () => [], propDecorators: { aerisInternalAppendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "aerisInternalAppendTo", 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"] }] } });
329
535
  function elementRefNativeElement(value) {
330
536
  if ('nativeElement' in value)
331
537
  return value.nativeElement;
@@ -345,6 +551,15 @@ function isHtmlElement(value) {
345
551
  function isDomNode(value) {
346
552
  return typeof value === 'object' && value !== null && 'nodeType' in value;
347
553
  }
554
+ function isClippingOverflow(value) {
555
+ return /^(auto|clip|hidden|overlay|scroll)$/.test(value.trim());
556
+ }
557
+ function hasPaintContainment(value) {
558
+ return value
559
+ .trim()
560
+ .split(/\s+/)
561
+ .some((token) => token === 'paint' || token === 'content' || token === 'strict');
562
+ }
348
563
 
349
564
  function filterSelectOptions(options, query, fields, matchMode, locale) {
350
565
  const normalizedQuery = query.trim().toLocaleLowerCase(locale);
@@ -495,26 +710,60 @@ function ɵunlockAerisDocumentScroll(document) {
495
710
 
496
711
  const BASE_FOCUSABLE_SELECTORS = [
497
712
  'a[href]',
498
- 'button:not([disabled])',
499
- 'input:not([disabled])',
500
- 'select:not([disabled])',
501
- 'textarea:not([disabled])',
502
- '[tabindex]:not([tabindex="-1"])',
713
+ 'area[href]',
714
+ 'button',
715
+ 'input',
716
+ 'select',
717
+ 'textarea',
718
+ 'iframe',
719
+ 'object',
720
+ 'embed',
721
+ 'audio[controls]',
722
+ 'video[controls]',
723
+ 'summary',
724
+ '[tabindex]',
503
725
  ];
504
726
  function aerisInternalIsFocusable(element, options = {}) {
505
- if (!element || element.hasAttribute('disabled') || element.getAttribute('aria-hidden') === 'true') {
727
+ if (!element ||
728
+ element.tabIndex < 0 ||
729
+ element.matches(':disabled') ||
730
+ element.hidden ||
731
+ element.inert ||
732
+ element.closest('[hidden], [inert], [aria-hidden="true"]')) {
733
+ return false;
734
+ }
735
+ if (element instanceof HTMLInputElement && element.type === 'hidden')
506
736
  return false;
737
+ const closedDetails = element.closest('details:not([open])');
738
+ if (closedDetails) {
739
+ const summary = Array.from(closedDetails.children).find((child) => child instanceof HTMLElement && child.tagName === 'SUMMARY');
740
+ if (!summary?.contains(element))
741
+ return false;
507
742
  }
508
743
  if (!options.checkComputedVisibility)
509
744
  return true;
510
- const style = element.ownerDocument.defaultView?.getComputedStyle(element);
511
- return style?.visibility !== 'hidden' && style?.display !== 'none';
745
+ const view = element.ownerDocument.defaultView;
746
+ for (let current = element; current; current = current.parentElement) {
747
+ const style = view?.getComputedStyle(current);
748
+ if (style?.visibility === 'hidden' ||
749
+ style?.visibility === 'collapse' ||
750
+ style?.display === 'none') {
751
+ return false;
752
+ }
753
+ }
754
+ return true;
512
755
  }
513
756
  function aerisInternalFocusableElements(root, options = {}) {
514
757
  const selectors = options.includeContentEditable
515
- ? [...BASE_FOCUSABLE_SELECTORS, '[contenteditable="true"]']
758
+ ? [...BASE_FOCUSABLE_SELECTORS, '[contenteditable]:not([contenteditable="false"])']
516
759
  : BASE_FOCUSABLE_SELECTORS;
517
- return Array.from(root.querySelectorAll(selectors.join(','))).filter((element) => aerisInternalIsFocusable(element, options));
760
+ return Array.from(root.querySelectorAll(selectors.join(',')))
761
+ .filter((element) => aerisInternalIsFocusable(element, options))
762
+ .sort((left, right) => {
763
+ const leftOrder = left.tabIndex > 0 ? left.tabIndex : Number.MAX_SAFE_INTEGER;
764
+ const rightOrder = right.tabIndex > 0 ? right.tabIndex : Number.MAX_SAFE_INTEGER;
765
+ return leftOrder - rightOrder;
766
+ });
518
767
  }
519
768
  function aerisInternalFocusInitialElement(root, selector, focusOptions, options = {}) {
520
769
  let requested = null;
@@ -637,7 +886,7 @@ function aerisInternalCreateFrameScheduler(callback) {
637
886
  };
638
887
  }
639
888
 
640
- const AERIS_UI_VERSION = '22.0.0-alpha.4';
889
+ const AERIS_UI_VERSION = '22.0.0-alpha.6';
641
890
 
642
891
  /**
643
892
  * Generated bundle index. Do not edit.