@jobber/components 7.10.0 → 7.11.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 (106) hide show
  1. package/dist/Autocomplete/index.cjs +1 -0
  2. package/dist/Autocomplete/index.mjs +1 -0
  3. package/dist/Card/index.cjs +3 -0
  4. package/dist/Card/index.mjs +3 -0
  5. package/dist/Chip/index.cjs +1 -0
  6. package/dist/Chip/index.mjs +1 -0
  7. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -0
  8. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -0
  9. package/dist/Chips/InternalChipDismissible/index.cjs +1 -0
  10. package/dist/Chips/InternalChipDismissible/index.mjs +1 -0
  11. package/dist/Chips/index.cjs +1 -0
  12. package/dist/Chips/index.mjs +1 -0
  13. package/dist/Combobox/components/ComboboxActivator/index.cjs +1 -0
  14. package/dist/Combobox/components/ComboboxActivator/index.mjs +1 -0
  15. package/dist/Combobox/components/ComboboxContent/index.cjs +1 -0
  16. package/dist/Combobox/components/ComboboxContent/index.mjs +1 -0
  17. package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -0
  18. package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -0
  19. package/dist/Combobox/index.cjs +1 -0
  20. package/dist/Combobox/index.mjs +1 -0
  21. package/dist/ConfirmationModal/index.cjs +1 -0
  22. package/dist/ConfirmationModal/index.mjs +1 -0
  23. package/dist/DataDump/index.cjs +3 -0
  24. package/dist/DataDump/index.mjs +3 -0
  25. package/dist/DataList/components/DataListActions/index.cjs +1 -0
  26. package/dist/DataList/components/DataListActions/index.mjs +1 -0
  27. package/dist/DataList/components/DataListBulkActions/index.cjs +1 -0
  28. package/dist/DataList/components/DataListBulkActions/index.mjs +1 -0
  29. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -0
  30. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -0
  31. package/dist/DataList/components/DataListFilters/index.cjs +1 -0
  32. package/dist/DataList/components/DataListFilters/index.mjs +1 -0
  33. package/dist/DataList/components/DataListHeader/index.cjs +1 -0
  34. package/dist/DataList/components/DataListHeader/index.mjs +1 -0
  35. package/dist/DataList/components/DataListItem/index.cjs +1 -0
  36. package/dist/DataList/components/DataListItem/index.mjs +1 -0
  37. package/dist/DataList/components/DataListItemActions/index.cjs +1 -0
  38. package/dist/DataList/components/DataListItemActions/index.mjs +1 -0
  39. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -0
  40. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -0
  41. package/dist/DataList/components/DataListItems/index.cjs +1 -0
  42. package/dist/DataList/components/DataListItems/index.mjs +1 -0
  43. package/dist/DataList/components/DataListLayout/index.cjs +1 -0
  44. package/dist/DataList/components/DataListLayout/index.mjs +1 -0
  45. package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -0
  46. package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -0
  47. package/dist/DataList/index.cjs +1 -0
  48. package/dist/DataList/index.mjs +1 -0
  49. package/dist/DatePicker/index.cjs +1 -0
  50. package/dist/DatePicker/index.mjs +1 -0
  51. package/dist/DrawerRoot-cjs.js +181 -968
  52. package/dist/DrawerRoot-es.js +5 -734
  53. package/dist/FormatFile/index.cjs +1 -0
  54. package/dist/FormatFile/index.mjs +1 -0
  55. package/dist/Gallery/index.cjs +1 -0
  56. package/dist/Gallery/index.mjs +1 -0
  57. package/dist/InputDate/index.cjs +1 -0
  58. package/dist/InputDate/index.mjs +1 -0
  59. package/dist/InputNumberExperimental-cjs.js +783 -0
  60. package/dist/InputNumberExperimental-es.js +763 -0
  61. package/dist/LightBox/index.cjs +1 -0
  62. package/dist/LightBox/index.mjs +1 -0
  63. package/dist/Menu/index.cjs +3 -0
  64. package/dist/Menu/index.mjs +3 -0
  65. package/dist/MenuSubmenuTrigger-cjs.js +202 -447
  66. package/dist/MenuSubmenuTrigger-es.js +7 -249
  67. package/dist/Modal/index.cjs +1 -0
  68. package/dist/Modal/index.mjs +1 -0
  69. package/dist/NumberFieldInput-cjs.js +1828 -0
  70. package/dist/NumberFieldInput-es.js +1788 -0
  71. package/dist/Page/index.cjs +3 -0
  72. package/dist/Page/index.mjs +3 -0
  73. package/dist/Popover/index.cjs +1 -0
  74. package/dist/Popover/index.mjs +1 -0
  75. package/dist/Tooltip/index.cjs +1 -0
  76. package/dist/Tooltip/index.mjs +1 -0
  77. package/dist/docs/Menu/Menu.md +197 -37
  78. package/dist/floating-ui.react-cjs.js +35 -34
  79. package/dist/floating-ui.react-dom-cjs.js +65 -64
  80. package/dist/floating-ui.react-dom-es.js +2 -1
  81. package/dist/floating-ui.react-es.js +2 -1
  82. package/dist/floating-ui.utils.dom-cjs.js +185 -0
  83. package/dist/floating-ui.utils.dom-es.js +165 -0
  84. package/dist/index.cjs +3 -0
  85. package/dist/index.esm-cjs.js +0 -183
  86. package/dist/index.esm-es.js +1 -165
  87. package/dist/index.mjs +3 -0
  88. package/dist/primitives/BottomSheet/index.cjs +3 -1
  89. package/dist/primitives/BottomSheet/index.mjs +3 -1
  90. package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +20 -0
  91. package/dist/primitives/InputNumberExperimental/index.cjs +22 -0
  92. package/dist/primitives/InputNumberExperimental/index.d.ts +2 -0
  93. package/dist/primitives/InputNumberExperimental/index.mjs +16 -0
  94. package/dist/primitives/InputNumberExperimental/types.d.ts +147 -0
  95. package/dist/primitives/index.cjs +9 -1
  96. package/dist/primitives/index.d.ts +2 -0
  97. package/dist/primitives/index.mjs +8 -1
  98. package/dist/styles.css +499 -0
  99. package/dist/unstyledPrimitives/index.cjs +264 -2039
  100. package/dist/unstyledPrimitives/index.mjs +72 -1847
  101. package/dist/useBaseUiId-cjs.js +275 -0
  102. package/dist/useBaseUiId-es.js +251 -0
  103. package/dist/useValueChanged-cjs.js +820 -0
  104. package/dist/useValueChanged-es.js +736 -0
  105. package/package.json +2 -2
  106. package/rollup.config.mjs +13 -2
@@ -3,7 +3,10 @@
3
3
  var React = require('react');
4
4
  var DrawerRoot = require('./DrawerRoot-cjs.js');
5
5
  var useRenderElement = require('./useRenderElement-cjs.js');
6
+ var useValueChanged = require('./useValueChanged-cjs.js');
7
+ var useBaseUiId = require('./useBaseUiId-cjs.js');
6
8
  var jsxRuntime = require('react/jsx-runtime');
9
+ var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
7
10
  var index_esm = require('./index.esm-cjs.js');
8
11
  var floatingUi_reactDom = require('./floating-ui.react-dom-cjs.js');
9
12
  var ReactDOM = require('react-dom');
@@ -28,242 +31,6 @@ function _interopNamespaceDefault(e) {
28
31
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
29
32
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
30
33
 
31
- let set;
32
- if (process.env.NODE_ENV !== 'production') {
33
- set = new Set();
34
- }
35
- function error(...messages) {
36
- if (process.env.NODE_ENV !== 'production') {
37
- const messageKey = messages.join(' ');
38
- if (!set.has(messageKey)) {
39
- set.add(messageKey);
40
- console.error(`Base UI: ${messageKey}`);
41
- }
42
- }
43
- }
44
-
45
- const CompositeRootContext = /*#__PURE__*/React__namespace.createContext(undefined);
46
- if (process.env.NODE_ENV !== "production") CompositeRootContext.displayName = "CompositeRootContext";
47
- function useCompositeRootContext(optional = false) {
48
- const context = React__namespace.useContext(CompositeRootContext);
49
- if (context === undefined && !optional) {
50
- throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' : useRenderElement.formatErrorMessage(16));
51
- }
52
- return context;
53
- }
54
-
55
- function useFocusableWhenDisabled(parameters) {
56
- const {
57
- focusableWhenDisabled,
58
- disabled,
59
- composite = false,
60
- tabIndex: tabIndexProp = 0,
61
- isNativeButton
62
- } = parameters;
63
- const isFocusableComposite = composite && focusableWhenDisabled !== false;
64
- const isNonFocusableComposite = composite && focusableWhenDisabled === false;
65
-
66
- // we can't explicitly assign `undefined` to any of these props because it
67
- // would otherwise prevent subsequently merged props from setting them
68
- const props = React__namespace.useMemo(() => {
69
- const additionalProps = {
70
- // allow Tabbing away from focusableWhenDisabled elements
71
- onKeyDown(event) {
72
- if (disabled && focusableWhenDisabled && event.key !== 'Tab') {
73
- event.preventDefault();
74
- }
75
- }
76
- };
77
- if (!composite) {
78
- additionalProps.tabIndex = tabIndexProp;
79
- if (!isNativeButton && disabled) {
80
- additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
81
- }
82
- }
83
- if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {
84
- additionalProps['aria-disabled'] = disabled;
85
- }
86
- if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
87
- additionalProps.disabled = disabled;
88
- }
89
- return additionalProps;
90
- }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
91
- return {
92
- props
93
- };
94
- }
95
-
96
- function useButton(parameters = {}) {
97
- const {
98
- disabled = false,
99
- focusableWhenDisabled,
100
- tabIndex = 0,
101
- native: isNativeButton = true,
102
- composite: compositeProp
103
- } = parameters;
104
- const elementRef = React__namespace.useRef(null);
105
- const compositeRootContext = useCompositeRootContext(true);
106
- const isCompositeItem = compositeProp ?? compositeRootContext !== undefined;
107
- const {
108
- props: focusableWhenDisabledProps
109
- } = useFocusableWhenDisabled({
110
- focusableWhenDisabled,
111
- disabled,
112
- composite: isCompositeItem,
113
- tabIndex,
114
- isNativeButton
115
- });
116
- if (process.env.NODE_ENV !== 'production') {
117
- // eslint-disable-next-line react-hooks/rules-of-hooks
118
- React__namespace.useEffect(() => {
119
- if (!elementRef.current) {
120
- return;
121
- }
122
- const isButtonTag = isButtonElement(elementRef.current);
123
- if (isNativeButton) {
124
- if (!isButtonTag) {
125
- const ownerStackMessage = DrawerRoot.SafeReact.captureOwnerStack?.() || '';
126
- const message = 'A component that acts as a button expected a native <button> because the ' + '`nativeButton` prop is true. Rendering a non-<button> removes native button ' + 'semantics, which can impact forms and accessibility. Use a real <button> in the ' + '`render` prop, or set `nativeButton` to `false`.';
127
- error(`${message}${ownerStackMessage}`);
128
- }
129
- } else if (isButtonTag) {
130
- const ownerStackMessage = DrawerRoot.SafeReact.captureOwnerStack?.() || '';
131
- const message = 'A component that acts as a button expected a non-<button> because the `nativeButton` ' + 'prop is false. Rendering a <button> keeps native behavior while Base UI applies ' + 'non-native attributes and handlers, which can add unintended extra attributes (such ' + 'as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set ' + '`nativeButton` to `true`.';
132
- error(`${message}${ownerStackMessage}`);
133
- }
134
- }, [isNativeButton]);
135
- }
136
-
137
- // handles a disabled composite button rendering another button, e.g.
138
- // <Toolbar.Button disabled render={<Menu.Trigger />} />
139
- // the `disabled` prop needs to pass through 2 `useButton`s then finally
140
- // delete the `disabled` attribute from DOM
141
- const updateDisabled = React__namespace.useCallback(() => {
142
- const element = elementRef.current;
143
- if (!isButtonElement(element)) {
144
- return;
145
- }
146
- if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === undefined && element.disabled) {
147
- element.disabled = false;
148
- }
149
- }, [disabled, focusableWhenDisabledProps.disabled, isCompositeItem]);
150
- DrawerRoot.useIsoLayoutEffect(updateDisabled, [updateDisabled]);
151
- const getButtonProps = React__namespace.useCallback((externalProps = {}) => {
152
- const {
153
- onClick: externalOnClick,
154
- onMouseDown: externalOnMouseDown,
155
- onKeyUp: externalOnKeyUp,
156
- onKeyDown: externalOnKeyDown,
157
- onPointerDown: externalOnPointerDown,
158
- ...otherExternalProps
159
- } = externalProps;
160
- const type = isNativeButton ? 'button' : undefined;
161
- return useRenderElement.mergeProps({
162
- type,
163
- onClick(event) {
164
- if (disabled) {
165
- event.preventDefault();
166
- return;
167
- }
168
- externalOnClick?.(event);
169
- },
170
- onMouseDown(event) {
171
- if (!disabled) {
172
- externalOnMouseDown?.(event);
173
- }
174
- },
175
- onKeyDown(event) {
176
- if (disabled) {
177
- return;
178
- }
179
- useRenderElement.makeEventPreventable(event);
180
- externalOnKeyDown?.(event);
181
- if (event.baseUIHandlerPrevented) {
182
- return;
183
- }
184
- const isCurrentTarget = event.target === event.currentTarget;
185
- const currentTarget = event.currentTarget;
186
- const isButton = isButtonElement(currentTarget);
187
- const isLink = !isNativeButton && isValidLinkElement(currentTarget);
188
- const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
189
- const isEnterKey = event.key === 'Enter';
190
- const isSpaceKey = event.key === ' ';
191
- const role = currentTarget.getAttribute('role');
192
- const isTextNavigationRole = role?.startsWith('menuitem') || role === 'option' || role === 'gridcell';
193
- if (isCurrentTarget && isCompositeItem && isSpaceKey) {
194
- if (event.defaultPrevented && isTextNavigationRole) {
195
- return;
196
- }
197
- event.preventDefault();
198
- if (isLink || isNativeButton && isButton) {
199
- currentTarget.click();
200
- event.preventBaseUIHandler();
201
- } else if (shouldClick) {
202
- externalOnClick?.(event);
203
- event.preventBaseUIHandler();
204
- }
205
- return;
206
- }
207
-
208
- // Keyboard accessibility for native and non-native elements.
209
- if (shouldClick) {
210
- if (!isNativeButton && (isSpaceKey || isEnterKey)) {
211
- event.preventDefault();
212
- }
213
- if (!isNativeButton && isEnterKey) {
214
- externalOnClick?.(event);
215
- }
216
- }
217
- },
218
- onKeyUp(event) {
219
- if (disabled) {
220
- return;
221
- }
222
-
223
- // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
224
- // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0
225
- useRenderElement.makeEventPreventable(event);
226
- externalOnKeyUp?.(event);
227
- if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === ' ') {
228
- event.preventDefault();
229
- return;
230
- }
231
- if (event.baseUIHandlerPrevented) {
232
- return;
233
- }
234
-
235
- // Keyboard accessibility for non interactive elements
236
- if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === ' ') {
237
- externalOnClick?.(event);
238
- }
239
- },
240
- onPointerDown(event) {
241
- if (disabled) {
242
- event.preventDefault();
243
- return;
244
- }
245
- externalOnPointerDown?.(event);
246
- }
247
- }, !isNativeButton ? {
248
- role: 'button'
249
- } : undefined, focusableWhenDisabledProps, otherExternalProps);
250
- }, [disabled, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
251
- const buttonRef = DrawerRoot.useStableCallback(element => {
252
- elementRef.current = element;
253
- updateDisabled();
254
- });
255
- return {
256
- getButtonProps,
257
- buttonRef
258
- };
259
- }
260
- function isButtonElement(elem) {
261
- return index_esm.isHTMLElement(elem) && elem.tagName === 'BUTTON';
262
- }
263
- function isValidLinkElement(elem) {
264
- return Boolean(elem?.tagName === 'A' && elem?.href);
265
- }
266
-
267
34
  /**
268
35
  * A button that closes the dialog.
269
36
  * Renders a `<button>` element.
@@ -284,13 +51,13 @@ const DialogClose = /*#__PURE__*/React__namespace.forwardRef(function DialogClos
284
51
  const open = store.useState('open');
285
52
  function handleClick(event) {
286
53
  if (open) {
287
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.closePress, event.nativeEvent));
54
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.closePress, event.nativeEvent));
288
55
  }
289
56
  }
290
57
  const {
291
58
  getButtonProps,
292
59
  buttonRef
293
- } = useButton({
60
+ } = useBaseUiId.useButton({
294
61
  disabled,
295
62
  native: nativeButton
296
63
  });
@@ -315,17 +82,8 @@ if (process.env.NODE_ENV !== "production") DialogClose.displayName = "DialogClos
315
82
  */
316
83
  const DrawerClose = DialogClose;
317
84
 
318
- /**
319
- * Wraps `useId` and prefixes generated `id`s with `base-ui-`
320
- * @param {string | undefined} idOverride overrides the generated id when provided
321
- * @returns {string | undefined}
322
- */
323
- function useBaseUiId(idOverride) {
324
- return DrawerRoot.useId(idOverride, 'base-ui');
325
- }
326
-
327
85
  function resolveValue(value, pointerType) {
328
- if (pointerType != null && !DrawerRoot.isMouseLikePointerType(pointerType)) {
86
+ if (pointerType != null && !useValueChanged.isMouseLikePointerType(pointerType)) {
329
87
  return 0;
330
88
  }
331
89
  if (typeof value === 'function') {
@@ -364,11 +122,11 @@ function useClick(context, props = {}) {
364
122
  ignoreMouse = false,
365
123
  stickIfOpen = true,
366
124
  touchOpenDelay = 0,
367
- reason = DrawerRoot.triggerPress
125
+ reason = useValueChanged.triggerPress
368
126
  } = props;
369
127
  const pointerTypeRef = React__namespace.useRef(undefined);
370
- const frame = DrawerRoot.useAnimationFrame();
371
- const touchOpenTimeout = DrawerRoot.useTimeout();
128
+ const frame = useValueChanged.useAnimationFrame();
129
+ const touchOpenTimeout = useValueChanged.useTimeout();
372
130
  const reference = React__namespace.useMemo(() => ({
373
131
  onPointerDown(event) {
374
132
  pointerTypeRef.current = event.pointerType;
@@ -380,7 +138,7 @@ function useClick(context, props = {}) {
380
138
 
381
139
  // Ignore all buttons except for the "main" button.
382
140
  // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
383
- if (event.button !== 0 || eventOption === 'click' || DrawerRoot.isMouseLikePointerType(pointerType, true) && ignoreMouse) {
141
+ if (event.button !== 0 || eventOption === 'click' || useValueChanged.isMouseLikePointerType(pointerType, true) && ignoreMouse) {
384
142
  return;
385
143
  }
386
144
  const openEvent = dataRef.current.openEvent;
@@ -391,7 +149,7 @@ function useClick(context, props = {}) {
391
149
  // Animations sometimes won't run on a typeable element if using a rAF.
392
150
  // Focus is always set on these elements. For touch, we may delay opening.
393
151
  if (DrawerRoot.isTypeableElement(nativeEvent.target)) {
394
- const details = DrawerRoot.createChangeEventDetails(reason, nativeEvent, nativeEvent.target);
152
+ const details = useValueChanged.createChangeEventDetails(reason, nativeEvent, nativeEvent.target);
395
153
  if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {
396
154
  touchOpenTimeout.start(touchOpenDelay, () => {
397
155
  store.setOpen(true, details);
@@ -409,7 +167,7 @@ function useClick(context, props = {}) {
409
167
  // Wait until focus is set on the element. This is an alternative to
410
168
  // `event.preventDefault()` to avoid :focus-visible from appearing when using a pointer.
411
169
  frame.request(() => {
412
- const details = DrawerRoot.createChangeEventDetails(reason, nativeEvent, eventCurrentTarget);
170
+ const details = useValueChanged.createChangeEventDetails(reason, nativeEvent, eventCurrentTarget);
413
171
  if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {
414
172
  touchOpenTimeout.start(touchOpenDelay, () => {
415
173
  store.setOpen(true, details);
@@ -428,14 +186,14 @@ function useClick(context, props = {}) {
428
186
  pointerTypeRef.current = undefined;
429
187
  return;
430
188
  }
431
- if (DrawerRoot.isMouseLikePointerType(pointerType, true) && ignoreMouse) {
189
+ if (useValueChanged.isMouseLikePointerType(pointerType, true) && ignoreMouse) {
432
190
  return;
433
191
  }
434
192
  const open = store.select('open');
435
193
  const openEvent = dataRef.current.openEvent;
436
194
  const hasClickedOnInactiveTrigger = store.select('domReferenceElement') !== event.currentTarget;
437
- const nextOpen = open && hasClickedOnInactiveTrigger || !(open && toggle && (openEvent && stickIfOpen ? DrawerRoot.isClickLikeEvent(openEvent) : true));
438
- const details = DrawerRoot.createChangeEventDetails(reason, event.nativeEvent, event.currentTarget);
195
+ const nextOpen = open && hasClickedOnInactiveTrigger || !(open && toggle && (openEvent && stickIfOpen ? useValueChanged.isClickLikeEvent(openEvent) : true));
196
+ const details = useValueChanged.createChangeEventDetails(reason, event.nativeEvent, event.currentTarget);
439
197
  if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {
440
198
  touchOpenTimeout.start(touchOpenDelay, () => {
441
199
  store.setOpen(true, details);
@@ -459,11 +217,11 @@ function useFloatingRootContext(options) {
459
217
  onOpenChange,
460
218
  elements = {}
461
219
  } = options;
462
- const floatingId = DrawerRoot.useId();
220
+ const floatingId = useValueChanged.useId();
463
221
  const nested = DrawerRoot.useFloatingParentNodeId() != null;
464
222
  if (process.env.NODE_ENV !== 'production') {
465
223
  const optionDomReference = elements.reference;
466
- if (optionDomReference && !index_esm.isElement(optionDomReference)) {
224
+ if (optionDomReference && !floatingUi_utils_dom.isElement(optionDomReference)) {
467
225
  console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');
468
226
  }
469
227
  }
@@ -477,7 +235,7 @@ function useFloatingRootContext(options) {
477
235
  nested,
478
236
  noEmit: false
479
237
  })).current;
480
- DrawerRoot.useIsoLayoutEffect(() => {
238
+ useValueChanged.useIsoLayoutEffect(() => {
481
239
  const valuesToSync = {
482
240
  open,
483
241
  floatingId
@@ -486,7 +244,7 @@ function useFloatingRootContext(options) {
486
244
  // Only sync elements that are defined to avoid overwriting existing ones
487
245
  if (elements.reference !== undefined) {
488
246
  valuesToSync.referenceElement = elements.reference;
489
- valuesToSync.domReferenceElement = index_esm.isElement(elements.reference) ? elements.reference : null;
247
+ valuesToSync.domReferenceElement = floatingUi_utils_dom.isElement(elements.reference) ? elements.reference : null;
490
248
  }
491
249
  if (elements.floating !== undefined) {
492
250
  valuesToSync.floatingElement = elements.floating;
@@ -518,7 +276,7 @@ function useFloating(options = {}) {
518
276
  const [positionReference, setPositionReferenceRaw] = React__namespace.useState(null);
519
277
  const domReferenceRef = React__namespace.useRef(null);
520
278
  const tree = DrawerRoot.useFloatingTree(externalTree);
521
- DrawerRoot.useIsoLayoutEffect(() => {
279
+ useValueChanged.useIsoLayoutEffect(() => {
522
280
  if (rootContextElements.domReference) {
523
281
  domReferenceRef.current = rootContextElements.domReference;
524
282
  }
@@ -533,7 +291,7 @@ function useFloating(options = {}) {
533
291
  }
534
292
  });
535
293
  const setPositionReference = React__namespace.useCallback(node => {
536
- const computedPositionReference = index_esm.isElement(node) ? {
294
+ const computedPositionReference = floatingUi_utils_dom.isElement(node) ? {
537
295
  getBoundingClientRect: () => node.getBoundingClientRect(),
538
296
  getClientRects: () => node.getClientRects(),
539
297
  contextElement: node
@@ -546,21 +304,21 @@ function useFloating(options = {}) {
546
304
  const [localDomReference, setLocalDomReference] = React__namespace.useState(null);
547
305
  const [localFloatingElement, setLocalFloatingElement] = React__namespace.useState(null);
548
306
  rootContext.useSyncedValue('referenceElement', localDomReference);
549
- rootContext.useSyncedValue('domReferenceElement', index_esm.isElement(localDomReference) ? localDomReference : null);
307
+ rootContext.useSyncedValue('domReferenceElement', floatingUi_utils_dom.isElement(localDomReference) ? localDomReference : null);
550
308
  rootContext.useSyncedValue('floatingElement', localFloatingElement);
551
309
  const setReference = React__namespace.useCallback(node => {
552
- if (index_esm.isElement(node) || node === null) {
310
+ if (floatingUi_utils_dom.isElement(node) || node === null) {
553
311
  domReferenceRef.current = node;
554
312
  setLocalDomReference(node);
555
313
  }
556
314
 
557
315
  // Backwards-compatibility for passing a virtual element to `reference`
558
316
  // after it has set the DOM reference.
559
- if (index_esm.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
317
+ if (floatingUi_utils_dom.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
560
318
  // Don't allow setting virtual elements using the old technique back to
561
319
  // `null` to support `positionReference` + an unstable `reference`
562
320
  // callback ref.
563
- node !== null && !index_esm.isElement(node)) {
321
+ node !== null && !floatingUi_utils_dom.isElement(node)) {
564
322
  position.refs.setReference(node);
565
323
  }
566
324
  }, [position.refs, setLocalDomReference]);
@@ -593,7 +351,7 @@ function useFloating(options = {}) {
593
351
  nodeId,
594
352
  rootStore: rootContext
595
353
  }), [position, refs, elements, nodeId, rootContext, open, floatingId]);
596
- DrawerRoot.useIsoLayoutEffect(() => {
354
+ useValueChanged.useIsoLayoutEffect(() => {
597
355
  rootContext.context.dataRef.current.floatingContext = context;
598
356
  const node = tree?.nodesRef.current.find(n => n.id === nodeId);
599
357
  if (node) {
@@ -609,7 +367,7 @@ function useFloating(options = {}) {
609
367
  }), [position, refs, elements, context, rootContext]);
610
368
  }
611
369
 
612
- const isMacSafari = DrawerRoot.isMac && DrawerRoot.isSafari;
370
+ const isMacSafari = useValueChanged.isMac && useValueChanged.isSafari;
613
371
  /**
614
372
  * Opens the floating element while the reference element has focus, like CSS
615
373
  * `:focus`.
@@ -628,21 +386,21 @@ function useFocus(context, props = {}) {
628
386
  const blockFocusRef = React__namespace.useRef(false);
629
387
  // Track which reference should be blocked from re-opening after Escape/press dismissal.
630
388
  const blockedReferenceRef = React__namespace.useRef(null);
631
- const timeout = DrawerRoot.useTimeout();
389
+ const timeout = useValueChanged.useTimeout();
632
390
  const keyboardModalityRef = React__namespace.useRef(true);
633
391
  React__namespace.useEffect(() => {
634
392
  const domReference = store.select('domReferenceElement');
635
393
  if (!enabled) {
636
394
  return undefined;
637
395
  }
638
- const win = index_esm.getWindow(domReference);
396
+ const win = floatingUi_utils_dom.getWindow(domReference);
639
397
 
640
398
  // If the reference was focused and the user left the tab/window, and the
641
399
  // floating element was not open, the focus should be blocked when they
642
400
  // return to the tab/window.
643
401
  function onBlur() {
644
402
  const currentDomReference = store.select('domReferenceElement');
645
- if (!store.select('open') && index_esm.isHTMLElement(currentDomReference) && currentDomReference === DrawerRoot.activeElement(DrawerRoot.ownerDocument(currentDomReference))) {
403
+ if (!store.select('open') && floatingUi_utils_dom.isHTMLElement(currentDomReference) && currentDomReference === DrawerRoot.activeElement(useValueChanged.ownerDocument(currentDomReference))) {
646
404
  blockFocusRef.current = true;
647
405
  }
648
406
  }
@@ -670,9 +428,9 @@ function useFocus(context, props = {}) {
670
428
  return undefined;
671
429
  }
672
430
  function onOpenChangeLocal(details) {
673
- if (details.reason === DrawerRoot.triggerPress || details.reason === DrawerRoot.escapeKey) {
431
+ if (details.reason === useValueChanged.triggerPress || details.reason === useValueChanged.escapeKey) {
674
432
  const referenceElement = store.select('domReferenceElement');
675
- if (index_esm.isElement(referenceElement)) {
433
+ if (floatingUi_utils_dom.isElement(referenceElement)) {
676
434
  blockedReferenceRef.current = referenceElement;
677
435
  blockFocusRef.current = true;
678
436
  }
@@ -698,7 +456,7 @@ function useFocus(context, props = {}) {
698
456
  blockedReferenceRef.current = null;
699
457
  }
700
458
  const target = DrawerRoot.getTarget(event.nativeEvent);
701
- if (index_esm.isElement(target)) {
459
+ if (floatingUi_utils_dom.isElement(target)) {
702
460
  // Safari fails to match `:focus-visible` if focus was initially
703
461
  // outside the document.
704
462
  if (isMacSafari && !event.relatedTarget) {
@@ -716,14 +474,14 @@ function useFocus(context, props = {}) {
716
474
  } = event;
717
475
  const delayValue = typeof delay === 'function' ? delay() : delay;
718
476
  if (store.select('open') && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === undefined) {
719
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerFocus, nativeEvent, currentTarget));
477
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.triggerFocus, nativeEvent, currentTarget));
720
478
  return;
721
479
  }
722
480
  timeout.start(delayValue, () => {
723
481
  if (blockFocusRef.current) {
724
482
  return;
725
483
  }
726
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerFocus, nativeEvent, currentTarget));
484
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.triggerFocus, nativeEvent, currentTarget));
727
485
  });
728
486
  },
729
487
  onBlur(event) {
@@ -734,7 +492,7 @@ function useFocus(context, props = {}) {
734
492
 
735
493
  // Hit the non-modal focus management portal guard. Focus will be
736
494
  // moved into the floating element immediately after.
737
- const movedToFocusGuard = index_esm.isElement(relatedTarget) && relatedTarget.hasAttribute(DrawerRoot.createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';
495
+ const movedToFocusGuard = floatingUi_utils_dom.isElement(relatedTarget) && relatedTarget.hasAttribute(DrawerRoot.createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';
738
496
 
739
497
  // Wait for the window blur listener to fire.
740
498
  timeout.start(0, () => {
@@ -764,7 +522,7 @@ function useFocus(context, props = {}) {
764
522
  if (DrawerRoot.isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) {
765
523
  return;
766
524
  }
767
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerFocus, nativeEvent));
525
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.triggerFocus, nativeEvent));
768
526
  });
769
527
  }
770
528
  }), [dataRef, store, timeout, delay]);
@@ -789,8 +547,8 @@ class HoverInteraction {
789
547
  this.pointerEventsReferenceElement = null;
790
548
  this.pointerEventsFloatingElement = null;
791
549
  this.restTimeoutPending = false;
792
- this.openChangeTimeout = new DrawerRoot.Timeout();
793
- this.restTimeout = new DrawerRoot.Timeout();
550
+ this.openChangeTimeout = new useValueChanged.Timeout();
551
+ this.restTimeout = new useValueChanged.Timeout();
794
552
  this.handleCloseOptions = undefined;
795
553
  }
796
554
  static create() {
@@ -837,7 +595,7 @@ function useHoverInteractionSharedState(store) {
837
595
  if (!data.hoverInteractionState) {
838
596
  data.hoverInteractionState = instance;
839
597
  }
840
- DrawerRoot.useOnMount(data.hoverInteractionState.disposeEffect);
598
+ useValueChanged.useOnMount(data.hoverInteractionState.disposeEffect);
841
599
  return data.hoverInteractionState;
842
600
  }
843
601
 
@@ -859,20 +617,20 @@ function useHoverFloatingInteraction(context, parameters = {}) {
859
617
  const instance = useHoverInteractionSharedState(store);
860
618
  const tree = DrawerRoot.useFloatingTree();
861
619
  const parentId = DrawerRoot.useFloatingParentNodeId();
862
- const isClickLikeOpenEvent$1 = DrawerRoot.useStableCallback(() => {
620
+ const isClickLikeOpenEvent$1 = useValueChanged.useStableCallback(() => {
863
621
  return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
864
622
  });
865
- const isHoverOpen = DrawerRoot.useStableCallback(() => {
623
+ const isHoverOpen = useValueChanged.useStableCallback(() => {
866
624
  const type = dataRef.current.openEvent?.type;
867
625
  return type?.includes('mouse') && type !== 'mousedown';
868
626
  });
869
- const isRelatedTargetInsideEnabledTrigger = DrawerRoot.useStableCallback(target => {
627
+ const isRelatedTargetInsideEnabledTrigger = useValueChanged.useStableCallback(target => {
870
628
  return DrawerRoot.isTargetInsideEnabledTrigger(target, store.context.triggerElements);
871
629
  });
872
630
  const closeWithDelay = React__namespace.useCallback(event => {
873
631
  const closeDelay = getDelay(closeDelayProp, 'close', instance.pointerType);
874
632
  const close = () => {
875
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event));
633
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event));
876
634
  tree?.events.emit('floating.closed', event);
877
635
  };
878
636
  if (closeDelay) {
@@ -882,10 +640,10 @@ function useHoverFloatingInteraction(context, parameters = {}) {
882
640
  close();
883
641
  }
884
642
  }, [closeDelayProp, store, instance, tree]);
885
- const clearPointerEvents = DrawerRoot.useStableCallback(() => {
643
+ const clearPointerEvents = useValueChanged.useStableCallback(() => {
886
644
  clearSafePolygonPointerEventsMutation(instance);
887
645
  });
888
- const handleInteractInside = DrawerRoot.useStableCallback(event => {
646
+ const handleInteractInside = useValueChanged.useStableCallback(event => {
889
647
  const target = DrawerRoot.getTarget(event);
890
648
  if (!isInteractiveElement(target)) {
891
649
  instance.interactedInside = false;
@@ -893,7 +651,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
893
651
  }
894
652
  instance.interactedInside = target?.closest('[aria-haspopup]') != null;
895
653
  });
896
- DrawerRoot.useIsoLayoutEffect(() => {
654
+ useValueChanged.useIsoLayoutEffect(() => {
897
655
  if (!open) {
898
656
  instance.pointerType = undefined;
899
657
  instance.restTimeoutPending = false;
@@ -904,14 +662,14 @@ function useHoverFloatingInteraction(context, parameters = {}) {
904
662
  React__namespace.useEffect(() => {
905
663
  return clearPointerEvents;
906
664
  }, [clearPointerEvents]);
907
- DrawerRoot.useIsoLayoutEffect(() => {
665
+ useValueChanged.useIsoLayoutEffect(() => {
908
666
  if (!enabled) {
909
667
  return undefined;
910
668
  }
911
- if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && index_esm.isElement(domReferenceElement) && floatingElement) {
669
+ if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && floatingUi_utils_dom.isElement(domReferenceElement) && floatingElement) {
912
670
  const ref = domReferenceElement;
913
671
  const floatingEl = floatingElement;
914
- const doc = DrawerRoot.ownerDocument(floatingElement);
672
+ const doc = useValueChanged.ownerDocument(floatingElement);
915
673
  const parentFloating = tree?.nodesRef.current.find(node => node.id === parentId)?.context?.elements.floating;
916
674
  if (parentFloating) {
917
675
  parentFloating.style.pointerEvents = '';
@@ -928,7 +686,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
928
686
  }
929
687
  return undefined;
930
688
  }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
931
- const childClosedTimeout = DrawerRoot.useTimeout();
689
+ const childClosedTimeout = useValueChanged.useTimeout();
932
690
  React__namespace.useEffect(() => {
933
691
  if (!enabled) {
934
692
  return undefined;
@@ -967,7 +725,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
967
725
  // Allow the mouseenter event to fire in case child was closed because mouse moved into parent.
968
726
  childClosedTimeout.start(0, () => {
969
727
  tree.events.off('floating.closed', onNodeClosed);
970
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event));
728
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event));
971
729
  tree.events.emit('floating.closed', event);
972
730
  });
973
731
  }
@@ -1016,21 +774,21 @@ function useHoverReferenceInteraction(context, props = {}) {
1016
774
  } = props;
1017
775
  const tree = DrawerRoot.useFloatingTree(externalTree);
1018
776
  const instance = useHoverInteractionSharedState(store);
1019
- const handleCloseRef = DrawerRoot.useValueAsRef(handleClose);
1020
- const delayRef = DrawerRoot.useValueAsRef(delay);
1021
- const restMsRef = DrawerRoot.useValueAsRef(restMs);
1022
- const enabledRef = DrawerRoot.useValueAsRef(enabled);
777
+ const handleCloseRef = useValueChanged.useValueAsRef(handleClose);
778
+ const delayRef = useValueChanged.useValueAsRef(delay);
779
+ const restMsRef = useValueChanged.useValueAsRef(restMs);
780
+ const enabledRef = useValueChanged.useValueAsRef(enabled);
1023
781
  if (isActiveTrigger) {
1024
782
  // eslint-disable-next-line no-underscore-dangle
1025
783
  instance.handleCloseOptions = handleCloseRef.current?.__options;
1026
784
  }
1027
- const isClickLikeOpenEvent$1 = DrawerRoot.useStableCallback(() => {
785
+ const isClickLikeOpenEvent$1 = useValueChanged.useStableCallback(() => {
1028
786
  return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
1029
787
  });
1030
- const isRelatedTargetInsideEnabledTrigger = DrawerRoot.useStableCallback(target => {
788
+ const isRelatedTargetInsideEnabledTrigger = useValueChanged.useStableCallback(target => {
1031
789
  return DrawerRoot.isTargetInsideEnabledTrigger(target, store.context.triggerElements);
1032
790
  });
1033
- const isOverInactiveTrigger = DrawerRoot.useStableCallback((currentDomReference, currentTarget, target) => {
791
+ const isOverInactiveTrigger = useValueChanged.useStableCallback((currentDomReference, currentTarget, target) => {
1034
792
  const allTriggers = store.context.triggerElements;
1035
793
 
1036
794
  // Fast path for normal usage where handlers are attached directly to triggers.
@@ -1039,7 +797,7 @@ function useHoverReferenceInteraction(context, props = {}) {
1039
797
  }
1040
798
 
1041
799
  // Fallback for delegated/wrapper usage where currentTarget may be outside the trigger map.
1042
- if (!index_esm.isElement(target)) {
800
+ if (!floatingUi_utils_dom.isElement(target)) {
1043
801
  return false;
1044
802
  }
1045
803
  const targetElement = target;
@@ -1049,25 +807,25 @@ function useHoverReferenceInteraction(context, props = {}) {
1049
807
  const closeDelay = getDelay(delayRef.current, 'close', instance.pointerType);
1050
808
  if (closeDelay) {
1051
809
  instance.openChangeTimeout.start(closeDelay, () => {
1052
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event));
810
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event));
1053
811
  tree?.events.emit('floating.closed', event);
1054
812
  });
1055
813
  } else if (runElseBranch) {
1056
814
  instance.openChangeTimeout.clear();
1057
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event));
815
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event));
1058
816
  tree?.events.emit('floating.closed', event);
1059
817
  }
1060
818
  }, [delayRef, store, instance, tree]);
1061
- const cleanupMouseMoveHandler = DrawerRoot.useStableCallback(() => {
819
+ const cleanupMouseMoveHandler = useValueChanged.useStableCallback(() => {
1062
820
  if (!instance.handler) {
1063
821
  return;
1064
822
  }
1065
- const doc = DrawerRoot.ownerDocument(store.select('domReferenceElement'));
823
+ const doc = useValueChanged.ownerDocument(store.select('domReferenceElement'));
1066
824
  doc.removeEventListener('mousemove', instance.handler);
1067
825
  instance.handler = undefined;
1068
826
  });
1069
827
  React__namespace.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
1070
- const clearPointerEvents = DrawerRoot.useStableCallback(() => {
828
+ const clearPointerEvents = useValueChanged.useStableCallback(() => {
1071
829
  clearSafePolygonPointerEventsMutation(instance);
1072
830
  });
1073
831
 
@@ -1096,13 +854,13 @@ function useHoverReferenceInteraction(context, props = {}) {
1096
854
  return undefined;
1097
855
  }
1098
856
  const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select('domReferenceElement') : null);
1099
- if (!index_esm.isElement(trigger)) {
857
+ if (!floatingUi_utils_dom.isElement(trigger)) {
1100
858
  return undefined;
1101
859
  }
1102
860
  function onMouseEnter(event) {
1103
861
  instance.openChangeTimeout.clear();
1104
862
  instance.blockMouseMove = false;
1105
- if (mouseOnly && !DrawerRoot.isMouseLikePointerType(instance.pointerType)) {
863
+ if (mouseOnly && !useValueChanged.isMouseLikePointerType(instance.pointerType)) {
1106
864
  return;
1107
865
  }
1108
866
 
@@ -1121,15 +879,15 @@ function useHoverReferenceInteraction(context, props = {}) {
1121
879
 
1122
880
  // When moving between triggers while already open, open immediately without delay
1123
881
  if (isOverInactive && isOpen) {
1124
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event, triggerNode));
882
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event, triggerNode));
1125
883
  } else if (openDelay) {
1126
884
  instance.openChangeTimeout.start(openDelay, () => {
1127
885
  if (shouldOpen) {
1128
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event, triggerNode));
886
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event, triggerNode));
1129
887
  }
1130
888
  });
1131
889
  } else if (shouldOpen) {
1132
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, event, triggerNode));
890
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, event, triggerNode));
1133
891
  }
1134
892
  }
1135
893
  function onMouseLeave(event) {
@@ -1139,7 +897,7 @@ function useHoverReferenceInteraction(context, props = {}) {
1139
897
  }
1140
898
  cleanupMouseMoveHandler();
1141
899
  const domReferenceElement = store.select('domReferenceElement');
1142
- const doc = DrawerRoot.ownerDocument(domReferenceElement);
900
+ const doc = useValueChanged.ownerDocument(domReferenceElement);
1143
901
  instance.restTimeout.clear();
1144
902
  instance.restTimeoutPending = false;
1145
903
  const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
@@ -1207,7 +965,7 @@ function useHoverReferenceInteraction(context, props = {}) {
1207
965
  const currentDomReference = store.select('domReferenceElement');
1208
966
  const currentOpen = store.select('open');
1209
967
  const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
1210
- if (mouseOnly && !DrawerRoot.isMouseLikePointerType(instance.pointerType)) {
968
+ if (mouseOnly && !useValueChanged.isMouseLikePointerType(instance.pointerType)) {
1211
969
  return;
1212
970
  }
1213
971
  const restMsValue = getRestMs(restMsRef.current);
@@ -1228,7 +986,7 @@ function useHoverReferenceInteraction(context, props = {}) {
1228
986
  }
1229
987
  const latestOpen = store.select('open');
1230
988
  if (!instance.blockMouseMove && (!latestOpen || isOverInactive)) {
1231
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.triggerHover, nativeEvent, trigger));
989
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.triggerHover, nativeEvent, trigger));
1232
990
  }
1233
991
  }
1234
992
  if (instance.pointerType === 'touch') {
@@ -1327,10 +1085,10 @@ function useListNavigation(context, props) {
1327
1085
  }
1328
1086
  }
1329
1087
  const floatingFocusElement = DrawerRoot.getFloatingFocusElement(floatingElement);
1330
- const floatingFocusElementRef = DrawerRoot.useValueAsRef(floatingFocusElement);
1088
+ const floatingFocusElementRef = useValueChanged.useValueAsRef(floatingFocusElement);
1331
1089
  const parentId = DrawerRoot.useFloatingParentNodeId();
1332
1090
  const tree = DrawerRoot.useFloatingTree(externalTree);
1333
- DrawerRoot.useIsoLayoutEffect(() => {
1091
+ useValueChanged.useIsoLayoutEffect(() => {
1334
1092
  dataRef.current.orientation = orientation;
1335
1093
  }, [dataRef, orientation]);
1336
1094
  const typeableComboboxReference = DrawerRoot.isTypeableCombobox(domReferenceElement);
@@ -1338,7 +1096,7 @@ function useListNavigation(context, props) {
1338
1096
  const indexRef = React__namespace.useRef(selectedIndex ?? -1);
1339
1097
  const keyRef = React__namespace.useRef(null);
1340
1098
  const isPointerModalityRef = React__namespace.useRef(true);
1341
- const onNavigate = DrawerRoot.useStableCallback(event => {
1099
+ const onNavigate = useValueChanged.useStableCallback(event => {
1342
1100
  onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);
1343
1101
  });
1344
1102
  const previousOnNavigateRef = React__namespace.useRef(onNavigate);
@@ -1346,11 +1104,11 @@ function useListNavigation(context, props) {
1346
1104
  const previousOpenRef = React__namespace.useRef(open);
1347
1105
  const forceSyncFocusRef = React__namespace.useRef(false);
1348
1106
  const forceScrollIntoViewRef = React__namespace.useRef(false);
1349
- const disabledIndicesRef = DrawerRoot.useValueAsRef(disabledIndices);
1350
- const latestOpenRef = DrawerRoot.useValueAsRef(open);
1351
- const selectedIndexRef = DrawerRoot.useValueAsRef(selectedIndex);
1352
- const resetOnPointerLeaveRef = DrawerRoot.useValueAsRef(resetOnPointerLeave);
1353
- const focusItem = DrawerRoot.useStableCallback(() => {
1107
+ const disabledIndicesRef = useValueChanged.useValueAsRef(disabledIndices);
1108
+ const latestOpenRef = useValueChanged.useValueAsRef(open);
1109
+ const selectedIndexRef = useValueChanged.useValueAsRef(selectedIndex);
1110
+ const resetOnPointerLeaveRef = useValueChanged.useValueAsRef(resetOnPointerLeave);
1111
+ const focusItem = useValueChanged.useStableCallback(() => {
1354
1112
  function runFocus(item) {
1355
1113
  if (virtual) {
1356
1114
  tree?.events.emit('virtualfocus', item);
@@ -1391,7 +1149,7 @@ function useListNavigation(context, props) {
1391
1149
 
1392
1150
  // Sync `selectedIndex` to be the `activeIndex` upon opening the floating
1393
1151
  // element. Also, reset `activeIndex` upon closing the floating element.
1394
- DrawerRoot.useIsoLayoutEffect(() => {
1152
+ useValueChanged.useIsoLayoutEffect(() => {
1395
1153
  if (!enabled) {
1396
1154
  return;
1397
1155
  }
@@ -1414,7 +1172,7 @@ function useListNavigation(context, props) {
1414
1172
 
1415
1173
  // Sync `activeIndex` to be the focused item while the floating element is
1416
1174
  // open.
1417
- DrawerRoot.useIsoLayoutEffect(() => {
1175
+ useValueChanged.useIsoLayoutEffect(() => {
1418
1176
  if (!enabled) {
1419
1177
  return;
1420
1178
  }
@@ -1468,13 +1226,13 @@ function useListNavigation(context, props) {
1468
1226
 
1469
1227
  // Ensure the parent floating element has focus when a nested child closes
1470
1228
  // to allow arrow key navigation to work after the pointer leaves the child.
1471
- DrawerRoot.useIsoLayoutEffect(() => {
1229
+ useValueChanged.useIsoLayoutEffect(() => {
1472
1230
  if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {
1473
1231
  return;
1474
1232
  }
1475
1233
  const nodes = tree.nodesRef.current;
1476
1234
  const parent = nodes.find(node => node.id === parentId)?.context?.elements.floating;
1477
- const activeEl = DrawerRoot.activeElement(DrawerRoot.ownerDocument(floatingElement));
1235
+ const activeEl = DrawerRoot.activeElement(useValueChanged.ownerDocument(floatingElement));
1478
1236
  const treeContainsActiveEl = nodes.some(node => node.context && DrawerRoot.contains(node.context.elements.floating, activeEl));
1479
1237
  if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {
1480
1238
  parent.focus({
@@ -1482,12 +1240,12 @@ function useListNavigation(context, props) {
1482
1240
  });
1483
1241
  }
1484
1242
  }, [enabled, floatingElement, tree, parentId, virtual]);
1485
- DrawerRoot.useIsoLayoutEffect(() => {
1243
+ useValueChanged.useIsoLayoutEffect(() => {
1486
1244
  previousOnNavigateRef.current = onNavigate;
1487
1245
  previousOpenRef.current = open;
1488
1246
  previousMountedRef.current = !!floatingElement;
1489
1247
  });
1490
- DrawerRoot.useIsoLayoutEffect(() => {
1248
+ useValueChanged.useIsoLayoutEffect(() => {
1491
1249
  if (!open) {
1492
1250
  keyRef.current = null;
1493
1251
  focusItemOnOpenRef.current = focusItemOnOpen;
@@ -1542,7 +1300,7 @@ function useListNavigation(context, props) {
1542
1300
  onNavigate(event);
1543
1301
  if (!virtual) {
1544
1302
  const floatingFocusEl = floatingFocusElementRef.current;
1545
- const activeEl = DrawerRoot.activeElement(DrawerRoot.ownerDocument(floatingFocusEl));
1303
+ const activeEl = DrawerRoot.activeElement(useValueChanged.ownerDocument(floatingFocusEl));
1546
1304
  if (floatingFocusEl && DrawerRoot.contains(floatingFocusEl, activeEl)) {
1547
1305
  floatingFocusEl.focus({
1548
1306
  preventScroll: true
@@ -1556,7 +1314,7 @@ function useListNavigation(context, props) {
1556
1314
  const getParentOrientation = React__namespace.useCallback(() => {
1557
1315
  return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;
1558
1316
  }, [parentId, tree, parentOrientation]);
1559
- const commonOnKeyDown = DrawerRoot.useStableCallback(event => {
1317
+ const commonOnKeyDown = useValueChanged.useStableCallback(event => {
1560
1318
  isPointerModalityRef.current = false;
1561
1319
  forceSyncFocusRef.current = true;
1562
1320
 
@@ -1578,10 +1336,10 @@ function useListNavigation(context, props) {
1578
1336
  // If the nested list's close key is also the parent navigation key,
1579
1337
  // let the parent navigate. Otherwise, stop propagating the event.
1580
1338
  if (!isMainOrientationKey(event.key, getParentOrientation())) {
1581
- DrawerRoot.stopEvent(event);
1339
+ useValueChanged.stopEvent(event);
1582
1340
  }
1583
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.listNavigation, event.nativeEvent));
1584
- if (index_esm.isHTMLElement(domReferenceElement)) {
1341
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.listNavigation, event.nativeEvent));
1342
+ if (floatingUi_utils_dom.isHTMLElement(domReferenceElement)) {
1585
1343
  if (virtual) {
1586
1344
  tree?.events.emit('virtualfocus', domReferenceElement);
1587
1345
  } else {
@@ -1595,12 +1353,12 @@ function useListNavigation(context, props) {
1595
1353
  const maxIndex = DrawerRoot.getMaxListIndex(listRef, disabledIndices);
1596
1354
  if (!typeableComboboxReference) {
1597
1355
  if (event.key === 'Home') {
1598
- DrawerRoot.stopEvent(event);
1356
+ useValueChanged.stopEvent(event);
1599
1357
  indexRef.current = minIndex;
1600
1358
  onNavigate(event);
1601
1359
  }
1602
1360
  if (event.key === 'End') {
1603
- DrawerRoot.stopEvent(event);
1361
+ useValueChanged.stopEvent(event);
1604
1362
  indexRef.current = maxIndex;
1605
1363
  onNavigate(event);
1606
1364
  }
@@ -1650,7 +1408,7 @@ function useListNavigation(context, props) {
1650
1408
  }
1651
1409
  }
1652
1410
  if (isMainOrientationKey(event.key, orientation)) {
1653
- DrawerRoot.stopEvent(event);
1411
+ useValueChanged.stopEvent(event);
1654
1412
 
1655
1413
  // Reset the index if no item is focused.
1656
1414
  if (open && !virtual && DrawerRoot.activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {
@@ -1728,9 +1486,9 @@ function useListNavigation(context, props) {
1728
1486
  if (target && !DrawerRoot.contains(floatingFocusElementRef.current, target)) {
1729
1487
  return;
1730
1488
  }
1731
- DrawerRoot.stopEvent(event);
1732
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.focusOut, event.nativeEvent));
1733
- if (index_esm.isHTMLElement(domReferenceElement)) {
1489
+ useValueChanged.stopEvent(event);
1490
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.focusOut, event.nativeEvent));
1491
+ if (floatingUi_utils_dom.isHTMLElement(domReferenceElement)) {
1734
1492
  domReferenceElement.focus();
1735
1493
  }
1736
1494
  return;
@@ -1744,14 +1502,14 @@ function useListNavigation(context, props) {
1744
1502
  }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, orientation, typeableComboboxReference, store, open, virtual, domReferenceElement]);
1745
1503
  const trigger = React__namespace.useMemo(() => {
1746
1504
  function checkVirtualMouse(event) {
1747
- if (focusItemOnOpen === 'auto' && DrawerRoot.isVirtualClick(event.nativeEvent)) {
1505
+ if (focusItemOnOpen === 'auto' && useValueChanged.isVirtualClick(event.nativeEvent)) {
1748
1506
  focusItemOnOpenRef.current = !virtual;
1749
1507
  }
1750
1508
  }
1751
1509
  function checkVirtualPointer(event) {
1752
1510
  // `pointerdown` fires first, reset the state then perform the checks.
1753
1511
  focusItemOnOpenRef.current = focusItemOnOpen;
1754
- if (focusItemOnOpen === 'auto' && DrawerRoot.isVirtualPointerEvent(event.nativeEvent)) {
1512
+ if (focusItemOnOpen === 'auto' && useValueChanged.isVirtualPointerEvent(event.nativeEvent)) {
1755
1513
  focusItemOnOpenRef.current = true;
1756
1514
  }
1757
1515
  }
@@ -1779,12 +1537,12 @@ function useListNavigation(context, props) {
1779
1537
  }
1780
1538
  if (nested) {
1781
1539
  if (isParentCrossOpenKey) {
1782
- DrawerRoot.stopEvent(event);
1540
+ useValueChanged.stopEvent(event);
1783
1541
  if (currentOpen) {
1784
1542
  indexRef.current = DrawerRoot.getMinListIndex(listRef, disabledIndicesRef.current);
1785
1543
  onNavigate(event);
1786
1544
  } else {
1787
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.listNavigation, event.nativeEvent, event.currentTarget));
1545
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.listNavigation, event.nativeEvent, event.currentTarget));
1788
1546
  }
1789
1547
  }
1790
1548
  return undefined;
@@ -1793,9 +1551,9 @@ function useListNavigation(context, props) {
1793
1551
  if (selectedIndexRef.current != null) {
1794
1552
  indexRef.current = selectedIndexRef.current;
1795
1553
  }
1796
- DrawerRoot.stopEvent(event);
1554
+ useValueChanged.stopEvent(event);
1797
1555
  if (!currentOpen && openOnArrowKeyDown) {
1798
- store.setOpen(true, DrawerRoot.createChangeEventDetails(DrawerRoot.listNavigation, event.nativeEvent, event.currentTarget));
1556
+ store.setOpen(true, useValueChanged.createChangeEventDetails(useValueChanged.listNavigation, event.nativeEvent, event.currentTarget));
1799
1557
  } else {
1800
1558
  commonOnKeyDown(event);
1801
1559
  }
@@ -1850,11 +1608,11 @@ function useTypeahead(context, props) {
1850
1608
  resetMs = 750,
1851
1609
  selectedIndex = null
1852
1610
  } = props;
1853
- const timeout = DrawerRoot.useTimeout();
1611
+ const timeout = useValueChanged.useTimeout();
1854
1612
  const stringRef = React__namespace.useRef('');
1855
1613
  const prevIndexRef = React__namespace.useRef(selectedIndex ?? activeIndex ?? -1);
1856
1614
  const matchIndexRef = React__namespace.useRef(null);
1857
- DrawerRoot.useIsoLayoutEffect(() => {
1615
+ useValueChanged.useIsoLayoutEffect(() => {
1858
1616
  if (!open && selectedIndex !== null) {
1859
1617
  return;
1860
1618
  }
@@ -1864,13 +1622,13 @@ function useTypeahead(context, props) {
1864
1622
  stringRef.current = '';
1865
1623
  }
1866
1624
  }, [open, selectedIndex, timeout]);
1867
- DrawerRoot.useIsoLayoutEffect(() => {
1625
+ useValueChanged.useIsoLayoutEffect(() => {
1868
1626
  // Sync arrow key navigation but not typeahead navigation.
1869
1627
  if (open && stringRef.current === '') {
1870
1628
  prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
1871
1629
  }
1872
1630
  }, [open, selectedIndex, activeIndex]);
1873
- const setTypingChange = DrawerRoot.useStableCallback(value => {
1631
+ const setTypingChange = useValueChanged.useStableCallback(value => {
1874
1632
  if (value) {
1875
1633
  if (!dataRef.current.typing) {
1876
1634
  dataRef.current.typing = value;
@@ -1881,7 +1639,7 @@ function useTypeahead(context, props) {
1881
1639
  onTypingChange?.(value);
1882
1640
  }
1883
1641
  });
1884
- const onKeyDown = DrawerRoot.useStableCallback(event => {
1642
+ const onKeyDown = useValueChanged.useStableCallback(event => {
1885
1643
  function isVisible(index) {
1886
1644
  const element = elementsRef?.current[index];
1887
1645
  return !element || DrawerRoot.isElementVisible(element);
@@ -1905,7 +1663,7 @@ function useTypeahead(context, props) {
1905
1663
  const listContent = listRef.current;
1906
1664
  if (stringRef.current.length > 0 && event.key === ' ') {
1907
1665
  // Space should continue the in-progress typeahead session.
1908
- DrawerRoot.stopEvent(event);
1666
+ useValueChanged.stopEvent(event);
1909
1667
  setTypingChange(true);
1910
1668
  }
1911
1669
  if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {
@@ -1921,7 +1679,7 @@ function useTypeahead(context, props) {
1921
1679
  return;
1922
1680
  }
1923
1681
  if (open && event.key !== ' ') {
1924
- DrawerRoot.stopEvent(event);
1682
+ useValueChanged.stopEvent(event);
1925
1683
  setTypingChange(true);
1926
1684
  }
1927
1685
 
@@ -1962,7 +1720,7 @@ function useTypeahead(context, props) {
1962
1720
  setTypingChange(false);
1963
1721
  }
1964
1722
  });
1965
- const onBlur = DrawerRoot.useStableCallback(event => {
1723
+ const onBlur = useValueChanged.useStableCallback(event => {
1966
1724
  const next = event.relatedTarget;
1967
1725
  const currentDomReferenceElement = store.select('domReferenceElement');
1968
1726
  const currentFloatingElement = store.select('floatingElement');
@@ -2039,7 +1797,7 @@ function safePolygon(options = {}) {
2039
1797
  const {
2040
1798
  blockPointerEvents = false
2041
1799
  } = options;
2042
- const timeout = new DrawerRoot.Timeout();
1800
+ const timeout = new useValueChanged.Timeout();
2043
1801
  const fn = ({
2044
1802
  x,
2045
1803
  y,
@@ -2107,7 +1865,7 @@ function safePolygon(options = {}) {
2107
1865
 
2108
1866
  // Prevent overlapping floating element from being stuck in an open-close
2109
1867
  // loop: https://github.com/floating-ui/floating-ui/issues/1910
2110
- if (isLeave && index_esm.isElement(event.relatedTarget) && DrawerRoot.contains(floating, event.relatedTarget)) {
1868
+ if (isLeave && floatingUi_utils_dom.isElement(event.relatedTarget) && DrawerRoot.contains(floating, event.relatedTarget)) {
2111
1869
  return undefined;
2112
1870
  }
2113
1871
  function hasOpenChildNode() {
@@ -2253,7 +2011,7 @@ const DialogTitle = /*#__PURE__*/React__namespace.forwardRef(function DialogTitl
2253
2011
  const {
2254
2012
  store
2255
2013
  } = DrawerRoot.useDialogRootContext();
2256
- const id = useBaseUiId(idProp);
2014
+ const id = useBaseUiId.useBaseUiId(idProp);
2257
2015
  store.useSyncedValueWithCleanup('titleElementId', id);
2258
2016
  return useRenderElement.useRenderElement('h2', componentProps, {
2259
2017
  ref: forwardedRef,
@@ -2286,7 +2044,7 @@ const DialogTrigger = /*#__PURE__*/React__namespace.forwardRef(function DialogTr
2286
2044
  if (!store) {
2287
2045
  throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.' : useRenderElement.formatErrorMessage(79));
2288
2046
  }
2289
- const thisTriggerId = useBaseUiId(idProp);
2047
+ const thisTriggerId = useBaseUiId.useBaseUiId(idProp);
2290
2048
  const floatingContext = store.useState('floatingRootContext');
2291
2049
  const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
2292
2050
  const triggerElementRef = React__namespace.useRef(null);
@@ -2299,7 +2057,7 @@ const DialogTrigger = /*#__PURE__*/React__namespace.forwardRef(function DialogTr
2299
2057
  const {
2300
2058
  getButtonProps,
2301
2059
  buttonRef
2302
- } = useButton({
2060
+ } = useBaseUiId.useButton({
2303
2061
  disabled,
2304
2062
  native: nativeButton
2305
2063
  });
@@ -2416,7 +2174,7 @@ function useMenuItemCommonProps(params) {
2416
2174
  if (closeOnClick) {
2417
2175
  menuEvents.emit('close', {
2418
2176
  domEvent: event,
2419
- reason: DrawerRoot.itemPress
2177
+ reason: useValueChanged.itemPress
2420
2178
  });
2421
2179
  }
2422
2180
  },
@@ -2430,7 +2188,7 @@ function useMenuItemCommonProps(params) {
2430
2188
 
2431
2189
  // On non-macOS platforms, this mouseup belongs to the right-click gesture
2432
2190
  // that opened the context menu, so it must not activate an item.
2433
- if (isContextMenu && !DrawerRoot.isMac && event.button === 2) {
2191
+ if (isContextMenu && !useValueChanged.isMac && event.button === 2) {
2434
2192
  return;
2435
2193
  }
2436
2194
  }
@@ -2464,7 +2222,7 @@ function useMenuItem(params) {
2464
2222
  const {
2465
2223
  getButtonProps,
2466
2224
  buttonRef
2467
- } = useButton({
2225
+ } = useBaseUiId.useButton({
2468
2226
  disabled,
2469
2227
  focusableWhenDisabled: true,
2470
2228
  native: nativeButton,
@@ -2560,7 +2318,7 @@ function useCompositeListItem(params = {}) {
2560
2318
  }
2561
2319
  }
2562
2320
  }, [index, elementsRef, labelsRef, label, textRef]);
2563
- DrawerRoot.useIsoLayoutEffect(() => {
2321
+ useValueChanged.useIsoLayoutEffect(() => {
2564
2322
  if (externalIndex != null) {
2565
2323
  return undefined;
2566
2324
  }
@@ -2573,7 +2331,7 @@ function useCompositeListItem(params = {}) {
2573
2331
  }
2574
2332
  return undefined;
2575
2333
  }, [externalIndex, register, unregister, metadata]);
2576
- DrawerRoot.useIsoLayoutEffect(() => {
2334
+ useValueChanged.useIsoLayoutEffect(() => {
2577
2335
  if (externalIndex != null) {
2578
2336
  return undefined;
2579
2337
  }
@@ -2621,7 +2379,7 @@ const itemMapping = {
2621
2379
  [MenuCheckboxItemDataAttributes.unchecked]: ''
2622
2380
  };
2623
2381
  },
2624
- ...DrawerRoot.transitionStatusMapping
2382
+ ...useValueChanged.transitionStatusMapping
2625
2383
  };
2626
2384
 
2627
2385
  const MenuGroupContext = /*#__PURE__*/React__namespace.createContext(undefined);
@@ -2672,11 +2430,11 @@ const MenuGroupLabel = /*#__PURE__*/React__namespace.forwardRef(function MenuGro
2672
2430
  id: idProp,
2673
2431
  ...elementProps
2674
2432
  } = componentProps;
2675
- const id = useBaseUiId(idProp);
2433
+ const id = useBaseUiId.useBaseUiId(idProp);
2676
2434
  const {
2677
2435
  setLabelId
2678
2436
  } = useMenuGroupRootContext();
2679
- DrawerRoot.useIsoLayoutEffect(() => {
2437
+ useValueChanged.useIsoLayoutEffect(() => {
2680
2438
  setLabelId(id);
2681
2439
  return () => {
2682
2440
  setLabelId(undefined);
@@ -2714,7 +2472,7 @@ const MenuItem = /*#__PURE__*/React__namespace.forwardRef(function MenuItem(comp
2714
2472
  label
2715
2473
  });
2716
2474
  const menuPositionerContext = useMenuPositionerContext(true);
2717
- const id = useBaseUiId(idProp);
2475
+ const id = useBaseUiId.useBaseUiId(idProp);
2718
2476
  const {
2719
2477
  store
2720
2478
  } = useMenuRootContext();
@@ -2766,7 +2524,7 @@ const MenuLinkItem = /*#__PURE__*/React__namespace.forwardRef(function MenuLinkI
2766
2524
  });
2767
2525
  const menuPositionerContext = useMenuPositionerContext(true);
2768
2526
  const nodeId = menuPositionerContext?.nodeId;
2769
- const id = useBaseUiId(idProp);
2527
+ const id = useBaseUiId.useBaseUiId(idProp);
2770
2528
  const {
2771
2529
  store
2772
2530
  } = useMenuRootContext();
@@ -2776,7 +2534,7 @@ const MenuLinkItem = /*#__PURE__*/React__namespace.forwardRef(function MenuLinkI
2776
2534
  const {
2777
2535
  getButtonProps,
2778
2536
  buttonRef
2779
- } = useButton({
2537
+ } = useBaseUiId.useButton({
2780
2538
  native: false,
2781
2539
  composite: true
2782
2540
  });
@@ -2819,7 +2577,7 @@ function getDisabledMountTransitionStyles(transitionStatus) {
2819
2577
 
2820
2578
  const stateAttributesMapping = {
2821
2579
  ...DrawerRoot.popupStateMapping,
2822
- ...DrawerRoot.transitionStatusMapping
2580
+ ...useValueChanged.transitionStatusMapping
2823
2581
  };
2824
2582
 
2825
2583
  /**
@@ -2857,7 +2615,7 @@ const MenuPopup = /*#__PURE__*/React__namespace.forwardRef(function MenuPopup(co
2857
2615
  const closeDelay = store.useState('closeDelay');
2858
2616
  const activeTriggerElement = store.useState('activeTriggerElement');
2859
2617
  const isContextMenu = parent.type === 'context-menu';
2860
- DrawerRoot.useOpenChangeComplete({
2618
+ useValueChanged.useOpenChangeComplete({
2861
2619
  open,
2862
2620
  ref: store.context.popupRef,
2863
2621
  onComplete() {
@@ -2868,7 +2626,7 @@ const MenuPopup = /*#__PURE__*/React__namespace.forwardRef(function MenuPopup(co
2868
2626
  });
2869
2627
  React__namespace.useEffect(() => {
2870
2628
  function handleClose(event) {
2871
- store.setOpen(false, DrawerRoot.createChangeEventDetails(event.reason, event.domEvent));
2629
+ store.setOpen(false, useValueChanged.createChangeEventDetails(event.reason, event.domEvent));
2872
2630
  }
2873
2631
  floatingTreeRoot.events.on('close', handleClose);
2874
2632
  return () => {
@@ -2907,7 +2665,7 @@ const MenuPopup = /*#__PURE__*/React__namespace.forwardRef(function MenuPopup(co
2907
2665
  }]
2908
2666
  });
2909
2667
  let returnFocus = parent.type === undefined || isContextMenu;
2910
- if (triggerElement || parent.type === 'menubar' && lastOpenChangeReason !== DrawerRoot.outsidePress) {
2668
+ if (triggerElement || parent.type === 'menubar' && lastOpenChangeReason !== useValueChanged.outsidePress) {
2911
2669
  returnFocus = true;
2912
2670
  }
2913
2671
  return /*#__PURE__*/jsxRuntime.jsx(DrawerRoot.FloatingFocusManager, {
@@ -3102,7 +2860,7 @@ const adaptiveOrigin = {
3102
2860
  strategy,
3103
2861
  placement
3104
2862
  } = state;
3105
- const win = index_esm.getWindow(floating);
2863
+ const win = floatingUi_utils_dom.getWindow(floating);
3106
2864
  const styles = win.getComputedStyle(floating);
3107
2865
  const hasTransition = styles.transitionDuration !== '0s' && styles.transitionDuration !== '';
3108
2866
  if (!hasTransition) {
@@ -3125,7 +2883,7 @@ const adaptiveOrigin = {
3125
2883
  height: win.visualViewport.height
3126
2884
  };
3127
2885
  } else if (offsetParent === win) {
3128
- const doc = DrawerRoot.ownerDocument(floating);
2886
+ const doc = useValueChanged.ownerDocument(floating);
3129
2887
  offsetDimensions = {
3130
2888
  width: doc.documentElement.clientWidth,
3131
2889
  height: doc.documentElement.clientHeight
@@ -3222,9 +2980,9 @@ function useAnchorPositioning(params) {
3222
2980
  const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';
3223
2981
  const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';
3224
2982
  const anchorFn = typeof anchor === 'function' ? anchor : undefined;
3225
- const anchorFnCallback = DrawerRoot.useStableCallback(anchorFn);
2983
+ const anchorFnCallback = useValueChanged.useStableCallback(anchorFn);
3226
2984
  const anchorDep = anchorFn ? anchorFnCallback : anchor;
3227
- const anchorValueRef = DrawerRoot.useValueAsRef(anchor);
2985
+ const anchorValueRef = useValueChanged.useValueAsRef(anchor);
3228
2986
  const direction = useDirection();
3229
2987
  const isRtl = direction === 'rtl';
3230
2988
  const side = mountSide || {
@@ -3272,8 +3030,8 @@ function useAnchorPositioning(params) {
3272
3030
  const arrowRef = React__namespace.useRef(null);
3273
3031
 
3274
3032
  // Keep these reactive if they're not functions
3275
- const sideOffsetRef = DrawerRoot.useValueAsRef(sideOffset);
3276
- const alignOffsetRef = DrawerRoot.useValueAsRef(alignOffset);
3033
+ const sideOffsetRef = useValueChanged.useValueAsRef(sideOffset);
3034
+ const alignOffsetRef = useValueChanged.useValueAsRef(alignOffset);
3277
3035
  const sideOffsetDep = typeof sideOffset !== 'function' ? sideOffset : 0;
3278
3036
  const alignOffsetDep = typeof alignOffset !== 'function' ? alignOffset : 0;
3279
3037
  const middleware = [floatingUi_reactDom.offset(state => {
@@ -3303,7 +3061,7 @@ function useAnchorPositioning(params) {
3303
3061
  fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
3304
3062
  });
3305
3063
  const shiftMiddleware = shiftDisabled ? null : floatingUi_reactDom.shift(data => {
3306
- const html = DrawerRoot.ownerDocument(data.elements.floating).documentElement;
3064
+ const html = useValueChanged.ownerDocument(data.elements.floating).documentElement;
3307
3065
  return {
3308
3066
  ...commonCollisionProps,
3309
3067
  // Use the Layout Viewport to avoid shifting around when pinch-zooming
@@ -3407,7 +3165,7 @@ function useAnchorPositioning(params) {
3407
3165
  return {};
3408
3166
  }
3409
3167
  }, hide, adaptiveOrigin);
3410
- DrawerRoot.useIsoLayoutEffect(() => {
3168
+ useValueChanged.useIsoLayoutEffect(() => {
3411
3169
  // Ensure positioning doesn't run initially for `keepMounted` elements that
3412
3170
  // aren't initially open.
3413
3171
  if (!mounted && floatingRootContext) {
@@ -3465,7 +3223,7 @@ function useAnchorPositioning(params) {
3465
3223
  return base;
3466
3224
  }, [adaptiveOrigin, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);
3467
3225
  const registeredPositionReferenceRef = React__namespace.useRef(null);
3468
- DrawerRoot.useIsoLayoutEffect(() => {
3226
+ useValueChanged.useIsoLayoutEffect(() => {
3469
3227
  if (!mounted) {
3470
3228
  return;
3471
3229
  }
@@ -3510,7 +3268,7 @@ function useAnchorPositioning(params) {
3510
3268
  * and flips back lazily, not eagerly. Ideal for filtered lists that change
3511
3269
  * the size of the popup dynamically to avoid unwanted flipping when typing.
3512
3270
  */
3513
- DrawerRoot.useIsoLayoutEffect(() => {
3271
+ useValueChanged.useIsoLayoutEffect(() => {
3514
3272
  if (lazyFlip && mounted && isPositioned) {
3515
3273
  setMountSide(renderedSide);
3516
3274
  }
@@ -3552,7 +3310,7 @@ function CompositeList(props) {
3552
3310
  labelsRef,
3553
3311
  onMapChange: onMapChangeProp
3554
3312
  } = props;
3555
- const onMapChange = DrawerRoot.useStableCallback(onMapChangeProp);
3313
+ const onMapChange = useValueChanged.useStableCallback(onMapChangeProp);
3556
3314
  const nextIndexRef = React__namespace.useRef(0);
3557
3315
  const listeners = useRenderElement.useRefWithInit(createListeners).current;
3558
3316
 
@@ -3568,12 +3326,12 @@ function CompositeList(props) {
3568
3326
  // `mapTick` uses a counter rather than objects for low precision-loss risk and better memory efficiency
3569
3327
  const [mapTick, setMapTick] = React__namespace.useState(0);
3570
3328
  const lastTickRef = React__namespace.useRef(mapTick);
3571
- const register = DrawerRoot.useStableCallback((node, metadata) => {
3329
+ const register = useValueChanged.useStableCallback((node, metadata) => {
3572
3330
  map.set(node, metadata ?? null);
3573
3331
  lastTickRef.current += 1;
3574
3332
  setMapTick(lastTickRef.current);
3575
3333
  });
3576
- const unregister = DrawerRoot.useStableCallback(node => {
3334
+ const unregister = useValueChanged.useStableCallback(node => {
3577
3335
  map.delete(node);
3578
3336
  lastTickRef.current += 1;
3579
3337
  setMapTick(lastTickRef.current);
@@ -3592,7 +3350,7 @@ function CompositeList(props) {
3592
3350
  });
3593
3351
  return newMap;
3594
3352
  }, [map, mapTick]);
3595
- DrawerRoot.useIsoLayoutEffect(() => {
3353
+ useValueChanged.useIsoLayoutEffect(() => {
3596
3354
  if (typeof MutationObserver !== 'function' || sortedMap.size === 0) {
3597
3355
  return undefined;
3598
3356
  }
@@ -3619,7 +3377,7 @@ function CompositeList(props) {
3619
3377
  mutationObserver.disconnect();
3620
3378
  };
3621
3379
  }, [sortedMap]);
3622
- DrawerRoot.useIsoLayoutEffect(() => {
3380
+ useValueChanged.useIsoLayoutEffect(() => {
3623
3381
  const shouldUpdateLengths = lastTickRef.current === mapTick;
3624
3382
  if (shouldUpdateLengths) {
3625
3383
  if (elementsRef.current.length !== sortedMap.size) {
@@ -3632,25 +3390,25 @@ function CompositeList(props) {
3632
3390
  }
3633
3391
  onMapChange(sortedMap);
3634
3392
  }, [onMapChange, sortedMap, elementsRef, labelsRef, mapTick]);
3635
- DrawerRoot.useIsoLayoutEffect(() => {
3393
+ useValueChanged.useIsoLayoutEffect(() => {
3636
3394
  return () => {
3637
3395
  elementsRef.current = [];
3638
3396
  };
3639
3397
  }, [elementsRef]);
3640
- DrawerRoot.useIsoLayoutEffect(() => {
3398
+ useValueChanged.useIsoLayoutEffect(() => {
3641
3399
  return () => {
3642
3400
  if (labelsRef) {
3643
3401
  labelsRef.current = [];
3644
3402
  }
3645
3403
  };
3646
3404
  }, [labelsRef]);
3647
- const subscribeMapChange = DrawerRoot.useStableCallback(fn => {
3405
+ const subscribeMapChange = useValueChanged.useStableCallback(fn => {
3648
3406
  listeners.add(fn);
3649
3407
  return () => {
3650
3408
  listeners.delete(fn);
3651
3409
  };
3652
3410
  });
3653
- DrawerRoot.useIsoLayoutEffect(() => {
3411
+ useValueChanged.useIsoLayoutEffect(() => {
3654
3412
  listeners.forEach(l => l(sortedMap));
3655
3413
  }, [listeners, sortedMap]);
3656
3414
  const contextValue = React__namespace.useMemo(() => ({
@@ -3722,7 +3480,7 @@ const MenuPositioner = /*#__PURE__*/React__namespace.forwardRef(function MenuPos
3722
3480
  const floatingParentNodeId = store.useState('floatingParentNodeId');
3723
3481
  const domReference = floatingRootContext.useState('domReferenceElement');
3724
3482
  const previousTriggerRef = React__namespace.useRef(null);
3725
- const runOnceAnimationsFinish = DrawerRoot.useAnimationsFinished(positionerElement, false, false);
3483
+ const runOnceAnimationsFinish = useValueChanged.useAnimationsFinished(positionerElement, false, false);
3726
3484
  let anchor = anchorProp;
3727
3485
  let sideOffset = sideOffsetProp;
3728
3486
  let alignOffset = alignOffsetProp;
@@ -3789,7 +3547,7 @@ const MenuPositioner = /*#__PURE__*/React__namespace.forwardRef(function MenuPos
3789
3547
  store.set('hoverEnabled', false);
3790
3548
  }
3791
3549
  if (details.nodeId !== floatingNodeId && details.parentNodeId === store.select('floatingParentNodeId')) {
3792
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.siblingOpen));
3550
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.siblingOpen));
3793
3551
  }
3794
3552
  }
3795
3553
  }
@@ -3806,15 +3564,15 @@ const MenuPositioner = /*#__PURE__*/React__namespace.forwardRef(function MenuPos
3806
3564
  if (details.open || details.nodeId !== store.select('floatingParentNodeId')) {
3807
3565
  return;
3808
3566
  }
3809
- const reason = details.reason ?? DrawerRoot.siblingOpen;
3810
- store.setOpen(false, DrawerRoot.createChangeEventDetails(reason));
3567
+ const reason = details.reason ?? useValueChanged.siblingOpen;
3568
+ store.setOpen(false, useValueChanged.createChangeEventDetails(reason));
3811
3569
  }
3812
3570
  floatingTreeRoot.events.on('menuopenchange', onParentClose);
3813
3571
  return () => {
3814
3572
  floatingTreeRoot.events.off('menuopenchange', onParentClose);
3815
3573
  };
3816
3574
  }, [floatingTreeRoot.events, store]);
3817
- const closeTimeout = DrawerRoot.useTimeout();
3575
+ const closeTimeout = useValueChanged.useTimeout();
3818
3576
 
3819
3577
  // Clear pending close timeout when the menu closes.
3820
3578
  React__namespace.useEffect(() => {
@@ -3836,11 +3594,11 @@ const MenuPositioner = /*#__PURE__*/React__namespace.forwardRef(function MenuPos
3836
3594
  if (delay > 0) {
3837
3595
  if (!closeTimeout.isStarted()) {
3838
3596
  closeTimeout.start(delay, () => {
3839
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.siblingOpen));
3597
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.siblingOpen));
3840
3598
  });
3841
3599
  }
3842
3600
  } else {
3843
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.siblingOpen));
3601
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.siblingOpen));
3844
3602
  }
3845
3603
  } else {
3846
3604
  // User re-hovered the submenu trigger, cancel pending close.
@@ -3863,7 +3621,7 @@ const MenuPositioner = /*#__PURE__*/React__namespace.forwardRef(function MenuPos
3863
3621
  }, [floatingTreeRoot.events, open, store, floatingNodeId, floatingParentNodeId]);
3864
3622
 
3865
3623
  // Keep positioner transition behavior aligned with Popover when switching detached triggers.
3866
- DrawerRoot.useIsoLayoutEffect(() => {
3624
+ useValueChanged.useIsoLayoutEffect(() => {
3867
3625
  const currentTrigger = domReference;
3868
3626
  const previousTrigger = previousTriggerRef.current;
3869
3627
  if (currentTrigger) {
@@ -3903,7 +3661,7 @@ const MenuPositioner = /*#__PURE__*/React__namespace.forwardRef(function MenuPos
3903
3661
  ref: [forwardedRef, store.useStateSetter('positionerElement')],
3904
3662
  props: [positionerProps, getDisabledMountTransitionStyles(transitionStatus), elementProps]
3905
3663
  });
3906
- const shouldRenderBackdrop = mounted && parent.type !== 'menu' && (parent.type !== 'menubar' && modal && lastOpenChangeReason !== DrawerRoot.triggerHover || parent.type === 'menubar' && parent.context.modal);
3664
+ const shouldRenderBackdrop = mounted && parent.type !== 'menu' && (parent.type !== 'menubar' && modal && lastOpenChangeReason !== useValueChanged.triggerHover || parent.type === 'menubar' && parent.context.modal);
3907
3665
 
3908
3666
  // cuts a hole in the backdrop to allow pointer interaction with the menubar or dropdown menu trigger element
3909
3667
  let backdropCutout = null;
@@ -3956,13 +3714,13 @@ const MenuRadioGroup = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__na
3956
3714
  disabled = false,
3957
3715
  ...elementProps
3958
3716
  } = componentProps;
3959
- const [value, setValueUnwrapped] = DrawerRoot.useControlled({
3717
+ const [value, setValueUnwrapped] = useValueChanged.useControlled({
3960
3718
  controlled: valueProp,
3961
3719
  default: defaultValue,
3962
3720
  name: 'MenuRadioGroup'
3963
3721
  });
3964
- const onValueChange = DrawerRoot.useStableCallback(onValueChangeProp);
3965
- const setValue = DrawerRoot.useStableCallback((newValue, eventDetails) => {
3722
+ const onValueChange = useValueChanged.useStableCallback(onValueChangeProp);
3723
+ const setValue = useValueChanged.useStableCallback((newValue, eventDetails) => {
3966
3724
  onValueChange?.(newValue, eventDetails);
3967
3725
  if (eventDetails.isCanceled) {
3968
3726
  return;
@@ -4019,7 +3777,7 @@ const MenuRadioItem = /*#__PURE__*/React__namespace.forwardRef(function MenuRadi
4019
3777
  label
4020
3778
  });
4021
3779
  const menuPositionerContext = useMenuPositionerContext(true);
4022
- const id = useBaseUiId(idProp);
3780
+ const id = useBaseUiId.useBaseUiId(idProp);
4023
3781
  const {
4024
3782
  store
4025
3783
  } = useMenuRootContext();
@@ -4050,9 +3808,9 @@ const MenuRadioItem = /*#__PURE__*/React__namespace.forwardRef(function MenuRadi
4050
3808
  highlighted,
4051
3809
  checked
4052
3810
  }), [disabled, highlighted, checked]);
4053
- const handleClick = DrawerRoot.useStableCallback(event => {
3811
+ const handleClick = useValueChanged.useStableCallback(event => {
4054
3812
  const details = {
4055
- ...DrawerRoot.createChangeEventDetails(DrawerRoot.itemPress, event.nativeEvent),
3813
+ ...useValueChanged.createChangeEventDetails(useValueChanged.itemPress, event.nativeEvent),
4056
3814
  preventUnmountOnClose: () => {}
4057
3815
  };
4058
3816
  setSelectedValue(value, details);
@@ -4092,8 +3850,8 @@ const MenuRadioItemIndicator = /*#__PURE__*/React__namespace.forwardRef(function
4092
3850
  const {
4093
3851
  transitionStatus,
4094
3852
  setMounted
4095
- } = DrawerRoot.useTransitionStatus(item.checked);
4096
- DrawerRoot.useOpenChangeComplete({
3853
+ } = useValueChanged.useTransitionStatus(item.checked);
3854
+ useValueChanged.useOpenChangeComplete({
4097
3855
  open: item.checked,
4098
3856
  ref: indicatorRef,
4099
3857
  onComplete() {
@@ -4343,7 +4101,7 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4343
4101
  const floatingTreeRoot = store.useState('floatingTreeRoot');
4344
4102
  const floatingNodeIdFromContext = DrawerRoot.useFloatingNodeId(floatingTreeRoot);
4345
4103
  const floatingParentNodeIdFromContext = DrawerRoot.useFloatingParentNodeId();
4346
- DrawerRoot.useIsoLayoutEffect(() => {
4104
+ useValueChanged.useIsoLayoutEffect(() => {
4347
4105
  if (contextMenuContext && !parentMenuRootContext) {
4348
4106
  // This is a context menu root.
4349
4107
  // It doesn't support detached triggers yet, so we have to sync the parent context manually.
@@ -4384,7 +4142,7 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4384
4142
  store.useSyncedValues({
4385
4143
  disabled: disabledProp,
4386
4144
  modal: parent.type === undefined ? modalProp : undefined,
4387
- rootId: DrawerRoot.useId()
4145
+ rootId: useValueChanged.useId()
4388
4146
  });
4389
4147
  const {
4390
4148
  openMethod,
@@ -4400,7 +4158,7 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4400
4158
  });
4401
4159
  });
4402
4160
  const allowOutsidePressDismissalRef = React__namespace.useRef(parent.type !== 'context-menu');
4403
- const allowOutsidePressDismissalTimeout = DrawerRoot.useTimeout();
4161
+ const allowOutsidePressDismissalTimeout = useValueChanged.useTimeout();
4404
4162
  React__namespace.useEffect(() => {
4405
4163
  if (!open) {
4406
4164
  openEventRef.current = null;
@@ -4421,15 +4179,15 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4421
4179
  allowOutsidePressDismissalRef.current = true;
4422
4180
  });
4423
4181
  }, [allowOutsidePressDismissalTimeout, open, parent.type]);
4424
- DrawerRoot.useScrollLock(open && modal && lastOpenChangeReason !== DrawerRoot.triggerHover && openMethod !== 'touch', positionerElement);
4425
- DrawerRoot.useIsoLayoutEffect(() => {
4182
+ DrawerRoot.useScrollLock(open && modal && lastOpenChangeReason !== useValueChanged.triggerHover && openMethod !== 'touch', positionerElement);
4183
+ useValueChanged.useIsoLayoutEffect(() => {
4426
4184
  if (!open && !hoverEnabled) {
4427
4185
  store.set('hoverEnabled', true);
4428
4186
  }
4429
4187
  }, [open, hoverEnabled, store]);
4430
4188
  const allowTouchToCloseRef = React__namespace.useRef(true);
4431
- const allowTouchToCloseTimeout = DrawerRoot.useTimeout();
4432
- const setOpen = DrawerRoot.useStableCallback((nextOpen, eventDetails) => {
4189
+ const allowTouchToCloseTimeout = useValueChanged.useTimeout();
4190
+ const setOpen = useValueChanged.useStableCallback((nextOpen, eventDetails) => {
4433
4191
  const reason = eventDetails.reason;
4434
4192
  if (open === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) {
4435
4193
  return;
@@ -4475,7 +4233,7 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4475
4233
  // Prevent the menu from closing on mobile devices that have a delayed click event.
4476
4234
  // In some cases the menu, when tapped, will fire the focus event first and then the click event.
4477
4235
  // Without this guard, the menu will close immediately after opening.
4478
- if (nextOpen && reason === DrawerRoot.triggerFocus) {
4236
+ if (nextOpen && reason === useValueChanged.triggerFocus) {
4479
4237
  allowTouchToCloseRef.current = false;
4480
4238
  allowTouchToCloseTimeout.start(300, () => {
4481
4239
  allowTouchToCloseRef.current = true;
@@ -4484,8 +4242,8 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4484
4242
  allowTouchToCloseRef.current = true;
4485
4243
  allowTouchToCloseTimeout.clear();
4486
4244
  }
4487
- const isKeyboardClick = (reason === DrawerRoot.triggerPress || reason === DrawerRoot.itemPress) && nativeEvent.detail === 0 && nativeEvent?.isTrusted;
4488
- const isDismissClose = !nextOpen && (reason === DrawerRoot.escapeKey || reason == null);
4245
+ const isKeyboardClick = (reason === useValueChanged.triggerPress || reason === useValueChanged.itemPress) && nativeEvent.detail === 0 && nativeEvent?.isTrusted;
4246
+ const isDismissClose = !nextOpen && (reason === useValueChanged.escapeKey || reason == null);
4489
4247
  const updatedState = {
4490
4248
  open: nextOpen,
4491
4249
  openChangeReason: reason
@@ -4500,7 +4258,7 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4500
4258
  updatedState.activeTriggerElement = eventDetails.trigger ?? null;
4501
4259
  }
4502
4260
  store.update(updatedState);
4503
- if (parent.type === 'menubar' && (reason === DrawerRoot.triggerFocus || reason === DrawerRoot.focusOut || reason === DrawerRoot.triggerHover || reason === DrawerRoot.listNavigation || reason === DrawerRoot.siblingOpen)) {
4261
+ if (parent.type === 'menubar' && (reason === useValueChanged.triggerFocus || reason === useValueChanged.focusOut || reason === useValueChanged.triggerHover || reason === useValueChanged.listNavigation || reason === useValueChanged.siblingOpen)) {
4504
4262
  store.set('instantType', 'group');
4505
4263
  } else if (isKeyboardClick || isDismissClose) {
4506
4264
  store.set('instantType', isKeyboardClick ? 'click' : 'dismiss');
@@ -4509,14 +4267,14 @@ const MenuRoot = DrawerRoot.fastComponent(function MenuRoot(props) {
4509
4267
  }
4510
4268
  });
4511
4269
  const createMenuEventDetails = React__namespace.useCallback(reason => {
4512
- const details = DrawerRoot.createChangeEventDetails(reason);
4270
+ const details = useValueChanged.createChangeEventDetails(reason);
4513
4271
  details.preventUnmountOnClose = () => {
4514
4272
  store.set('preventUnmountingOnClose', true);
4515
4273
  };
4516
4274
  return details;
4517
4275
  }, [store]);
4518
4276
  const handleImperativeClose = React__namespace.useCallback(() => {
4519
- store.setOpen(false, createMenuEventDetails(DrawerRoot.imperativeAction));
4277
+ store.setOpen(false, createMenuEventDetails(useValueChanged.imperativeAction));
4520
4278
  }, [store, createMenuEventDetails]);
4521
4279
  React__namespace.useImperativeHandle(actionsRef, () => ({
4522
4280
  unmount: forceUnmount,
@@ -4733,7 +4491,7 @@ function useCompositeItem(params = {}) {
4733
4491
  highlightItemOnHover,
4734
4492
  highlightedIndex,
4735
4493
  onHighlightedIndexChange
4736
- } = useCompositeRootContext();
4494
+ } = useBaseUiId.useCompositeRootContext();
4737
4495
  const {
4738
4496
  ref,
4739
4497
  index
@@ -4794,13 +4552,13 @@ function CompositeItem(componentProps) {
4794
4552
  }
4795
4553
 
4796
4554
  function findRootOwnerId(node) {
4797
- if (index_esm.isHTMLElement(node) && node.hasAttribute('data-rootownerid')) {
4555
+ if (floatingUi_utils_dom.isHTMLElement(node) && node.hasAttribute('data-rootownerid')) {
4798
4556
  return node.getAttribute('data-rootownerid') ?? undefined;
4799
4557
  }
4800
- if (index_esm.isLastTraversableNode(node)) {
4558
+ if (floatingUi_utils_dom.isLastTraversableNode(node)) {
4801
4559
  return undefined;
4802
4560
  }
4803
- return findRootOwnerId(index_esm.getParentNode(node));
4561
+ return findRootOwnerId(floatingUi_utils_dom.getParentNode(node));
4804
4562
  }
4805
4563
 
4806
4564
  /**
@@ -4823,7 +4581,7 @@ function useMixedToggleClickHandler(params) {
4823
4581
  onMouseDown: event => {
4824
4582
  if (mouseDownAction === 'open' && !open || mouseDownAction === 'close' && open) {
4825
4583
  ignoreClickRef.current = true;
4826
- DrawerRoot.ownerDocument(event.currentTarget).addEventListener('click', () => {
4584
+ useValueChanged.ownerDocument(event.currentTarget).addEventListener('click', () => {
4827
4585
  ignoreClickRef.current = false;
4828
4586
  }, {
4829
4587
  once: true
@@ -4867,13 +4625,13 @@ const MenuTrigger = DrawerRoot.fastComponentRef(function MenuTrigger(componentPr
4867
4625
  if (!store) {
4868
4626
  throw new Error(process.env.NODE_ENV !== "production" ? 'Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.' : useRenderElement.formatErrorMessage(85));
4869
4627
  }
4870
- const thisTriggerId = useBaseUiId(idProp);
4628
+ const thisTriggerId = useBaseUiId.useBaseUiId(idProp);
4871
4629
  const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);
4872
4630
  const floatingRootContext = store.useState('floatingRootContext');
4873
4631
  const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
4874
4632
  const triggerElementRef = React__namespace.useRef(null);
4875
4633
  const parent = useMenuParent();
4876
- const compositeRootContext = useCompositeRootContext(true);
4634
+ const compositeRootContext = useBaseUiId.useCompositeRootContext(true);
4877
4635
  const floatingTreeRootFromContext = DrawerRoot.useFloatingTree();
4878
4636
  const floatingTreeRoot = React__namespace.useMemo(() => {
4879
4637
  return floatingTreeRootFromContext ?? new DrawerRoot.FloatingTreeStore();
@@ -4898,7 +4656,7 @@ const MenuTrigger = DrawerRoot.fastComponentRef(function MenuTrigger(componentPr
4898
4656
  const {
4899
4657
  getButtonProps,
4900
4658
  buttonRef
4901
- } = useButton({
4659
+ } = useBaseUiId.useButton({
4902
4660
  disabled,
4903
4661
  native: nativeButton
4904
4662
  });
@@ -4908,8 +4666,8 @@ const MenuTrigger = DrawerRoot.fastComponentRef(function MenuTrigger(componentPr
4908
4666
  }
4909
4667
  }, [store, isOpenedByThisTrigger, parent.type]);
4910
4668
  const triggerRef = React__namespace.useRef(null);
4911
- const allowMouseUpTriggerTimeout = DrawerRoot.useTimeout();
4912
- const handleDocumentMouseUp = DrawerRoot.useStableCallback(mouseEvent => {
4669
+ const allowMouseUpTriggerTimeout = useValueChanged.useTimeout();
4670
+ const handleDocumentMouseUp = useValueChanged.useStableCallback(mouseEvent => {
4913
4671
  if (!triggerRef.current) {
4914
4672
  return;
4915
4673
  }
@@ -4928,12 +4686,12 @@ const MenuTrigger = DrawerRoot.fastComponentRef(function MenuTrigger(componentPr
4928
4686
  }
4929
4687
  floatingTreeRoot.events.emit('close', {
4930
4688
  domEvent: mouseEvent,
4931
- reason: DrawerRoot.cancelOpen
4689
+ reason: useValueChanged.cancelOpen
4932
4690
  });
4933
4691
  });
4934
4692
  React__namespace.useEffect(() => {
4935
- if (isOpenedByThisTrigger && store.select('lastOpenChangeReason') === DrawerRoot.triggerHover) {
4936
- const doc = DrawerRoot.ownerDocument(triggerRef.current);
4693
+ if (isOpenedByThisTrigger && store.select('lastOpenChangeReason') === useValueChanged.triggerHover) {
4694
+ const doc = useValueChanged.ownerDocument(triggerRef.current);
4937
4695
  doc.addEventListener('mouseup', handleDocumentMouseUp, {
4938
4696
  once: true
4939
4697
  });
@@ -4995,7 +4753,7 @@ const MenuTrigger = DrawerRoot.fastComponentRef(function MenuTrigger(componentPr
4995
4753
  allowMouseUpTriggerTimeout.start(200, () => {
4996
4754
  store.context.allowMouseUpTriggerRef.current = true;
4997
4755
  });
4998
- const doc = DrawerRoot.ownerDocument(event.currentTarget);
4756
+ const doc = useValueChanged.ownerDocument(event.currentTarget);
4999
4757
  doc.addEventListener('mouseup', handleDocumentMouseUp, {
5000
4758
  once: true
5001
4759
  });
@@ -5004,20 +4762,20 @@ const MenuTrigger = DrawerRoot.fastComponentRef(function MenuTrigger(componentPr
5004
4762
  role: 'menuitem'
5005
4763
  } : {}, mixedToggleHandlers, elementProps, getButtonProps];
5006
4764
  const preFocusGuardRef = React__namespace.useRef(null);
5007
- const handlePreFocusGuardFocus = DrawerRoot.useStableCallback(event => {
4765
+ const handlePreFocusGuardFocus = useValueChanged.useStableCallback(event => {
5008
4766
  ReactDOM__namespace.flushSync(() => {
5009
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.focusOut, event.nativeEvent, event.currentTarget));
4767
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.focusOut, event.nativeEvent, event.currentTarget));
5010
4768
  });
5011
4769
  const previousTabbable = DrawerRoot.getTabbableBeforeElement(preFocusGuardRef.current);
5012
4770
  previousTabbable?.focus();
5013
4771
  });
5014
- const handleFocusTargetFocus = DrawerRoot.useStableCallback(event => {
4772
+ const handleFocusTargetFocus = useValueChanged.useStableCallback(event => {
5015
4773
  const currentPositionerElement = store.select('positionerElement');
5016
4774
  if (currentPositionerElement && DrawerRoot.isOutsideEvent(event, currentPositionerElement)) {
5017
4775
  store.context.beforeContentFocusGuardRef.current?.focus();
5018
4776
  } else {
5019
4777
  ReactDOM__namespace.flushSync(() => {
5020
- store.setOpen(false, DrawerRoot.createChangeEventDetails(DrawerRoot.focusOut, event.nativeEvent, event.currentTarget));
4778
+ store.setOpen(false, useValueChanged.createChangeEventDetails(useValueChanged.focusOut, event.nativeEvent, event.currentTarget));
5021
4779
  });
5022
4780
  let nextTabbable = DrawerRoot.getTabbableAfterElement(store.context.triggerFocusTargetRef.current || triggerElementRef.current);
5023
4781
  while (nextTabbable !== null && DrawerRoot.contains(currentPositionerElement, nextTabbable)) {
@@ -5074,9 +4832,9 @@ if (process.env.NODE_ENV !== "production") MenuTrigger.displayName = "MenuTrigge
5074
4832
  * Determines whether to ignore clicks after a hover-open.
5075
4833
  */
5076
4834
  function useStickIfOpen(open, openReason) {
5077
- const stickIfOpenTimeout = DrawerRoot.useTimeout();
4835
+ const stickIfOpenTimeout = useValueChanged.useTimeout();
5078
4836
  const [stickIfOpen, setStickIfOpen] = React__namespace.useState(false);
5079
- DrawerRoot.useIsoLayoutEffect(() => {
4837
+ useValueChanged.useIsoLayoutEffect(() => {
5080
4838
  if (open && openReason === 'trigger-hover') {
5081
4839
  // Only allow "patient" clicks to close the menu if it's open.
5082
4840
  // If they clicked within 500ms of the menu opening, keep it open.
@@ -5143,7 +4901,7 @@ const MenuSubmenuTrigger = /*#__PURE__*/React__namespace.forwardRef(function Sub
5143
4901
  const {
5144
4902
  store
5145
4903
  } = useMenuRootContext();
5146
- const thisTriggerId = useBaseUiId(idProp);
4904
+ const thisTriggerId = useBaseUiId.useBaseUiId(idProp);
5147
4905
  const open = store.useState('open');
5148
4906
  const floatingRootContext = store.useState('floatingRootContext');
5149
4907
  const floatingTreeRoot = store.useState('floatingTreeRoot');
@@ -5264,13 +5022,10 @@ exports.MenuSubmenuRoot = MenuSubmenuRoot;
5264
5022
  exports.MenuSubmenuTrigger = MenuSubmenuTrigger;
5265
5023
  exports.MenuTrigger = MenuTrigger;
5266
5024
  exports.REGULAR_ITEM = REGULAR_ITEM;
5267
- exports.error = error;
5268
5025
  exports.getDisabledMountTransitionStyles = getDisabledMountTransitionStyles;
5269
5026
  exports.getPseudoElementBounds = getPseudoElementBounds;
5270
5027
  exports.itemMapping = itemMapping;
5271
5028
  exports.useAnchorPositioning = useAnchorPositioning;
5272
- exports.useBaseUiId = useBaseUiId;
5273
- exports.useButton = useButton;
5274
5029
  exports.useClick = useClick;
5275
5030
  exports.useCompositeListItem = useCompositeListItem;
5276
5031
  exports.useContextMenuRootContext = useContextMenuRootContext;