@qualtrics/ui-react 2.85.1 → 2.85.4

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 (105) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/__node_modules/@radix-ui/primitive/dist/index.js +14 -3
  3. package/dist/__node_modules/@radix-ui/primitive/dist/internal/is-development.false.js +4 -0
  4. package/dist/__node_modules/@radix-ui/react-arrow/dist/index.js +7 -4
  5. package/dist/__node_modules/@radix-ui/react-collection/dist/index.js +58 -39
  6. package/dist/__node_modules/@radix-ui/react-compose-refs/dist/index.js +8 -1
  7. package/dist/__node_modules/@radix-ui/react-context/dist/index.js +35 -12
  8. package/dist/__node_modules/@radix-ui/react-direction/dist/index.js +10 -3
  9. package/dist/__node_modules/@radix-ui/react-dismissable-layer/dist/index.js +172 -41
  10. package/dist/__node_modules/@radix-ui/react-dropdown-menu/dist/index.js +58 -61
  11. package/dist/__node_modules/@radix-ui/react-focus-guards/dist/index.js +30 -6
  12. package/dist/__node_modules/@radix-ui/react-focus-scope/dist/index.js +33 -9
  13. package/dist/__node_modules/@radix-ui/react-id/dist/index.js +6 -0
  14. package/dist/__node_modules/@radix-ui/react-menu/dist/index.js +107 -79
  15. package/dist/__node_modules/@radix-ui/react-popper/dist/index.js +79 -38
  16. package/dist/__node_modules/@radix-ui/react-portal/dist/index.js +9 -6
  17. package/dist/__node_modules/@radix-ui/react-presence/dist/index.js +71 -12
  18. package/dist/__node_modules/@radix-ui/react-primitive/dist/index.js +6 -0
  19. package/dist/__node_modules/@radix-ui/react-roving-focus/dist/index.js +36 -12
  20. package/dist/__node_modules/@radix-ui/react-slot/dist/index.js +85 -54
  21. package/dist/__node_modules/@radix-ui/react-use-callback-ref/dist/index.js +6 -1
  22. package/dist/__node_modules/@radix-ui/react-use-controllable-state/dist/index.js +14 -4
  23. package/dist/__node_modules/@radix-ui/react-use-effect-event/dist/index.js +6 -1
  24. package/dist/__node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +37 -0
  25. package/dist/__node_modules/@radix-ui/react-use-layout-effect/dist/index.js +1 -1
  26. package/dist/__node_modules/@radix-ui/react-use-size/dist/index.js +6 -0
  27. package/dist/__shared/cjs/{index-21aa4d43.js → index-08198ff4.js} +140 -136
  28. package/dist/__shared/cjs/{index-e3d48e21.js → index-e51bbd75.js} +4 -4
  29. package/dist/components/Accordion/Accordion2.js +3 -3
  30. package/dist/components/Button/Button.js +3 -3
  31. package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
  32. package/dist/components/Checkbox/Checkbox2.js +3 -3
  33. package/dist/components/ColorPicker/ColorPicker2.js +3 -3
  34. package/dist/components/Combobox/Combobox2.js +3 -3
  35. package/dist/components/ConfigPane/ConfigPane.js +6 -2
  36. package/dist/components/ConfigPane/ConfigPane2.js +3 -3
  37. package/dist/components/Divider/Divider2.js +3 -3
  38. package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +1 -1
  39. package/dist/components/Dropdown/Dropdown2.js +3 -3
  40. package/dist/components/FilePicker/FilePicker2.js +3 -3
  41. package/dist/components/FormField/Caption.js +3 -3
  42. package/dist/components/FormField/FormField2.js +3 -3
  43. package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
  44. package/dist/components/IconButton/IconButton2.js +3 -3
  45. package/dist/components/InlineInput/InlineInput2.js +3 -3
  46. package/dist/components/Input/Input2.js +3 -3
  47. package/dist/components/InputGroup/InputGroup2.js +3 -3
  48. package/dist/components/Label/Label2.js +3 -3
  49. package/dist/components/Link/Link2.js +3 -3
  50. package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
  51. package/dist/components/LogicEditor/LogicEditor2.js +3 -3
  52. package/dist/components/Modal/Modal2.js +3 -3
  53. package/dist/components/NewMenu/NewMenu.js +3 -3
  54. package/dist/components/NumberStepper/NumberStepper2.js +3 -3
  55. package/dist/components/PageLayout/PageLayout.js +3 -3
  56. package/dist/components/Pagination/Pagination2.js +3 -3
  57. package/dist/components/Popover/Popover2.js +3 -3
  58. package/dist/components/QuickSearch/QuickSearch2.js +3 -3
  59. package/dist/components/Radio/Radio2.js +3 -3
  60. package/dist/components/SearchInput/SearchInput2.js +3 -3
  61. package/dist/components/SidebarNav/SidebarNav2.js +3 -3
  62. package/dist/components/Slider/Slider2.js +3 -3
  63. package/dist/components/Switch/Switch2.js +3 -3
  64. package/dist/components/Table/Table2.js +3 -3
  65. package/dist/components/Tabs/Tabs2.js +3 -3
  66. package/dist/components/Tooltip/Tooltip2.js +3 -3
  67. package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
  68. package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
  69. package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
  70. package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
  71. package/dist/design-tokens/less/typography.js +3 -3
  72. package/dist/hooks/useOverlay/useOverlay2.js +3 -3
  73. package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
  74. package/dist/icons/Icon.js +3 -3
  75. package/dist/icons/components/BadgeHandIcon.js +1 -1
  76. package/dist/icons/index.js +1 -1
  77. package/dist/index.es.js +1 -1
  78. package/dist/index.js +3 -3
  79. package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
  80. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
  81. package/dist/next/Combobox/Combobox2.js +3 -3
  82. package/dist/next/Drawer/Drawer2.js +3 -3
  83. package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
  84. package/dist/next/Form/FormFields/InputField.js +3 -3
  85. package/dist/next/Indicator/Indicator2.js +3 -3
  86. package/dist/next/Input/Input2.js +3 -3
  87. package/dist/next/LoadingSpinner/LoadingSpinner2.js +3 -3
  88. package/dist/next/Menu/Hooks/useFlyoutNode.js +48 -0
  89. package/dist/next/Menu/Menu2.js +3 -3
  90. package/dist/next/Menu/MenuButton.js +4 -3
  91. package/dist/next/Menu/MenuItem.js +3 -2
  92. package/dist/next/Menu/MenuPane.js +17 -16
  93. package/dist/next/Menu/PaneChildren.js +15 -10
  94. package/dist/next/Menu/SubMenu.js +17 -16
  95. package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
  96. package/dist/next/Select/Select2.js +3 -3
  97. package/dist/next/SplitButton/SplitButton2.js +3 -3
  98. package/dist/next/TimePicker/TimePicker2.js +3 -3
  99. package/dist/next/ToggleButton/styles.js +3 -3
  100. package/dist/next/index.js +1055 -519
  101. package/dist/utils/Flyout/Flyout2.js +3 -3
  102. package/icons/package.json +5 -5
  103. package/next/package.json +6 -6
  104. package/package.json +15 -15
  105. package/dist/__node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -23
@@ -14,6 +14,11 @@ import { useSize } from '../../react-use-size/dist/index.js';
14
14
  const _excluded = ["__scopePopper", "virtualRef"],
15
15
  _excluded2 = ["__scopePopper", "side", "sideOffset", "align", "alignOffset", "arrowPadding", "avoidCollisions", "collisionBoundary", "collisionPadding", "sticky", "hideWhenDetached", "updatePositionStrategy", "onPlaced"],
16
16
  _excluded3 = ["__scopePopper"];
17
+ var __defProp = Object.defineProperty;
18
+ var __name = (target, value) => __defProp(target, "name", {
19
+ value,
20
+ configurable: true
21
+ });
17
22
  var SIDE_OPTIONS = ["top", "right", "bottom", "left"];
18
23
  var ALIGN_OPTIONS = ["start", "center", "end"];
19
24
  var POPPER_NAME = "Popper";
@@ -25,50 +30,69 @@ var _createPopperContext = createPopperContext(POPPER_NAME),
25
30
  _createPopperContext2 = _slicedToArray(_createPopperContext, 2),
26
31
  PopperProvider = _createPopperContext2[0],
27
32
  usePopperContext = _createPopperContext2[1];
28
- var Popper = props => {
33
+ var Popper = /* @__PURE__ */__name(props => {
29
34
  const __scopePopper = props.__scopePopper,
30
35
  children = props.children;
31
36
  const _React$useState = React.useState(null),
32
37
  _React$useState2 = _slicedToArray(_React$useState, 2),
33
38
  anchor = _React$useState2[0],
34
39
  setAnchor = _React$useState2[1];
40
+ const _React$useState3 = React.useState(void 0),
41
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
42
+ placementState = _React$useState4[0],
43
+ setPlacementState = _React$useState4[1];
35
44
  return /* @__PURE__ */React.createElement(PopperProvider, {
36
45
  scope: __scopePopper,
37
46
  anchor,
38
47
  onAnchorChange: setAnchor,
48
+ placementState,
49
+ setPlacementState,
39
50
  children
40
51
  });
41
- };
42
- Popper.displayName = POPPER_NAME;
52
+ }, "Popper");
43
53
  var ANCHOR_NAME = "PopperAnchor";
44
- var PopperAnchor = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
54
+ var PopperAnchor = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function PopperAnchor2(props, forwardedRef) {
45
55
  const __scopePopper = props.__scopePopper,
46
56
  virtualRef = props.virtualRef,
47
57
  anchorProps = _objectWithoutProperties(props, _excluded);
48
58
  const context = usePopperContext(ANCHOR_NAME, __scopePopper);
49
59
  const ref = React.useRef(null);
50
- const composedRefs = useComposedRefs(forwardedRef, ref);
60
+ const onAnchorChange = context.onAnchorChange;
61
+ const callbackRef = React.useCallback(node => {
62
+ ref.current = node;
63
+ if (node) {
64
+ onAnchorChange(node);
65
+ }
66
+ }, [onAnchorChange]);
67
+ const composedRefs = useComposedRefs(forwardedRef, callbackRef);
51
68
  const anchorRef = React.useRef(null);
52
69
  React.useEffect(() => {
70
+ if (!virtualRef) {
71
+ return;
72
+ }
53
73
  const previousAnchor = anchorRef.current;
54
- anchorRef.current = (virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current;
74
+ anchorRef.current = virtualRef.current;
55
75
  if (previousAnchor !== anchorRef.current) {
56
- context.onAnchorChange(anchorRef.current);
76
+ onAnchorChange(anchorRef.current);
57
77
  }
58
78
  });
79
+ const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
80
+ const placedSide = sideAndAlign === null || sideAndAlign === void 0 ? void 0 : sideAndAlign[0];
81
+ const placedAlign = sideAndAlign === null || sideAndAlign === void 0 ? void 0 : sideAndAlign[1];
59
82
  return virtualRef ? null : /* @__PURE__ */React.createElement(Primitive.div, {
83
+ "data-radix-popper-side": placedSide,
84
+ "data-radix-popper-align": placedAlign,
60
85
  ...anchorProps,
61
86
  ref: composedRefs
62
87
  });
63
- });
64
- PopperAnchor.displayName = ANCHOR_NAME;
88
+ }, "PopperAnchor"));
65
89
  var CONTENT_NAME = "PopperContent";
66
90
  var _createPopperContext3 = createPopperContext(CONTENT_NAME),
67
91
  _createPopperContext4 = _slicedToArray(_createPopperContext3, 2),
68
92
  PopperContentProvider = _createPopperContext4[0],
69
93
  useContentContext = _createPopperContext4[1];
70
- var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
71
- var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
94
+ var PopperContent = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function PopperContent2(props, forwardedRef) {
95
+ var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide, _contentProps$style;
72
96
  const __scopePopper = props.__scopePopper,
73
97
  _props$side = props.side,
74
98
  side = _props$side === void 0 ? "bottom" : _props$side,
@@ -95,15 +119,15 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
95
119
  onPlaced = props.onPlaced,
96
120
  contentProps = _objectWithoutProperties(props, _excluded2);
97
121
  const context = usePopperContext(CONTENT_NAME, __scopePopper);
98
- const _React$useState3 = React.useState(null),
99
- _React$useState4 = _slicedToArray(_React$useState3, 2),
100
- content = _React$useState4[0],
101
- setContent = _React$useState4[1];
102
- const composedRefs = useComposedRefs(forwardedRef, node => setContent(node));
103
122
  const _React$useState5 = React.useState(null),
104
123
  _React$useState6 = _slicedToArray(_React$useState5, 2),
105
- arrow$1 = _React$useState6[0],
106
- setArrow = _React$useState6[1];
124
+ content = _React$useState6[0],
125
+ setContent = _React$useState6[1];
126
+ const composedRefs = useComposedRefs(forwardedRef, setContent);
127
+ const _React$useState7 = React.useState(null),
128
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
129
+ arrow$1 = _React$useState8[0],
130
+ setArrow = _React$useState8[1];
107
131
  const arrowSize = useSize(arrow$1);
108
132
  const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
109
133
  const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
@@ -127,7 +151,7 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
127
151
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
128
152
  strategy: "fixed",
129
153
  placement: desiredPlacement,
130
- whileElementsMounted: function () {
154
+ whileElementsMounted: /* @__PURE__ */__name(function () {
131
155
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
132
156
  args[_key] = arguments[_key];
133
157
  }
@@ -135,7 +159,7 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
135
159
  animationFrame: updatePositionStrategy === "always"
136
160
  });
137
161
  return cleanup;
138
- },
162
+ }, "whileElementsMounted"),
139
163
  elements: {
140
164
  reference: context.anchor
141
165
  },
@@ -151,7 +175,7 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
151
175
  ...detectOverflowOptions
152
176
  }), size({
153
177
  ...detectOverflowOptions,
154
- apply: _ref => {
178
+ apply: /* @__PURE__ */__name(_ref => {
155
179
  let elements = _ref.elements,
156
180
  rects = _ref.rects,
157
181
  availableWidth = _ref.availableWidth,
@@ -164,7 +188,7 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
164
188
  contentStyle.setProperty("--radix-popper-available-height", "".concat(availableHeight, "px"));
165
189
  contentStyle.setProperty("--radix-popper-anchor-width", "".concat(anchorWidth, "px"));
166
190
  contentStyle.setProperty("--radix-popper-anchor-height", "".concat(anchorHeight, "px"));
167
- }
191
+ }, "apply")
168
192
  }), arrow$1 && arrow({
169
193
  element: arrow$1,
170
194
  padding: arrowPadding
@@ -173,7 +197,15 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
173
197
  arrowHeight
174
198
  }), hideWhenDetached && hide({
175
199
  strategy: "referenceHidden",
176
- ...detectOverflowOptions
200
+ ...detectOverflowOptions,
201
+ // `hide` detects whether the anchor (reference) is clipped, so when
202
+ // no explicit `collisionBoundary` is set we fall back to Floating
203
+ // UI's default clipping ancestors (e.g. a scrollable menu). This
204
+ // lets an occluded submenu hide once its anchor scrolls out of view
205
+ // (#3237). The collision/size middlewares deliberately keep the
206
+ // viewport-based default to avoid clamping content rendered inside
207
+ // transformed or overflow-clipping portal containers.
208
+ boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
177
209
  })]
178
210
  }),
179
211
  refs = _useFloating.refs,
@@ -181,6 +213,13 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
181
213
  placement = _useFloating.placement,
182
214
  isPositioned = _useFloating.isPositioned,
183
215
  middlewareData = _useFloating.middlewareData;
216
+ const setPlacementState = context.setPlacementState;
217
+ useLayoutEffect2(() => {
218
+ setPlacementState(placement);
219
+ return () => {
220
+ setPlacementState(void 0);
221
+ };
222
+ }, [placement, setPlacementState]);
184
223
  const _getSideAndAlignFromP = getSideAndAlignFromPlacement(placement),
185
224
  _getSideAndAlignFromP2 = _slicedToArray(_getSideAndAlignFromP, 2),
186
225
  placedSide = _getSideAndAlignFromP2[0],
@@ -194,10 +233,10 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
194
233
  const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
195
234
  const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
196
235
  const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
197
- const _React$useState7 = React.useState(),
198
- _React$useState8 = _slicedToArray(_React$useState7, 2),
199
- contentZIndex = _React$useState8[0],
200
- setContentZIndex = _React$useState8[1];
236
+ const _React$useState9 = React.useState(),
237
+ _React$useState0 = _slicedToArray(_React$useState9, 2),
238
+ contentZIndex = _React$useState0[0],
239
+ setContentZIndex = _React$useState0[1];
201
240
  useLayoutEffect2(() => {
202
241
  if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
203
242
  }, [content]);
@@ -210,7 +249,7 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
210
249
  // keep off the page when measuring
211
250
  minWidth: "max-content",
212
251
  zIndex: contentZIndex,
213
- ["--radix-popper-transform-origin"]: [(_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x, (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y].join(" "),
252
+ "--radix-popper-transform-origin": [(_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x, (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y].join(" "),
214
253
  // hide the content if using the hide middleware and should be hidden
215
254
  // set visibility to hidden and disable pointer events so the UI behaves
216
255
  // as if the PopperContent isn't there at all
@@ -223,6 +262,7 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
223
262
  children: /* @__PURE__ */React.createElement(PopperContentProvider, {
224
263
  scope: __scopePopper,
225
264
  placedSide,
265
+ placedAlign,
226
266
  onArrowChange: setArrow,
227
267
  arrowX,
228
268
  arrowY,
@@ -234,15 +274,15 @@ var PopperContent = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
234
274
  ref: composedRefs,
235
275
  style: {
236
276
  ...contentProps.style,
237
- // if the PopperContent hasn't been placed yet (not all measurements done)
238
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
239
- animation: !isPositioned ? "none" : void 0
277
+ // if the PopperContent hasn't been placed yet (not all
278
+ // measurements done) we prevent animations so that users'
279
+ // animations don't kick in too early from the wrong sides.
280
+ animation: !isPositioned ? "none" : (_contentProps$style = contentProps.style) === null || _contentProps$style === void 0 ? void 0 : _contentProps$style.animation
240
281
  }
241
282
  })
242
283
  })
243
284
  });
244
- });
245
- PopperContent.displayName = CONTENT_NAME;
285
+ }, "PopperContent"));
246
286
  var ARROW_NAME = "PopperArrow";
247
287
  var OPPOSITE_SIDE = {
248
288
  top: "bottom",
@@ -250,7 +290,7 @@ var OPPOSITE_SIDE = {
250
290
  bottom: "top",
251
291
  left: "right"
252
292
  };
253
- var PopperArrow = /*#__PURE__*/React.forwardRef(function PopperArrow2(props, forwardedRef) {
293
+ var PopperArrow = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function PopperArrow2(props, forwardedRef) {
254
294
  const __scopePopper = props.__scopePopper,
255
295
  arrowProps = _objectWithoutProperties(props, _excluded3);
256
296
  const contentContext = useContentContext(ARROW_NAME, __scopePopper);
@@ -291,12 +331,12 @@ var PopperArrow = /*#__PURE__*/React.forwardRef(function PopperArrow2(props, for
291
331
  })
292
332
  })
293
333
  );
294
- });
295
- PopperArrow.displayName = ARROW_NAME;
334
+ }, "PopperArrow"));
296
335
  function isNotNull(value) {
297
336
  return value !== null;
298
337
  }
299
- var transformOrigin = options => ({
338
+ __name(isNotNull, "isNotNull");
339
+ var transformOrigin = /* @__PURE__ */__name(options => ({
300
340
  name: "transformOrigin",
301
341
  options,
302
342
  fn(data) {
@@ -341,7 +381,7 @@ var transformOrigin = options => ({
341
381
  }
342
382
  };
343
383
  }
344
- });
384
+ }), "transformOrigin");
345
385
  function getSideAndAlignFromPlacement(placement) {
346
386
  const _placement$split = placement.split("-"),
347
387
  _placement$split2 = _slicedToArray(_placement$split, 2),
@@ -350,6 +390,7 @@ function getSideAndAlignFromPlacement(placement) {
350
390
  align = _placement$split2$ === void 0 ? "center" : _placement$split2$;
351
391
  return [side, align];
352
392
  }
393
+ __name(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
353
394
  var Root2 = Popper;
354
395
  var Anchor = PopperAnchor;
355
396
  var Content = PopperContent;
@@ -1,14 +1,18 @@
1
1
  import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
2
2
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
3
3
  import * as React from 'react';
4
- import ReactDOM__default from 'react-dom';
4
+ import * as ReactDOM from 'react-dom';
5
5
  import { Primitive } from '../../react-primitive/dist/index.js';
6
6
  import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
7
7
 
8
8
  "use client";
9
9
  const _excluded = ["container"];
10
- var PORTAL_NAME = "Portal";
11
- var Portal = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
10
+ var __defProp = Object.defineProperty;
11
+ var __name = (target, value) => __defProp(target, "name", {
12
+ value,
13
+ configurable: true
14
+ });
15
+ var Portal = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function Portal2(props, forwardedRef) {
12
16
  var _globalThis$document;
13
17
  const containerProp = props.container,
14
18
  portalProps = _objectWithoutProperties(props, _excluded);
@@ -18,12 +22,11 @@ var Portal = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
18
22
  setMounted = _React$useState2[1];
19
23
  useLayoutEffect2(() => setMounted(true), []);
20
24
  const container = containerProp || mounted && (globalThis === null || globalThis === void 0 || (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body);
21
- return container ? /*#__PURE__*/ReactDOM__default.createPortal(/* @__PURE__ */React.createElement(Primitive.div, {
25
+ return container ? /*#__PURE__*/ReactDOM.createPortal(/* @__PURE__ */React.createElement(Primitive.div, {
22
26
  ...portalProps,
23
27
  ref: forwardedRef
24
28
  }), container) : null;
25
- });
26
- Portal.displayName = PORTAL_NAME;
29
+ }, "Portal"));
27
30
  var Root = Portal;
28
31
 
29
32
  export { Portal, Root };
@@ -1,32 +1,36 @@
1
1
  import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
2
2
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
3
3
  import * as React from 'react';
4
- import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
5
4
  import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
6
5
 
7
6
  "use client";
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", {
9
+ value,
10
+ configurable: true
11
+ });
8
12
  function useStateMachine(initialState, machine) {
9
13
  return React.useReducer((state, event) => {
10
14
  const nextState = machine[state][event];
11
15
  return nextState !== null && nextState !== void 0 ? nextState : state;
12
16
  }, initialState);
13
17
  }
18
+ __name(useStateMachine, "useStateMachine");
14
19
 
15
20
  // src/presence.tsx
16
- var Presence = props => {
21
+ var Presence = /* @__PURE__ */__name(props => {
17
22
  const present = props.present,
18
23
  children = props.children;
19
24
  const presence = usePresence(present);
20
25
  const child = typeof children === "function" ? children({
21
26
  present: presence.isPresent
22
27
  }) : React.Children.only(children);
23
- const ref = useComposedRefs(presence.ref, getElementRef(child));
28
+ const ref = useStableComposedRefs(presence.ref, getElementRef(child));
24
29
  const forceMount = typeof children === "function";
25
30
  return forceMount || presence.isPresent ? /*#__PURE__*/React.cloneElement(child, {
26
31
  ref
27
32
  }) : null;
28
- };
29
- Presence.displayName = "Presence";
33
+ }, "Presence");
30
34
  function usePresence(present) {
31
35
  var _context;
32
36
  const _React2$useState = React.useState(),
@@ -36,6 +40,7 @@ function usePresence(present) {
36
40
  const stylesRef = React.useRef(null);
37
41
  const prevPresentRef = React.useRef(present);
38
42
  const prevAnimationNameRef = React.useRef("none");
43
+ const mountAnimationNameRef = React.useRef(void 0);
39
44
  const initialState = present ? "mounted" : "unmounted";
40
45
  const _useStateMachine = useStateMachine(initialState, {
41
46
  mounted: {
@@ -54,8 +59,13 @@ function usePresence(present) {
54
59
  state = _useStateMachine2[0],
55
60
  send = _useStateMachine2[1];
56
61
  React.useEffect(() => {
57
- const currentAnimationName = getAnimationName(stylesRef.current);
58
- prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
62
+ if (state === "mounted") {
63
+ var _mountAnimationNameRe;
64
+ prevAnimationNameRef.current = (_mountAnimationNameRe = mountAnimationNameRef.current) !== null && _mountAnimationNameRe !== void 0 ? _mountAnimationNameRe : getAnimationName(stylesRef.current);
65
+ mountAnimationNameRef.current = void 0;
66
+ } else {
67
+ prevAnimationNameRef.current = "none";
68
+ }
59
69
  }, [state]);
60
70
  useLayoutEffect2(() => {
61
71
  const styles = stylesRef.current;
@@ -65,6 +75,7 @@ function usePresence(present) {
65
75
  const prevAnimationName = prevAnimationNameRef.current;
66
76
  const currentAnimationName = getAnimationName(styles);
67
77
  if (present) {
78
+ mountAnimationNameRef.current = currentAnimationName;
68
79
  send("MOUNT");
69
80
  } else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none") {
70
81
  send("UNMOUNT");
@@ -84,7 +95,7 @@ function usePresence(present) {
84
95
  var _node$ownerDocument$d;
85
96
  let timeoutId;
86
97
  const ownerWindow = (_node$ownerDocument$d = node.ownerDocument.defaultView) !== null && _node$ownerDocument$d !== void 0 ? _node$ownerDocument$d : window;
87
- const handleAnimationEnd = event => {
98
+ const handleAnimationEnd = /* @__PURE__ */__name(event => {
88
99
  const currentAnimationName = getAnimationName(stylesRef.current);
89
100
  const isCurrentAnimation = _includesInstanceProperty(currentAnimationName).call(currentAnimationName, CSS.escape(event.animationName));
90
101
  if (event.target === node && isCurrentAnimation) {
@@ -99,12 +110,12 @@ function usePresence(present) {
99
110
  });
100
111
  }
101
112
  }
102
- };
103
- const handleAnimationStart = event => {
113
+ }, "handleAnimationEnd");
114
+ const handleAnimationStart = /* @__PURE__ */__name(event => {
104
115
  if (event.target === node) {
105
116
  prevAnimationNameRef.current = getAnimationName(stylesRef.current);
106
117
  }
107
- };
118
+ }, "handleAnimationStart");
108
119
  node.addEventListener("animationstart", handleAnimationStart);
109
120
  node.addEventListener("animationcancel", handleAnimationEnd);
110
121
  node.addEventListener("animationend", handleAnimationEnd);
@@ -121,14 +132,61 @@ function usePresence(present) {
121
132
  return {
122
133
  isPresent: _includesInstanceProperty(_context = ["mounted", "unmountSuspended"]).call(_context, state),
123
134
  ref: React.useCallback(node2 => {
124
- stylesRef.current = node2 ? getComputedStyle(node2) : null;
135
+ if (node2) {
136
+ const styles = getComputedStyle(node2);
137
+ stylesRef.current = styles;
138
+ mountAnimationNameRef.current = getAnimationName(styles);
139
+ } else {
140
+ stylesRef.current = null;
141
+ }
125
142
  setNode(node2);
126
143
  }, [])
127
144
  };
128
145
  }
146
+ __name(usePresence, "usePresence");
147
+ function setRef(ref, value) {
148
+ if (typeof ref === "function") {
149
+ return ref(value);
150
+ } else if (ref !== null && ref !== void 0) {
151
+ ref.current = value;
152
+ }
153
+ }
154
+ __name(setRef, "setRef");
155
+ function useStableComposedRefs() {
156
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
157
+ refs[_key] = arguments[_key];
158
+ }
159
+ const refsRef = React.useRef(refs);
160
+ refsRef.current = refs;
161
+ return React.useCallback(node => {
162
+ const currentRefs = refsRef.current;
163
+ let hasCleanup = false;
164
+ const cleanups = currentRefs.map(ref => {
165
+ const cleanup = setRef(ref, node);
166
+ if (!hasCleanup && typeof cleanup === "function") {
167
+ hasCleanup = true;
168
+ }
169
+ return cleanup;
170
+ });
171
+ if (hasCleanup) {
172
+ return () => {
173
+ for (let i = 0; i < cleanups.length; i++) {
174
+ const cleanup = cleanups[i];
175
+ if (typeof cleanup === "function") {
176
+ cleanup();
177
+ } else {
178
+ setRef(currentRefs[i], null);
179
+ }
180
+ }
181
+ };
182
+ }
183
+ }, []);
184
+ }
185
+ __name(useStableComposedRefs, "useStableComposedRefs");
129
186
  function getAnimationName(styles) {
130
187
  return (styles === null || styles === void 0 ? void 0 : styles.animationName) || "none";
131
188
  }
189
+ __name(getAnimationName, "getAnimationName");
132
190
  function getElementRef(element) {
133
191
  var _Object$getOwnPropert, _Object$getOwnPropert2;
134
192
  let getter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(element.props, "ref")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.get;
@@ -143,6 +201,7 @@ function getElementRef(element) {
143
201
  }
144
202
  return element.props.ref || element.ref;
145
203
  }
204
+ __name(getElementRef, "getElementRef");
146
205
  var Root = Presence;
147
206
 
148
207
  export { Presence, Root };
@@ -4,6 +4,11 @@ import * as ReactDOM from 'react-dom';
4
4
  import { createSlot } from '../../react-slot/dist/index.js';
5
5
 
6
6
  const _excluded = ["asChild"];
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", {
9
+ value,
10
+ configurable: true
11
+ });
7
12
  var NODES = ["a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "select", "span", "svg", "ul"];
8
13
  var Primitive = NODES.reduce((primitive, node) => {
9
14
  const Slot = createSlot("Primitive.".concat(node));
@@ -28,6 +33,7 @@ var Primitive = NODES.reduce((primitive, node) => {
28
33
  function dispatchDiscreteCustomEvent(target, event) {
29
34
  if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
30
35
  }
36
+ __name(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
31
37
  var Root = Primitive;
32
38
 
33
39
  export { Primitive, Root, dispatchDiscreteCustomEvent };
@@ -11,10 +11,17 @@ import { Primitive } from '../../react-primitive/dist/index.js';
11
11
  import { useCallbackRef } from '../../react-use-callback-ref/dist/index.js';
12
12
  import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
13
13
  import { useDirection } from '../../react-direction/dist/index.js';
14
+ import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
15
+ import { useIsHydrated as useIsHydrated2 } from '../../react-use-is-hydrated/dist/index.js';
14
16
 
15
17
  "use client";
16
18
  const _excluded = ["__scopeRovingFocusGroup", "orientation", "loop", "dir", "currentTabStopId", "defaultCurrentTabStopId", "onCurrentTabStopIdChange", "onEntryFocus", "preventScrollOnEntryFocus"],
17
19
  _excluded2 = ["__scopeRovingFocusGroup", "focusable", "active", "tabStopId", "children"];
20
+ var __defProp = Object.defineProperty;
21
+ var __name = (target, value) => __defProp(target, "name", {
22
+ value,
23
+ configurable: true
24
+ });
18
25
  var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
19
26
  var EVENT_OPTIONS = {
20
27
  bubbles: false,
@@ -34,7 +41,10 @@ var _createRovingFocusGro = createRovingFocusGroupContext(GROUP_NAME),
34
41
  _createRovingFocusGro2 = _slicedToArray(_createRovingFocusGro, 2),
35
42
  RovingFocusProvider = _createRovingFocusGro2[0],
36
43
  useRovingFocusContext = _createRovingFocusGro2[1];
37
- var RovingFocusGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
44
+ var RovingFocusGroup = /* @__PURE__ */React.forwardRef(
45
+ // blank line to reduce diff noise
46
+ /* @__PURE__ */
47
+ __name(function RovingFocusGroup2(props, forwardedRef) {
38
48
  return /* @__PURE__ */React.createElement(Collection.Provider, {
39
49
  scope: props.__scopeRovingFocusGroup,
40
50
  children: /* @__PURE__ */React.createElement(Collection.Slot, {
@@ -45,9 +55,8 @@ var RovingFocusGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
45
55
  })
46
56
  })
47
57
  });
48
- });
49
- RovingFocusGroup.displayName = GROUP_NAME;
50
- var RovingFocusGroupImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
58
+ }, "RovingFocusGroup"));
59
+ var RovingFocusGroupImpl = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function RovingFocusGroupImpl2(props, forwardedRef) {
51
60
  const __scopeRovingFocusGroup = props.__scopeRovingFocusGroup,
52
61
  orientation = props.orientation,
53
62
  _props$loop = props.loop,
@@ -131,9 +140,12 @@ var RovingFocusGroupImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
131
140
  onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
132
141
  })
133
142
  });
134
- });
143
+ }, "RovingFocusGroupImpl"));
135
144
  var ITEM_NAME = "RovingFocusGroupItem";
136
- var RovingFocusGroupItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
145
+ var RovingFocusGroupItem = /* @__PURE__ */React.forwardRef(
146
+ // blank line to reduce diff noise
147
+ /* @__PURE__ */
148
+ __name(function RovingFocusGroupItem2(props, forwardedRef) {
137
149
  const __scopeRovingFocusGroup = props.__scopeRovingFocusGroup,
138
150
  _props$focusable = props.focusable,
139
151
  focusable = _props$focusable === void 0 ? true : _props$focusable,
@@ -150,12 +162,21 @@ var RovingFocusGroupItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
150
162
  const onFocusableItemAdd = context.onFocusableItemAdd,
151
163
  onFocusableItemRemove = context.onFocusableItemRemove,
152
164
  currentTabStopId = context.currentTabStopId;
165
+ const isHydrated = useIsHydrated2();
166
+ useLayoutEffect2(() => {
167
+ if (!isHydrated || !focusable) {
168
+ return;
169
+ }
170
+ onFocusableItemAdd();
171
+ return () => onFocusableItemRemove();
172
+ }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
153
173
  React.useEffect(() => {
154
- if (focusable) {
155
- onFocusableItemAdd();
156
- return () => onFocusableItemRemove();
174
+ if (isHydrated || !focusable) {
175
+ return;
157
176
  }
158
- }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
177
+ onFocusableItemAdd();
178
+ return () => onFocusableItemRemove();
179
+ }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
159
180
  return /* @__PURE__ */React.createElement(Collection.ItemSlot, {
160
181
  scope: __scopeRovingFocusGroup,
161
182
  id,
@@ -196,8 +217,7 @@ var RovingFocusGroupItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
196
217
  }) : children
197
218
  })
198
219
  });
199
- });
200
- RovingFocusGroupItem.displayName = ITEM_NAME;
220
+ }, "RovingFocusGroupItem"));
201
221
  var MAP_KEY_TO_FOCUS_INTENT = {
202
222
  ArrowLeft: "prev",
203
223
  ArrowUp: "prev",
@@ -212,6 +232,7 @@ function getDirectionAwareKey(key, dir) {
212
232
  if (dir !== "rtl") return key;
213
233
  return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
214
234
  }
235
+ __name(getDirectionAwareKey, "getDirectionAwareKey");
215
236
  function getFocusIntent(event, orientation, dir) {
216
237
  var _context, _context2;
217
238
  const key = getDirectionAwareKey(event.key, dir);
@@ -219,6 +240,7 @@ function getFocusIntent(event, orientation, dir) {
219
240
  if (orientation === "horizontal" && _includesInstanceProperty(_context2 = ["ArrowUp", "ArrowDown"]).call(_context2, key)) return void 0;
220
241
  return MAP_KEY_TO_FOCUS_INTENT[key];
221
242
  }
243
+ __name(getFocusIntent, "getFocusIntent");
222
244
  function focusFirst(candidates) {
223
245
  let preventScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
224
246
  const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
@@ -230,9 +252,11 @@ function focusFirst(candidates) {
230
252
  if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
231
253
  }
232
254
  }
255
+ __name(focusFirst, "focusFirst");
233
256
  function wrapArray(array, startIndex) {
234
257
  return array.map((_, index) => array[(startIndex + index) % array.length]);
235
258
  }
259
+ __name(wrapArray, "wrapArray");
236
260
  var Root = RovingFocusGroup;
237
261
  var Item = RovingFocusGroupItem;
238
262