@qualtrics/ui-react 2.85.2 → 2.85.5

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 (122) hide show
  1. package/CHANGELOG.md +25 -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 +9 -6
  5. package/dist/__node_modules/@radix-ui/react-collection/dist/index.js +263 -153
  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 +16 -6
  9. package/dist/__node_modules/@radix-ui/react-dismissable-layer/dist/index.js +172 -43
  10. package/dist/__node_modules/@radix-ui/react-dropdown-menu/dist/index.js +76 -95
  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 +111 -30
  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 +232 -197
  15. package/dist/__node_modules/@radix-ui/react-popper/dist/index.js +104 -49
  16. package/dist/__node_modules/@radix-ui/react-portal/dist/index.js +10 -8
  17. package/dist/__node_modules/@radix-ui/react-presence/dist/index.js +72 -14
  18. package/dist/__node_modules/@radix-ui/react-primitive/dist/index.js +8 -2
  19. package/dist/__node_modules/@radix-ui/react-roving-focus/dist/index.js +52 -18
  20. package/dist/__node_modules/@radix-ui/react-slot/dist/index.js +106 -54
  21. package/dist/__node_modules/@radix-ui/react-use-callback-ref/dist/index.js +17 -4
  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 +28 -15
  27. package/dist/__shared/cjs/{index-e03dac36.js → index-bd03241f.js} +213 -208
  28. package/dist/__shared/cjs/{index-507024ee.js → index-ccb5282a.js} +12 -3
  29. package/dist/components/Accordion/Accordion2.js +3 -3
  30. package/dist/components/Button/Button.js +52 -6
  31. package/dist/components/Button/Button2.js +6 -52
  32. package/dist/components/Button/index.js +1 -1
  33. package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
  34. package/dist/components/Checkbox/Checkbox2.js +3 -3
  35. package/dist/components/ColorPicker/ColorPicker2.js +3 -3
  36. package/dist/components/ColorPicker/ColorPickerFlyout.js +1 -1
  37. package/dist/components/Combobox/Combobox2.js +3 -3
  38. package/dist/components/ConfigPane/ConfigPane.js +6 -2
  39. package/dist/components/ConfigPane/ConfigPane2.js +3 -3
  40. package/dist/components/Divider/Divider2.js +3 -3
  41. package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +1 -1
  42. package/dist/components/Dropdown/Dropdown2.js +3 -3
  43. package/dist/components/FilePicker/FilePicker.js +1 -1
  44. package/dist/components/FilePicker/FilePicker2.js +3 -3
  45. package/dist/components/FormField/Caption.js +3 -3
  46. package/dist/components/FormField/FormField2.js +3 -3
  47. package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
  48. package/dist/components/Icon/IconTypes.js +1 -0
  49. package/dist/components/IconButton/IconButton2.js +3 -3
  50. package/dist/components/InlineInput/InlineInput2.js +3 -3
  51. package/dist/components/Input/Input2.js +3 -3
  52. package/dist/components/InputGroup/InputGroup2.js +3 -3
  53. package/dist/components/Label/Label2.js +3 -3
  54. package/dist/components/Link/Link2.js +3 -3
  55. package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
  56. package/dist/components/LogicEditor/LogicEditor2.js +3 -3
  57. package/dist/components/Modal/Modal2.js +3 -3
  58. package/dist/components/NewMenu/NewMenu.js +3 -3
  59. package/dist/components/NumberStepper/NumberStepper2.js +3 -3
  60. package/dist/components/PageLayout/PageLayout.js +3 -3
  61. package/dist/components/Pagination/Pagination2.js +3 -3
  62. package/dist/components/Pagination/PaginationNextButton.js +1 -1
  63. package/dist/components/Pagination/PaginationPreviousButton.js +1 -1
  64. package/dist/components/Popover/Popover2.js +3 -3
  65. package/dist/components/QuickSearch/QuickSearch.js +1 -1
  66. package/dist/components/QuickSearch/QuickSearch2.js +3 -3
  67. package/dist/components/Radio/Radio2.js +3 -3
  68. package/dist/components/SearchInput/SearchInput2.js +3 -3
  69. package/dist/components/SidebarNav/SidebarNav2.js +3 -3
  70. package/dist/components/Slider/Slider2.js +3 -3
  71. package/dist/components/Switch/Switch2.js +3 -3
  72. package/dist/components/Table/Table2.js +3 -3
  73. package/dist/components/Tabs/Tabs2.js +3 -3
  74. package/dist/components/Tooltip/Tooltip2.js +3 -3
  75. package/dist/components/deprecated_ColorPicker/ColorPicker.js +1 -1
  76. package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
  77. package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
  78. package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
  79. package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
  80. package/dist/design-tokens/less/typography.js +3 -3
  81. package/dist/hooks/useOverlay/useOverlay2.js +3 -3
  82. package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
  83. package/dist/icons/Icon.js +3 -3
  84. package/dist/icons/components/PulseIcon.js +11 -0
  85. package/dist/icons/index.d.ts +2 -0
  86. package/dist/icons/index.es.js +1 -0
  87. package/dist/icons/index.js +2 -1
  88. package/dist/index.d.ts +72 -71
  89. package/dist/index.es.js +2 -2
  90. package/dist/index.js +3 -3
  91. package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
  92. package/dist/next/Chat/Loader.js +1 -1
  93. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
  94. package/dist/next/Combobox/Combobox2.js +3 -3
  95. package/dist/next/Drawer/Drawer2.js +3 -3
  96. package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
  97. package/dist/next/Form/FormFields/InputField.js +3 -3
  98. package/dist/next/Indicator/Indicator2.js +3 -3
  99. package/dist/next/Input/Input2.js +3 -3
  100. package/dist/next/LoadingSpinner/LoadingSpinner2.js +3 -3
  101. package/dist/next/Menu/Hooks/useFlyoutNode.js +48 -0
  102. package/dist/next/Menu/Menu.js +2 -2
  103. package/dist/next/Menu/Menu2.js +3 -3
  104. package/dist/next/Menu/MenuButton.js +6 -5
  105. package/dist/next/Menu/MenuItem.js +5 -4
  106. package/dist/next/Menu/MenuPane.js +20 -19
  107. package/dist/next/Menu/PaneChildren.js +15 -10
  108. package/dist/next/Menu/SubMenu.js +22 -21
  109. package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
  110. package/dist/next/Select/Select2.js +3 -3
  111. package/dist/next/SplitButton/SplitButton.js +1 -1
  112. package/dist/next/SplitButton/SplitButton2.js +3 -3
  113. package/dist/next/TimePicker/TimePicker2.js +3 -3
  114. package/dist/next/ToggleButton/ToggleButton.js +1 -1
  115. package/dist/next/ToggleButton/styles.js +3 -3
  116. package/dist/next/index.js +1581 -850
  117. package/dist/translations-en.js +71 -71
  118. package/dist/utils/Flyout/Flyout2.js +3 -3
  119. package/icons/package.json +4 -4
  120. package/next/package.json +5 -5
  121. package/package.json +16 -16
  122. package/dist/__node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -23
@@ -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,
@@ -30,11 +37,22 @@ var _createContextScope = createContextScope(GROUP_NAME, [createCollectionScope]
30
37
  _createContextScope2 = _slicedToArray(_createContextScope, 2),
31
38
  createRovingFocusGroupContext = _createContextScope2[0],
32
39
  createRovingFocusGroupScope = _createContextScope2[1];
40
+ var Orientation = {
41
+ Vertical: "vertical",
42
+ Horizontal: "horizontal"
43
+ };
44
+ var Direction = {
45
+ LTR: "ltr",
46
+ RTL: "rtl"
47
+ };
33
48
  var _createRovingFocusGro = createRovingFocusGroupContext(GROUP_NAME),
34
49
  _createRovingFocusGro2 = _slicedToArray(_createRovingFocusGro, 2),
35
50
  RovingFocusProvider = _createRovingFocusGro2[0],
36
51
  useRovingFocusContext = _createRovingFocusGro2[1];
37
- var RovingFocusGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
52
+ var RovingFocusGroup = /* @__PURE__ */React.forwardRef(
53
+ // blank line to reduce diff noise
54
+ /* @__PURE__ */
55
+ __name(function RovingFocusGroup2(props, forwardedRef) {
38
56
  return /* @__PURE__ */React.createElement(Collection.Provider, {
39
57
  scope: props.__scopeRovingFocusGroup,
40
58
  children: /* @__PURE__ */React.createElement(Collection.Slot, {
@@ -45,9 +63,8 @@ var RovingFocusGroup = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
45
63
  })
46
64
  })
47
65
  });
48
- });
49
- RovingFocusGroup.displayName = GROUP_NAME;
50
- var RovingFocusGroupImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
66
+ }, "RovingFocusGroup"));
67
+ var RovingFocusGroupImpl = /* @__PURE__ */React.forwardRef(/* @__PURE__ */__name(function RovingFocusGroupImpl2(props, forwardedRef) {
51
68
  const __scopeRovingFocusGroup = props.__scopeRovingFocusGroup,
52
69
  orientation = props.orientation,
53
70
  _props$loop = props.loop,
@@ -131,9 +148,12 @@ var RovingFocusGroupImpl = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
131
148
  onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
132
149
  })
133
150
  });
134
- });
151
+ }, "RovingFocusGroupImpl"));
135
152
  var ITEM_NAME = "RovingFocusGroupItem";
136
- var RovingFocusGroupItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
153
+ var RovingFocusGroupItem = /* @__PURE__ */React.forwardRef(
154
+ // blank line to reduce diff noise
155
+ /* @__PURE__ */
156
+ __name(function RovingFocusGroupItem2(props, forwardedRef) {
137
157
  const __scopeRovingFocusGroup = props.__scopeRovingFocusGroup,
138
158
  _props$focusable = props.focusable,
139
159
  focusable = _props$focusable === void 0 ? true : _props$focusable,
@@ -150,12 +170,21 @@ var RovingFocusGroupItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
150
170
  const onFocusableItemAdd = context.onFocusableItemAdd,
151
171
  onFocusableItemRemove = context.onFocusableItemRemove,
152
172
  currentTabStopId = context.currentTabStopId;
173
+ const isHydrated = useIsHydrated2();
174
+ useLayoutEffect2(() => {
175
+ if (!isHydrated || !focusable) {
176
+ return;
177
+ }
178
+ onFocusableItemAdd();
179
+ return () => onFocusableItemRemove();
180
+ }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
153
181
  React.useEffect(() => {
154
- if (focusable) {
155
- onFocusableItemAdd();
156
- return () => onFocusableItemRemove();
182
+ if (isHydrated || !focusable) {
183
+ return;
157
184
  }
158
- }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
185
+ onFocusableItemAdd();
186
+ return () => onFocusableItemRemove();
187
+ }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
159
188
  return /* @__PURE__ */React.createElement(Collection.ItemSlot, {
160
189
  scope: __scopeRovingFocusGroup,
161
190
  id,
@@ -196,8 +225,7 @@ var RovingFocusGroupItem = /*#__PURE__*/React.forwardRef((props, forwardedRef) =
196
225
  }) : children
197
226
  })
198
227
  });
199
- });
200
- RovingFocusGroupItem.displayName = ITEM_NAME;
228
+ }, "RovingFocusGroupItem"));
201
229
  var MAP_KEY_TO_FOCUS_INTENT = {
202
230
  ArrowLeft: "prev",
203
231
  ArrowUp: "prev",
@@ -209,16 +237,22 @@ var MAP_KEY_TO_FOCUS_INTENT = {
209
237
  End: "last"
210
238
  };
211
239
  function getDirectionAwareKey(key, dir) {
212
- if (dir !== "rtl") return key;
240
+ if (dir !== Direction.RTL) return key;
213
241
  return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
214
242
  }
243
+ __name(getDirectionAwareKey, "getDirectionAwareKey");
215
244
  function getFocusIntent(event, orientation, dir) {
216
245
  var _context, _context2;
217
246
  const key = getDirectionAwareKey(event.key, dir);
218
- if (orientation === "vertical" && _includesInstanceProperty(_context = ["ArrowLeft", "ArrowRight"]).call(_context, key)) return void 0;
219
- if (orientation === "horizontal" && _includesInstanceProperty(_context2 = ["ArrowUp", "ArrowDown"]).call(_context2, key)) return void 0;
247
+ if (orientation === Orientation.Vertical && _includesInstanceProperty(_context = ["ArrowLeft", "ArrowRight"]).call(_context, key)) {
248
+ return void 0;
249
+ }
250
+ if (orientation === Orientation.Horizontal && _includesInstanceProperty(_context2 = ["ArrowUp", "ArrowDown"]).call(_context2, key)) {
251
+ return void 0;
252
+ }
220
253
  return MAP_KEY_TO_FOCUS_INTENT[key];
221
254
  }
255
+ __name(getFocusIntent, "getFocusIntent");
222
256
  function focusFirst(candidates) {
223
257
  let preventScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
224
258
  const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
@@ -230,10 +264,10 @@ function focusFirst(candidates) {
230
264
  if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
231
265
  }
232
266
  }
267
+ __name(focusFirst, "focusFirst");
233
268
  function wrapArray(array, startIndex) {
234
269
  return array.map((_, index) => array[(startIndex + index) % array.length]);
235
270
  }
236
- var Root = RovingFocusGroup;
237
- var Item = RovingFocusGroupItem;
271
+ __name(wrapArray, "wrapArray");
238
272
 
239
- export { Item, Root, RovingFocusGroup, RovingFocusGroupItem, createRovingFocusGroupScope };
273
+ export { RovingFocusGroupItem as Item, RovingFocusGroup as Root, RovingFocusGroup, RovingFocusGroupItem, createRovingFocusGroupScope };
@@ -1,78 +1,84 @@
1
1
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
2
2
  import * as React from 'react';
3
- import { composeRefs } from '../../react-compose-refs/dist/index.js';
3
+ import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
4
4
 
5
- const _excluded = ["children"],
6
- _excluded2 = ["children"];
5
+ const _excluded = ["children"];
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", {
8
+ value,
9
+ configurable: true
10
+ });
7
11
  // @__NO_SIDE_EFFECTS__
8
12
  function createSlot(ownerName) {
9
- const SlotClone = /* @__PURE__ */createSlotClone(ownerName);
10
13
  const Slot2 = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
11
- const children = props.children,
14
+ var _slottableElement$pro;
15
+ let children = props.children,
12
16
  slotProps = _objectWithoutProperties(props, _excluded);
13
- const childrenArray = React.Children.toArray(children);
14
- const slottable = childrenArray.find(isSlottable);
15
- if (slottable) {
16
- const newElement = slottable.props.children;
17
- const newChildren = childrenArray.map(child => {
18
- if (child === slottable) {
19
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
20
- return /*#__PURE__*/React.isValidElement(newElement) ? newElement.props.children : null;
21
- } else {
22
- return child;
17
+ let slottableElement = null;
18
+ let hasSlottable = false;
19
+ const newChildren = [];
20
+ children = useUnwrappedLazy(children);
21
+ React.Children.forEach(children, maybeSlottable => {
22
+ if (isSlottable(maybeSlottable)) {
23
+ var _slottableElement;
24
+ hasSlottable = true;
25
+ const slottable = maybeSlottable;
26
+ let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
27
+ while (isLazyComponent(child) && typeof use === "function") {
28
+ child = use(child._payload);
23
29
  }
24
- });
25
- return /* @__PURE__ */React.createElement(SlotClone, {
26
- ...slotProps,
27
- ref: forwardedRef,
28
- children: /*#__PURE__*/React.isValidElement(newElement) ? /*#__PURE__*/React.cloneElement(newElement, void 0, newChildren) : null
29
- });
30
- }
31
- return /* @__PURE__ */React.createElement(SlotClone, {
32
- ...slotProps,
33
- ref: forwardedRef,
34
- children
30
+ slottableElement = getSlottableElementFromSlottable(slottable, child);
31
+ newChildren.push((_slottableElement = slottableElement) === null || _slottableElement === void 0 || (_slottableElement = _slottableElement.props) === null || _slottableElement === void 0 ? void 0 : _slottableElement.children);
32
+ } else {
33
+ newChildren.push(maybeSlottable);
34
+ }
35
35
  });
36
+ if (slottableElement) {
37
+ slottableElement = /*#__PURE__*/React.cloneElement(slottableElement, void 0, newChildren);
38
+ } else if (
39
+ // A `Slottable` was found but it didn't resolve to a single element (e.g.
40
+ // it wrapped multiple elements, text, or a render-prop `child` that
41
+ // wasn't an element). Don't fall back to treating the `Slottable` wrapper
42
+ // itself as the slot target — throw a descriptive error below instead.
43
+ !hasSlottable && React.Children.count(children) === 1 && /*#__PURE__*/React.isValidElement(children)) {
44
+ slottableElement = children;
45
+ }
46
+ const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;
47
+ const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
48
+ if (!slottableElement) {
49
+ if (children || children === 0) {
50
+ throw new Error(hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName));
51
+ }
52
+ return children;
53
+ }
54
+ const mergedProps = mergeProps(slotProps, (_slottableElement$pro = slottableElement.props) !== null && _slottableElement$pro !== void 0 ? _slottableElement$pro : {});
55
+ if (slottableElement.type !== React.Fragment) {
56
+ mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
57
+ }
58
+ return /*#__PURE__*/React.cloneElement(slottableElement, mergedProps);
36
59
  });
37
60
  Slot2.displayName = "".concat(ownerName, ".Slot");
38
61
  return Slot2;
39
62
  }
63
+ __name(createSlot, "createSlot");
40
64
  var Slot = /* @__PURE__ */createSlot("Slot");
41
- // @__NO_SIDE_EFFECTS__
42
- function createSlotClone(ownerName) {
43
- const SlotClone = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
44
- const children = props.children,
45
- slotProps = _objectWithoutProperties(props, _excluded2);
46
- if (/*#__PURE__*/React.isValidElement(children)) {
47
- const childrenRef = getElementRef(children);
48
- const props2 = mergeProps(slotProps, children.props);
49
- if (children.type !== React.Fragment) {
50
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
51
- }
52
- return /*#__PURE__*/React.cloneElement(children, props2);
53
- }
54
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
55
- });
56
- SlotClone.displayName = "".concat(ownerName, ".SlotClone");
57
- return SlotClone;
58
- }
59
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
65
+ var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
60
66
  // @__NO_SIDE_EFFECTS__
61
67
  function createSlottable(ownerName) {
62
- const Slottable2 = _ref => {
63
- let children = _ref.children;
64
- return /* @__PURE__ */React.createElement(React.Fragment, {
65
- children
66
- });
67
- };
68
+ const Slottable2 = /* @__PURE__ */__name(props => "child" in props ? props.children(props.child) : props.children, "Slottable");
68
69
  Slottable2.displayName = "".concat(ownerName, ".Slottable");
69
70
  Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
70
71
  return Slottable2;
71
72
  }
73
+ __name(createSlottable, "createSlottable");
72
74
  var Slottable = /* @__PURE__ */createSlottable("Slottable");
73
- function isSlottable(child) {
74
- return /*#__PURE__*/React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
75
- }
75
+ var getSlottableElementFromSlottable = /* @__PURE__ */__name((slottable, child) => {
76
+ if ("child" in slottable.props) {
77
+ if (! /*#__PURE__*/React.isValidElement(child)) return null;
78
+ return /*#__PURE__*/React.cloneElement(child, void 0, slottable.props.children(child.props.children));
79
+ }
80
+ return /*#__PURE__*/React.isValidElement(child) ? child : null;
81
+ }, "getSlottableElementFromSlottable");
76
82
  function mergeProps(slotProps, childProps) {
77
83
  const overrideProps = {
78
84
  ...childProps
@@ -98,6 +104,8 @@ function mergeProps(slotProps, childProps) {
98
104
  };
99
105
  } else if (propName === "className") {
100
106
  overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
107
+ } else if (propName === "aria-describedby") {
108
+ overrideProps[propName] = concatAriaDescribedby(childPropValue, slotPropValue);
101
109
  }
102
110
  }
103
111
  return {
@@ -105,6 +113,7 @@ function mergeProps(slotProps, childProps) {
105
113
  ...overrideProps
106
114
  };
107
115
  }
116
+ __name(mergeProps, "mergeProps");
108
117
  function getElementRef(element) {
109
118
  var _Object$getOwnPropert, _Object$getOwnPropert2;
110
119
  let getter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(element.props, "ref")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.get;
@@ -119,5 +128,48 @@ function getElementRef(element) {
119
128
  }
120
129
  return element.props.ref || element.ref;
121
130
  }
131
+ __name(getElementRef, "getElementRef");
132
+ function isSlottable(child) {
133
+ return /*#__PURE__*/React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
134
+ }
135
+ __name(isSlottable, "isSlottable");
136
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
137
+ function isLazyComponent(element) {
138
+ return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
139
+ }
140
+ __name(isLazyComponent, "isLazyComponent");
141
+ function isPromiseLike(value) {
142
+ return typeof value === "object" && value !== null && "then" in value;
143
+ }
144
+ __name(isPromiseLike, "isPromiseLike");
145
+ function useUnwrappedLazy(value) {
146
+ let unwrapped = value;
147
+ while (isLazyComponent(unwrapped) && typeof use === "function") {
148
+ unwrapped = use(unwrapped._payload);
149
+ }
150
+ return unwrapped;
151
+ }
152
+ __name(useUnwrappedLazy, "useUnwrappedLazy");
153
+ function concatAriaDescribedby() {
154
+ const ids = /* @__PURE__ */new Set();
155
+ for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
156
+ values[_key] = arguments[_key];
157
+ }
158
+ for (const value of values) {
159
+ if (typeof value !== "string") continue;
160
+ for (const id of String(value).trim().split(/\s+/)) {
161
+ if (id) ids.add(id);
162
+ }
163
+ }
164
+ return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
165
+ }
166
+ __name(concatAriaDescribedby, "concatAriaDescribedby");
167
+ var createSlotError = /* @__PURE__ */__name(ownerName => {
168
+ return "".concat(ownerName, " failed to slot onto its children. Expected a single React element child or `Slottable`.");
169
+ }, "createSlotError");
170
+ var createSlottableError = /* @__PURE__ */__name(ownerName => {
171
+ return "".concat(ownerName, " failed to slot onto its `Slottable`. Expected `Slottable` to receive a single React element child.");
172
+ }, "createSlottableError");
173
+ var use = React[" use ".trim().toString()];
122
174
 
123
175
  export { Slot as Root, Slot, Slottable, createSlot, createSlottable };
@@ -1,11 +1,23 @@
1
+ import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
1
2
  import * as React from 'react';
2
3
 
3
- // packages/react/use-callback-ref/src/use-callback-ref.tsx
4
+ var __defProp = Object.defineProperty;
5
+ var __name = (target, value) => __defProp(target, "name", {
6
+ value,
7
+ configurable: true
8
+ });
9
+ var useReactInsertionEffect = React[" useInsertionEffect ".trim().toString()];
4
10
  function useCallbackRef(callback) {
5
11
  const callbackRef = React.useRef(callback);
6
- React.useEffect(() => {
7
- callbackRef.current = callback;
8
- });
12
+ if (typeof useReactInsertionEffect === "function") {
13
+ useReactInsertionEffect(() => {
14
+ callbackRef.current = callback;
15
+ });
16
+ } else {
17
+ useLayoutEffect2(() => {
18
+ callbackRef.current = callback;
19
+ });
20
+ }
9
21
  return React.useMemo(() => function () {
10
22
  var _callbackRef$current;
11
23
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -14,5 +26,6 @@ function useCallbackRef(callback) {
14
26
  return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
15
27
  }, []);
16
28
  }
29
+ __name(useCallbackRef, "useCallbackRef");
17
30
 
18
31
  export { useCallbackRef };
@@ -1,14 +1,20 @@
1
1
  import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
2
2
  import * as React from 'react';
3
+ import { IS_DEVELOPMENT } from '../../primitive/dist/internal/is-development.false.js';
3
4
  import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
4
5
  import { useEffectEvent } from '../../react-use-effect-event/dist/index.js';
5
6
 
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", {
9
+ value,
10
+ configurable: true
11
+ });
6
12
  var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
7
13
  function useControllableState(_ref) {
8
14
  let prop = _ref.prop,
9
15
  defaultProp = _ref.defaultProp,
10
16
  _ref$onChange = _ref.onChange,
11
- onChange = _ref$onChange === void 0 ? () => {} : _ref$onChange,
17
+ onChange = _ref$onChange === void 0 ? /* @__PURE__ */__name(() => {}, "onChange") : _ref$onChange,
12
18
  caller = _ref.caller;
13
19
  const _useUncontrolledState = useUncontrolledState({
14
20
  defaultProp,
@@ -20,7 +26,7 @@ function useControllableState(_ref) {
20
26
  onChangeRef = _useUncontrolledState2[2];
21
27
  const isControlled = prop !== void 0;
22
28
  const value = isControlled ? prop : uncontrolledProp;
23
- if (true) {
29
+ if (IS_DEVELOPMENT) {
24
30
  const isControlledRef = React.useRef(prop !== void 0);
25
31
  React.useEffect(() => {
26
32
  const wasControlled = isControlledRef.current;
@@ -45,6 +51,7 @@ function useControllableState(_ref) {
45
51
  }, [isControlled, prop, setUncontrolledProp, onChangeRef]);
46
52
  return [value, setValue];
47
53
  }
54
+ __name(useControllableState, "useControllableState");
48
55
  function useUncontrolledState(_ref2) {
49
56
  let defaultProp = _ref2.defaultProp,
50
57
  onChange = _ref2.onChange;
@@ -66,9 +73,11 @@ function useUncontrolledState(_ref2) {
66
73
  }, [value, prevValueRef]);
67
74
  return [value, setValue, onChangeRef];
68
75
  }
76
+ __name(useUncontrolledState, "useUncontrolledState");
69
77
  function isFunction(value) {
70
78
  return typeof value === "function";
71
79
  }
80
+ __name(isFunction, "isFunction");
72
81
  var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
73
82
  function useControllableStateReducer(reducer, userArgs, initialArg, init) {
74
83
  const controlledState = userArgs.prop,
@@ -77,7 +86,7 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
77
86
  caller = userArgs.caller;
78
87
  const isControlled = controlledState !== void 0;
79
88
  const onChange = useEffectEvent(onChangeProp);
80
- if (true) {
89
+ if (IS_DEVELOPMENT) {
81
90
  const isControlledRef = React.useRef(controlledState !== void 0);
82
91
  React.useEffect(() => {
83
92
  const wasControlled = isControlledRef.current;
@@ -121,7 +130,7 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
121
130
  onChange(uncontrolledState);
122
131
  }
123
132
  }
124
- }, [onChange, uncontrolledState, prevValueRef, isControlled]);
133
+ }, [uncontrolledState, prevValueRef, isControlled]);
125
134
  const state = React.useMemo(() => {
126
135
  const isControlled2 = controlledState !== void 0;
127
136
  if (isControlled2) {
@@ -142,5 +151,6 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
142
151
  }, [controlledState, internalState.state, isControlled]);
143
152
  return [state, dispatch];
144
153
  }
154
+ __name(useControllableStateReducer, "useControllableStateReducer");
145
155
 
146
156
  export { useControllableState, useControllableStateReducer };
@@ -1,7 +1,11 @@
1
1
  import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
2
2
  import * as React from 'react';
3
3
 
4
- // src/use-effect-event.tsx
4
+ var __defProp = Object.defineProperty;
5
+ var __name = (target, value) => __defProp(target, "name", {
6
+ value,
7
+ configurable: true
8
+ });
5
9
  var useReactEffectEvent = React[" useEffectEvent ".trim().toString()];
6
10
  var useReactInsertionEffect = React[" useInsertionEffect ".trim().toString()];
7
11
  function useEffectEvent(callback) {
@@ -28,5 +32,6 @@ function useEffectEvent(callback) {
28
32
  return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.call(ref, ...args);
29
33
  }, []);
30
34
  }
35
+ __name(useEffectEvent, "useEffectEvent");
31
36
 
32
37
  export { useEffectEvent };
@@ -0,0 +1,37 @@
1
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
2
+ import * as React from 'react';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __name = (target, value) => __defProp(target, "name", {
6
+ value,
7
+ configurable: true
8
+ });
9
+ var _isHydrated = false;
10
+ function useIsHydrated() {
11
+ const _React$useState = React.useState(_isHydrated),
12
+ _React$useState2 = _slicedToArray(_React$useState, 2),
13
+ isHydrated = _React$useState2[0],
14
+ setIsHydrated = _React$useState2[1];
15
+ React.useEffect(() => {
16
+ if (!_isHydrated) {
17
+ _isHydrated = true;
18
+ setIsHydrated(true);
19
+ }
20
+ }, []);
21
+ return isHydrated;
22
+ }
23
+ __name(useIsHydrated, "useIsHydrated");
24
+
25
+ // src/use-is-hydrated.tsx
26
+ var useReactSyncExternalStore = React[" useSyncExternalStore ".trim().toString()];
27
+ function subscribe() {
28
+ return () => {};
29
+ }
30
+ __name(subscribe, "subscribe");
31
+ function useIsHydratedModern() {
32
+ return useReactSyncExternalStore(subscribe, () => true, () => false);
33
+ }
34
+ __name(useIsHydratedModern, "useIsHydratedModern");
35
+ var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
36
+
37
+ export { useIsHydrated2 as useIsHydrated };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- // packages/react/use-layout-effect/src/use-layout-effect.tsx
3
+ // src/use-layout-effect.tsx
4
4
  var useLayoutEffect2 = globalThis !== null && globalThis !== void 0 && globalThis.document ? React.useLayoutEffect : () => {};
5
5
 
6
6
  export { useLayoutEffect2 as useLayoutEffect };
@@ -2,6 +2,11 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
2
2
  import * as React from 'react';
3
3
  import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
4
4
 
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", {
7
+ value,
8
+ configurable: true
9
+ });
5
10
  function useSize(element) {
6
11
  const _React$useState = React.useState(void 0),
7
12
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -13,6 +18,7 @@ function useSize(element) {
13
18
  width: element.offsetWidth,
14
19
  height: element.offsetHeight
15
20
  });
21
+ let rAF = 0;
16
22
  const resizeObserver = new ResizeObserver(entries => {
17
23
  if (!Array.isArray(entries)) {
18
24
  return;
@@ -21,31 +27,38 @@ function useSize(element) {
21
27
  return;
22
28
  }
23
29
  const entry = entries[0];
24
- let width;
25
- let height;
26
- if ("borderBoxSize" in entry) {
27
- const borderSizeEntry = entry["borderBoxSize"];
28
- const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
29
- width = borderSize["inlineSize"];
30
- height = borderSize["blockSize"];
31
- } else {
32
- width = element.offsetWidth;
33
- height = element.offsetHeight;
34
- }
35
- setSize({
36
- width,
37
- height
30
+ window.cancelAnimationFrame(rAF);
31
+ rAF = window.requestAnimationFrame(() => {
32
+ let width;
33
+ let height;
34
+ if ("borderBoxSize" in entry) {
35
+ const borderSizeEntry = entry["borderBoxSize"];
36
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
37
+ width = borderSize["inlineSize"];
38
+ height = borderSize["blockSize"];
39
+ } else {
40
+ width = element.offsetWidth;
41
+ height = element.offsetHeight;
42
+ }
43
+ setSize({
44
+ width,
45
+ height
46
+ });
38
47
  });
39
48
  });
40
49
  resizeObserver.observe(element, {
41
50
  box: "border-box"
42
51
  });
43
- return () => resizeObserver.unobserve(element);
52
+ return () => {
53
+ window.cancelAnimationFrame(rAF);
54
+ resizeObserver.unobserve(element);
55
+ };
44
56
  } else {
45
57
  setSize(void 0);
46
58
  }
47
59
  }, [element]);
48
60
  return size;
49
61
  }
62
+ __name(useSize, "useSize");
50
63
 
51
64
  export { useSize };