@jobber/components 6.122.0 → 6.123.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 +2 -1
- package/dist/BottomSheet-cjs.js +66 -0
- package/dist/BottomSheet-es.js +64 -0
- package/dist/Card/index.cjs +3 -2
- package/dist/Card/index.mjs +3 -2
- package/dist/Chip/index.cjs +3 -2
- package/dist/Chip/index.mjs +3 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +3 -2
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +3 -2
- package/dist/Chips/InternalChipDismissible/index.cjs +3 -2
- package/dist/Chips/InternalChipDismissible/index.mjs +3 -2
- package/dist/Chips/index.cjs +3 -2
- package/dist/Chips/index.mjs +3 -2
- package/dist/Combobox/components/ComboboxActivator/index.cjs +3 -2
- package/dist/Combobox/components/ComboboxActivator/index.mjs +3 -2
- package/dist/Combobox/components/ComboboxContent/index.cjs +3 -2
- package/dist/Combobox/components/ComboboxContent/index.mjs +3 -2
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +3 -2
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +3 -2
- package/dist/Combobox/index.cjs +3 -2
- package/dist/Combobox/index.mjs +3 -2
- package/dist/ComboboxContent-es.js +1 -1
- package/dist/ConfirmationModal/index.cjs +2 -1
- package/dist/ConfirmationModal/index.mjs +2 -1
- package/dist/DataDump/index.cjs +3 -2
- package/dist/DataDump/index.mjs +3 -2
- package/dist/DataList/components/DataListActions/index.cjs +3 -2
- package/dist/DataList/components/DataListActions/index.mjs +3 -2
- package/dist/DataList/components/DataListBulkActions/index.cjs +3 -2
- package/dist/DataList/components/DataListBulkActions/index.mjs +3 -2
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +3 -2
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +3 -2
- package/dist/DataList/components/DataListFilters/index.cjs +3 -2
- package/dist/DataList/components/DataListFilters/index.mjs +3 -2
- package/dist/DataList/components/DataListHeader/index.cjs +3 -2
- package/dist/DataList/components/DataListHeader/index.mjs +3 -2
- package/dist/DataList/components/DataListItem/index.cjs +3 -2
- package/dist/DataList/components/DataListItem/index.mjs +3 -2
- package/dist/DataList/components/DataListItemActions/index.cjs +3 -2
- package/dist/DataList/components/DataListItemActions/index.mjs +3 -2
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +3 -2
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +3 -2
- package/dist/DataList/components/DataListItems/index.cjs +3 -2
- package/dist/DataList/components/DataListItems/index.mjs +3 -2
- package/dist/DataList/components/DataListLayout/index.cjs +3 -2
- package/dist/DataList/components/DataListLayout/index.mjs +3 -2
- package/dist/DataList/components/DataListLayoutActions/index.cjs +3 -2
- package/dist/DataList/components/DataListLayoutActions/index.mjs +3 -2
- package/dist/DataList/index.cjs +3 -2
- package/dist/DataList/index.mjs +3 -2
- package/dist/DatePicker/index.cjs +3 -2
- package/dist/DatePicker/index.mjs +3 -2
- package/dist/DatePicker-es.js +1 -1
- package/dist/DrawerRoot-cjs.js +6181 -0
- package/dist/DrawerRoot-es.js +6056 -0
- package/dist/FormatFile/index.cjs +2 -1
- package/dist/FormatFile/index.mjs +2 -1
- package/dist/Gallery/index.cjs +2 -1
- package/dist/Gallery/index.mjs +2 -1
- package/dist/InputDate/index.cjs +3 -2
- package/dist/InputDate/index.mjs +3 -2
- package/dist/LightBox/index.cjs +2 -1
- package/dist/LightBox/index.mjs +2 -1
- package/dist/Menu/index.cjs +3 -2
- package/dist/Menu/index.mjs +3 -2
- package/dist/Menu-es.js +1 -1
- package/dist/Modal/index.cjs +2 -1
- package/dist/Modal/index.mjs +2 -1
- package/dist/OverlaySeparator-cjs.js +15 -0
- package/dist/OverlaySeparator-es.js +13 -0
- package/dist/Page/index.cjs +2 -1
- package/dist/Page/index.mjs +2 -1
- package/dist/Popover/index.cjs +3 -2
- package/dist/Popover/index.mjs +3 -2
- package/dist/Popover-es.js +1 -1
- package/dist/Separator-cjs.js +53 -0
- package/dist/Separator-es.js +32 -0
- package/dist/Tooltip/index.cjs +3 -2
- package/dist/Tooltip/index.mjs +3 -2
- package/dist/Tooltip-es.js +1 -1
- package/dist/floating-ui.react-cjs.js +45 -44
- package/dist/floating-ui.react-dom-cjs.js +155 -1053
- package/dist/floating-ui.react-dom-es.js +2 -876
- package/dist/floating-ui.react-es.js +2 -1
- package/dist/index.cjs +3 -2
- package/dist/index.esm-cjs.js +921 -0
- package/dist/index.esm-es.js +876 -0
- package/dist/index.mjs +3 -2
- package/dist/primitives/BottomSheet/BottomSheet.d.ts +15 -0
- package/dist/primitives/BottomSheet/index.cjs +16 -0
- package/dist/primitives/BottomSheet/index.d.ts +1 -0
- package/dist/primitives/BottomSheet/index.mjs +10 -0
- package/dist/primitives/OverlaySeparator/OverlaySeparator.d.ts +6 -0
- package/dist/primitives/OverlaySeparator/index.cjs +12 -0
- package/dist/primitives/OverlaySeparator/index.d.ts +1 -0
- package/dist/primitives/OverlaySeparator/index.mjs +6 -0
- package/dist/primitives/index.cjs +17 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.mjs +12 -1
- package/dist/unstyledPrimitives/index.cjs +7676 -9833
- package/dist/unstyledPrimitives/index.d.ts +6 -9
- package/dist/unstyledPrimitives/index.mjs +7551 -9711
- package/dist/useRenderElement-cjs.js +598 -0
- package/dist/useRenderElement-es.js +569 -0
- package/dist/useScrollToActive-es.js +1 -1
- package/package.json +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var index_esm = require('./index.esm-cjs.js');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
|
+
var floatingUi_reactDom = require('./floating-ui.react-dom-cjs.js');
|
|
7
8
|
|
|
8
9
|
function _interopNamespaceDefault(e) {
|
|
9
10
|
var n = Object.create(null);
|
|
@@ -85,7 +86,7 @@ function contains(parent, child) {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
// then fallback to custom implementation with Shadow DOM support
|
|
88
|
-
if (rootNode &&
|
|
89
|
+
if (rootNode && index_esm.isShadowRoot(rootNode)) {
|
|
89
90
|
let next = child;
|
|
90
91
|
while (next) {
|
|
91
92
|
if (parent === next) {
|
|
@@ -127,7 +128,7 @@ function getDocument$1(node) {
|
|
|
127
128
|
return (node == null ? void 0 : node.ownerDocument) || document;
|
|
128
129
|
}
|
|
129
130
|
function isTypeableElement(element) {
|
|
130
|
-
return
|
|
131
|
+
return index_esm.isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
131
132
|
}
|
|
132
133
|
function isTypeableCombobox(element) {
|
|
133
134
|
if (!element) return false;
|
|
@@ -349,7 +350,7 @@ function getGridNavigatedIndex(listRef, _ref) {
|
|
|
349
350
|
|
|
350
351
|
// Remains on the same row/column.
|
|
351
352
|
if (orientation === 'both') {
|
|
352
|
-
const prevRow =
|
|
353
|
+
const prevRow = index_esm.floor(prevIndex / cols);
|
|
353
354
|
if (event.key === (rtl ? ARROW_LEFT$1 : ARROW_RIGHT$1)) {
|
|
354
355
|
stop && stopEvent(event);
|
|
355
356
|
if (prevIndex % cols !== cols - 1) {
|
|
@@ -399,7 +400,7 @@ function getGridNavigatedIndex(listRef, _ref) {
|
|
|
399
400
|
nextIndex = prevIndex;
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
|
-
const lastRow =
|
|
403
|
+
const lastRow = index_esm.floor(maxIndex / cols) === prevRow;
|
|
403
404
|
if (isIndexOutOfListBounds(listRef, nextIndex)) {
|
|
404
405
|
if (loop && lastRow) {
|
|
405
406
|
nextIndex = event.key === (rtl ? ARROW_RIGHT$1 : ARROW_LEFT$1) ? maxIndex : findNonDisabledListIndex(listRef, {
|
|
@@ -500,7 +501,7 @@ const getTabbableOptions = () => ({
|
|
|
500
501
|
typeof ResizeObserver === 'function' && ResizeObserver.toString().includes('[native code]') ? 'full' : 'none'
|
|
501
502
|
});
|
|
502
503
|
function getTabbableIn(container, dir) {
|
|
503
|
-
const list =
|
|
504
|
+
const list = index_esm.tabbable(container, getTabbableOptions());
|
|
504
505
|
const len = list.length;
|
|
505
506
|
if (len === 0) return;
|
|
506
507
|
const active = activeElement(getDocument$1(container));
|
|
@@ -520,7 +521,7 @@ function isOutsideEvent(event, container) {
|
|
|
520
521
|
return !relatedTarget || !contains(containerElement, relatedTarget);
|
|
521
522
|
}
|
|
522
523
|
function disableFocusInside(container) {
|
|
523
|
-
const tabbableElements =
|
|
524
|
+
const tabbableElements = index_esm.tabbable(container, getTabbableOptions());
|
|
524
525
|
tabbableElements.forEach(element => {
|
|
525
526
|
element.dataset.tabindex = element.getAttribute('tabindex') || '';
|
|
526
527
|
element.setAttribute('tabindex', '-1');
|
|
@@ -649,7 +650,7 @@ const FloatingArrow = /*#__PURE__*/React__namespace.forwardRef(function Floating
|
|
|
649
650
|
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
650
651
|
index(() => {
|
|
651
652
|
if (!floating) return;
|
|
652
|
-
const isRTL =
|
|
653
|
+
const isRTL = index_esm.getComputedStyle(floating).direction === 'rtl';
|
|
653
654
|
if (isRTL) {
|
|
654
655
|
setIsRTL(true);
|
|
655
656
|
}
|
|
@@ -922,7 +923,7 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner
|
|
|
922
923
|
return;
|
|
923
924
|
}
|
|
924
925
|
[].forEach.call(parent.children, node => {
|
|
925
|
-
if (
|
|
926
|
+
if (index_esm.getNodeName(node) === 'script') return;
|
|
926
927
|
if (elementsToKeep.has(node)) {
|
|
927
928
|
deep(node);
|
|
928
929
|
} else {
|
|
@@ -1076,7 +1077,7 @@ function useFloatingPortalNode(props) {
|
|
|
1076
1077
|
if (!uniqueId) return;
|
|
1077
1078
|
if (portalNodeRef.current) return;
|
|
1078
1079
|
let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
|
|
1079
|
-
if (container && !
|
|
1080
|
+
if (container && !index_esm.isNode(container)) container = container.current;
|
|
1080
1081
|
container = container || document.body;
|
|
1081
1082
|
let idWrapper = null;
|
|
1082
1083
|
if (id) {
|
|
@@ -1224,7 +1225,7 @@ function clearDisconnectedPreviouslyFocusedElements() {
|
|
|
1224
1225
|
}
|
|
1225
1226
|
function addPreviouslyFocusedElement(element) {
|
|
1226
1227
|
clearDisconnectedPreviouslyFocusedElements();
|
|
1227
|
-
if (element &&
|
|
1228
|
+
if (element && index_esm.getNodeName(element) !== 'body') {
|
|
1228
1229
|
previouslyFocusedElements.push(element);
|
|
1229
1230
|
if (previouslyFocusedElements.length > LIST_LIMIT) {
|
|
1230
1231
|
previouslyFocusedElements = previouslyFocusedElements.slice(-20);
|
|
@@ -1237,10 +1238,10 @@ function getPreviouslyFocusedElement() {
|
|
|
1237
1238
|
}
|
|
1238
1239
|
function getFirstTabbableElement(container) {
|
|
1239
1240
|
const tabbableOptions = getTabbableOptions();
|
|
1240
|
-
if (
|
|
1241
|
+
if (index_esm.isTabbable(container, tabbableOptions)) {
|
|
1241
1242
|
return container;
|
|
1242
1243
|
}
|
|
1243
|
-
return
|
|
1244
|
+
return index_esm.tabbable(container, tabbableOptions)[0] || container;
|
|
1244
1245
|
}
|
|
1245
1246
|
function handleTabIndex(floatingFocusElement, orderRef) {
|
|
1246
1247
|
var _floatingFocusElement;
|
|
@@ -1248,10 +1249,10 @@ function handleTabIndex(floatingFocusElement, orderRef) {
|
|
|
1248
1249
|
return;
|
|
1249
1250
|
}
|
|
1250
1251
|
const options = getTabbableOptions();
|
|
1251
|
-
const focusableElements =
|
|
1252
|
+
const focusableElements = index_esm.focusable(floatingFocusElement, options);
|
|
1252
1253
|
const tabbableContent = focusableElements.filter(element => {
|
|
1253
1254
|
const dataTabIndex = element.getAttribute('data-tabindex') || '';
|
|
1254
|
-
return
|
|
1255
|
+
return index_esm.isTabbable(element, options) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');
|
|
1255
1256
|
});
|
|
1256
1257
|
const tabIndex = floatingFocusElement.getAttribute('tabindex');
|
|
1257
1258
|
if (orderRef.current.includes('floating') || tabbableContent.length === 0) {
|
|
@@ -1336,7 +1337,7 @@ function FloatingFocusManager(props) {
|
|
|
1336
1337
|
if (container === void 0) {
|
|
1337
1338
|
container = floatingFocusElement;
|
|
1338
1339
|
}
|
|
1339
|
-
return container ?
|
|
1340
|
+
return container ? index_esm.tabbable(container, getTabbableOptions()) : [];
|
|
1340
1341
|
});
|
|
1341
1342
|
const getTabbableElements = useEffectEvent(container => {
|
|
1342
1343
|
const content = getTabbableContent(container);
|
|
@@ -1430,13 +1431,13 @@ function FloatingFocusManager(props) {
|
|
|
1430
1431
|
if (restoreFocus && currentTarget !== domReference && !(target != null && target.isConnected) && activeElement(getDocument$1(floatingFocusElement)) === getDocument$1(floatingFocusElement).body) {
|
|
1431
1432
|
// Let `FloatingPortal` effect knows that focus is still inside the
|
|
1432
1433
|
// floating tree.
|
|
1433
|
-
if (
|
|
1434
|
+
if (index_esm.isHTMLElement(floatingFocusElement)) {
|
|
1434
1435
|
floatingFocusElement.focus();
|
|
1435
1436
|
}
|
|
1436
1437
|
const prevTabbableIndex = tabbableIndexRef.current;
|
|
1437
1438
|
const tabbableContent = getTabbableContent();
|
|
1438
1439
|
const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
|
|
1439
|
-
if (
|
|
1440
|
+
if (index_esm.isHTMLElement(nodeToFocus)) {
|
|
1440
1441
|
nodeToFocus.focus();
|
|
1441
1442
|
}
|
|
1442
1443
|
}
|
|
@@ -1465,7 +1466,7 @@ function FloatingFocusManager(props) {
|
|
|
1465
1466
|
dataRef.current.insideReactTree = false;
|
|
1466
1467
|
});
|
|
1467
1468
|
}
|
|
1468
|
-
if (floating &&
|
|
1469
|
+
if (floating && index_esm.isHTMLElement(domReference)) {
|
|
1469
1470
|
domReference.addEventListener('focusout', handleFocusOutside);
|
|
1470
1471
|
domReference.addEventListener('pointerdown', handlePointerDown);
|
|
1471
1472
|
floating.addEventListener('focusout', handleFocusOutside);
|
|
@@ -1505,7 +1506,7 @@ function FloatingFocusManager(props) {
|
|
|
1505
1506
|
};
|
|
1506
1507
|
}, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards, useInert, tree, getNodeId, getInsideElements]);
|
|
1507
1508
|
index(() => {
|
|
1508
|
-
if (disabled || !
|
|
1509
|
+
if (disabled || !index_esm.isHTMLElement(floatingFocusElement)) return;
|
|
1509
1510
|
const doc = getDocument$1(floatingFocusElement);
|
|
1510
1511
|
const previouslyFocusedElement = activeElement(doc);
|
|
1511
1512
|
|
|
@@ -1587,7 +1588,7 @@ function FloatingFocusManager(props) {
|
|
|
1587
1588
|
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
|
1588
1589
|
if (
|
|
1589
1590
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1590
|
-
returnFocusRef.current && !preventReturnFocusRef.current &&
|
|
1591
|
+
returnFocusRef.current && !preventReturnFocusRef.current && index_esm.isHTMLElement(tabbableReturnElement) && (
|
|
1591
1592
|
// If the focus moved somewhere else after mount, avoid returning focus
|
|
1592
1593
|
// since it likely entered a different element which should be
|
|
1593
1594
|
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
@@ -1778,10 +1779,10 @@ const FloatingOverlay = /*#__PURE__*/React__namespace.forwardRef(function Floati
|
|
|
1778
1779
|
});
|
|
1779
1780
|
|
|
1780
1781
|
function isButtonTarget(event) {
|
|
1781
|
-
return
|
|
1782
|
+
return index_esm.isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
|
|
1782
1783
|
}
|
|
1783
1784
|
function isAnchorTarget(event) {
|
|
1784
|
-
return
|
|
1785
|
+
return index_esm.isHTMLElement(event.target) && event.target.tagName === 'A';
|
|
1785
1786
|
}
|
|
1786
1787
|
function isSpaceIgnored(element) {
|
|
1787
1788
|
return isTypeableElement(element);
|
|
@@ -2006,10 +2007,10 @@ function useDismiss(context, props) {
|
|
|
2006
2007
|
const target = getTarget(event);
|
|
2007
2008
|
const inertSelector = "[" + createAttribute('inert') + "]";
|
|
2008
2009
|
const markers = getDocument$1(elements.floating).querySelectorAll(inertSelector);
|
|
2009
|
-
let targetRootAncestor =
|
|
2010
|
-
while (targetRootAncestor && !
|
|
2011
|
-
const nextParent =
|
|
2012
|
-
if (
|
|
2010
|
+
let targetRootAncestor = index_esm.isElement(target) ? target : null;
|
|
2011
|
+
while (targetRootAncestor && !index_esm.isLastTraversableNode(targetRootAncestor)) {
|
|
2012
|
+
const nextParent = index_esm.getParentNode(targetRootAncestor);
|
|
2013
|
+
if (index_esm.isLastTraversableNode(nextParent) || !index_esm.isElement(nextParent)) {
|
|
2013
2014
|
break;
|
|
2014
2015
|
}
|
|
2015
2016
|
targetRootAncestor = nextParent;
|
|
@@ -2017,7 +2018,7 @@ function useDismiss(context, props) {
|
|
|
2017
2018
|
|
|
2018
2019
|
// Check if the click occurred on a third-party element injected after the
|
|
2019
2020
|
// floating element rendered.
|
|
2020
|
-
if (markers.length &&
|
|
2021
|
+
if (markers.length && index_esm.isElement(target) && !isRootElement(target) &&
|
|
2021
2022
|
// Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
2022
2023
|
!contains(target, elements.floating) &&
|
|
2023
2024
|
// If the target root element contains none of the markers, then the
|
|
@@ -2027,9 +2028,9 @@ function useDismiss(context, props) {
|
|
|
2027
2028
|
}
|
|
2028
2029
|
|
|
2029
2030
|
// Check if the click occurred on the scrollbar
|
|
2030
|
-
if (
|
|
2031
|
-
const lastTraversableNode =
|
|
2032
|
-
const style =
|
|
2031
|
+
if (index_esm.isHTMLElement(target) && floating) {
|
|
2032
|
+
const lastTraversableNode = index_esm.isLastTraversableNode(target);
|
|
2033
|
+
const style = index_esm.getComputedStyle(target);
|
|
2033
2034
|
const scrollRe = /auto|scroll/;
|
|
2034
2035
|
const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
|
|
2035
2036
|
const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
|
|
@@ -2104,7 +2105,7 @@ function useDismiss(context, props) {
|
|
|
2104
2105
|
},
|
|
2105
2106
|
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
2106
2107
|
// Only apply to WebKit for the test to remain 0ms.
|
|
2107
|
-
|
|
2108
|
+
index_esm.isWebKit() ? 5 : 0);
|
|
2108
2109
|
}
|
|
2109
2110
|
const doc = getDocument$1(elements.floating);
|
|
2110
2111
|
if (escapeKey) {
|
|
@@ -2115,14 +2116,14 @@ function useDismiss(context, props) {
|
|
|
2115
2116
|
outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
2116
2117
|
let ancestors = [];
|
|
2117
2118
|
if (ancestorScroll) {
|
|
2118
|
-
if (
|
|
2119
|
-
ancestors =
|
|
2119
|
+
if (index_esm.isElement(elements.domReference)) {
|
|
2120
|
+
ancestors = index_esm.getOverflowAncestors(elements.domReference);
|
|
2120
2121
|
}
|
|
2121
|
-
if (
|
|
2122
|
-
ancestors = ancestors.concat(
|
|
2122
|
+
if (index_esm.isElement(elements.floating)) {
|
|
2123
|
+
ancestors = ancestors.concat(index_esm.getOverflowAncestors(elements.floating));
|
|
2123
2124
|
}
|
|
2124
|
-
if (!
|
|
2125
|
-
ancestors = ancestors.concat(
|
|
2125
|
+
if (!index_esm.isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
|
|
2126
|
+
ancestors = ancestors.concat(index_esm.getOverflowAncestors(elements.reference.contextElement));
|
|
2126
2127
|
}
|
|
2127
2128
|
}
|
|
2128
2129
|
|
|
@@ -2195,7 +2196,7 @@ function useFloatingRootContext(options) {
|
|
|
2195
2196
|
const nested = useFloatingParentNodeId() != null;
|
|
2196
2197
|
if (process.env.NODE_ENV !== "production") {
|
|
2197
2198
|
const optionDomReference = elementsProp.reference;
|
|
2198
|
-
if (optionDomReference && !
|
|
2199
|
+
if (optionDomReference && !index_esm.isElement(optionDomReference)) {
|
|
2199
2200
|
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
2200
2201
|
}
|
|
2201
2202
|
}
|
|
@@ -2271,7 +2272,7 @@ function useFloating(options) {
|
|
|
2271
2272
|
}
|
|
2272
2273
|
});
|
|
2273
2274
|
const setPositionReference = React__namespace.useCallback(node => {
|
|
2274
|
-
const computedPositionReference =
|
|
2275
|
+
const computedPositionReference = index_esm.isElement(node) ? {
|
|
2275
2276
|
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
2276
2277
|
getClientRects: () => node.getClientRects(),
|
|
2277
2278
|
contextElement: node
|
|
@@ -2282,18 +2283,18 @@ function useFloating(options) {
|
|
|
2282
2283
|
position.refs.setReference(computedPositionReference);
|
|
2283
2284
|
}, [position.refs]);
|
|
2284
2285
|
const setReference = React__namespace.useCallback(node => {
|
|
2285
|
-
if (
|
|
2286
|
+
if (index_esm.isElement(node) || node === null) {
|
|
2286
2287
|
domReferenceRef.current = node;
|
|
2287
2288
|
setDomReference(node);
|
|
2288
2289
|
}
|
|
2289
2290
|
|
|
2290
2291
|
// Backwards-compatibility for passing a virtual element to `reference`
|
|
2291
2292
|
// after it has set the DOM reference.
|
|
2292
|
-
if (
|
|
2293
|
+
if (index_esm.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
2293
2294
|
// Don't allow setting virtual elements using the old technique back to
|
|
2294
2295
|
// `null` to support `positionReference` + an unstable `reference`
|
|
2295
2296
|
// callback ref.
|
|
2296
|
-
node !== null && !
|
|
2297
|
+
node !== null && !index_esm.isElement(node)) {
|
|
2297
2298
|
position.refs.setReference(node);
|
|
2298
2299
|
}
|
|
2299
2300
|
}, [position.refs]);
|
|
@@ -2766,7 +2767,7 @@ function useListNavigation(context, props) {
|
|
|
2766
2767
|
stopEvent(event);
|
|
2767
2768
|
}
|
|
2768
2769
|
onOpenChange(false, event.nativeEvent, 'list-navigation');
|
|
2769
|
-
if (
|
|
2770
|
+
if (index_esm.isHTMLElement(elements.domReference)) {
|
|
2770
2771
|
if (virtual) {
|
|
2771
2772
|
tree == null || tree.events.emit('virtualfocus', elements.domReference);
|
|
2772
2773
|
} else {
|