@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.
- package/dist/Autocomplete/index.cjs +1 -0
- package/dist/Autocomplete/index.mjs +1 -0
- package/dist/Card/index.cjs +3 -0
- package/dist/Card/index.mjs +3 -0
- package/dist/Chip/index.cjs +1 -0
- package/dist/Chip/index.mjs +1 -0
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -0
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -0
- package/dist/Chips/index.cjs +1 -0
- package/dist/Chips/index.mjs +1 -0
- package/dist/Combobox/components/ComboboxActivator/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxActivator/index.mjs +1 -0
- package/dist/Combobox/components/ComboboxContent/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxContent/index.mjs +1 -0
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -0
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -0
- package/dist/Combobox/index.cjs +1 -0
- package/dist/Combobox/index.mjs +1 -0
- package/dist/ConfirmationModal/index.cjs +1 -0
- package/dist/ConfirmationModal/index.mjs +1 -0
- package/dist/DataDump/index.cjs +3 -0
- package/dist/DataDump/index.mjs +3 -0
- package/dist/DataList/components/DataListActions/index.cjs +1 -0
- package/dist/DataList/components/DataListActions/index.mjs +1 -0
- package/dist/DataList/components/DataListBulkActions/index.cjs +1 -0
- package/dist/DataList/components/DataListBulkActions/index.mjs +1 -0
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -0
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -0
- package/dist/DataList/components/DataListFilters/index.cjs +1 -0
- package/dist/DataList/components/DataListFilters/index.mjs +1 -0
- package/dist/DataList/components/DataListHeader/index.cjs +1 -0
- package/dist/DataList/components/DataListHeader/index.mjs +1 -0
- package/dist/DataList/components/DataListItem/index.cjs +1 -0
- package/dist/DataList/components/DataListItem/index.mjs +1 -0
- package/dist/DataList/components/DataListItemActions/index.cjs +1 -0
- package/dist/DataList/components/DataListItemActions/index.mjs +1 -0
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -0
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -0
- package/dist/DataList/components/DataListItems/index.cjs +1 -0
- package/dist/DataList/components/DataListItems/index.mjs +1 -0
- package/dist/DataList/components/DataListLayout/index.cjs +1 -0
- package/dist/DataList/components/DataListLayout/index.mjs +1 -0
- package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -0
- package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -0
- package/dist/DataList/index.cjs +1 -0
- package/dist/DataList/index.mjs +1 -0
- package/dist/DatePicker/index.cjs +1 -0
- package/dist/DatePicker/index.mjs +1 -0
- package/dist/DrawerRoot-cjs.js +181 -968
- package/dist/DrawerRoot-es.js +5 -734
- package/dist/FormatFile/index.cjs +1 -0
- package/dist/FormatFile/index.mjs +1 -0
- package/dist/Gallery/index.cjs +1 -0
- package/dist/Gallery/index.mjs +1 -0
- package/dist/InputDate/index.cjs +1 -0
- package/dist/InputDate/index.mjs +1 -0
- package/dist/InputNumberExperimental-cjs.js +783 -0
- package/dist/InputNumberExperimental-es.js +763 -0
- package/dist/LightBox/index.cjs +1 -0
- package/dist/LightBox/index.mjs +1 -0
- package/dist/Menu/index.cjs +3 -0
- package/dist/Menu/index.mjs +3 -0
- package/dist/MenuSubmenuTrigger-cjs.js +202 -447
- package/dist/MenuSubmenuTrigger-es.js +7 -249
- package/dist/Modal/index.cjs +1 -0
- package/dist/Modal/index.mjs +1 -0
- package/dist/NumberFieldInput-cjs.js +1828 -0
- package/dist/NumberFieldInput-es.js +1788 -0
- package/dist/Page/index.cjs +3 -0
- package/dist/Page/index.mjs +3 -0
- package/dist/Popover/index.cjs +1 -0
- package/dist/Popover/index.mjs +1 -0
- package/dist/Tooltip/index.cjs +1 -0
- package/dist/Tooltip/index.mjs +1 -0
- package/dist/docs/Menu/Menu.md +197 -37
- package/dist/floating-ui.react-cjs.js +35 -34
- package/dist/floating-ui.react-dom-cjs.js +65 -64
- package/dist/floating-ui.react-dom-es.js +2 -1
- package/dist/floating-ui.react-es.js +2 -1
- package/dist/floating-ui.utils.dom-cjs.js +185 -0
- package/dist/floating-ui.utils.dom-es.js +165 -0
- package/dist/index.cjs +3 -0
- package/dist/index.esm-cjs.js +0 -183
- package/dist/index.esm-es.js +1 -165
- package/dist/index.mjs +3 -0
- package/dist/primitives/BottomSheet/index.cjs +3 -1
- package/dist/primitives/BottomSheet/index.mjs +3 -1
- package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +20 -0
- package/dist/primitives/InputNumberExperimental/index.cjs +22 -0
- package/dist/primitives/InputNumberExperimental/index.d.ts +2 -0
- package/dist/primitives/InputNumberExperimental/index.mjs +16 -0
- package/dist/primitives/InputNumberExperimental/types.d.ts +147 -0
- package/dist/primitives/index.cjs +9 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.mjs +8 -1
- package/dist/styles.css +499 -0
- package/dist/unstyledPrimitives/index.cjs +264 -2039
- package/dist/unstyledPrimitives/index.mjs +72 -1847
- package/dist/useBaseUiId-cjs.js +275 -0
- package/dist/useBaseUiId-es.js +251 -0
- package/dist/useValueChanged-cjs.js +820 -0
- package/dist/useValueChanged-es.js +736 -0
- package/package.json +2 -2
- package/rollup.config.mjs +13 -2
package/dist/DrawerRoot-es.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { f as formatErrorMessage, u as useRenderElement,
|
|
3
|
+
import { f as formatErrorMessage, u as useRenderElement, E as EMPTY_OBJECT, b as useRefWithInit, c as useMergedRefs, i as isReactVersionAtLeast, N as NOOP } from './useRenderElement-es.js';
|
|
4
|
+
import { X as TransitionStatusDataAttributes, t as transitionStatusMapping, Y as isJSDOM, z as stopEvent, s as ownerDocument, u as useIsoLayoutEffect, I as isSafari, l as visuallyHidden, k as createChangeEventDetails, M as focusOut, b as useId, a as useStableCallback, i as useValueAsRef, c as useTimeout, D as useAnimationFrame, Z as resolveRef, K as triggerHover, Q as outsidePress, N as isVirtualClick, O as isVirtualPointerEvent, _ as isWebKit, $ as isReactEvent, J as escapeKey, F as triggerPress, T as Timeout, E as isClickLikeEvent, d as useTransitionStatus, e as useOpenChangeComplete, g as clamp, j as isIOS, a0 as AnimationFrame, y as useValueChanged, V as imperativeAction, h as useControlled, n as none, a1 as isAndroid, a2 as closeWatcher } from './useValueChanged-es.js';
|
|
4
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
import {
|
|
6
|
+
import { f as floor, t as tabbable, i as isTabbable, a as focusable } from './index.esm-es.js';
|
|
7
|
+
import { i as isShadowRoot, b as isElement, a as isHTMLElement, f as getComputedStyle$1, g as getNodeName, c as isNode, k as getWindow, j as isWebKit$1, d as isLastTraversableNode, e as getParentNode, o as isOverflowElement } from './floating-ui.utils.dom-es.js';
|
|
6
8
|
import * as ReactDOM from 'react-dom';
|
|
7
9
|
|
|
8
10
|
const DialogRootContext = /*#__PURE__*/React.createContext(undefined);
|
|
@@ -55,35 +57,6 @@ const ownerVisuallyHidden = {
|
|
|
55
57
|
left: 0
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
let TransitionStatusDataAttributes = /*#__PURE__*/function (TransitionStatusDataAttributes) {
|
|
59
|
-
/**
|
|
60
|
-
* Present when the component is animating in.
|
|
61
|
-
*/
|
|
62
|
-
TransitionStatusDataAttributes["startingStyle"] = "data-starting-style";
|
|
63
|
-
/**
|
|
64
|
-
* Present when the component is animating out.
|
|
65
|
-
*/
|
|
66
|
-
TransitionStatusDataAttributes["endingStyle"] = "data-ending-style";
|
|
67
|
-
return TransitionStatusDataAttributes;
|
|
68
|
-
}({});
|
|
69
|
-
const STARTING_HOOK = {
|
|
70
|
-
[TransitionStatusDataAttributes.startingStyle]: ''
|
|
71
|
-
};
|
|
72
|
-
const ENDING_HOOK = {
|
|
73
|
-
[TransitionStatusDataAttributes.endingStyle]: ''
|
|
74
|
-
};
|
|
75
|
-
const transitionStatusMapping = {
|
|
76
|
-
transitionStatus(value) {
|
|
77
|
-
if (value === 'starting') {
|
|
78
|
-
return STARTING_HOOK;
|
|
79
|
-
}
|
|
80
|
-
if (value === 'ending') {
|
|
81
|
-
return ENDING_HOOK;
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
60
|
let CommonPopupDataAttributes = function (CommonPopupDataAttributes) {
|
|
88
61
|
/**
|
|
89
62
|
* Present when the popup is open.
|
|
@@ -272,131 +245,6 @@ const DrawerBackdrop = /*#__PURE__*/React.forwardRef(function DrawerBackdrop(com
|
|
|
272
245
|
});
|
|
273
246
|
if (process.env.NODE_ENV !== "production") DrawerBackdrop.displayName = "DrawerBackdrop";
|
|
274
247
|
|
|
275
|
-
// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
276
|
-
const useInsertionEffect = React[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)];
|
|
277
|
-
const useSafeInsertionEffect =
|
|
278
|
-
// React 17 doesn't have useInsertionEffect.
|
|
279
|
-
useInsertionEffect &&
|
|
280
|
-
// Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
|
|
281
|
-
useInsertionEffect !== React.useLayoutEffect ? useInsertionEffect : fn => fn();
|
|
282
|
-
/**
|
|
283
|
-
* Stabilizes the function passed so it's always the same between renders.
|
|
284
|
-
*
|
|
285
|
-
* The function becomes non-reactive to any values it captures.
|
|
286
|
-
* It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.
|
|
287
|
-
*
|
|
288
|
-
* The function must only be called inside effects and event handlers, never during render (which throws an error).
|
|
289
|
-
*
|
|
290
|
-
* This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.
|
|
291
|
-
*/
|
|
292
|
-
function useStableCallback(callback) {
|
|
293
|
-
const stable = useRefWithInit(createStableCallback).current;
|
|
294
|
-
stable.next = callback;
|
|
295
|
-
useSafeInsertionEffect(stable.effect);
|
|
296
|
-
return stable.trampoline;
|
|
297
|
-
}
|
|
298
|
-
function createStableCallback() {
|
|
299
|
-
const stable = {
|
|
300
|
-
next: undefined,
|
|
301
|
-
callback: assertNotCalled,
|
|
302
|
-
trampoline: (...args) => stable.callback?.(...args),
|
|
303
|
-
effect: () => {
|
|
304
|
-
stable.callback = stable.next;
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
return stable;
|
|
308
|
-
}
|
|
309
|
-
function assertNotCalled() {
|
|
310
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
311
|
-
throw /* minify-error-disabled */new Error('Base UI: Cannot call an event handler while rendering.');
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379
|
|
316
|
-
const SafeReact = {
|
|
317
|
-
...React
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const noop = () => {};
|
|
321
|
-
const useIsoLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : noop;
|
|
322
|
-
|
|
323
|
-
const none = 'none';
|
|
324
|
-
const triggerPress = 'trigger-press';
|
|
325
|
-
const triggerHover = 'trigger-hover';
|
|
326
|
-
const triggerFocus = 'trigger-focus';
|
|
327
|
-
const outsidePress = 'outside-press';
|
|
328
|
-
const itemPress = 'item-press';
|
|
329
|
-
const closePress = 'close-press';
|
|
330
|
-
const clearPress = 'clear-press';
|
|
331
|
-
const chipRemovePress = 'chip-remove-press';
|
|
332
|
-
const incrementPress = 'increment-press';
|
|
333
|
-
const decrementPress = 'decrement-press';
|
|
334
|
-
const inputChange = 'input-change';
|
|
335
|
-
const inputClear = 'input-clear';
|
|
336
|
-
const inputBlur = 'input-blur';
|
|
337
|
-
const inputPaste = 'input-paste';
|
|
338
|
-
const inputPress = 'input-press';
|
|
339
|
-
const focusOut = 'focus-out';
|
|
340
|
-
const escapeKey = 'escape-key';
|
|
341
|
-
const closeWatcher = 'close-watcher';
|
|
342
|
-
const listNavigation = 'list-navigation';
|
|
343
|
-
const keyboard = 'keyboard';
|
|
344
|
-
const scrub = 'scrub';
|
|
345
|
-
const cancelOpen = 'cancel-open';
|
|
346
|
-
const siblingOpen = 'sibling-open';
|
|
347
|
-
const imperativeAction = 'imperative-action';
|
|
348
|
-
const swipe = 'swipe';
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Maps a change `reason` string to the corresponding native event type.
|
|
352
|
-
*/
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Details of custom change events emitted by Base UI components.
|
|
356
|
-
*/
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Details of custom generic events emitted by Base UI components.
|
|
360
|
-
*/
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Creates a Base UI event details object with the given reason and utilities
|
|
364
|
-
* for preventing Base UI's internal event handling.
|
|
365
|
-
*/
|
|
366
|
-
function createChangeEventDetails(reason, event, trigger, customProperties) {
|
|
367
|
-
let canceled = false;
|
|
368
|
-
let allowPropagation = false;
|
|
369
|
-
const custom = customProperties ?? EMPTY_OBJECT;
|
|
370
|
-
const details = {
|
|
371
|
-
reason,
|
|
372
|
-
event: event ?? new Event('base-ui'),
|
|
373
|
-
cancel() {
|
|
374
|
-
canceled = true;
|
|
375
|
-
},
|
|
376
|
-
allowPropagation() {
|
|
377
|
-
allowPropagation = true;
|
|
378
|
-
},
|
|
379
|
-
get isCanceled() {
|
|
380
|
-
return canceled;
|
|
381
|
-
},
|
|
382
|
-
get isPropagationAllowed() {
|
|
383
|
-
return allowPropagation;
|
|
384
|
-
},
|
|
385
|
-
trigger,
|
|
386
|
-
...custom
|
|
387
|
-
};
|
|
388
|
-
return details;
|
|
389
|
-
}
|
|
390
|
-
function createGenericEventDetails(reason, event, customProperties) {
|
|
391
|
-
const custom = customProperties ?? EMPTY_OBJECT;
|
|
392
|
-
const details = {
|
|
393
|
-
reason,
|
|
394
|
-
event: event ?? new Event('base-ui'),
|
|
395
|
-
...custom
|
|
396
|
-
};
|
|
397
|
-
return details;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
248
|
const DRAWER_CONTENT_ATTRIBUTE = 'data-drawer-content';
|
|
401
249
|
|
|
402
250
|
/**
|
|
@@ -421,44 +269,6 @@ const DrawerContent = /*#__PURE__*/React.forwardRef(function DrawerContent(compo
|
|
|
421
269
|
});
|
|
422
270
|
if (process.env.NODE_ENV !== "production") DrawerContent.displayName = "DrawerContent";
|
|
423
271
|
|
|
424
|
-
let globalId = 0;
|
|
425
|
-
|
|
426
|
-
// TODO React 17: Remove `useGlobalId` once React 17 support is removed
|
|
427
|
-
function useGlobalId(idOverride, prefix = 'mui') {
|
|
428
|
-
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
429
|
-
const id = idOverride || defaultId;
|
|
430
|
-
React.useEffect(() => {
|
|
431
|
-
if (defaultId == null) {
|
|
432
|
-
// Fallback to this default id when possible.
|
|
433
|
-
// Use the incrementing value for client-side rendering only.
|
|
434
|
-
// We can't use it server-side.
|
|
435
|
-
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
436
|
-
globalId += 1;
|
|
437
|
-
setDefaultId(`${prefix}-${globalId}`);
|
|
438
|
-
}
|
|
439
|
-
}, [defaultId, prefix]);
|
|
440
|
-
return id;
|
|
441
|
-
}
|
|
442
|
-
const maybeReactUseId = SafeReact.useId;
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
*
|
|
446
|
-
* @example <div id={useId()} />
|
|
447
|
-
* @param idOverride
|
|
448
|
-
* @returns {string}
|
|
449
|
-
*/
|
|
450
|
-
function useId(idOverride, prefix) {
|
|
451
|
-
// React.useId() is only available from React 17.0.0.
|
|
452
|
-
if (maybeReactUseId !== undefined) {
|
|
453
|
-
const reactId = maybeReactUseId();
|
|
454
|
-
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
|
|
458
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
459
|
-
return useGlobalId(idOverride, prefix);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
272
|
const DrawerProviderContext = /*#__PURE__*/React.createContext(undefined);
|
|
463
273
|
if (process.env.NODE_ENV !== "production") DrawerProviderContext.displayName = "DrawerProviderContext";
|
|
464
274
|
function useDrawerProviderContext(optional) {
|
|
@@ -466,116 +276,6 @@ function useDrawerProviderContext(optional) {
|
|
|
466
276
|
return context;
|
|
467
277
|
}
|
|
468
278
|
|
|
469
|
-
const EMPTY$2 = [];
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* A React.useEffect equivalent that runs once, when the component is mounted.
|
|
473
|
-
*/
|
|
474
|
-
function useOnMount(fn) {
|
|
475
|
-
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- no need to put `fn` in the dependency array
|
|
476
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
477
|
-
React.useEffect(fn, EMPTY$2);
|
|
478
|
-
/* eslint-enable react-hooks/exhaustive-deps */
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
const EMPTY$1 = 0;
|
|
482
|
-
class Timeout {
|
|
483
|
-
static create() {
|
|
484
|
-
return new Timeout();
|
|
485
|
-
}
|
|
486
|
-
currentId = EMPTY$1;
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
490
|
-
*/
|
|
491
|
-
start(delay, fn) {
|
|
492
|
-
this.clear();
|
|
493
|
-
this.currentId = setTimeout(() => {
|
|
494
|
-
this.currentId = EMPTY$1;
|
|
495
|
-
fn();
|
|
496
|
-
}, delay); /* Node.js types are enabled in development */
|
|
497
|
-
}
|
|
498
|
-
isStarted() {
|
|
499
|
-
return this.currentId !== EMPTY$1;
|
|
500
|
-
}
|
|
501
|
-
clear = () => {
|
|
502
|
-
if (this.currentId !== EMPTY$1) {
|
|
503
|
-
clearTimeout(this.currentId);
|
|
504
|
-
this.currentId = EMPTY$1;
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
disposeEffect = () => {
|
|
508
|
-
return this.clear;
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* A `setTimeout` with automatic cleanup and guard.
|
|
514
|
-
*/
|
|
515
|
-
function useTimeout() {
|
|
516
|
-
const timeout = useRefWithInit(Timeout.create).current;
|
|
517
|
-
useOnMount(timeout.disposeEffect);
|
|
518
|
-
return timeout;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
const hasNavigator = typeof navigator !== 'undefined';
|
|
522
|
-
const nav = getNavigatorData();
|
|
523
|
-
const platform = getPlatform();
|
|
524
|
-
const userAgent = getUserAgent();
|
|
525
|
-
const isWebKit = typeof CSS === 'undefined' || !CSS.supports ? false : CSS.supports('-webkit-backdrop-filter:none');
|
|
526
|
-
const isIOS =
|
|
527
|
-
// iPads can claim to be MacIntel
|
|
528
|
-
nav.platform === 'MacIntel' && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform);
|
|
529
|
-
const isFirefox = hasNavigator && /firefox/i.test(userAgent);
|
|
530
|
-
const isSafari = hasNavigator && /apple/i.test(navigator.vendor);
|
|
531
|
-
const isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent);
|
|
532
|
-
const isMac = hasNavigator && platform.toLowerCase().startsWith('mac') && !navigator.maxTouchPoints;
|
|
533
|
-
const isJSDOM = userAgent.includes('jsdom/');
|
|
534
|
-
|
|
535
|
-
// Avoid Chrome DevTools blue warning.
|
|
536
|
-
function getNavigatorData() {
|
|
537
|
-
if (!hasNavigator) {
|
|
538
|
-
return {
|
|
539
|
-
platform: '',
|
|
540
|
-
maxTouchPoints: -1
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
const uaData = navigator.userAgentData;
|
|
544
|
-
if (uaData?.platform) {
|
|
545
|
-
return {
|
|
546
|
-
platform: uaData.platform,
|
|
547
|
-
maxTouchPoints: navigator.maxTouchPoints
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
return {
|
|
551
|
-
platform: navigator.platform ?? '',
|
|
552
|
-
maxTouchPoints: navigator.maxTouchPoints ?? -1
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
function getUserAgent() {
|
|
556
|
-
if (!hasNavigator) {
|
|
557
|
-
return '';
|
|
558
|
-
}
|
|
559
|
-
const uaData = navigator.userAgentData;
|
|
560
|
-
if (uaData && Array.isArray(uaData.brands)) {
|
|
561
|
-
return uaData.brands.map(({
|
|
562
|
-
brand,
|
|
563
|
-
version
|
|
564
|
-
}) => `${brand}/${version}`).join(' ');
|
|
565
|
-
}
|
|
566
|
-
return navigator.userAgent;
|
|
567
|
-
}
|
|
568
|
-
function getPlatform() {
|
|
569
|
-
if (!hasNavigator) {
|
|
570
|
-
return '';
|
|
571
|
-
}
|
|
572
|
-
const uaData = navigator.userAgentData;
|
|
573
|
-
if (uaData?.platform) {
|
|
574
|
-
return uaData.platform;
|
|
575
|
-
}
|
|
576
|
-
return navigator.platform ?? '';
|
|
577
|
-
}
|
|
578
|
-
|
|
579
279
|
const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';
|
|
580
280
|
const ACTIVE_KEY = 'active';
|
|
581
281
|
const SELECTED_KEY = 'selected';
|
|
@@ -707,46 +407,6 @@ function getNodeAncestors(nodes, id) {
|
|
|
707
407
|
return allAncestors;
|
|
708
408
|
}
|
|
709
409
|
|
|
710
|
-
function stopEvent(event) {
|
|
711
|
-
event.preventDefault();
|
|
712
|
-
event.stopPropagation();
|
|
713
|
-
}
|
|
714
|
-
function isReactEvent(event) {
|
|
715
|
-
return 'nativeEvent' in event;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
// License: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/utils/src/isVirtualEvent.ts
|
|
719
|
-
function isVirtualClick(event) {
|
|
720
|
-
if (event.pointerType === '' && event.isTrusted) {
|
|
721
|
-
return true;
|
|
722
|
-
}
|
|
723
|
-
if (isAndroid && event.pointerType) {
|
|
724
|
-
return event.type === 'click' && event.buttons === 1;
|
|
725
|
-
}
|
|
726
|
-
return event.detail === 0 && !event.pointerType;
|
|
727
|
-
}
|
|
728
|
-
function isVirtualPointerEvent(event) {
|
|
729
|
-
if (isJSDOM) {
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
return !isAndroid && event.width === 0 && event.height === 0 || isAndroid && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||
|
|
733
|
-
// iOS VoiceOver returns 0.333• for width/height.
|
|
734
|
-
event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';
|
|
735
|
-
}
|
|
736
|
-
function isMouseLikePointerType(pointerType, strict) {
|
|
737
|
-
// On some Linux machines with Chromium, mouse inputs return a `pointerType`
|
|
738
|
-
// of "pen": https://github.com/floating-ui/floating-ui/issues/2015
|
|
739
|
-
const values = ['mouse', 'pen'];
|
|
740
|
-
if (!strict) {
|
|
741
|
-
values.push('', undefined);
|
|
742
|
-
}
|
|
743
|
-
return values.includes(pointerType);
|
|
744
|
-
}
|
|
745
|
-
function isClickLikeEvent(event) {
|
|
746
|
-
const type = event.type;
|
|
747
|
-
return type === 'click' || type === 'mousedown' || type === 'keydown' || type === 'keyup';
|
|
748
|
-
}
|
|
749
|
-
|
|
750
410
|
function isDifferentGridRow(index, cols, prevRow) {
|
|
751
411
|
return Math.floor(index / cols) !== prevRow;
|
|
752
412
|
}
|
|
@@ -1088,10 +748,6 @@ function isElementVisible(element) {
|
|
|
1088
748
|
return getComputedStyle$1(element).display !== 'none';
|
|
1089
749
|
}
|
|
1090
750
|
|
|
1091
|
-
function ownerDocument(node) {
|
|
1092
|
-
return node?.ownerDocument || document;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
751
|
const getTabbableOptions = () => ({
|
|
1096
752
|
getShadowRoot: true,
|
|
1097
753
|
displayCheck:
|
|
@@ -1165,154 +821,6 @@ function enableFocusInside(container) {
|
|
|
1165
821
|
});
|
|
1166
822
|
}
|
|
1167
823
|
|
|
1168
|
-
/**
|
|
1169
|
-
* Untracks the provided value by turning it into a ref to remove its reactivity.
|
|
1170
|
-
*
|
|
1171
|
-
* Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.
|
|
1172
|
-
*/
|
|
1173
|
-
function useValueAsRef(value) {
|
|
1174
|
-
const latest = useRefWithInit(createLatestRef, value).current;
|
|
1175
|
-
latest.next = value;
|
|
1176
|
-
|
|
1177
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1178
|
-
useIsoLayoutEffect(latest.effect);
|
|
1179
|
-
return latest;
|
|
1180
|
-
}
|
|
1181
|
-
function createLatestRef(value) {
|
|
1182
|
-
const latest = {
|
|
1183
|
-
current: value,
|
|
1184
|
-
next: value,
|
|
1185
|
-
effect: () => {
|
|
1186
|
-
latest.current = latest.next;
|
|
1187
|
-
}
|
|
1188
|
-
};
|
|
1189
|
-
return latest;
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
/** Unlike `setTimeout`, rAF doesn't guarantee a positive integer return value, so we can't have
|
|
1193
|
-
* a monomorphic `uint` type with `0` meaning empty.
|
|
1194
|
-
* See warning note at:
|
|
1195
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#return_value */
|
|
1196
|
-
const EMPTY = null;
|
|
1197
|
-
let LAST_RAF = globalThis.requestAnimationFrame;
|
|
1198
|
-
class Scheduler {
|
|
1199
|
-
/* This implementation uses an array as a backing data-structure for frame callbacks.
|
|
1200
|
-
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
|
|
1201
|
-
* never calls the native `cancelAnimationFrame` if there are no frames left. This can
|
|
1202
|
-
* be much more efficient if there is a call pattern that alterns as
|
|
1203
|
-
* "request-cancel-request-cancel-…".
|
|
1204
|
-
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
|
|
1205
|
-
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
|
|
1206
|
-
|
|
1207
|
-
callbacks = [];
|
|
1208
|
-
callbacksCount = 0;
|
|
1209
|
-
nextId = 1;
|
|
1210
|
-
startId = 1;
|
|
1211
|
-
isScheduled = false;
|
|
1212
|
-
tick = timestamp => {
|
|
1213
|
-
this.isScheduled = false;
|
|
1214
|
-
const currentCallbacks = this.callbacks;
|
|
1215
|
-
const currentCallbacksCount = this.callbacksCount;
|
|
1216
|
-
|
|
1217
|
-
// Update these before iterating, callbacks could call `requestAnimationFrame` again.
|
|
1218
|
-
this.callbacks = [];
|
|
1219
|
-
this.callbacksCount = 0;
|
|
1220
|
-
this.startId = this.nextId;
|
|
1221
|
-
if (currentCallbacksCount > 0) {
|
|
1222
|
-
for (let i = 0; i < currentCallbacks.length; i += 1) {
|
|
1223
|
-
currentCallbacks[i]?.(timestamp);
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
request(fn) {
|
|
1228
|
-
const id = this.nextId;
|
|
1229
|
-
this.nextId += 1;
|
|
1230
|
-
this.callbacks.push(fn);
|
|
1231
|
-
this.callbacksCount += 1;
|
|
1232
|
-
|
|
1233
|
-
/* In a test environment with fake timers, a fake `requestAnimationFrame` can be called
|
|
1234
|
-
* but there's no guarantee that the animation frame will actually run before the fake
|
|
1235
|
-
* timers are teared, which leaves `isScheduled` set, but won't run our `tick()`. */
|
|
1236
|
-
const didRAFChange = process.env.NODE_ENV !== 'production' && LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
|
|
1237
|
-
if (!this.isScheduled || didRAFChange) {
|
|
1238
|
-
requestAnimationFrame(this.tick);
|
|
1239
|
-
this.isScheduled = true;
|
|
1240
|
-
}
|
|
1241
|
-
return id;
|
|
1242
|
-
}
|
|
1243
|
-
cancel(id) {
|
|
1244
|
-
const index = id - this.startId;
|
|
1245
|
-
if (index < 0 || index >= this.callbacks.length) {
|
|
1246
|
-
return;
|
|
1247
|
-
}
|
|
1248
|
-
this.callbacks[index] = null;
|
|
1249
|
-
this.callbacksCount -= 1;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
const scheduler = new Scheduler();
|
|
1253
|
-
class AnimationFrame {
|
|
1254
|
-
static create() {
|
|
1255
|
-
return new AnimationFrame();
|
|
1256
|
-
}
|
|
1257
|
-
static request(fn) {
|
|
1258
|
-
return scheduler.request(fn);
|
|
1259
|
-
}
|
|
1260
|
-
static cancel(id) {
|
|
1261
|
-
return scheduler.cancel(id);
|
|
1262
|
-
}
|
|
1263
|
-
currentId = EMPTY;
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
1267
|
-
*/
|
|
1268
|
-
request(fn) {
|
|
1269
|
-
this.cancel();
|
|
1270
|
-
this.currentId = scheduler.request(() => {
|
|
1271
|
-
this.currentId = EMPTY;
|
|
1272
|
-
fn();
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1275
|
-
cancel = () => {
|
|
1276
|
-
if (this.currentId !== EMPTY) {
|
|
1277
|
-
scheduler.cancel(this.currentId);
|
|
1278
|
-
this.currentId = EMPTY;
|
|
1279
|
-
}
|
|
1280
|
-
};
|
|
1281
|
-
disposeEffect = () => {
|
|
1282
|
-
return this.cancel;
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
/**
|
|
1287
|
-
* A `requestAnimationFrame` with automatic cleanup and guard.
|
|
1288
|
-
*/
|
|
1289
|
-
function useAnimationFrame() {
|
|
1290
|
-
const timeout = useRefWithInit(AnimationFrame.create).current;
|
|
1291
|
-
useOnMount(timeout.disposeEffect);
|
|
1292
|
-
return timeout;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
const visuallyHiddenBase = {
|
|
1296
|
-
clipPath: 'inset(50%)',
|
|
1297
|
-
overflow: 'hidden',
|
|
1298
|
-
whiteSpace: 'nowrap',
|
|
1299
|
-
border: 0,
|
|
1300
|
-
padding: 0,
|
|
1301
|
-
width: 1,
|
|
1302
|
-
height: 1,
|
|
1303
|
-
margin: -1
|
|
1304
|
-
};
|
|
1305
|
-
const visuallyHidden = {
|
|
1306
|
-
...visuallyHiddenBase,
|
|
1307
|
-
position: 'fixed',
|
|
1308
|
-
top: 0,
|
|
1309
|
-
left: 0
|
|
1310
|
-
};
|
|
1311
|
-
const visuallyHiddenInput = {
|
|
1312
|
-
...visuallyHiddenBase,
|
|
1313
|
-
position: 'absolute'
|
|
1314
|
-
};
|
|
1315
|
-
|
|
1316
824
|
const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {
|
|
1317
825
|
const [role, setRole] = React.useState();
|
|
1318
826
|
useIsoLayoutEffect(() => {
|
|
@@ -1829,17 +1337,6 @@ function FloatingTree(props) {
|
|
|
1829
1337
|
});
|
|
1830
1338
|
}
|
|
1831
1339
|
|
|
1832
|
-
/**
|
|
1833
|
-
* If the provided argument is a ref object, returns its `current` value.
|
|
1834
|
-
* Otherwise, returns the argument itself.
|
|
1835
|
-
*/
|
|
1836
|
-
function resolveRef(maybeRef) {
|
|
1837
|
-
if (maybeRef == null) {
|
|
1838
|
-
return maybeRef;
|
|
1839
|
-
}
|
|
1840
|
-
return 'current' in maybeRef ? maybeRef.current : maybeRef;
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
1340
|
function getEventType(event, lastInteractionType) {
|
|
1844
1341
|
const win = getWindow(event.target);
|
|
1845
1342
|
if (event instanceof win.KeyboardEvent) {
|
|
@@ -4299,178 +3796,6 @@ class FloatingRootStore extends ReactStore {
|
|
|
4299
3796
|
};
|
|
4300
3797
|
}
|
|
4301
3798
|
|
|
4302
|
-
/**
|
|
4303
|
-
* Provides a status string for CSS animations.
|
|
4304
|
-
* @param open - a boolean that determines if the element is open.
|
|
4305
|
-
* @param enableIdleState - a boolean that enables the `'idle'` state between `'starting'` and `'ending'`
|
|
4306
|
-
*/
|
|
4307
|
-
function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
|
|
4308
|
-
const [transitionStatus, setTransitionStatus] = React.useState(open && enableIdleState ? 'idle' : undefined);
|
|
4309
|
-
const [mounted, setMounted] = React.useState(open);
|
|
4310
|
-
if (open && !mounted) {
|
|
4311
|
-
setMounted(true);
|
|
4312
|
-
setTransitionStatus('starting');
|
|
4313
|
-
}
|
|
4314
|
-
if (!open && mounted && transitionStatus !== 'ending' && !deferEndingState) {
|
|
4315
|
-
setTransitionStatus('ending');
|
|
4316
|
-
}
|
|
4317
|
-
if (!open && !mounted && transitionStatus === 'ending') {
|
|
4318
|
-
setTransitionStatus(undefined);
|
|
4319
|
-
}
|
|
4320
|
-
useIsoLayoutEffect(() => {
|
|
4321
|
-
if (!open && mounted && transitionStatus !== 'ending' && deferEndingState) {
|
|
4322
|
-
const frame = AnimationFrame.request(() => {
|
|
4323
|
-
setTransitionStatus('ending');
|
|
4324
|
-
});
|
|
4325
|
-
return () => {
|
|
4326
|
-
AnimationFrame.cancel(frame);
|
|
4327
|
-
};
|
|
4328
|
-
}
|
|
4329
|
-
return undefined;
|
|
4330
|
-
}, [open, mounted, transitionStatus, deferEndingState]);
|
|
4331
|
-
useIsoLayoutEffect(() => {
|
|
4332
|
-
if (!open || enableIdleState) {
|
|
4333
|
-
return undefined;
|
|
4334
|
-
}
|
|
4335
|
-
const frame = AnimationFrame.request(() => {
|
|
4336
|
-
// Avoid `flushSync` here due to Firefox.
|
|
4337
|
-
// See https://github.com/mui/base-ui/pull/3424
|
|
4338
|
-
setTransitionStatus(undefined);
|
|
4339
|
-
});
|
|
4340
|
-
return () => {
|
|
4341
|
-
AnimationFrame.cancel(frame);
|
|
4342
|
-
};
|
|
4343
|
-
}, [enableIdleState, open]);
|
|
4344
|
-
useIsoLayoutEffect(() => {
|
|
4345
|
-
if (!open || !enableIdleState) {
|
|
4346
|
-
return undefined;
|
|
4347
|
-
}
|
|
4348
|
-
if (open && mounted && transitionStatus !== 'idle') {
|
|
4349
|
-
setTransitionStatus('starting');
|
|
4350
|
-
}
|
|
4351
|
-
const frame = AnimationFrame.request(() => {
|
|
4352
|
-
setTransitionStatus('idle');
|
|
4353
|
-
});
|
|
4354
|
-
return () => {
|
|
4355
|
-
AnimationFrame.cancel(frame);
|
|
4356
|
-
};
|
|
4357
|
-
}, [enableIdleState, open, mounted, setTransitionStatus, transitionStatus]);
|
|
4358
|
-
return React.useMemo(() => ({
|
|
4359
|
-
mounted,
|
|
4360
|
-
setMounted,
|
|
4361
|
-
transitionStatus
|
|
4362
|
-
}), [mounted, transitionStatus]);
|
|
4363
|
-
}
|
|
4364
|
-
|
|
4365
|
-
/**
|
|
4366
|
-
* Executes a function once all animations have finished on the provided element.
|
|
4367
|
-
* @param elementOrRef - The element to watch for animations.
|
|
4368
|
-
* @param waitForStartingStyleRemoved - Whether to wait for [data-starting-style] to be removed before checking for animations.
|
|
4369
|
-
* @param treatAbortedAsFinished - Whether to treat aborted animations as finished. If `false`, and there are aborted animations,
|
|
4370
|
-
* the function will check again if any new animations have started and wait for them to finish.
|
|
4371
|
-
* @returns A function that takes a callback to execute once all animations have finished, and an optional AbortSignal to abort the callback
|
|
4372
|
-
*/
|
|
4373
|
-
function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) {
|
|
4374
|
-
const frame = useAnimationFrame();
|
|
4375
|
-
return useStableCallback((fnToExecute,
|
|
4376
|
-
/**
|
|
4377
|
-
* An optional [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that
|
|
4378
|
-
* can be used to abort `fnToExecute` before all the animations have finished.
|
|
4379
|
-
* @default null
|
|
4380
|
-
*/
|
|
4381
|
-
signal = null) => {
|
|
4382
|
-
frame.cancel();
|
|
4383
|
-
function done() {
|
|
4384
|
-
// Synchronously flush the unmounting of the component so that the browser doesn't
|
|
4385
|
-
// paint: https://github.com/mui/base-ui/issues/979
|
|
4386
|
-
ReactDOM.flushSync(fnToExecute);
|
|
4387
|
-
}
|
|
4388
|
-
const element = resolveRef(elementOrRef);
|
|
4389
|
-
if (element == null) {
|
|
4390
|
-
return;
|
|
4391
|
-
}
|
|
4392
|
-
const resolvedElement = element;
|
|
4393
|
-
if (typeof resolvedElement.getAnimations !== 'function' || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
|
|
4394
|
-
fnToExecute();
|
|
4395
|
-
} else {
|
|
4396
|
-
function execWaitForStartingStyleRemoved() {
|
|
4397
|
-
const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
|
|
4398
|
-
|
|
4399
|
-
// If `[data-starting-style]` isn't present, fall back to waiting one more frame
|
|
4400
|
-
// to give "open" animations a chance to be registered.
|
|
4401
|
-
if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
|
|
4402
|
-
frame.request(exec);
|
|
4403
|
-
return;
|
|
4404
|
-
}
|
|
4405
|
-
|
|
4406
|
-
// Wait for `[data-starting-style]` to have been removed.
|
|
4407
|
-
const attributeObserver = new MutationObserver(() => {
|
|
4408
|
-
if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
|
|
4409
|
-
attributeObserver.disconnect();
|
|
4410
|
-
exec();
|
|
4411
|
-
}
|
|
4412
|
-
});
|
|
4413
|
-
attributeObserver.observe(resolvedElement, {
|
|
4414
|
-
attributes: true,
|
|
4415
|
-
attributeFilter: [startingStyleAttribute]
|
|
4416
|
-
});
|
|
4417
|
-
signal?.addEventListener('abort', () => attributeObserver.disconnect(), {
|
|
4418
|
-
once: true
|
|
4419
|
-
});
|
|
4420
|
-
}
|
|
4421
|
-
function exec() {
|
|
4422
|
-
Promise.all(resolvedElement.getAnimations().map(anim => anim.finished)).then(() => {
|
|
4423
|
-
if (signal?.aborted) {
|
|
4424
|
-
return;
|
|
4425
|
-
}
|
|
4426
|
-
done();
|
|
4427
|
-
}).catch(() => {
|
|
4428
|
-
const currentAnimations = resolvedElement.getAnimations();
|
|
4429
|
-
if (treatAbortedAsFinished) {
|
|
4430
|
-
if (signal?.aborted) {
|
|
4431
|
-
return;
|
|
4432
|
-
}
|
|
4433
|
-
done();
|
|
4434
|
-
} else if (currentAnimations.length > 0 && currentAnimations.some(anim => anim.pending || anim.playState !== 'finished')) {
|
|
4435
|
-
// Sometimes animations can be aborted because a property they depend on changes while the animation plays.
|
|
4436
|
-
// In such cases, we need to re-check if any new animations have started.
|
|
4437
|
-
exec();
|
|
4438
|
-
}
|
|
4439
|
-
});
|
|
4440
|
-
}
|
|
4441
|
-
if (waitForStartingStyleRemoved) {
|
|
4442
|
-
execWaitForStartingStyleRemoved();
|
|
4443
|
-
return;
|
|
4444
|
-
}
|
|
4445
|
-
frame.request(exec);
|
|
4446
|
-
}
|
|
4447
|
-
});
|
|
4448
|
-
}
|
|
4449
|
-
|
|
4450
|
-
/**
|
|
4451
|
-
* Calls the provided function when the CSS open/close animation or transition completes.
|
|
4452
|
-
*/
|
|
4453
|
-
function useOpenChangeComplete(parameters) {
|
|
4454
|
-
const {
|
|
4455
|
-
enabled = true,
|
|
4456
|
-
open,
|
|
4457
|
-
ref,
|
|
4458
|
-
onComplete: onCompleteParam
|
|
4459
|
-
} = parameters;
|
|
4460
|
-
const onComplete = useStableCallback(onCompleteParam);
|
|
4461
|
-
const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false);
|
|
4462
|
-
React.useEffect(() => {
|
|
4463
|
-
if (!enabled) {
|
|
4464
|
-
return undefined;
|
|
4465
|
-
}
|
|
4466
|
-
const abortController = new AbortController();
|
|
4467
|
-
runOnceAnimationsFinish(onComplete, abortController.signal);
|
|
4468
|
-
return () => {
|
|
4469
|
-
abortController.abort();
|
|
4470
|
-
};
|
|
4471
|
-
}, [enabled, open, onComplete, runOnceAnimationsFinish]);
|
|
4472
|
-
}
|
|
4473
|
-
|
|
4474
3799
|
/**
|
|
4475
3800
|
* Returns a callback ref that registers/unregisters the trigger element in the store.
|
|
4476
3801
|
*
|
|
@@ -5105,10 +4430,6 @@ function useDrawerRootContext(optional) {
|
|
|
5105
4430
|
return drawerRootContext;
|
|
5106
4431
|
}
|
|
5107
4432
|
|
|
5108
|
-
function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
5109
|
-
return Math.max(min, Math.min(val, max));
|
|
5110
|
-
}
|
|
5111
|
-
|
|
5112
4433
|
function resolveSnapPointValue(snapPoint, viewportHeight, rootFontSize) {
|
|
5113
4434
|
if (!Number.isFinite(viewportHeight) || viewportHeight <= 0) {
|
|
5114
4435
|
return null;
|
|
@@ -5663,42 +4984,6 @@ if (process.env.NODE_ENV !== "production") DialogPortal.displayName = "DialogPor
|
|
|
5663
4984
|
*/
|
|
5664
4985
|
const DrawerPortal = DialogPortal;
|
|
5665
4986
|
|
|
5666
|
-
function useControlled({
|
|
5667
|
-
controlled,
|
|
5668
|
-
default: defaultProp,
|
|
5669
|
-
name,
|
|
5670
|
-
state = 'value'
|
|
5671
|
-
}) {
|
|
5672
|
-
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
5673
|
-
const {
|
|
5674
|
-
current: isControlled
|
|
5675
|
-
} = React.useRef(controlled !== undefined);
|
|
5676
|
-
const [valueState, setValue] = React.useState(defaultProp);
|
|
5677
|
-
const value = isControlled ? controlled : valueState;
|
|
5678
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5679
|
-
React.useEffect(() => {
|
|
5680
|
-
if (isControlled !== (controlled !== undefined)) {
|
|
5681
|
-
console.error([`Base UI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
5682
|
-
}
|
|
5683
|
-
}, [state, name, controlled]);
|
|
5684
|
-
const {
|
|
5685
|
-
current: defaultValue
|
|
5686
|
-
} = React.useRef(defaultProp);
|
|
5687
|
-
React.useEffect(() => {
|
|
5688
|
-
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is for more details.
|
|
5689
|
-
if (!isControlled && JSON.stringify(defaultValue) !== JSON.stringify(defaultProp)) {
|
|
5690
|
-
console.error([`Base UI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\n'));
|
|
5691
|
-
}
|
|
5692
|
-
}, [JSON.stringify(defaultProp)]);
|
|
5693
|
-
}
|
|
5694
|
-
const setValueIfUncontrolled = React.useCallback(newValue => {
|
|
5695
|
-
if (!isControlled) {
|
|
5696
|
-
setValue(newValue);
|
|
5697
|
-
}
|
|
5698
|
-
}, []);
|
|
5699
|
-
return [value, setValueIfUncontrolled];
|
|
5700
|
-
}
|
|
5701
|
-
|
|
5702
4987
|
function useOnFirstRender(fn) {
|
|
5703
4988
|
const ref = React.useRef(true);
|
|
5704
4989
|
if (ref.current) {
|
|
@@ -5979,20 +5264,6 @@ function useEnhancedClickHandler(handler) {
|
|
|
5979
5264
|
};
|
|
5980
5265
|
}
|
|
5981
5266
|
|
|
5982
|
-
function useValueChanged(value, onChange) {
|
|
5983
|
-
const valueRef = React.useRef(value);
|
|
5984
|
-
const onChangeCallback = useStableCallback(onChange);
|
|
5985
|
-
useIsoLayoutEffect(() => {
|
|
5986
|
-
if (valueRef.current === value) {
|
|
5987
|
-
return;
|
|
5988
|
-
}
|
|
5989
|
-
onChangeCallback(valueRef.current);
|
|
5990
|
-
}, [value, onChangeCallback]);
|
|
5991
|
-
useIsoLayoutEffect(() => {
|
|
5992
|
-
valueRef.current = value;
|
|
5993
|
-
}, [value]);
|
|
5994
|
-
}
|
|
5995
|
-
|
|
5996
5267
|
/**
|
|
5997
5268
|
* Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.
|
|
5998
5269
|
*
|
|
@@ -6517,4 +5788,4 @@ function DrawerProviderReporter() {
|
|
|
6517
5788
|
return null;
|
|
6518
5789
|
}
|
|
6519
5790
|
|
|
6520
|
-
export {
|
|
5791
|
+
export { createInitialPopupStoreState as $, ARROW_DOWN$1 as A, ARROW_RIGHT$1 as B, findNonDisabledListIndex as C, DrawerPortal as D, enqueueFocus as E, FloatingRootStore as F, ARROW_UP$1 as G, isElementVisible as H, useTriggerDataForwarding as I, useInteractions as J, CLICK_TRIGGER_IDENTIFIER as K, triggerOpenStateMapping as L, DISABLED_TRANSITIONS_STYLE as M, popupStateMapping as N, COMPOSITE_KEYS as O, PopupTriggerMap as P, FloatingFocusManager as Q, FloatingPortal as R, POPUP_COLLISION_AVOIDANCE as S, TYPEABLE_SELECTOR as T, InternalBackdrop as U, inertValue as V, FloatingNode as W, DROPDOWN_COLLISION_AVOIDANCE as X, popupStoreSelectors as Y, createSelector as Z, ReactStore as _, DrawerBackdrop as a, FloatingTreeStore as a0, fastComponent as a1, useOnFirstRender as a2, useFloatingNodeId as a3, useOpenInteractionType as a4, useImplicitActiveTrigger as a5, useOpenStateTransitions as a6, useScrollLock as a7, useSyncedFloatingRootContext as a8, useDismiss as a9, Store as aA, useRole as aa, TYPEAHEAD_RESET_MS as ab, FloatingTree as ac, fastComponentRef as ad, getTabbableBeforeElement as ae, isOutsideEvent as af, getTabbableAfterElement as ag, getNextTabbable as ah, pressableTriggerOpenStateMapping as ai, FocusGuard as aj, PATIENT_CLICK_THRESHOLD as ak, useTriggerRegistration as al, useDrawerProviderContext as am, DrawerBackdropCssVars as an, DrawerPopupCssVars as ao, DrawerProviderContext as ap, CommonPopupDataAttributes as aq, useDialogPortalContext as ar, DialogStore as as, useDrawerRootContext as at, DrawerPopupDataAttributes as au, useDrawerSnapPoints as av, DrawerViewportContext as aw, BASE_UI_SWIPE_IGNORE_SELECTOR as ax, DRAWER_CONTENT_ATTRIBUTE as ay, useStore as az, DrawerPopup as b, DrawerContent as c, DrawerRoot as d, useFloatingParentNodeId as e, useFloatingTree as f, getTarget as g, isTargetInsideEnabledTrigger as h, isTypeableElement as i, createAttribute as j, activeElement as k, contains as l, matchesFocusVisible as m, getNodeChildren as n, getFloatingFocusElement as o, isTypeableCombobox as p, isIndexOutOfListBounds as q, getMinListIndex as r, getMaxListIndex as s, createGridCellMap as t, useDialogRootContext as u, isListIndexDisabled as v, getGridNavigatedIndex as w, getGridCellIndices as x, getGridCellIndexOfCorner as y, ARROW_LEFT$1 as z };
|