@adam-milo/ui 1.0.28 → 1.0.29

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 (160) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +3 -1
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +1 -1
  5. package/dist/index11.cjs +1 -1
  6. package/dist/index11.js +1 -1
  7. package/dist/index12.cjs +1 -1
  8. package/dist/index12.js +1 -1
  9. package/dist/index13.cjs +1 -1
  10. package/dist/index13.js +1 -1
  11. package/dist/index14.cjs +1 -1
  12. package/dist/index14.js +1 -1
  13. package/dist/index15.cjs +1 -1
  14. package/dist/index15.js +2 -2
  15. package/dist/index16.cjs +1 -1
  16. package/dist/index16.js +1 -1
  17. package/dist/index17.cjs +1 -1
  18. package/dist/index17.js +1 -1
  19. package/dist/index18.cjs +1 -1
  20. package/dist/index18.js +1 -1
  21. package/dist/index19.cjs +1 -1
  22. package/dist/index19.js +43 -12
  23. package/dist/index2.cjs +1 -1
  24. package/dist/index2.js +1 -1
  25. package/dist/index20.cjs +1 -0
  26. package/dist/index20.js +14 -0
  27. package/dist/index22.cjs +1 -1
  28. package/dist/index22.js +20 -299
  29. package/dist/index23.cjs +1 -1
  30. package/dist/index23.js +298 -13
  31. package/dist/index24.cjs +1 -0
  32. package/dist/index24.js +16 -0
  33. package/dist/{index26.cjs → index27.cjs} +1 -1
  34. package/dist/{index26.js → index27.js} +21 -21
  35. package/dist/index3.cjs +1 -1
  36. package/dist/index3.js +2 -2
  37. package/dist/index4.cjs +1 -1
  38. package/dist/index4.js +1 -1
  39. package/dist/index40.cjs +1 -1
  40. package/dist/index40.js +18 -3
  41. package/dist/index41.cjs +1 -1
  42. package/dist/index41.js +3 -8
  43. package/dist/index42.cjs +1 -1
  44. package/dist/index42.js +7 -66
  45. package/dist/index43.cjs +1 -1
  46. package/dist/index43.js +66 -35
  47. package/dist/index44.cjs +1 -1
  48. package/dist/index44.js +31 -56
  49. package/dist/index45.cjs +1 -1
  50. package/dist/index45.js +60 -6
  51. package/dist/index46.cjs +1 -1
  52. package/dist/index46.js +6 -208
  53. package/dist/index47.cjs +1 -1
  54. package/dist/index47.js +203 -20
  55. package/dist/index48.cjs +1 -1
  56. package/dist/index48.js +23 -202
  57. package/dist/index49.cjs +1 -1
  58. package/dist/index49.js +204 -10
  59. package/dist/index5.cjs +1 -1
  60. package/dist/index5.js +1 -1
  61. package/dist/index50.cjs +1 -1
  62. package/dist/index50.js +10 -289
  63. package/dist/index51.cjs +1 -1
  64. package/dist/index51.js +288 -13
  65. package/dist/index52.cjs +1 -1
  66. package/dist/index52.js +14 -39
  67. package/dist/index53.cjs +1 -1
  68. package/dist/index53.js +36 -82
  69. package/dist/index54.cjs +1 -1
  70. package/dist/index54.js +84 -9
  71. package/dist/index55.cjs +1 -1
  72. package/dist/index55.js +8 -65
  73. package/dist/index56.cjs +1 -1
  74. package/dist/index56.js +68 -3
  75. package/dist/index57.cjs +1 -1
  76. package/dist/index57.js +3 -11
  77. package/dist/index58.cjs +1 -1
  78. package/dist/index58.js +11 -31
  79. package/dist/index59.cjs +1 -1
  80. package/dist/index59.js +30 -118
  81. package/dist/index6.cjs +1 -1
  82. package/dist/index6.js +2 -2
  83. package/dist/index60.cjs +1 -1
  84. package/dist/index60.js +120 -9
  85. package/dist/index61.cjs +1 -1
  86. package/dist/index61.js +8 -14
  87. package/dist/index63.cjs +1 -1
  88. package/dist/index63.js +14 -22
  89. package/dist/index64.cjs +1 -1
  90. package/dist/index64.js +291 -33
  91. package/dist/index65.cjs +1 -1
  92. package/dist/index65.js +22 -622
  93. package/dist/index66.cjs +1 -1
  94. package/dist/index66.js +35 -35
  95. package/dist/index67.cjs +1 -1
  96. package/dist/index67.js +620 -33
  97. package/dist/index68.cjs +1 -1
  98. package/dist/index68.js +37 -5
  99. package/dist/index69.cjs +1 -1
  100. package/dist/index69.js +36 -8
  101. package/dist/index7.cjs +1 -1
  102. package/dist/index7.js +1 -1
  103. package/dist/index70.cjs +1 -1
  104. package/dist/index70.js +5 -3
  105. package/dist/index71.cjs +1 -1
  106. package/dist/index71.js +8 -33
  107. package/dist/index72.cjs +1 -1
  108. package/dist/index72.js +3 -178
  109. package/dist/index73.cjs +1 -1
  110. package/dist/index73.js +31 -17
  111. package/dist/index74.cjs +1 -1
  112. package/dist/index74.js +165 -706
  113. package/dist/index75.cjs +1 -1
  114. package/dist/index75.js +16 -149
  115. package/dist/index76.cjs +1 -1
  116. package/dist/index76.js +697 -149
  117. package/dist/index77.cjs +1 -1
  118. package/dist/index77.js +150 -43
  119. package/dist/index78.cjs +1 -1
  120. package/dist/index78.js +170 -10
  121. package/dist/index79.cjs +1 -1
  122. package/dist/index79.js +83 -14
  123. package/dist/index8.cjs +1 -1
  124. package/dist/index8.js +1 -1
  125. package/dist/index80.cjs +1 -1
  126. package/dist/index80.js +41 -96
  127. package/dist/index81.cjs +1 -1
  128. package/dist/index81.js +10 -85
  129. package/dist/index82.cjs +1 -1
  130. package/dist/index82.js +15 -7
  131. package/dist/index83.cjs +1 -1
  132. package/dist/index83.js +99 -26
  133. package/dist/index84.cjs +1 -1
  134. package/dist/index84.js +8 -34
  135. package/dist/index85.cjs +1 -1
  136. package/dist/index85.js +27 -14
  137. package/dist/index86.cjs +1 -1
  138. package/dist/index86.js +30 -41
  139. package/dist/index87.cjs +1 -1
  140. package/dist/index87.js +13 -6
  141. package/dist/index88.cjs +1 -0
  142. package/dist/index88.js +48 -0
  143. package/dist/index89.cjs +1 -0
  144. package/dist/index89.js +9 -0
  145. package/dist/index9.cjs +1 -1
  146. package/dist/index9.js +2 -2
  147. package/dist/src/components/typography/text/Text.component.d.ts +93 -0
  148. package/dist/src/components/typography/text/Text.component.d.ts.map +1 -0
  149. package/dist/src/index.d.ts +2 -0
  150. package/dist/src/index.d.ts.map +1 -1
  151. package/dist/style.css +1 -1
  152. package/package.json +1 -1
  153. package/dist/index21.cjs +0 -1
  154. package/dist/index21.js +0 -22
  155. package/dist/index38.cjs +0 -1
  156. package/dist/index38.js +0 -21
  157. package/dist/index62.cjs +0 -1
  158. package/dist/index62.js +0 -297
  159. /package/dist/{index34.cjs → index35.cjs} +0 -0
  160. /package/dist/{index34.js → index35.js} +0 -0
package/dist/index76.js CHANGED
@@ -1,173 +1,721 @@
1
- function hasWindow() {
2
- return typeof window !== "undefined";
3
- }
4
- function getNodeName(node) {
5
- if (isNode(node)) {
6
- return (node.nodeName || "").toLowerCase();
7
- }
8
- return "#document";
9
- }
10
- function getWindow(node) {
11
- var _node$ownerDocument;
12
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
13
- }
14
- function getDocumentElement(node) {
15
- var _ref;
16
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
17
- }
18
- function isNode(value) {
19
- if (!hasWindow()) {
20
- return false;
1
+ import { evaluate, getSideAxis, getSide, clamp, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, getAlignmentSides, getAlignment, min, max, getPaddingObject, rectToClientRect, getOppositeAxis, getAlignmentAxis, sides, getAxisLength } from "./index77.js";
2
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
3
+ let {
4
+ reference,
5
+ floating
6
+ } = _ref;
7
+ const sideAxis = getSideAxis(placement);
8
+ const alignmentAxis = getAlignmentAxis(placement);
9
+ const alignLength = getAxisLength(alignmentAxis);
10
+ const side = getSide(placement);
11
+ const isVertical = sideAxis === "y";
12
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
13
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
14
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
15
+ let coords;
16
+ switch (side) {
17
+ case "top":
18
+ coords = {
19
+ x: commonX,
20
+ y: reference.y - floating.height
21
+ };
22
+ break;
23
+ case "bottom":
24
+ coords = {
25
+ x: commonX,
26
+ y: reference.y + reference.height
27
+ };
28
+ break;
29
+ case "right":
30
+ coords = {
31
+ x: reference.x + reference.width,
32
+ y: commonY
33
+ };
34
+ break;
35
+ case "left":
36
+ coords = {
37
+ x: reference.x - floating.width,
38
+ y: commonY
39
+ };
40
+ break;
41
+ default:
42
+ coords = {
43
+ x: reference.x,
44
+ y: reference.y
45
+ };
21
46
  }
22
- return value instanceof Node || value instanceof getWindow(value).Node;
23
- }
24
- function isElement(value) {
25
- if (!hasWindow()) {
26
- return false;
47
+ switch (getAlignment(placement)) {
48
+ case "start":
49
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
50
+ break;
51
+ case "end":
52
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
53
+ break;
27
54
  }
28
- return value instanceof Element || value instanceof getWindow(value).Element;
55
+ return coords;
29
56
  }
30
- function isHTMLElement(value) {
31
- if (!hasWindow()) {
32
- return false;
57
+ const computePosition = async (reference, floating, config) => {
58
+ const {
59
+ placement = "bottom",
60
+ strategy = "absolute",
61
+ middleware = [],
62
+ platform
63
+ } = config;
64
+ const validMiddleware = middleware.filter(Boolean);
65
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
66
+ let rects = await platform.getElementRects({
67
+ reference,
68
+ floating,
69
+ strategy
70
+ });
71
+ let {
72
+ x,
73
+ y
74
+ } = computeCoordsFromPlacement(rects, placement, rtl);
75
+ let statefulPlacement = placement;
76
+ let middlewareData = {};
77
+ let resetCount = 0;
78
+ for (let i = 0; i < validMiddleware.length; i++) {
79
+ const {
80
+ name,
81
+ fn
82
+ } = validMiddleware[i];
83
+ const {
84
+ x: nextX,
85
+ y: nextY,
86
+ data,
87
+ reset
88
+ } = await fn({
89
+ x,
90
+ y,
91
+ initialPlacement: placement,
92
+ placement: statefulPlacement,
93
+ strategy,
94
+ middlewareData,
95
+ rects,
96
+ platform,
97
+ elements: {
98
+ reference,
99
+ floating
100
+ }
101
+ });
102
+ x = nextX != null ? nextX : x;
103
+ y = nextY != null ? nextY : y;
104
+ middlewareData = {
105
+ ...middlewareData,
106
+ [name]: {
107
+ ...middlewareData[name],
108
+ ...data
109
+ }
110
+ };
111
+ if (reset && resetCount <= 50) {
112
+ resetCount++;
113
+ if (typeof reset === "object") {
114
+ if (reset.placement) {
115
+ statefulPlacement = reset.placement;
116
+ }
117
+ if (reset.rects) {
118
+ rects = reset.rects === true ? await platform.getElementRects({
119
+ reference,
120
+ floating,
121
+ strategy
122
+ }) : reset.rects;
123
+ }
124
+ ({
125
+ x,
126
+ y
127
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
128
+ }
129
+ i = -1;
130
+ }
33
131
  }
34
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
35
- }
36
- function isShadowRoot(value) {
37
- if (!hasWindow() || typeof ShadowRoot === "undefined") {
38
- return false;
132
+ return {
133
+ x,
134
+ y,
135
+ placement: statefulPlacement,
136
+ strategy,
137
+ middlewareData
138
+ };
139
+ };
140
+ async function detectOverflow(state, options) {
141
+ var _await$platform$isEle;
142
+ if (options === void 0) {
143
+ options = {};
39
144
  }
40
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
41
- }
42
- const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
43
- function isOverflowElement(element) {
44
145
  const {
45
- overflow,
46
- overflowX,
47
- overflowY,
48
- display
49
- } = getComputedStyle(element);
50
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
51
- }
52
- const tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
53
- function isTableElement(element) {
54
- return tableElements.has(getNodeName(element));
146
+ x,
147
+ y,
148
+ platform,
149
+ rects,
150
+ elements,
151
+ strategy
152
+ } = state;
153
+ const {
154
+ boundary = "clippingAncestors",
155
+ rootBoundary = "viewport",
156
+ elementContext = "floating",
157
+ altBoundary = false,
158
+ padding = 0
159
+ } = evaluate(options, state);
160
+ const paddingObject = getPaddingObject(padding);
161
+ const altContext = elementContext === "floating" ? "reference" : "floating";
162
+ const element = elements[altBoundary ? altContext : elementContext];
163
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
164
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
165
+ boundary,
166
+ rootBoundary,
167
+ strategy
168
+ }));
169
+ const rect = elementContext === "floating" ? {
170
+ x,
171
+ y,
172
+ width: rects.floating.width,
173
+ height: rects.floating.height
174
+ } : rects.reference;
175
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
176
+ const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
177
+ x: 1,
178
+ y: 1
179
+ } : {
180
+ x: 1,
181
+ y: 1
182
+ };
183
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
184
+ elements,
185
+ rect,
186
+ offsetParent,
187
+ strategy
188
+ }) : rect);
189
+ return {
190
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
191
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
192
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
193
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
194
+ };
55
195
  }
56
- const topLayerSelectors = [":popover-open", ":modal"];
57
- function isTopLayer(element) {
58
- return topLayerSelectors.some((selector) => {
59
- try {
60
- return element.matches(selector);
61
- } catch (_e) {
62
- return false;
196
+ const arrow = (options) => ({
197
+ name: "arrow",
198
+ options,
199
+ async fn(state) {
200
+ const {
201
+ x,
202
+ y,
203
+ placement,
204
+ rects,
205
+ platform,
206
+ elements,
207
+ middlewareData
208
+ } = state;
209
+ const {
210
+ element,
211
+ padding = 0
212
+ } = evaluate(options, state) || {};
213
+ if (element == null) {
214
+ return {};
63
215
  }
64
- });
65
- }
66
- const transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
67
- const willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
68
- const containValues = ["paint", "layout", "strict", "content"];
69
- function isContainingBlock(elementOrCss) {
70
- const webkit = isWebKit();
71
- const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
72
- return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
73
- }
74
- function getContainingBlock(element) {
75
- let currentNode = getParentNode(element);
76
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
77
- if (isContainingBlock(currentNode)) {
78
- return currentNode;
79
- } else if (isTopLayer(currentNode)) {
80
- return null;
216
+ const paddingObject = getPaddingObject(padding);
217
+ const coords = {
218
+ x,
219
+ y
220
+ };
221
+ const axis = getAlignmentAxis(placement);
222
+ const length = getAxisLength(axis);
223
+ const arrowDimensions = await platform.getDimensions(element);
224
+ const isYAxis = axis === "y";
225
+ const minProp = isYAxis ? "top" : "left";
226
+ const maxProp = isYAxis ? "bottom" : "right";
227
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
228
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
229
+ const startDiff = coords[axis] - rects.reference[axis];
230
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
231
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
232
+ if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) {
233
+ clientSize = elements.floating[clientProp] || rects.floating[length];
81
234
  }
82
- currentNode = getParentNode(currentNode);
83
- }
84
- return null;
85
- }
86
- function isWebKit() {
87
- if (typeof CSS === "undefined" || !CSS.supports) return false;
88
- return CSS.supports("-webkit-backdrop-filter", "none");
89
- }
90
- const lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
91
- function isLastTraversableNode(node) {
92
- return lastTraversableNodeNames.has(getNodeName(node));
93
- }
94
- function getComputedStyle(element) {
95
- return getWindow(element).getComputedStyle(element);
96
- }
97
- function getNodeScroll(element) {
98
- if (isElement(element)) {
235
+ const centerToReference = endDiff / 2 - startDiff / 2;
236
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
237
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
238
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
239
+ const min$1 = minPadding;
240
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
241
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
242
+ const offset2 = clamp(min$1, center, max2);
243
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
244
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
99
245
  return {
100
- scrollLeft: element.scrollLeft,
101
- scrollTop: element.scrollTop
246
+ [axis]: coords[axis] + alignmentOffset,
247
+ data: {
248
+ [axis]: offset2,
249
+ centerOffset: center - offset2 - alignmentOffset,
250
+ ...shouldAddOffset && {
251
+ alignmentOffset
252
+ }
253
+ },
254
+ reset: shouldAddOffset
102
255
  };
103
256
  }
257
+ });
258
+ const flip = function(options) {
259
+ if (options === void 0) {
260
+ options = {};
261
+ }
104
262
  return {
105
- scrollLeft: element.scrollX,
106
- scrollTop: element.scrollY
263
+ name: "flip",
264
+ options,
265
+ async fn(state) {
266
+ var _middlewareData$arrow, _middlewareData$flip;
267
+ const {
268
+ placement,
269
+ middlewareData,
270
+ rects,
271
+ initialPlacement,
272
+ platform,
273
+ elements
274
+ } = state;
275
+ const {
276
+ mainAxis: checkMainAxis = true,
277
+ crossAxis: checkCrossAxis = true,
278
+ fallbackPlacements: specifiedFallbackPlacements,
279
+ fallbackStrategy = "bestFit",
280
+ fallbackAxisSideDirection = "none",
281
+ flipAlignment = true,
282
+ ...detectOverflowOptions
283
+ } = evaluate(options, state);
284
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
285
+ return {};
286
+ }
287
+ const side = getSide(placement);
288
+ const initialSideAxis = getSideAxis(initialPlacement);
289
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
290
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
291
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
292
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
293
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
294
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
295
+ }
296
+ const placements = [initialPlacement, ...fallbackPlacements];
297
+ const overflow = await detectOverflow(state, detectOverflowOptions);
298
+ const overflows = [];
299
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
300
+ if (checkMainAxis) {
301
+ overflows.push(overflow[side]);
302
+ }
303
+ if (checkCrossAxis) {
304
+ const sides2 = getAlignmentSides(placement, rects, rtl);
305
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
306
+ }
307
+ overflowsData = [...overflowsData, {
308
+ placement,
309
+ overflows
310
+ }];
311
+ if (!overflows.every((side2) => side2 <= 0)) {
312
+ var _middlewareData$flip2, _overflowsData$filter;
313
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
314
+ const nextPlacement = placements[nextIndex];
315
+ if (nextPlacement) {
316
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
317
+ if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
318
+ // overflows the main axis.
319
+ overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
320
+ return {
321
+ data: {
322
+ index: nextIndex,
323
+ overflows: overflowsData
324
+ },
325
+ reset: {
326
+ placement: nextPlacement
327
+ }
328
+ };
329
+ }
330
+ }
331
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
332
+ if (!resetPlacement) {
333
+ switch (fallbackStrategy) {
334
+ case "bestFit": {
335
+ var _overflowsData$filter2;
336
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
337
+ if (hasFallbackAxisSideDirection) {
338
+ const currentSideAxis = getSideAxis(d.placement);
339
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
340
+ // reading directions favoring greater width.
341
+ currentSideAxis === "y";
342
+ }
343
+ return true;
344
+ }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
345
+ if (placement2) {
346
+ resetPlacement = placement2;
347
+ }
348
+ break;
349
+ }
350
+ case "initialPlacement":
351
+ resetPlacement = initialPlacement;
352
+ break;
353
+ }
354
+ }
355
+ if (placement !== resetPlacement) {
356
+ return {
357
+ reset: {
358
+ placement: resetPlacement
359
+ }
360
+ };
361
+ }
362
+ }
363
+ return {};
364
+ }
365
+ };
366
+ };
367
+ function getSideOffsets(overflow, rect) {
368
+ return {
369
+ top: overflow.top - rect.height,
370
+ right: overflow.right - rect.width,
371
+ bottom: overflow.bottom - rect.height,
372
+ left: overflow.left - rect.width
107
373
  };
108
374
  }
109
- function getParentNode(node) {
110
- if (getNodeName(node) === "html") {
111
- return node;
112
- }
113
- const result = (
114
- // Step into the shadow DOM of the parent of a slotted node.
115
- node.assignedSlot || // DOM Element detected.
116
- node.parentNode || // ShadowRoot detected.
117
- isShadowRoot(node) && node.host || // Fallback.
118
- getDocumentElement(node)
119
- );
120
- return isShadowRoot(result) ? result.host : result;
375
+ function isAnySideFullyClipped(overflow) {
376
+ return sides.some((side) => overflow[side] >= 0);
121
377
  }
122
- function getNearestOverflowAncestor(node) {
123
- const parentNode = getParentNode(node);
124
- if (isLastTraversableNode(parentNode)) {
125
- return node.ownerDocument ? node.ownerDocument.body : node.body;
378
+ const hide = function(options) {
379
+ if (options === void 0) {
380
+ options = {};
126
381
  }
127
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
128
- return parentNode;
382
+ return {
383
+ name: "hide",
384
+ options,
385
+ async fn(state) {
386
+ const {
387
+ rects
388
+ } = state;
389
+ const {
390
+ strategy = "referenceHidden",
391
+ ...detectOverflowOptions
392
+ } = evaluate(options, state);
393
+ switch (strategy) {
394
+ case "referenceHidden": {
395
+ const overflow = await detectOverflow(state, {
396
+ ...detectOverflowOptions,
397
+ elementContext: "reference"
398
+ });
399
+ const offsets = getSideOffsets(overflow, rects.reference);
400
+ return {
401
+ data: {
402
+ referenceHiddenOffsets: offsets,
403
+ referenceHidden: isAnySideFullyClipped(offsets)
404
+ }
405
+ };
406
+ }
407
+ case "escaped": {
408
+ const overflow = await detectOverflow(state, {
409
+ ...detectOverflowOptions,
410
+ altBoundary: true
411
+ });
412
+ const offsets = getSideOffsets(overflow, rects.floating);
413
+ return {
414
+ data: {
415
+ escapedOffsets: offsets,
416
+ escaped: isAnySideFullyClipped(offsets)
417
+ }
418
+ };
419
+ }
420
+ default: {
421
+ return {};
422
+ }
423
+ }
424
+ }
425
+ };
426
+ };
427
+ const originSides = /* @__PURE__ */ new Set(["left", "top"]);
428
+ async function convertValueToCoords(state, options) {
429
+ const {
430
+ placement,
431
+ platform,
432
+ elements
433
+ } = state;
434
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
435
+ const side = getSide(placement);
436
+ const alignment = getAlignment(placement);
437
+ const isVertical = getSideAxis(placement) === "y";
438
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
439
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
440
+ const rawValue = evaluate(options, state);
441
+ let {
442
+ mainAxis,
443
+ crossAxis,
444
+ alignmentAxis
445
+ } = typeof rawValue === "number" ? {
446
+ mainAxis: rawValue,
447
+ crossAxis: 0,
448
+ alignmentAxis: null
449
+ } : {
450
+ mainAxis: rawValue.mainAxis || 0,
451
+ crossAxis: rawValue.crossAxis || 0,
452
+ alignmentAxis: rawValue.alignmentAxis
453
+ };
454
+ if (alignment && typeof alignmentAxis === "number") {
455
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
129
456
  }
130
- return getNearestOverflowAncestor(parentNode);
457
+ return isVertical ? {
458
+ x: crossAxis * crossAxisMulti,
459
+ y: mainAxis * mainAxisMulti
460
+ } : {
461
+ x: mainAxis * mainAxisMulti,
462
+ y: crossAxis * crossAxisMulti
463
+ };
131
464
  }
132
- function getOverflowAncestors(node, list, traverseIframes) {
133
- var _node$ownerDocument2;
134
- if (list === void 0) {
135
- list = [];
465
+ const offset = function(options) {
466
+ if (options === void 0) {
467
+ options = 0;
468
+ }
469
+ return {
470
+ name: "offset",
471
+ options,
472
+ async fn(state) {
473
+ var _middlewareData$offse, _middlewareData$arrow;
474
+ const {
475
+ x,
476
+ y,
477
+ placement,
478
+ middlewareData
479
+ } = state;
480
+ const diffCoords = await convertValueToCoords(state, options);
481
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
482
+ return {};
483
+ }
484
+ return {
485
+ x: x + diffCoords.x,
486
+ y: y + diffCoords.y,
487
+ data: {
488
+ ...diffCoords,
489
+ placement
490
+ }
491
+ };
492
+ }
493
+ };
494
+ };
495
+ const shift = function(options) {
496
+ if (options === void 0) {
497
+ options = {};
136
498
  }
137
- if (traverseIframes === void 0) {
138
- traverseIframes = true;
499
+ return {
500
+ name: "shift",
501
+ options,
502
+ async fn(state) {
503
+ const {
504
+ x,
505
+ y,
506
+ placement
507
+ } = state;
508
+ const {
509
+ mainAxis: checkMainAxis = true,
510
+ crossAxis: checkCrossAxis = false,
511
+ limiter = {
512
+ fn: (_ref) => {
513
+ let {
514
+ x: x2,
515
+ y: y2
516
+ } = _ref;
517
+ return {
518
+ x: x2,
519
+ y: y2
520
+ };
521
+ }
522
+ },
523
+ ...detectOverflowOptions
524
+ } = evaluate(options, state);
525
+ const coords = {
526
+ x,
527
+ y
528
+ };
529
+ const overflow = await detectOverflow(state, detectOverflowOptions);
530
+ const crossAxis = getSideAxis(getSide(placement));
531
+ const mainAxis = getOppositeAxis(crossAxis);
532
+ let mainAxisCoord = coords[mainAxis];
533
+ let crossAxisCoord = coords[crossAxis];
534
+ if (checkMainAxis) {
535
+ const minSide = mainAxis === "y" ? "top" : "left";
536
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
537
+ const min2 = mainAxisCoord + overflow[minSide];
538
+ const max2 = mainAxisCoord - overflow[maxSide];
539
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
540
+ }
541
+ if (checkCrossAxis) {
542
+ const minSide = crossAxis === "y" ? "top" : "left";
543
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
544
+ const min2 = crossAxisCoord + overflow[minSide];
545
+ const max2 = crossAxisCoord - overflow[maxSide];
546
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
547
+ }
548
+ const limitedCoords = limiter.fn({
549
+ ...state,
550
+ [mainAxis]: mainAxisCoord,
551
+ [crossAxis]: crossAxisCoord
552
+ });
553
+ return {
554
+ ...limitedCoords,
555
+ data: {
556
+ x: limitedCoords.x - x,
557
+ y: limitedCoords.y - y,
558
+ enabled: {
559
+ [mainAxis]: checkMainAxis,
560
+ [crossAxis]: checkCrossAxis
561
+ }
562
+ }
563
+ };
564
+ }
565
+ };
566
+ };
567
+ const limitShift = function(options) {
568
+ if (options === void 0) {
569
+ options = {};
139
570
  }
140
- const scrollableAncestor = getNearestOverflowAncestor(node);
141
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
142
- const win = getWindow(scrollableAncestor);
143
- if (isBody) {
144
- const frameElement = getFrameElement(win);
145
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
571
+ return {
572
+ options,
573
+ fn(state) {
574
+ const {
575
+ x,
576
+ y,
577
+ placement,
578
+ rects,
579
+ middlewareData
580
+ } = state;
581
+ const {
582
+ offset: offset2 = 0,
583
+ mainAxis: checkMainAxis = true,
584
+ crossAxis: checkCrossAxis = true
585
+ } = evaluate(options, state);
586
+ const coords = {
587
+ x,
588
+ y
589
+ };
590
+ const crossAxis = getSideAxis(placement);
591
+ const mainAxis = getOppositeAxis(crossAxis);
592
+ let mainAxisCoord = coords[mainAxis];
593
+ let crossAxisCoord = coords[crossAxis];
594
+ const rawOffset = evaluate(offset2, state);
595
+ const computedOffset = typeof rawOffset === "number" ? {
596
+ mainAxis: rawOffset,
597
+ crossAxis: 0
598
+ } : {
599
+ mainAxis: 0,
600
+ crossAxis: 0,
601
+ ...rawOffset
602
+ };
603
+ if (checkMainAxis) {
604
+ const len = mainAxis === "y" ? "height" : "width";
605
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
606
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
607
+ if (mainAxisCoord < limitMin) {
608
+ mainAxisCoord = limitMin;
609
+ } else if (mainAxisCoord > limitMax) {
610
+ mainAxisCoord = limitMax;
611
+ }
612
+ }
613
+ if (checkCrossAxis) {
614
+ var _middlewareData$offse, _middlewareData$offse2;
615
+ const len = mainAxis === "y" ? "width" : "height";
616
+ const isOriginSide = originSides.has(getSide(placement));
617
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
618
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
619
+ if (crossAxisCoord < limitMin) {
620
+ crossAxisCoord = limitMin;
621
+ } else if (crossAxisCoord > limitMax) {
622
+ crossAxisCoord = limitMax;
623
+ }
624
+ }
625
+ return {
626
+ [mainAxis]: mainAxisCoord,
627
+ [crossAxis]: crossAxisCoord
628
+ };
629
+ }
630
+ };
631
+ };
632
+ const size = function(options) {
633
+ if (options === void 0) {
634
+ options = {};
146
635
  }
147
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
148
- }
149
- function getFrameElement(win) {
150
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
151
- }
636
+ return {
637
+ name: "size",
638
+ options,
639
+ async fn(state) {
640
+ var _state$middlewareData, _state$middlewareData2;
641
+ const {
642
+ placement,
643
+ rects,
644
+ platform,
645
+ elements
646
+ } = state;
647
+ const {
648
+ apply = () => {
649
+ },
650
+ ...detectOverflowOptions
651
+ } = evaluate(options, state);
652
+ const overflow = await detectOverflow(state, detectOverflowOptions);
653
+ const side = getSide(placement);
654
+ const alignment = getAlignment(placement);
655
+ const isYAxis = getSideAxis(placement) === "y";
656
+ const {
657
+ width,
658
+ height
659
+ } = rects.floating;
660
+ let heightSide;
661
+ let widthSide;
662
+ if (side === "top" || side === "bottom") {
663
+ heightSide = side;
664
+ widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
665
+ } else {
666
+ widthSide = side;
667
+ heightSide = alignment === "end" ? "top" : "bottom";
668
+ }
669
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
670
+ const maximumClippingWidth = width - overflow.left - overflow.right;
671
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
672
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
673
+ const noShift = !state.middlewareData.shift;
674
+ let availableHeight = overflowAvailableHeight;
675
+ let availableWidth = overflowAvailableWidth;
676
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
677
+ availableWidth = maximumClippingWidth;
678
+ }
679
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
680
+ availableHeight = maximumClippingHeight;
681
+ }
682
+ if (noShift && !alignment) {
683
+ const xMin = max(overflow.left, 0);
684
+ const xMax = max(overflow.right, 0);
685
+ const yMin = max(overflow.top, 0);
686
+ const yMax = max(overflow.bottom, 0);
687
+ if (isYAxis) {
688
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
689
+ } else {
690
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
691
+ }
692
+ }
693
+ await apply({
694
+ ...state,
695
+ availableWidth,
696
+ availableHeight
697
+ });
698
+ const nextDimensions = await platform.getDimensions(elements.floating);
699
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
700
+ return {
701
+ reset: {
702
+ rects: true
703
+ }
704
+ };
705
+ }
706
+ return {};
707
+ }
708
+ };
709
+ };
152
710
  export {
153
- getComputedStyle,
154
- getContainingBlock,
155
- getDocumentElement,
156
- getFrameElement,
157
- getNearestOverflowAncestor,
158
- getNodeName,
159
- getNodeScroll,
160
- getOverflowAncestors,
161
- getParentNode,
162
- getWindow,
163
- isContainingBlock,
164
- isElement,
165
- isHTMLElement,
166
- isLastTraversableNode,
167
- isNode,
168
- isOverflowElement,
169
- isShadowRoot,
170
- isTableElement,
171
- isTopLayer,
172
- isWebKit
711
+ arrow,
712
+ computePosition,
713
+ detectOverflow,
714
+ flip,
715
+ hide,
716
+ limitShift,
717
+ offset,
718
+ rectToClientRect,
719
+ shift,
720
+ size
173
721
  };