@wix/site-ui 1.346.0 → 1.348.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/{6706.js → 1093.js} +3 -3
  2. package/dist/{8724.js → 1219.js} +2 -2
  3. package/dist/{7373.js → 1288.js} +8 -2
  4. package/dist/{5299.js → 1381.js} +98 -127
  5. package/dist/{3056.js → 1607.js} +32 -34
  6. package/dist/1629.js +2 -0
  7. package/dist/1669.js +75 -0
  8. package/dist/1718.js +26 -0
  9. package/dist/{1477.js → 201.js} +17 -26
  10. package/dist/2221.js +9 -0
  11. package/dist/{2445.js → 226.js} +12 -48
  12. package/dist/2387.js +7 -0
  13. package/dist/2580.js +6 -0
  14. package/dist/{1500.js → 2859.js} +10 -34
  15. package/dist/3014.js +178 -0
  16. package/dist/{6247.js → 3054.js} +3 -3
  17. package/dist/{7642.js → 3093.js} +1 -1
  18. package/dist/3189.js +5 -0
  19. package/dist/{7564.js → 331.js} +2 -2
  20. package/dist/3357.js +7 -0
  21. package/dist/{487.js → 3398.js} +38 -39
  22. package/dist/3502.js +224 -0
  23. package/dist/3695.js +50 -0
  24. package/dist/3829.js +1 -1
  25. package/dist/{6588.js → 3859.js} +115 -92
  26. package/dist/{3670.js → 3910.js} +28 -21
  27. package/dist/392.js +7 -0
  28. package/dist/{4549.js → 4155.js} +11 -3
  29. package/dist/4226.js +7 -0
  30. package/dist/{6329.js → 4229.js} +1 -1
  31. package/dist/4293.js +3 -0
  32. package/dist/4346.js +853 -2
  33. package/dist/{285.js → 4472.js} +3 -3
  34. package/dist/4605.js +207 -0
  35. package/dist/{7366.js → 488.js} +60 -7
  36. package/dist/{8750.js → 497.js} +190 -375
  37. package/dist/4989.js +35 -0
  38. package/dist/{6270.js → 510.js} +157 -196
  39. package/dist/5258.js +26 -0
  40. package/dist/{5036.js → 5275.js} +0 -3
  41. package/dist/{8171.js → 5298.js} +90 -102
  42. package/dist/5473.js +11 -0
  43. package/dist/{4745.js → 5490.js} +3 -1
  44. package/dist/{6089.js → 5561.js} +869 -786
  45. package/dist/{8996.js → 5595.js} +4 -3
  46. package/dist/5890.js +25 -0
  47. package/dist/{6046.js → 5969.js} +1 -1
  48. package/dist/5984.js +38 -0
  49. package/dist/{8527.js → 6006.js} +3 -3
  50. package/dist/6040.js +97 -0
  51. package/dist/{8758.js → 6137.js} +10 -8
  52. package/dist/{4281.js → 6140.js} +18 -10
  53. package/dist/{8960.js → 6191.js} +2 -2
  54. package/dist/6240.js +121 -0
  55. package/dist/{4490.js → 6373.js} +7 -5
  56. package/dist/{904.js → 6487.js} +19 -17
  57. package/dist/{9635.js → 6498.js} +1 -1
  58. package/dist/6499.js +4 -7
  59. package/dist/6508.js +7 -0
  60. package/dist/{8225.js → 6540.js} +1 -0
  61. package/dist/6551.js +46 -0
  62. package/dist/{9369.js → 6620.js} +35 -34
  63. package/dist/{4143.js → 6838.js} +19 -10
  64. package/dist/6902.js +48 -0
  65. package/dist/6904.js +51 -0
  66. package/dist/70.js +24 -0
  67. package/dist/7024.js +39 -0
  68. package/dist/{6882.js → 721.js} +737 -362
  69. package/dist/{951.js → 7270.js} +4 -4
  70. package/dist/{3485.js → 7323.js} +143 -111
  71. package/dist/{7541.js → 7488.js} +2 -2
  72. package/dist/{4863.js → 7542.js} +7 -6
  73. package/dist/7551.js +28 -0
  74. package/dist/{7021.js → 7640.js} +1 -1
  75. package/dist/{353.js → 7692.js} +3 -7
  76. package/dist/{4707.js → 7930.js} +2 -2
  77. package/dist/{8052.js → 8.js} +80 -64
  78. package/dist/{6914.js → 8129.js} +3 -15
  79. package/dist/{3319.js → 8358.js} +62 -63
  80. package/dist/{5864.js → 8407.js} +13 -13
  81. package/dist/8488.js +15 -0
  82. package/dist/{4768.js → 8495.js} +1 -1
  83. package/dist/8734.js +171 -0
  84. package/dist/{1763.js → 9018.js} +205 -331
  85. package/dist/9053.js +29 -0
  86. package/dist/9067.js +41 -0
  87. package/dist/{2861.js → 9120.js} +2 -2
  88. package/dist/{42.js → 9197.js} +2 -2
  89. package/dist/{9189.js → 9248.js} +36 -17
  90. package/dist/{2801.js → 9252.js} +4 -9
  91. package/dist/9295.js +7 -0
  92. package/dist/9303.js +8 -0
  93. package/dist/{167.js → 9374.js} +1 -1
  94. package/dist/{9352.js → 9540.js} +17 -47
  95. package/dist/9576.js +51 -0
  96. package/dist/{8272.js → 9591.js} +36 -46
  97. package/dist/{6107.js → 9770.js} +2 -2
  98. package/dist/{5085.js → 9880.js} +6 -3
  99. package/dist/Accordion/index.d.ts +207 -41
  100. package/dist/Accordion/index.js +75 -177
  101. package/dist/AlertDialog/index.d.ts +440 -140
  102. package/dist/AlertDialog/index.js +3 -13
  103. package/dist/Autocomplete/index.d.ts +722 -150
  104. package/dist/Autocomplete/index.js +16 -29
  105. package/dist/Avatar/index.d.ts +38 -3
  106. package/dist/Avatar/index.js +82 -28
  107. package/dist/Breadcrumbs/index.d.ts +63 -91
  108. package/dist/Breadcrumbs/index.js +1 -1
  109. package/dist/Button/index.d.ts +11 -0
  110. package/dist/Button/index.js +2 -2
  111. package/dist/Checkbox/index.d.ts +206 -36
  112. package/dist/Checkbox/index.js +293 -8
  113. package/dist/CheckboxField/index.css +1 -1
  114. package/dist/CheckboxField/index.d.ts +40 -36
  115. package/dist/CheckboxGroup/index.d.ts +50 -36
  116. package/dist/CheckboxGroup/index.js +87 -58
  117. package/dist/CheckboxGroupField/index.css +1 -1
  118. package/dist/Collapsible/index.d.ts +128 -36
  119. package/dist/Collapsible/index.js +21 -25
  120. package/dist/Combobox/index.d.ts +801 -158
  121. package/dist/Combobox/index.js +70 -114
  122. package/dist/ContextMenu/index.d.ts +1162 -195
  123. package/dist/ContextMenu/index.js +46 -36
  124. package/dist/Dialog/index.d.ts +425 -133
  125. package/dist/Dialog/index.js +8 -4
  126. package/dist/Drawer/index.d.ts +589 -144
  127. package/dist/Drawer/index.js +482 -562
  128. package/dist/Field/index.css +1 -1
  129. package/dist/Field/index.d.ts +341 -42
  130. package/dist/Field/index.js +123 -273
  131. package/dist/Fieldset/index.d.ts +11 -0
  132. package/dist/Fieldset/index.js +10 -17
  133. package/dist/Form/index.d.ts +43 -39
  134. package/dist/Form/index.js +58 -50
  135. package/dist/Input/index.css +1 -1
  136. package/dist/Input/index.d.ts +94 -42
  137. package/dist/Input/index.js +1 -1
  138. package/dist/Menu/index.d.ts +1140 -175
  139. package/dist/Menu/index.js +51 -67
  140. package/dist/Menubar/index.d.ts +651 -173
  141. package/dist/Menubar/index.js +12 -16
  142. package/dist/Meter/index.js +21 -18
  143. package/dist/NavigationMenu/index.d.ts +370 -86
  144. package/dist/NavigationMenu/index.js +144 -178
  145. package/dist/NumberField/index.css +1 -1
  146. package/dist/NumberField/index.d.ts +507 -47
  147. package/dist/NumberField/index.js +434 -718
  148. package/dist/Popover/index.d.ts +561 -142
  149. package/dist/Popover/index.js +181 -252
  150. package/dist/PreviewCard/index.d.ts +507 -143
  151. package/dist/PreviewCard/index.js +97 -151
  152. package/dist/Progress/index.d.ts +117 -3
  153. package/dist/Progress/index.js +37 -36
  154. package/dist/Radio/index.d.ts +177 -7
  155. package/dist/Radio/index.js +54 -70
  156. package/dist/RadioField/index.css +1 -1
  157. package/dist/RadioField/index.d.ts +23 -7
  158. package/dist/RadioGroup/index.d.ts +51 -37
  159. package/dist/RadioGroup/index.js +60 -51
  160. package/dist/RadioGroupField/index.css +1 -1
  161. package/dist/RadioGroupField/index.d.ts +40 -37
  162. package/dist/ScrollArea/index.d.ts +295 -1
  163. package/dist/ScrollArea/index.js +256 -324
  164. package/dist/Select/index.d.ts +516 -123
  165. package/dist/Select/index.js +513 -635
  166. package/dist/SelectField/index.css +1 -1
  167. package/dist/SelectField/index.d.ts +109 -134
  168. package/dist/SelectField/index.js +5 -1
  169. package/dist/Separator/index.d.ts +12 -0
  170. package/dist/Separator/index.js +1 -1
  171. package/dist/Slider/index.d.ts +383 -64
  172. package/dist/Slider/index.js +298 -374
  173. package/dist/Switch/index.d.ts +184 -37
  174. package/dist/Switch/index.js +44 -58
  175. package/dist/Tabs/index.d.ts +220 -35
  176. package/dist/Tabs/index.js +199 -193
  177. package/dist/Toast/index.d.ts +280 -64
  178. package/dist/Toast/index.js +299 -374
  179. package/dist/Toggle/index.d.ts +55 -35
  180. package/dist/Toggle/index.js +19 -13
  181. package/dist/ToggleGroup/index.d.ts +62 -35
  182. package/dist/ToggleGroup/index.js +13 -31
  183. package/dist/Toolbar/index.d.ts +117 -2
  184. package/dist/Toolbar/index.js +31 -43
  185. package/dist/Tooltip/index.d.ts +507 -150
  186. package/dist/Tooltip/index.js +163 -213
  187. package/dist/index.d.ts +12912 -5382
  188. package/package.json +3 -3
  189. package/dist/2205.js +0 -26
  190. package/dist/2274.js +0 -34
  191. package/dist/2287.js +0 -17
  192. package/dist/3020.js +0 -7
  193. package/dist/3021.js +0 -72
  194. package/dist/3140.js +0 -4
  195. package/dist/3248.js +0 -307
  196. package/dist/4026.js +0 -12
  197. package/dist/4922.js +0 -15
  198. package/dist/5659.js +0 -4
  199. package/dist/5992.js +0 -447
  200. package/dist/6330.js +0 -30
  201. package/dist/6535.js +0 -72
  202. package/dist/6917.js +0 -55
  203. package/dist/7725.js +0 -10
  204. package/dist/7871.js +0 -38
  205. package/dist/8106.js +0 -239
  206. package/dist/8685.js +0 -102
  207. package/dist/8935.js +0 -8
  208. package/dist/8971.js +0 -40
  209. package/dist/8979.js +0 -10
  210. package/dist/9048.js +0 -52
  211. package/dist/9087.js +0 -256
  212. package/dist/9255.js +0 -136
  213. /package/dist/{1457.js → 1068.js} +0 -0
  214. /package/dist/{6003.js → 1234.js} +0 -0
  215. /package/dist/{4723.js → 1282.js} +0 -0
  216. /package/dist/{6825.js → 1876.js} +0 -0
  217. /package/dist/{5778.js → 1885.js} +0 -0
  218. /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
  219. /package/dist/{1279.js → 3278.js} +0 -0
  220. /package/dist/{3296.js → 5568.js} +0 -0
  221. /package/dist/{8685.css → 6240.css} +0 -0
  222. /package/dist/{9829.js → 6488.js} +0 -0
  223. /package/dist/{9863.js → 6534.js} +0 -0
  224. /package/dist/{4495.js → 7718.js} +0 -0
  225. /package/dist/{3395.js → 8866.js} +0 -0
  226. /package/dist/{2418.js → 9837.js} +0 -0
@@ -1,16 +1,14 @@
1
- import { getOppositePlacement, round, getAxisLength as floating_ui_utils_getAxisLength, clamp as floating_ui_utils_clamp, createCoords, rectToClientRect as floating_ui_utils_rectToClientRect, getOppositeAxisPlacements, getSideAxis as floating_ui_utils_getSideAxis, sides as floating_ui_utils_sides, floor, getExpandedPlacements, getAlignmentSides as floating_ui_utils_getAlignmentSides, getAlignment as floating_ui_utils_getAlignment, getOppositeAxis, getAlignmentAxis as floating_ui_utils_getAlignmentAxis, getSide as floating_ui_utils_getSide, evaluate as floating_ui_utils_evaluate, getPaddingObject as floating_ui_utils_getPaddingObject, max as floating_ui_utils_max, min as floating_ui_utils_min } from "./3319.js";
1
+ import { getOppositePlacement, round, getAxisLength as floating_ui_utils_getAxisLength, clamp as floating_ui_utils_clamp, createCoords, rectToClientRect as floating_ui_utils_rectToClientRect, getOppositeAxisPlacements, getSideAxis as floating_ui_utils_getSideAxis, floor, getAlignmentSides as floating_ui_utils_getAlignmentSides, getExpandedPlacements, getAlignment as floating_ui_utils_getAlignment, getOppositeAxis, getAlignmentAxis as floating_ui_utils_getAlignmentAxis, getSide as floating_ui_utils_getSide, evaluate as floating_ui_utils_evaluate, getPaddingObject as floating_ui_utils_getPaddingObject, max as floating_ui_utils_max, min as floating_ui_utils_min } from "./8358.js";
2
2
  import { isWebKit, getNodeName, isHTMLElement, getFrameElement, getComputedStyle as floating_ui_utils_dom_getComputedStyle, isOverflowElement, isTopLayer, getContainingBlock, getNodeScroll, isTableElement, isLastTraversableNode, getOverflowAncestors, getDocumentElement, getWindow, isElement, isContainingBlock, getParentNode } from "./3829.js";
3
- import { useId } from "./2205.js";
4
- import { useFloatingParentNodeId, useFloatingTree } from "./285.js";
5
- import { useRefWithInit, useRenderElement, EMPTY_OBJECT } from "./8272.js";
6
- import { PopupTriggerMap, FloatingRootStore } from "./5992.js";
7
- import { useIsoLayoutEffect } from "./6499.js";
8
- import { ownerDocument } from "./9829.js";
9
- import { useStableCallback } from "./7541.js";
10
- import { useValueAsRef } from "./4707.js";
11
- import { useDirection } from "./9863.js";
12
- import { DISABLED_TRANSITIONS_STYLE } from "./487.js";
13
- import { popupStateMapping } from "./6917.js";
3
+ import { useFloatingTree } from "./4472.js";
4
+ import { useIsoLayoutEffect } from "./3357.js";
5
+ import { useStableCallback } from "./7488.js";
6
+ import { useValueAsRef } from "./7930.js";
7
+ import { useDirection } from "./6534.js";
8
+ import { ownerDocument } from "./6488.js";
9
+ import { DISABLED_TRANSITIONS_STYLE } from "./3398.js";
10
+ import { useRenderElement, EMPTY_OBJECT } from "./9591.js";
11
+ import { popupStateMapping } from "./6904.js";
14
12
  import * as __rspack_external_react from "react";
15
13
  import * as __rspack_external_react_dom_7136dc57 from "react-dom";
16
14
  function computeCoordsFromPlacement(_ref, placement, rtl) {
@@ -55,14 +53,8 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
55
53
  y: reference.y
56
54
  };
57
55
  }
58
- switch(floating_ui_utils_getAlignment(placement)){
59
- case 'start':
60
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
61
- break;
62
- case 'end':
63
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
64
- break;
65
- }
56
+ const alignment = floating_ui_utils_getAlignment(placement);
57
+ if (alignment) coords[alignmentAxis] += commonAlign * ('end' === alignment ? 1 : -1) * (rtl && isVertical ? -1 : 1);
66
58
  return coords;
67
59
  }
68
60
  async function detectOverflow(state, options) {
@@ -86,10 +78,7 @@ async function detectOverflow(state, options) {
86
78
  height: rects.floating.height
87
79
  } : rects.reference;
88
80
  const offsetParent = await (null == platform.getOffsetParent ? void 0 : platform.getOffsetParent(elements.floating));
89
- const offsetScale = await (null == platform.isElement ? void 0 : platform.isElement(offsetParent)) ? await (null == platform.getScale ? void 0 : platform.getScale(offsetParent)) || {
90
- x: 1,
91
- y: 1
92
- } : {
81
+ const offsetScale = await (null == platform.isElement ? void 0 : platform.isElement(offsetParent)) && await (null == platform.getScale ? void 0 : platform.getScale(offsetParent)) || {
93
82
  x: 1,
94
83
  y: 1
95
84
  };
@@ -255,60 +244,6 @@ const flip = function(options) {
255
244
  }
256
245
  };
257
246
  };
258
- function getSideOffsets(overflow, rect) {
259
- return {
260
- top: overflow.top - rect.height,
261
- right: overflow.right - rect.width,
262
- bottom: overflow.bottom - rect.height,
263
- left: overflow.left - rect.width
264
- };
265
- }
266
- function isAnySideFullyClipped(overflow) {
267
- return floating_ui_utils_sides.some((side)=>overflow[side] >= 0);
268
- }
269
- const hide = function(options) {
270
- if (void 0 === options) options = {};
271
- return {
272
- name: 'hide',
273
- options,
274
- async fn (state) {
275
- const { rects, platform } = state;
276
- const { strategy = 'referenceHidden', ...detectOverflowOptions } = floating_ui_utils_evaluate(options, state);
277
- switch(strategy){
278
- case 'referenceHidden':
279
- {
280
- const overflow = await platform.detectOverflow(state, {
281
- ...detectOverflowOptions,
282
- elementContext: 'reference'
283
- });
284
- const offsets = getSideOffsets(overflow, rects.reference);
285
- return {
286
- data: {
287
- referenceHiddenOffsets: offsets,
288
- referenceHidden: isAnySideFullyClipped(offsets)
289
- }
290
- };
291
- }
292
- case 'escaped':
293
- {
294
- const overflow = await platform.detectOverflow(state, {
295
- ...detectOverflowOptions,
296
- altBoundary: true
297
- });
298
- const offsets = getSideOffsets(overflow, rects.floating);
299
- return {
300
- data: {
301
- escapedOffsets: offsets,
302
- escaped: isAnySideFullyClipped(offsets)
303
- }
304
- };
305
- }
306
- default:
307
- return {};
308
- }
309
- }
310
- };
311
- };
312
247
  const originSides = /*#__PURE__*/ new Set([
313
248
  'left',
314
249
  'top'
@@ -361,7 +296,7 @@ const floating_ui_core_offset = function(options) {
361
296
  }
362
297
  };
363
298
  };
364
- const shift = function(options) {
299
+ const floating_ui_core_shift = function(options) {
365
300
  if (void 0 === options) options = {};
366
301
  return {
367
302
  name: 'shift',
@@ -382,24 +317,13 @@ const shift = function(options) {
382
317
  y
383
318
  };
384
319
  const overflow = await platform.detectOverflow(state, detectOverflowOptions);
385
- const crossAxis = floating_ui_utils_getSideAxis(floating_ui_utils_getSide(placement));
320
+ const crossAxis = floating_ui_utils_getSideAxis(placement);
386
321
  const mainAxis = getOppositeAxis(crossAxis);
387
322
  let mainAxisCoord = coords[mainAxis];
388
323
  let crossAxisCoord = coords[crossAxis];
389
- if (checkMainAxis) {
390
- const minSide = 'y' === mainAxis ? 'top' : 'left';
391
- const maxSide = 'y' === mainAxis ? 'bottom' : 'right';
392
- const min = mainAxisCoord + overflow[minSide];
393
- const max = mainAxisCoord - overflow[maxSide];
394
- mainAxisCoord = floating_ui_utils_clamp(min, mainAxisCoord, max);
395
- }
396
- if (checkCrossAxis) {
397
- const minSide = 'y' === crossAxis ? 'top' : 'left';
398
- const maxSide = 'y' === crossAxis ? 'bottom' : 'right';
399
- const min = crossAxisCoord + overflow[minSide];
400
- const max = crossAxisCoord - overflow[maxSide];
401
- crossAxisCoord = floating_ui_utils_clamp(min, crossAxisCoord, max);
402
- }
324
+ const clampCoord = (axis, coord)=>floating_ui_utils_clamp(coord + overflow['y' === axis ? 'top' : 'left'], coord, coord - overflow['y' === axis ? 'bottom' : 'right']);
325
+ if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
326
+ if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
403
327
  const limitedCoords = limiter.fn({
404
328
  ...state,
405
329
  [mainAxis]: mainAxisCoord,
@@ -424,6 +348,7 @@ const limitShift = function(options) {
424
348
  return {
425
349
  options,
426
350
  fn (state) {
351
+ var _rawOffset$mainAxis, _rawOffset$crossAxis;
427
352
  const { x, y, placement, rects, middlewareData } = state;
428
353
  const { offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = floating_ui_utils_evaluate(options, state);
429
354
  const coords = {
@@ -439,9 +364,8 @@ const limitShift = function(options) {
439
364
  mainAxis: rawOffset,
440
365
  crossAxis: 0
441
366
  } : {
442
- mainAxis: 0,
443
- crossAxis: 0,
444
- ...rawOffset
367
+ mainAxis: null != (_rawOffset$mainAxis = rawOffset.mainAxis) ? _rawOffset$mainAxis : 0,
368
+ crossAxis: null != (_rawOffset$crossAxis = rawOffset.crossAxis) ? _rawOffset$crossAxis : 0
445
369
  };
446
370
  if (checkMainAxis) {
447
371
  const len = 'y' === mainAxis ? 'height' : 'width';
@@ -472,7 +396,6 @@ const size = function(options) {
472
396
  name: 'size',
473
397
  options,
474
398
  async fn (state) {
475
- var _state$middlewareData, _state$middlewareData2;
476
399
  const { placement, rects, platform, elements } = state;
477
400
  const { apply = ()=>{}, ...detectOverflowOptions } = floating_ui_utils_evaluate(options, state);
478
401
  const overflow = await platform.detectOverflow(state, detectOverflowOptions);
@@ -493,19 +416,14 @@ const size = function(options) {
493
416
  const maximumClippingWidth = width - overflow.left - overflow.right;
494
417
  const overflowAvailableHeight = floating_ui_utils_min(height - overflow[heightSide], maximumClippingHeight);
495
418
  const overflowAvailableWidth = floating_ui_utils_min(width - overflow[widthSide], maximumClippingWidth);
496
- const noShift = !state.middlewareData.shift;
419
+ const shiftData = state.middlewareData.shift;
420
+ const noShift = !shiftData;
497
421
  let availableHeight = overflowAvailableHeight;
498
422
  let availableWidth = overflowAvailableWidth;
499
- if (null != (_state$middlewareData = state.middlewareData.shift) && _state$middlewareData.enabled.x) availableWidth = maximumClippingWidth;
500
- if (null != (_state$middlewareData2 = state.middlewareData.shift) && _state$middlewareData2.enabled.y) availableHeight = maximumClippingHeight;
501
- if (noShift && !alignment) {
502
- const xMin = floating_ui_utils_max(overflow.left, 0);
503
- const xMax = floating_ui_utils_max(overflow.right, 0);
504
- const yMin = floating_ui_utils_max(overflow.top, 0);
505
- const yMax = floating_ui_utils_max(overflow.bottom, 0);
506
- if (isYAxis) availableWidth = width - 2 * (0 !== xMin || 0 !== xMax ? xMin + xMax : floating_ui_utils_max(overflow.left, overflow.right));
507
- else availableHeight = height - 2 * (0 !== yMin || 0 !== yMax ? yMin + yMax : floating_ui_utils_max(overflow.top, overflow.bottom));
508
- }
423
+ if (null != shiftData && shiftData.enabled.x) availableWidth = maximumClippingWidth;
424
+ if (null != shiftData && shiftData.enabled.y) availableHeight = maximumClippingHeight;
425
+ if (noShift && !alignment) if (isYAxis) availableWidth = width - 2 * floating_ui_utils_max(overflow.left, overflow.right);
426
+ else availableHeight = height - 2 * floating_ui_utils_max(overflow.top, overflow.bottom);
509
427
  await apply({
510
428
  ...state,
511
429
  availableWidth,
@@ -567,8 +485,7 @@ function getVisualOffsets(element) {
567
485
  }
568
486
  function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
569
487
  if (void 0 === isFixed) isFixed = false;
570
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false;
571
- return isFixed;
488
+ return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
572
489
  }
573
490
  function floating_ui_dom_getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
574
491
  if (void 0 === includeScale) includeScale = false;
@@ -584,12 +501,12 @@ function floating_ui_dom_getBoundingClientRect(element, includeScale, isFixedStr
584
501
  let y = (clientRect.top + visualOffsets.y) / scale.y;
585
502
  let width = clientRect.width / scale.x;
586
503
  let height = clientRect.height / scale.y;
587
- if (domElement) {
504
+ if (domElement && offsetParent) {
588
505
  const win = getWindow(domElement);
589
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
506
+ const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
590
507
  let currentWin = win;
591
508
  let currentIFrame = getFrameElement(currentWin);
592
- while(currentIFrame && offsetParent && offsetWin !== currentWin){
509
+ while(currentIFrame && offsetWin !== currentWin){
593
510
  const iframeScale = getScale(currentIFrame);
594
511
  const iframeRect = currentIFrame.getBoundingClientRect();
595
512
  const css = floating_ui_utils_dom_getComputedStyle(currentIFrame);
@@ -639,7 +556,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
639
556
  let scale = createCoords(1);
640
557
  const offsets = createCoords(0);
641
558
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
642
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
559
+ if (isOffsetParentAnElement || !isFixed) {
643
560
  if ('body' !== getNodeName(offsetParent) || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
644
561
  if (isOffsetParentAnElement) {
645
562
  const offsetRect = floating_ui_dom_getBoundingClientRect(offsetParent);
@@ -657,15 +574,14 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
657
574
  };
658
575
  }
659
576
  function getClientRects(element) {
660
- return Array.from(element.getClientRects());
577
+ return element.getClientRects ? Array.from(element.getClientRects()) : [];
661
578
  }
662
- function getDocumentRect(element) {
663
- const html = getDocumentElement(element);
664
- const scroll = getNodeScroll(element);
665
- const body = element.ownerDocument.body;
579
+ function getDocumentRect(html) {
580
+ const scroll = getNodeScroll(html);
581
+ const body = html.ownerDocument.body;
666
582
  const width = floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
667
583
  const height = floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
668
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
584
+ let x = -scroll.scrollLeft + getWindowScrollBarX(html);
669
585
  const y = -scroll.scrollTop;
670
586
  if ('rtl' === floating_ui_utils_dom_getComputedStyle(body).direction) x += floating_ui_utils_max(html.clientWidth, body.clientWidth) - width;
671
587
  return {
@@ -676,7 +592,9 @@ function getDocumentRect(element) {
676
592
  };
677
593
  }
678
594
  const SCROLLBAR_MAX = 25;
679
- function getViewportRect(element, strategy) {
595
+ function getViewportRect(element, strategy, rootBoundary) {
596
+ if (void 0 === rootBoundary) rootBoundary = 'viewport';
597
+ const isLayoutViewport = 'layoutViewport' === rootBoundary;
680
598
  const win = getWindow(element);
681
599
  const html = getDocumentElement(element);
682
600
  const visualViewport = win.visualViewport;
@@ -685,12 +603,19 @@ function getViewportRect(element, strategy) {
685
603
  let x = 0;
686
604
  let y = 0;
687
605
  if (visualViewport) {
688
- width = visualViewport.width;
689
- height = visualViewport.height;
690
- const visualViewportBased = isWebKit();
691
- if (!visualViewportBased || visualViewportBased && 'fixed' === strategy) {
692
- x = visualViewport.offsetLeft;
693
- y = visualViewport.offsetTop;
606
+ const layoutRelativeClientCoords = !isWebKit() || 'fixed' === strategy;
607
+ if (isLayoutViewport) {
608
+ if (!layoutRelativeClientCoords) {
609
+ x = -visualViewport.offsetLeft;
610
+ y = -visualViewport.offsetTop;
611
+ }
612
+ } else {
613
+ width = visualViewport.width;
614
+ height = visualViewport.height;
615
+ if (layoutRelativeClientCoords) {
616
+ x = visualViewport.offsetLeft;
617
+ y = visualViewport.offsetTop;
618
+ }
694
619
  }
695
620
  }
696
621
  const windowScrollbarX = getWindowScrollBarX(html);
@@ -699,9 +624,10 @@ function getViewportRect(element, strategy) {
699
624
  const body = doc.body;
700
625
  const bodyStyles = getComputedStyle(body);
701
626
  const bodyMarginInline = 'CSS1Compat' === doc.compatMode ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
702
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
703
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth;
704
- } else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX;
627
+ const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
628
+ const gutter = 'stable both-edges' === getComputedStyle(html).scrollbarGutter ? reservedWidth / 2 : reservedWidth;
629
+ if (gutter <= SCROLLBAR_MAX) width -= gutter;
630
+ }
705
631
  return {
706
632
  width,
707
633
  height,
@@ -713,7 +639,7 @@ function getInnerBoundingClientRect(element, strategy) {
713
639
  const clientRect = floating_ui_dom_getBoundingClientRect(element, true, 'fixed' === strategy);
714
640
  const top = clientRect.top + element.clientTop;
715
641
  const left = clientRect.left + element.clientLeft;
716
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
642
+ const scale = getScale(element);
717
643
  const width = element.clientWidth * scale.x;
718
644
  const height = element.clientHeight * scale.y;
719
645
  const x = left * scale.x;
@@ -727,7 +653,7 @@ function getInnerBoundingClientRect(element, strategy) {
727
653
  }
728
654
  function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
729
655
  let rect;
730
- if ('viewport' === clippingAncestor) rect = getViewportRect(element, strategy);
656
+ if ('viewport' === clippingAncestor || 'layoutViewport' === clippingAncestor) rect = getViewportRect(element, strategy, clippingAncestor);
731
657
  else if ('document' === clippingAncestor) rect = getDocumentRect(getDocumentElement(element));
732
658
  else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
733
659
  else {
@@ -741,25 +667,20 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
741
667
  }
742
668
  return floating_ui_utils_rectToClientRect(rect);
743
669
  }
744
- function hasFixedPositionAncestor(element, stopNode) {
745
- const parentNode = getParentNode(element);
746
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false;
747
- return 'fixed' === floating_ui_utils_dom_getComputedStyle(parentNode).position || hasFixedPositionAncestor(parentNode, stopNode);
748
- }
749
670
  function getClippingElementAncestors(element, cache) {
750
671
  const cachedResult = cache.get(element);
751
672
  if (cachedResult) return cachedResult;
752
673
  let result = getOverflowAncestors(element, [], false).filter((el)=>isElement(el) && 'body' !== getNodeName(el));
753
- let currentContainingBlockComputedStyle = null;
674
+ let lastKeptComputedStyle = null;
754
675
  const elementIsFixed = 'fixed' === floating_ui_utils_dom_getComputedStyle(element).position;
755
676
  let currentNode = elementIsFixed ? getParentNode(element) : element;
756
677
  while(isElement(currentNode) && !isLastTraversableNode(currentNode)){
757
678
  const computedStyle = floating_ui_utils_dom_getComputedStyle(currentNode);
758
679
  const currentNodeIsContaining = isContainingBlock(currentNode);
759
- if (!currentNodeIsContaining && 'fixed' === computedStyle.position) currentContainingBlockComputedStyle = null;
760
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && 'static' === computedStyle.position && !!currentContainingBlockComputedStyle && ('absolute' === currentContainingBlockComputedStyle.position || 'fixed' === currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
680
+ const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';
681
+ const shouldDropCurrentNode = !currentNodeIsContaining && ('fixed' === lastPosition || 'absolute' === lastPosition && 'static' === computedStyle.position);
761
682
  if (shouldDropCurrentNode) result = result.filter((ancestor)=>ancestor !== currentNode);
762
- else currentContainingBlockComputedStyle = computedStyle;
683
+ else lastKeptComputedStyle = computedStyle;
763
684
  currentNode = getParentNode(currentNode);
764
685
  }
765
686
  cache.set(element, result);
@@ -808,18 +729,15 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
808
729
  scrollTop: 0
809
730
  };
810
731
  const offsets = createCoords(0);
811
- function setLeftRTLScrollbarOffset() {
812
- offsets.x = getWindowScrollBarX(documentElement);
813
- }
814
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
732
+ if (isOffsetParentAnElement || !isFixed) {
815
733
  if ('body' !== getNodeName(offsetParent) || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
816
734
  if (isOffsetParentAnElement) {
817
735
  const offsetRect = floating_ui_dom_getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
818
736
  offsets.x = offsetRect.x + offsetParent.clientLeft;
819
737
  offsets.y = offsetRect.y + offsetParent.clientTop;
820
- } else if (documentElement) setLeftRTLScrollbarOffset();
738
+ }
821
739
  }
822
- if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset();
740
+ if (!isOffsetParentAnElement && documentElement) offsets.x = getWindowScrollBarX(documentElement);
823
741
  const htmlOffset = !documentElement || isOffsetParentAnElement || isFixed ? createCoords(0) : getHTMLOffset(documentElement, scroll);
824
742
  const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
825
743
  const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
@@ -888,7 +806,7 @@ const floating_ui_dom_platform = {
888
806
  function rectsAreEqual(a, b) {
889
807
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
890
808
  }
891
- function observeMove(element, onMove) {
809
+ function observeMove(element, onMove, ancestorResize) {
892
810
  let io = null;
893
811
  let timeoutId;
894
812
  const root = getDocumentElement(element);
@@ -918,6 +836,7 @@ function observeMove(element, onMove) {
918
836
  let isFirstUpdate = true;
919
837
  function handleObserve(entries) {
920
838
  const ratio = entries[0].intersectionRatio;
839
+ if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) return refresh();
921
840
  if (ratio !== threshold) {
922
841
  if (!isFirstUpdate) return refresh();
923
842
  if (ratio) refresh(false, ratio);
@@ -925,7 +844,6 @@ function observeMove(element, onMove) {
925
844
  refresh(false, 1e-7);
926
845
  }, 1000);
927
846
  }
928
- if (1 === ratio && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh();
929
847
  isFirstUpdate = false;
930
848
  }
931
849
  try {
@@ -938,8 +856,14 @@ function observeMove(element, onMove) {
938
856
  }
939
857
  io.observe(element);
940
858
  }
859
+ const win = getWindow(element);
860
+ const handleResize = ()=>refresh(ancestorResize);
861
+ win.addEventListener('resize', handleResize);
941
862
  refresh(true);
942
- return cleanup;
863
+ return ()=>{
864
+ win.removeEventListener('resize', handleResize);
865
+ cleanup();
866
+ };
943
867
  }
944
868
  function autoUpdate(reference, floating, update, options) {
945
869
  if (void 0 === options) options = {};
@@ -950,12 +874,10 @@ function autoUpdate(reference, floating, update, options) {
950
874
  ...floating ? getOverflowAncestors(floating) : []
951
875
  ] : [];
952
876
  ancestors.forEach((ancestor)=>{
953
- ancestorScroll && ancestor.addEventListener('scroll', update, {
954
- passive: true
955
- });
877
+ ancestorScroll && ancestor.addEventListener('scroll', update);
956
878
  ancestorResize && ancestor.addEventListener('resize', update);
957
879
  });
958
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
880
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
959
881
  let reobserveFrame = -1;
960
882
  let resizeObserver = null;
961
883
  if (elementResize) {
@@ -997,18 +919,15 @@ function autoUpdate(reference, floating, update, options) {
997
919
  };
998
920
  }
999
921
  const floating_ui_dom_offset = floating_ui_core_offset;
1000
- const floating_ui_dom_shift = shift;
922
+ const floating_ui_dom_shift = floating_ui_core_shift;
1001
923
  const floating_ui_dom_flip = flip;
1002
924
  const floating_ui_dom_size = size;
1003
- const floating_ui_dom_hide = hide;
1004
925
  const floating_ui_dom_limitShift = limitShift;
1005
926
  const floating_ui_dom_computePosition = (reference, floating, options)=>{
1006
927
  const cache = new Map();
1007
- const mergedOptions = {
1008
- platform: floating_ui_dom_platform,
1009
- ...options
1010
- };
928
+ const mergedOptions = null != options ? options : {};
1011
929
  const platformWithCache = {
930
+ ...floating_ui_dom_platform,
1012
931
  ...mergedOptions.platform,
1013
932
  _c: cache
1014
933
  };
@@ -1271,70 +1190,14 @@ const floating_ui_react_dom_size = (options, deps)=>{
1271
1190
  ]
1272
1191
  };
1273
1192
  };
1274
- const floating_ui_react_dom_hide = (options, deps)=>{
1275
- const result = floating_ui_dom_hide(options);
1276
- return {
1277
- name: result.name,
1278
- fn: result.fn,
1279
- options: [
1280
- options,
1281
- deps
1282
- ]
1283
- };
1284
- };
1285
- function useFloatingRootContext(options) {
1286
- const { open = false, onOpenChange, elements = {} } = options;
1287
- const floatingId = useId();
1288
- const nested = null != useFloatingParentNodeId();
1289
- if ('production' !== process.env.NODE_ENV) {
1290
- const optionDomReference = elements.reference;
1291
- if (optionDomReference && !isElement(optionDomReference)) console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');
1292
- }
1293
- const store = useRefWithInit(()=>new FloatingRootStore({
1294
- open,
1295
- transitionStatus: void 0,
1296
- onOpenChange,
1297
- referenceElement: elements.reference ?? null,
1298
- floatingElement: elements.floating ?? null,
1299
- triggerElements: new PopupTriggerMap(),
1300
- floatingId,
1301
- syncOnly: false,
1302
- nested
1303
- })).current;
1304
- useIsoLayoutEffect(()=>{
1305
- const valuesToSync = {
1306
- open,
1307
- floatingId
1308
- };
1309
- if (void 0 !== elements.reference) {
1310
- valuesToSync.referenceElement = elements.reference;
1311
- valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
1312
- }
1313
- if (void 0 !== elements.floating) valuesToSync.floatingElement = elements.floating;
1314
- store.update(valuesToSync);
1315
- }, [
1316
- open,
1317
- floatingId,
1318
- elements.reference,
1319
- elements.floating,
1320
- store
1321
- ]);
1322
- store.context.onOpenChange = onOpenChange;
1323
- store.context.nested = nested;
1324
- return store;
1325
- }
1326
- function useFloating_useFloating(options = {}) {
1327
- const { nodeId, externalTree } = options;
1328
- const internalStore = useFloatingRootContext(options);
1329
- const store = options.rootContext || internalStore;
1193
+ function useBaseUIFloating(options) {
1194
+ const { nodeId, externalTree, rootContext: store } = options;
1330
1195
  const referenceElement = store.useState('referenceElement');
1331
1196
  const floatingElement = store.useState('floatingElement');
1332
1197
  const domReferenceElement = store.useState('domReferenceElement');
1333
1198
  const open = store.useState('open');
1334
1199
  const floatingId = store.useState('floatingId');
1335
1200
  const [positionReference, setPositionReferenceRaw] = __rspack_external_react.useState(null);
1336
- const [localDomReference, setLocalDomReference] = __rspack_external_react.useState(void 0);
1337
- const [localFloatingElement, setLocalFloatingElement] = __rspack_external_react.useState(void 0);
1338
1201
  const domReferenceRef = __rspack_external_react.useRef(null);
1339
1202
  const tree = useFloatingTree(externalTree);
1340
1203
  const storeElements = __rspack_external_react.useMemo(()=>({
@@ -1355,11 +1218,6 @@ function useFloating_useFloating(options = {}) {
1355
1218
  }
1356
1219
  }
1357
1220
  });
1358
- const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
1359
- const syncedFloatingElement = void 0 === localFloatingElement ? store.state.floatingElement : localFloatingElement;
1360
- store.useSyncedValue('referenceElement', localDomReference ?? null);
1361
- store.useSyncedValue('domReferenceElement', void 0 === localDomReference ? domReferenceElement : localDomReferenceElement);
1362
- store.useSyncedValue('floatingElement', syncedFloatingElement);
1363
1221
  const setPositionReference = __rspack_external_react.useCallback((node)=>{
1364
1222
  const computedPositionReference = isElement(node) ? {
1365
1223
  getBoundingClientRect: ()=>node.getBoundingClientRect(),
@@ -1371,32 +1229,12 @@ function useFloating_useFloating(options = {}) {
1371
1229
  }, [
1372
1230
  position.refs
1373
1231
  ]);
1374
- const setReference = __rspack_external_react.useCallback((node)=>{
1375
- if (isElement(node) || null === node) {
1376
- domReferenceRef.current = node;
1377
- setLocalDomReference(node);
1378
- }
1379
- if (isElement(position.refs.reference.current) || null === position.refs.reference.current || null !== node && !isElement(node)) position.refs.setReference(node);
1380
- }, [
1381
- position.refs,
1382
- setLocalDomReference
1383
- ]);
1384
- const setFloating = __rspack_external_react.useCallback((node)=>{
1385
- setLocalFloatingElement(node);
1386
- position.refs.setFloating(node);
1387
- }, [
1388
- position.refs
1389
- ]);
1390
1232
  const refs = __rspack_external_react.useMemo(()=>({
1391
1233
  ...position.refs,
1392
- setReference,
1393
- setFloating,
1394
1234
  setPositionReference,
1395
1235
  domReference: domReferenceRef
1396
1236
  }), [
1397
1237
  position.refs,
1398
- setReference,
1399
- setFloating,
1400
1238
  setPositionReference
1401
1239
  ]);
1402
1240
  const elements = __rspack_external_react.useMemo(()=>({
@@ -1455,7 +1293,7 @@ const baseArrow = (options)=>({
1455
1293
  options,
1456
1294
  async fn (state) {
1457
1295
  const { x, y, placement, rects, platform, elements, middlewareData } = state;
1458
- const { element, padding = 0, offsetParent = 'real' } = floating_ui_utils_evaluate(options, state) || {};
1296
+ const { element, padding = 0 } = floating_ui_utils_evaluate(options, state) || {};
1459
1297
  if (null == element) return {};
1460
1298
  const paddingObject = floating_ui_utils_getPaddingObject(padding);
1461
1299
  const coords = {
@@ -1471,9 +1309,7 @@ const baseArrow = (options)=>({
1471
1309
  const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1472
1310
  const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1473
1311
  const startDiff = coords[axis] - rects.reference[axis];
1474
- const arrowOffsetParent = 'real' === offsetParent ? await platform.getOffsetParent?.(element) : elements.floating;
1475
- let clientSize = elements.floating[clientProp] || rects.floating[length];
1476
- if (!clientSize || !await platform.isElement?.(arrowOffsetParent)) clientSize = elements.floating[clientProp] || rects.floating[length];
1312
+ const clientSize = elements.floating[clientProp] || rects.floating[length];
1477
1313
  const centerToReference = endDiff / 2 - startDiff / 2;
1478
1314
  const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1479
1315
  const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
@@ -1497,22 +1333,29 @@ const baseArrow = (options)=>({
1497
1333
  };
1498
1334
  }
1499
1335
  });
1500
- const arrow_arrow = (options, deps)=>({
1501
- ...baseArrow(options),
1336
+ const arrow_arrow = (options, deps)=>{
1337
+ const { name, fn } = baseArrow(options);
1338
+ return {
1339
+ name,
1340
+ fn,
1502
1341
  options: [
1503
1342
  options,
1504
1343
  deps
1505
1344
  ]
1506
- });
1345
+ };
1346
+ };
1507
1347
  const hideMiddleware_hide = {
1508
1348
  name: 'hide',
1509
1349
  async fn (state) {
1510
1350
  const { width, height, x, y } = state.rects.reference;
1511
1351
  const anchorHidden = 0 === width && 0 === height && 0 === x && 0 === y;
1512
- const nativeHideResult = await floating_ui_react_dom_hide().fn(state);
1352
+ const overflow = await state.platform.detectOverflow(state, {
1353
+ elementContext: 'reference'
1354
+ });
1355
+ const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;
1513
1356
  return {
1514
1357
  data: {
1515
- referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden
1358
+ referenceHidden: referenceHidden || anchorHidden
1516
1359
  }
1517
1360
  };
1518
1361
  }
@@ -1521,51 +1364,15 @@ const DEFAULT_SIDES = {
1521
1364
  sideX: 'left',
1522
1365
  sideY: 'top'
1523
1366
  };
1524
- const adaptiveOriginMiddleware_adaptiveOrigin = {
1525
- name: 'adaptiveOrigin',
1526
- async fn (state) {
1527
- const { x: rawX, y: rawY, rects: { floating: floatRect }, elements: { floating }, platform, strategy, placement } = state;
1528
- const win = getWindow(floating);
1529
- const styles = win.getComputedStyle(floating);
1530
- const hasTransition = '0s' !== styles.transitionDuration && '' !== styles.transitionDuration;
1531
- if (!hasTransition) return {
1532
- x: rawX,
1533
- y: rawY,
1534
- data: DEFAULT_SIDES
1535
- };
1536
- const offsetParent = await platform.getOffsetParent?.(floating);
1537
- let offsetDimensions = {
1538
- width: 0,
1539
- height: 0
1540
- };
1541
- if ('fixed' === strategy && win?.visualViewport) offsetDimensions = {
1542
- width: win.visualViewport.width,
1543
- height: win.visualViewport.height
1544
- };
1545
- else if (offsetParent === win) {
1546
- const doc = ownerDocument(floating);
1547
- offsetDimensions = {
1548
- width: doc.documentElement.clientWidth,
1549
- height: doc.documentElement.clientHeight
1550
- };
1551
- } else if (await platform.isElement?.(offsetParent)) offsetDimensions = await platform.getDimensions(offsetParent);
1552
- const currentSide = floating_ui_utils_getSide(placement);
1553
- let x = rawX;
1554
- let y = rawY;
1555
- if ('left' === currentSide) x = offsetDimensions.width - (rawX + floatRect.width);
1556
- if ('top' === currentSide) y = offsetDimensions.height - (rawY + floatRect.height);
1557
- const sideX = 'left' === currentSide ? 'right' : DEFAULT_SIDES.sideX;
1558
- const sideY = 'top' === currentSide ? 'bottom' : DEFAULT_SIDES.sideY;
1559
- return {
1560
- x,
1561
- y,
1562
- data: {
1563
- sideX,
1564
- sideY
1565
- }
1566
- };
1567
- }
1568
- };
1367
+ const CommonPositionerCssVars_availableWidth = '--available-width';
1368
+ const CommonPositionerCssVars_availableHeight = '--available-height';
1369
+ const CommonPositionerCssVars_anchorWidth = '--anchor-width';
1370
+ const CommonPositionerCssVars_anchorHeight = '--anchor-height';
1371
+ const transformOrigin = '--transform-origin';
1372
+ const positionerWidth = '--positioner-width';
1373
+ const positionerHeight = '--positioner-height';
1374
+ const AVAILABLE_WIDTH_VAR = CommonPositionerCssVars_availableWidth;
1375
+ const AVAILABLE_HEIGHT_VAR = CommonPositionerCssVars_availableHeight;
1569
1376
  function getLogicalSide(sideParam, renderedSide, isRtl) {
1570
1377
  const isLogicalSideParam = 'inline-start' === sideParam || 'inline-end' === sideParam;
1571
1378
  const logicalRight = isRtl ? 'inline-start' : 'inline-end';
@@ -1594,12 +1401,15 @@ function getOffsetData(state, sideParam, isRtl) {
1594
1401
  return data;
1595
1402
  }
1596
1403
  function useAnchorPositioning(params) {
1597
- const { anchor, positionMethod = 'absolute', side: sideParam = 'bottom', sideOffset = 0, align = 'center', alignOffset = 0, collisionBoundary, collisionPadding: collisionPaddingParam = 5, sticky = false, arrowPadding = 5, disableAnchorTracking = false, inline: inlineMiddleware, keepMounted = false, floatingRootContext, mounted, collisionAvoidance, shiftCrossAxis = false, nodeId, adaptiveOrigin, lazyFlip = false, externalTree } = params;
1598
- const [mountSide, setMountSide] = __rspack_external_react.useState(null);
1599
- if (!mounted && null !== mountSide) setMountSide(null);
1404
+ return useAnchorPositioningWithHook(params, useBaseUIFloating);
1405
+ }
1406
+ function useAnchorPositioningWithHook(params, useFloatingHook) {
1407
+ const { anchor, positionMethod = 'absolute', side: sideParam = 'bottom', sideOffset = 0, align = 'center', alignOffset = 0, collisionBoundary, collisionPadding: collisionPaddingParam = 5, sticky = false, arrowPadding = 5, disableAnchorTracking = false, inline: inlineMiddleware, keepMounted = false, floatingRootContext, mounted, collisionAvoidance, shift, nodeId, adaptiveOrigin, lazyFlip = false, externalTree } = params;
1600
1408
  const collisionAvoidanceSide = collisionAvoidance.side || 'flip';
1601
1409
  const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';
1602
1410
  const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';
1411
+ const shiftCrossAxis = shift?.crossAxis ?? false;
1412
+ const shiftRootBoundary = shift?.rootBoundary;
1603
1413
  const anchorFn = 'function' == typeof anchor ? anchor : void 0;
1604
1414
  const anchorFnCallback = useStableCallback(anchorFn);
1605
1415
  const anchorDep = anchorFn ? anchorFnCallback : anchor;
@@ -1607,6 +1417,11 @@ function useAnchorPositioning(params) {
1607
1417
  const mountedRef = useValueAsRef(mounted);
1608
1418
  const direction = useDirection();
1609
1419
  const isRtl = 'rtl' === direction;
1420
+ const [mountPlacement, setMountPlacement] = __rspack_external_react.useState(null);
1421
+ if (!mounted && null !== mountPlacement) setMountPlacement(null);
1422
+ const lockAlign = 'placement' === lazyFlip;
1423
+ const mountSide = mountPlacement ? floating_ui_utils_getSide(mountPlacement) : null;
1424
+ const mountAlign = mountPlacement && lockAlign ? floating_ui_utils_getAlignment(mountPlacement) || 'center' : null;
1610
1425
  const side = mountSide || ({
1611
1426
  top: 'top',
1612
1427
  right: 'right',
@@ -1615,25 +1430,26 @@ function useAnchorPositioning(params) {
1615
1430
  'inline-end': isRtl ? 'left' : 'right',
1616
1431
  'inline-start': isRtl ? 'right' : 'left'
1617
1432
  })[sideParam];
1618
- const placement = 'center' === align ? side : `${side}-${align}`;
1433
+ const placementAlign = mountAlign || align;
1434
+ const placement = 'center' === placementAlign ? side : `${side}-${placementAlign}`;
1619
1435
  let collisionPadding = collisionPaddingParam;
1436
+ if ('number' == typeof collisionPadding) collisionPadding = {
1437
+ top: collisionPadding,
1438
+ right: collisionPadding,
1439
+ bottom: collisionPadding,
1440
+ left: collisionPadding
1441
+ };
1442
+ else if (collisionPadding) collisionPadding = {
1443
+ top: collisionPadding.top || 0,
1444
+ right: collisionPadding.right || 0,
1445
+ bottom: collisionPadding.bottom || 0,
1446
+ left: collisionPadding.left || 0
1447
+ };
1620
1448
  const bias = 1;
1621
1449
  const biasTop = 'bottom' === sideParam ? bias : 0;
1622
1450
  const biasBottom = 'top' === sideParam ? bias : 0;
1623
1451
  const biasLeft = 'right' === sideParam ? bias : 0;
1624
1452
  const biasRight = 'left' === sideParam ? bias : 0;
1625
- if ('number' == typeof collisionPadding) collisionPadding = {
1626
- top: collisionPadding + biasTop,
1627
- right: collisionPadding + biasRight,
1628
- bottom: collisionPadding + biasBottom,
1629
- left: collisionPadding + biasLeft
1630
- };
1631
- else if (collisionPadding) collisionPadding = {
1632
- top: (collisionPadding.top || 0) + biasTop,
1633
- right: (collisionPadding.right || 0) + biasRight,
1634
- bottom: (collisionPadding.bottom || 0) + biasBottom,
1635
- left: (collisionPadding.left || 0) + biasLeft
1636
- };
1637
1453
  const commonCollisionProps = {
1638
1454
  boundary: 'clipping-ancestors' === collisionBoundary ? 'clippingAncestors' : collisionBoundary,
1639
1455
  padding: collisionPadding
@@ -1665,92 +1481,78 @@ function useAnchorPositioning(params) {
1665
1481
  const flipMiddleware = 'none' === collisionAvoidanceSide ? null : floating_ui_react_dom_flip({
1666
1482
  ...commonCollisionProps,
1667
1483
  padding: {
1668
- top: collisionPadding.top + bias,
1669
- right: collisionPadding.right + bias,
1670
- bottom: collisionPadding.bottom + bias,
1671
- left: collisionPadding.left + bias
1484
+ top: collisionPadding.top + bias + biasTop,
1485
+ right: collisionPadding.right + bias + biasRight,
1486
+ bottom: collisionPadding.bottom + bias + biasBottom,
1487
+ left: collisionPadding.left + bias + biasLeft
1672
1488
  },
1673
1489
  mainAxis: !shiftCrossAxis && 'flip' === collisionAvoidanceSide,
1674
1490
  crossAxis: 'flip' === collisionAvoidanceAlign ? 'alignment' : false,
1675
1491
  fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
1676
1492
  });
1677
- const shiftMiddleware = shiftDisabled ? null : floating_ui_react_dom_shift((data)=>{
1678
- const html = ownerDocument(data.elements.floating).documentElement;
1679
- return {
1680
- ...commonCollisionProps,
1681
- rootBoundary: shiftCrossAxis ? {
1682
- x: 0,
1683
- y: 0,
1684
- width: html.clientWidth,
1685
- height: html.clientHeight
1686
- } : void 0,
1687
- mainAxis: 'none' !== collisionAvoidanceAlign,
1688
- crossAxis: crossAxisShiftEnabled,
1689
- limiter: sticky || shiftCrossAxis ? void 0 : floating_ui_react_dom_limitShift((limitData)=>{
1690
- if (!arrowRef.current) return {};
1691
- const { width, height } = arrowRef.current.getBoundingClientRect();
1692
- const sideAxis = floating_ui_utils_getSideAxis(floating_ui_utils_getSide(limitData.placement));
1693
- const arrowSize = 'y' === sideAxis ? width : height;
1694
- const offsetAmount = 'y' === sideAxis ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
1695
- return {
1696
- offset: arrowSize / 2 + offsetAmount / 2
1697
- };
1698
- })
1699
- };
1493
+ const shiftMiddleware = shiftDisabled ? null : floating_ui_react_dom_shift({
1494
+ ...commonCollisionProps,
1495
+ rootBoundary: shiftRootBoundary,
1496
+ mainAxis: 'none' !== collisionAvoidanceAlign,
1497
+ crossAxis: crossAxisShiftEnabled,
1498
+ limiter: sticky || shiftCrossAxis ? void 0 : floating_ui_react_dom_limitShift((limitData)=>{
1499
+ if (!arrowRef.current) return {};
1500
+ const { width, height } = arrowRef.current.getBoundingClientRect();
1501
+ const sideAxis = floating_ui_utils_getSideAxis(floating_ui_utils_getSide(limitData.placement));
1502
+ const arrowSize = 'y' === sideAxis ? width : height;
1503
+ const offsetAmount = 'y' === sideAxis ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
1504
+ return {
1505
+ offset: arrowSize / 2 + offsetAmount / 2
1506
+ };
1507
+ })
1700
1508
  }, [
1701
1509
  commonCollisionProps,
1702
1510
  sticky,
1703
1511
  shiftCrossAxis,
1512
+ shiftRootBoundary,
1704
1513
  collisionPadding,
1705
1514
  collisionAvoidanceAlign
1706
1515
  ]);
1707
- if ('shift' === collisionAvoidanceSide || 'shift' === collisionAvoidanceAlign || 'center' === align) middleware.push(shiftMiddleware, flipMiddleware);
1516
+ if ('shift' === collisionAvoidanceSide || 'shift' === collisionAvoidanceAlign || 'center' === placementAlign) middleware.push(shiftMiddleware, flipMiddleware);
1708
1517
  else middleware.push(flipMiddleware, shiftMiddleware);
1709
1518
  middleware.push(floating_ui_react_dom_size({
1710
1519
  ...commonCollisionProps,
1711
1520
  apply ({ elements: { floating }, availableWidth, availableHeight, rects }) {
1712
1521
  if (!mountedRef.current) return;
1713
1522
  const floatingStyle = floating.style;
1714
- floatingStyle.setProperty('--available-width', `${availableWidth}px`);
1715
- floatingStyle.setProperty('--available-height', `${availableHeight}px`);
1523
+ floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);
1524
+ floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);
1716
1525
  const dpr = getWindow(floating).devicePixelRatio || 1;
1717
1526
  const { x, y, width, height } = rects.reference;
1718
1527
  const anchorWidth = (Math.round((x + width) * dpr) - Math.round(x * dpr)) / dpr;
1719
1528
  const anchorHeight = (Math.round((y + height) * dpr) - Math.round(y * dpr)) / dpr;
1720
- floatingStyle.setProperty('--anchor-width', `${anchorWidth}px`);
1721
- floatingStyle.setProperty('--anchor-height', `${anchorHeight}px`);
1529
+ floatingStyle.setProperty(CommonPositionerCssVars_anchorWidth, `${anchorWidth}px`);
1530
+ floatingStyle.setProperty(CommonPositionerCssVars_anchorHeight, `${anchorHeight}px`);
1722
1531
  }
1723
1532
  }), arrow_arrow((state)=>({
1724
1533
  element: arrowRef.current || ownerDocument(state.elements.floating).createElement('div'),
1725
- padding: arrowPadding,
1726
- offsetParent: 'floating'
1534
+ padding: arrowRef.current ? arrowPadding : 0
1727
1535
  }), [
1728
1536
  arrowPadding
1729
1537
  ]), {
1730
1538
  name: 'transformOrigin',
1731
1539
  fn (state) {
1732
- const { elements, middlewareData, placement: renderedPlacement, rects, y } = state;
1733
- const currentRenderedSide = floating_ui_utils_getSide(renderedPlacement);
1734
- const currentRenderedAxis = floating_ui_utils_getSideAxis(currentRenderedSide);
1540
+ const { elements: { floating }, middlewareData, placement: renderedPlacement, platform, rects, y } = state;
1541
+ const renderedSide = floating_ui_utils_getSide(renderedPlacement);
1542
+ const renderedAlign = floating_ui_utils_getAlignment(renderedPlacement);
1543
+ const isVertical = 'y' === floating_ui_utils_getSideAxis(renderedSide);
1735
1544
  const arrowEl = arrowRef.current;
1736
- const arrowX = middlewareData.arrow?.x || 0;
1737
- const arrowY = middlewareData.arrow?.y || 0;
1738
- const arrowWidth = arrowEl?.clientWidth || 0;
1739
- const arrowHeight = arrowEl?.clientHeight || 0;
1740
- const transformX = arrowX + arrowWidth / 2;
1741
- const transformY = arrowY + arrowHeight / 2;
1742
- const shiftY = Math.abs(middlewareData.shift?.y || 0);
1743
- const halfAnchorHeight = rects.reference.height / 2;
1744
1545
  const sideOffsetValue = 'function' == typeof sideOffset ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
1745
- const isOverlappingAnchor = shiftY > sideOffsetValue;
1746
- const adjacentTransformOrigin = {
1747
- top: `${transformX}px calc(100% + ${sideOffsetValue}px)`,
1748
- bottom: `${transformX}px ${-sideOffsetValue}px`,
1749
- left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`,
1750
- right: `${-sideOffsetValue}px ${transformY}px`
1751
- }[currentRenderedSide];
1752
- const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y}px`;
1753
- elements.floating.style.setProperty('--transform-origin', crossAxisShiftEnabled && 'y' === currentRenderedAxis && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin);
1546
+ let crossOrigin;
1547
+ if (!arrowEl && renderedAlign && Math.abs(isVertical ? middlewareData.shift?.x || 0 : middlewareData.shift?.y || 0) <= 1) crossOrigin = 'start' === renderedAlign === (isVertical && platform.isRTL?.(floating) === true) ? '100%' : '0%';
1548
+ else {
1549
+ const arrowOffset = isVertical ? middlewareData.arrow?.x || 0 : middlewareData.arrow?.y || 0;
1550
+ const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;
1551
+ crossOrigin = `${arrowOffset + arrowSize / 2}px`;
1552
+ }
1553
+ let sideOrigin = 'top' === renderedSide || 'left' === renderedSide ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;
1554
+ if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData.shift?.y || 0) > sideOffsetValue) sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y}px`;
1555
+ floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);
1754
1556
  return {};
1755
1557
  }
1756
1558
  }, hideMiddleware_hide, adaptiveOrigin);
@@ -1766,12 +1568,13 @@ function useAnchorPositioning(params) {
1766
1568
  floatingRootContext
1767
1569
  ]);
1768
1570
  const autoUpdateOptions = __rspack_external_react.useMemo(()=>({
1571
+ ancestorScroll: !disableAnchorTracking,
1769
1572
  elementResize: !disableAnchorTracking && "u" > typeof ResizeObserver,
1770
1573
  layoutShift: !disableAnchorTracking && "u" > typeof IntersectionObserver
1771
1574
  }), [
1772
1575
  disableAnchorTracking
1773
1576
  ]);
1774
- const { refs, elements, x, y, middlewareData, update, placement: renderedPlacement, context, isPositioned, floatingStyles: originalFloatingStyles } = useFloating_useFloating({
1577
+ const { refs, elements, x, y, middlewareData, update, placement: renderedPlacement, context, isPositioned, floatingStyles: originalFloatingStyles } = useFloatingHook({
1775
1578
  rootContext: floatingRootContext,
1776
1579
  open: keepMounted ? mounted : void 0,
1777
1580
  placement,
@@ -1784,14 +1587,21 @@ function useAnchorPositioning(params) {
1784
1587
  const { sideX, sideY } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
1785
1588
  const resolvedPosition = isPositioned ? positionMethod : 'fixed';
1786
1589
  const floatingStyles = __rspack_external_react.useMemo(()=>{
1787
- const base = adaptiveOrigin ? {
1590
+ let base;
1591
+ base = isPositioned ? adaptiveOrigin ? {
1788
1592
  position: resolvedPosition,
1789
1593
  [sideX]: x,
1790
1594
  [sideY]: y
1595
+ } : {
1596
+ ...originalFloatingStyles,
1597
+ position: resolvedPosition
1791
1598
  } : {
1792
1599
  position: resolvedPosition,
1793
- ...originalFloatingStyles
1600
+ top: 0,
1601
+ left: 0
1794
1602
  };
1603
+ base[AVAILABLE_WIDTH_VAR] = '100vw';
1604
+ base[AVAILABLE_HEIGHT_VAR] = '100vh';
1795
1605
  if (!isPositioned) base.opacity = 0;
1796
1606
  return base;
1797
1607
  }, [
@@ -1836,7 +1646,7 @@ function useAnchorPositioning(params) {
1836
1646
  anchorValueRef
1837
1647
  ]);
1838
1648
  __rspack_external_react.useEffect(()=>{
1839
- if (keepMounted && mounted && elements.domReference && elements.floating) return autoUpdate(elements.domReference, elements.floating, update, autoUpdateOptions);
1649
+ if (keepMounted && mounted && elements.reference && elements.floating) return autoUpdate(elements.reference, elements.floating, update, autoUpdateOptions);
1840
1650
  }, [
1841
1651
  keepMounted,
1842
1652
  mounted,
@@ -1849,12 +1659,17 @@ function useAnchorPositioning(params) {
1849
1659
  const renderedAlign = floating_ui_utils_getAlignment(renderedPlacement) || 'center';
1850
1660
  const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);
1851
1661
  useIsoLayoutEffect(()=>{
1852
- if (lazyFlip && mounted && isPositioned) setMountSide(renderedSide);
1662
+ if (lazyFlip && mounted && isPositioned && (renderedSide !== side || lockAlign && renderedAlign !== placementAlign)) setMountPlacement(renderedPlacement);
1853
1663
  }, [
1854
1664
  lazyFlip,
1665
+ lockAlign,
1855
1666
  mounted,
1856
1667
  isPositioned,
1857
- renderedSide
1668
+ renderedPlacement,
1669
+ renderedSide,
1670
+ renderedAlign,
1671
+ side,
1672
+ placementAlign
1858
1673
  ]);
1859
1674
  const arrowStyles = __rspack_external_react.useMemo(()=>({
1860
1675
  position: 'absolute',
@@ -1918,4 +1733,4 @@ function usePositioner(componentProps, state, { styles, transitionStatus, props,
1918
1733
  stateAttributesMapping: popupStateMapping
1919
1734
  });
1920
1735
  }
1921
- export { adaptiveOriginMiddleware_adaptiveOrigin, floating_ui_dom_platform, getDisabledMountTransitionStyles, useAnchorPositioning, useFloatingRootContext, usePositioner };
1736
+ export { CommonPositionerCssVars_availableHeight, CommonPositionerCssVars_availableWidth, DEFAULT_SIDES, floating_ui_dom_platform, getDisabledMountTransitionStyles, positionerHeight, positionerWidth, useAnchorPositioning, useAnchorPositioningWithHook, useBaseUIFloating, usePositioner };