@jobber/components 9.3.0 → 9.5.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 +0 -1
- package/dist/Autocomplete/index.mjs +0 -1
- package/dist/Card/index.cjs +7 -7
- package/dist/Card/index.mjs +7 -7
- package/dist/Chip/index.cjs +0 -1
- package/dist/Chip/index.mjs +0 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -1
- package/dist/Chips/InternalChipDismissible/index.cjs +0 -1
- package/dist/Chips/InternalChipDismissible/index.mjs +0 -1
- package/dist/Chips/index.cjs +0 -1
- package/dist/Chips/index.mjs +0 -1
- package/dist/ComboboxChipRemove-cjs.js +181 -184
- package/dist/ComboboxChipRemove-es.js +4 -7
- package/dist/ConfirmationModal/index.cjs +0 -1
- package/dist/ConfirmationModal/index.mjs +0 -1
- package/dist/DataDump/DataDump.d.ts +1 -1
- package/dist/DataDump/DataDump.messages.d.ts +6 -0
- package/dist/DataDump/index.cjs +9 -9
- package/dist/DataDump/index.mjs +9 -9
- package/dist/DataDump-cjs.js +11 -1
- package/dist/DataDump-es.js +11 -1
- package/dist/DataList/components/DataListActions/index.cjs +0 -1
- package/dist/DataList/components/DataListActions/index.mjs +0 -1
- package/dist/DataList/components/DataListBulkActions/index.cjs +0 -1
- package/dist/DataList/components/DataListBulkActions/index.mjs +0 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -1
- package/dist/DataList/components/DataListFilters/index.cjs +0 -1
- package/dist/DataList/components/DataListFilters/index.mjs +0 -1
- package/dist/DataList/components/DataListHeader/index.cjs +0 -1
- package/dist/DataList/components/DataListHeader/index.mjs +0 -1
- package/dist/DataList/components/DataListItem/index.cjs +0 -1
- package/dist/DataList/components/DataListItem/index.mjs +0 -1
- package/dist/DataList/components/DataListItemActions/index.cjs +0 -1
- package/dist/DataList/components/DataListItemActions/index.mjs +0 -1
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -1
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -1
- package/dist/DataList/components/DataListItems/index.cjs +0 -1
- package/dist/DataList/components/DataListItems/index.mjs +0 -1
- package/dist/DataList/components/DataListLayout/index.cjs +0 -1
- package/dist/DataList/components/DataListLayout/index.mjs +0 -1
- package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -1
- package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -1
- package/dist/DataList/index.cjs +0 -1
- package/dist/DataList/index.mjs +0 -1
- package/dist/DataTable/DataTable.messages.d.ts +22 -0
- package/dist/DataTable/index.cjs +2 -2
- package/dist/DataTable/index.mjs +2 -2
- package/dist/DataTable-cjs.js +34 -5
- package/dist/DataTable-es.js +34 -5
- package/dist/DatePicker/index.cjs +0 -2
- package/dist/DatePicker/index.mjs +0 -2
- package/dist/DatePicker-cjs.js +19 -18
- package/dist/DatePicker-es.js +2 -1
- package/dist/Dialog/index.cjs +11 -6
- package/dist/Dialog/index.mjs +11 -6
- package/dist/DrawerDescription-cjs.js +7 -8
- package/dist/DrawerDescription-es.js +1 -2
- package/dist/DrawerTitle-cjs.js +4 -4
- package/dist/DrawerTitle-es.js +1 -1
- package/dist/FeatureSwitch/FeatureSwitch.messages.d.ts +10 -0
- package/dist/FeatureSwitch/index.cjs +2 -0
- package/dist/FeatureSwitch/index.mjs +2 -0
- package/dist/FeatureSwitch-cjs.js +15 -2
- package/dist/FeatureSwitch-es.js +15 -2
- package/dist/FieldDescription-cjs.js +49 -49
- package/dist/FieldDescription-es.js +2 -2
- package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +0 -1
- package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +0 -1
- package/dist/FilterPicker/components/FilterPickerContent/index.cjs +0 -1
- package/dist/FilterPicker/components/FilterPickerContent/index.mjs +0 -1
- package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +0 -1
- package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +0 -1
- package/dist/FilterPicker/index.cjs +0 -1
- package/dist/FilterPicker/index.mjs +0 -1
- package/dist/FormatFile/FormatFile.messages.d.ts +18 -0
- package/dist/FormatFile/index.cjs +2 -3
- package/dist/FormatFile/index.mjs +2 -3
- package/dist/FormatFile-cjs.js +24 -2
- package/dist/FormatFile-es.js +24 -2
- package/dist/Gallery/index.cjs +0 -1
- package/dist/Gallery/index.mjs +0 -1
- package/dist/HelperText-cjs.js +3 -2
- package/dist/HelperText-es.js +3 -2
- package/dist/InputDate/index.cjs +0 -2
- package/dist/InputDate/index.mjs +0 -2
- package/dist/InputNumber/InputNumber.d.ts +75 -5
- package/dist/InputNumber/index.cjs +27 -3
- package/dist/InputNumber/index.d.ts +2 -2
- package/dist/InputNumber/index.mjs +27 -3
- package/dist/{primitives/InputNumberExperimental → InputNumber}/types.d.ts +48 -35
- package/dist/InputNumber-cjs.js +267 -4986
- package/dist/InputNumber-es.js +268 -4987
- package/dist/LightBox/index.cjs +0 -1
- package/dist/LightBox/index.mjs +0 -1
- package/dist/Menu/index.cjs +7 -7
- package/dist/Menu/index.mjs +7 -7
- package/dist/Menu-cjs.js +5 -1
- package/dist/Menu-es.js +5 -2
- package/dist/MenuSubmenuTrigger-cjs.js +142 -143
- package/dist/MenuSubmenuTrigger-es.js +5 -6
- package/dist/Modal/index.cjs +0 -1
- package/dist/Modal/index.mjs +0 -1
- package/dist/NumberFieldInput-cjs.js +63 -63
- package/dist/NumberFieldInput-es.js +5 -5
- package/dist/Page/index.cjs +18 -19
- package/dist/Page/index.mjs +18 -19
- package/dist/Page-cjs.js +6 -3
- package/dist/Page-es.js +6 -3
- package/dist/Popover/index.cjs +0 -1
- package/dist/Popover/index.mjs +0 -1
- package/dist/ProgressBar/ProgressBar.messages.d.ts +6 -0
- package/dist/ProgressBar/index.cjs +2 -0
- package/dist/ProgressBar/index.mjs +2 -0
- package/dist/ProgressBar-cjs.js +13 -1
- package/dist/ProgressBar-es.js +13 -1
- package/dist/ScrollAreaViewport-cjs.js +119 -121
- package/dist/ScrollAreaViewport-es.js +3 -5
- package/dist/Select/index.cjs +3 -9
- package/dist/Select/index.mjs +3 -9
- package/dist/SelectGroupLabel-cjs.js +117 -107
- package/dist/SelectGroupLabel-es.js +20 -12
- package/dist/Toast/Toast.messages.d.ts +6 -0
- package/dist/Toast/index.cjs +3 -1
- package/dist/Toast/index.mjs +3 -1
- package/dist/Toast/showToast.d.ts +12 -1
- package/dist/Tooltip/index.cjs +0 -1
- package/dist/Tooltip/index.mjs +0 -1
- package/dist/dialogReturnFocus-cjs.js +4 -1
- package/dist/dialogReturnFocus-es.js +4 -1
- package/dist/docs/DataDump/DataDump.md +1 -1
- package/dist/docs/InputNumber/InputNumber.md +564 -56
- package/dist/docs/Page/Page.md +1 -1
- package/dist/docs/index.md +0 -1
- package/dist/floating-ui.react-cjs.js +34 -35
- package/dist/floating-ui.react-dom-cjs.js +64 -65
- package/dist/floating-ui.react-dom-es.js +1 -2
- package/dist/floating-ui.react-es.js +1 -2
- package/dist/floating-ui.utils-cjs.js +183 -0
- package/dist/floating-ui.utils-es.js +165 -1
- package/dist/index.cjs +10 -15
- package/dist/index.mjs +10 -15
- package/dist/primitives/BottomSheet/index.cjs +2 -5
- package/dist/primitives/BottomSheet/index.mjs +2 -5
- package/dist/primitives/ComboboxPrimitive/index.cjs +3 -7
- package/dist/primitives/ComboboxPrimitive/index.mjs +3 -7
- package/dist/primitives/HelperText/HelperText.d.ts +4 -1
- package/dist/primitives/HelperText/index.cjs +1 -1
- package/dist/primitives/HelperText/index.mjs +1 -1
- package/dist/primitives/SelectPrimitive/index.cjs +3 -9
- package/dist/primitives/SelectPrimitive/index.mjs +3 -9
- package/dist/primitives/index.cjs +2 -16
- package/dist/primitives/index.d.ts +0 -2
- package/dist/primitives/index.mjs +2 -15
- package/dist/scrollEdges-cjs.js +6 -2
- package/dist/scrollEdges-es.js +5 -2
- package/dist/sharedHelpers/i18n/renderWithLocale.d.ts +11 -0
- package/dist/showToast-cjs.js +20 -6
- package/dist/showToast-es.js +20 -6
- package/dist/styles.css +573 -902
- package/dist/unstyledPrimitives/index.cjs +105 -111
- package/dist/unstyledPrimitives/index.mjs +5 -11
- package/dist/useCompositeListItem-cjs.js +516 -90
- package/dist/useCompositeListItem-es.js +407 -6
- package/dist/useLabel-cjs.js +10 -10
- package/dist/useLabel-es.js +3 -3
- package/dist/useRenderElement-es.js +1 -1
- package/dist/useScrollLock-cjs.js +1332 -203
- package/dist/useScrollLock-es.js +1068 -5
- package/dist/utils/meta/meta.json +12 -0
- package/package.json +2 -3
- package/dist/InputNumber/InputNumber.types.d.ts +0 -20
- package/dist/InputNumberExperimental-cjs.js +0 -277
- package/dist/InputNumberExperimental-es.js +0 -275
- package/dist/clamp-cjs.js +0 -7
- package/dist/clamp-es.js +0 -5
- package/dist/clsx-cjs.js +0 -5
- package/dist/clsx-es.js +0 -3
- package/dist/docs/InputNumberExperimental/InputNumberExperimental.md +0 -578
- package/dist/floating-ui.utils.dom-cjs.js +0 -185
- package/dist/floating-ui.utils.dom-es.js +0 -165
- package/dist/isElementDisabled-cjs.js +0 -40
- package/dist/isElementDisabled-es.js +0 -18
- package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +0 -77
- package/dist/primitives/InputNumberExperimental/index.cjs +0 -30
- package/dist/primitives/InputNumberExperimental/index.d.ts +0 -2
- package/dist/primitives/InputNumberExperimental/index.mjs +0 -24
- package/dist/resolveAriaLabelledBy-cjs.js +0 -200
- package/dist/resolveAriaLabelledBy-es.js +0 -166
- package/dist/useButton-cjs.js +0 -1164
- package/dist/useButton-es.js +0 -1071
- package/dist/useLabelableId-cjs.js +0 -278
- package/dist/useLabelableId-es.js +0 -247
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
5
4
|
var floatingUi_utils = require('./floating-ui.utils-cjs.js');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
var ReactDOM = require('react-dom');
|
|
@@ -663,7 +662,7 @@ function contains(parent, child) {
|
|
|
663
662
|
}
|
|
664
663
|
|
|
665
664
|
// then fallback to custom implementation with Shadow DOM support
|
|
666
|
-
if (rootNode &&
|
|
665
|
+
if (rootNode && floatingUi_utils.isShadowRoot(rootNode)) {
|
|
667
666
|
let next = child;
|
|
668
667
|
while (next) {
|
|
669
668
|
if (parent === next) {
|
|
@@ -705,7 +704,7 @@ function getDocument$1(node) {
|
|
|
705
704
|
return (node == null ? void 0 : node.ownerDocument) || document;
|
|
706
705
|
}
|
|
707
706
|
function isTypeableElement(element) {
|
|
708
|
-
return
|
|
707
|
+
return floatingUi_utils.isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
709
708
|
}
|
|
710
709
|
function isTypeableCombobox(element) {
|
|
711
710
|
if (!element) return false;
|
|
@@ -1227,7 +1226,7 @@ const FloatingArrow = /*#__PURE__*/React__namespace.forwardRef(function Floating
|
|
|
1227
1226
|
// https://github.com/floating-ui/floating-ui/issues/2932
|
|
1228
1227
|
index(() => {
|
|
1229
1228
|
if (!floating) return;
|
|
1230
|
-
const isRTL =
|
|
1229
|
+
const isRTL = floatingUi_utils.getComputedStyle(floating).direction === 'rtl';
|
|
1231
1230
|
if (isRTL) {
|
|
1232
1231
|
setIsRTL(true);
|
|
1233
1232
|
}
|
|
@@ -1500,7 +1499,7 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner
|
|
|
1500
1499
|
return;
|
|
1501
1500
|
}
|
|
1502
1501
|
[].forEach.call(parent.children, node => {
|
|
1503
|
-
if (
|
|
1502
|
+
if (floatingUi_utils.getNodeName(node) === 'script') return;
|
|
1504
1503
|
if (elementsToKeep.has(node)) {
|
|
1505
1504
|
deep(node);
|
|
1506
1505
|
} else {
|
|
@@ -1654,7 +1653,7 @@ function useFloatingPortalNode(props) {
|
|
|
1654
1653
|
if (!uniqueId) return;
|
|
1655
1654
|
if (portalNodeRef.current) return;
|
|
1656
1655
|
let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
|
|
1657
|
-
if (container && !
|
|
1656
|
+
if (container && !floatingUi_utils.isNode(container)) container = container.current;
|
|
1658
1657
|
container = container || document.body;
|
|
1659
1658
|
let idWrapper = null;
|
|
1660
1659
|
if (id) {
|
|
@@ -1802,7 +1801,7 @@ function clearDisconnectedPreviouslyFocusedElements() {
|
|
|
1802
1801
|
}
|
|
1803
1802
|
function addPreviouslyFocusedElement(element) {
|
|
1804
1803
|
clearDisconnectedPreviouslyFocusedElements();
|
|
1805
|
-
if (element &&
|
|
1804
|
+
if (element && floatingUi_utils.getNodeName(element) !== 'body') {
|
|
1806
1805
|
previouslyFocusedElements.push(element);
|
|
1807
1806
|
if (previouslyFocusedElements.length > LIST_LIMIT) {
|
|
1808
1807
|
previouslyFocusedElements = previouslyFocusedElements.slice(-20);
|
|
@@ -2008,13 +2007,13 @@ function FloatingFocusManager(props) {
|
|
|
2008
2007
|
if (restoreFocus && currentTarget !== domReference && !(target != null && target.isConnected) && activeElement(getDocument$1(floatingFocusElement)) === getDocument$1(floatingFocusElement).body) {
|
|
2009
2008
|
// Let `FloatingPortal` effect knows that focus is still inside the
|
|
2010
2009
|
// floating tree.
|
|
2011
|
-
if (
|
|
2010
|
+
if (floatingUi_utils.isHTMLElement(floatingFocusElement)) {
|
|
2012
2011
|
floatingFocusElement.focus();
|
|
2013
2012
|
}
|
|
2014
2013
|
const prevTabbableIndex = tabbableIndexRef.current;
|
|
2015
2014
|
const tabbableContent = getTabbableContent();
|
|
2016
2015
|
const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
|
|
2017
|
-
if (
|
|
2016
|
+
if (floatingUi_utils.isHTMLElement(nodeToFocus)) {
|
|
2018
2017
|
nodeToFocus.focus();
|
|
2019
2018
|
}
|
|
2020
2019
|
}
|
|
@@ -2043,7 +2042,7 @@ function FloatingFocusManager(props) {
|
|
|
2043
2042
|
dataRef.current.insideReactTree = false;
|
|
2044
2043
|
});
|
|
2045
2044
|
}
|
|
2046
|
-
if (floating &&
|
|
2045
|
+
if (floating && floatingUi_utils.isHTMLElement(domReference)) {
|
|
2047
2046
|
domReference.addEventListener('focusout', handleFocusOutside);
|
|
2048
2047
|
domReference.addEventListener('pointerdown', handlePointerDown);
|
|
2049
2048
|
floating.addEventListener('focusout', handleFocusOutside);
|
|
@@ -2083,7 +2082,7 @@ function FloatingFocusManager(props) {
|
|
|
2083
2082
|
};
|
|
2084
2083
|
}, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards, useInert, tree, getNodeId, getInsideElements]);
|
|
2085
2084
|
index(() => {
|
|
2086
|
-
if (disabled || !
|
|
2085
|
+
if (disabled || !floatingUi_utils.isHTMLElement(floatingFocusElement)) return;
|
|
2087
2086
|
const doc = getDocument$1(floatingFocusElement);
|
|
2088
2087
|
const previouslyFocusedElement = activeElement(doc);
|
|
2089
2088
|
|
|
@@ -2165,7 +2164,7 @@ function FloatingFocusManager(props) {
|
|
|
2165
2164
|
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
|
2166
2165
|
if (
|
|
2167
2166
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2168
|
-
returnFocusRef.current && !preventReturnFocusRef.current &&
|
|
2167
|
+
returnFocusRef.current && !preventReturnFocusRef.current && floatingUi_utils.isHTMLElement(tabbableReturnElement) && (
|
|
2169
2168
|
// If the focus moved somewhere else after mount, avoid returning focus
|
|
2170
2169
|
// since it likely entered a different element which should be
|
|
2171
2170
|
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
@@ -2356,10 +2355,10 @@ const FloatingOverlay = /*#__PURE__*/React__namespace.forwardRef(function Floati
|
|
|
2356
2355
|
});
|
|
2357
2356
|
|
|
2358
2357
|
function isButtonTarget(event) {
|
|
2359
|
-
return
|
|
2358
|
+
return floatingUi_utils.isHTMLElement(event.target) && event.target.tagName === 'BUTTON';
|
|
2360
2359
|
}
|
|
2361
2360
|
function isAnchorTarget(event) {
|
|
2362
|
-
return
|
|
2361
|
+
return floatingUi_utils.isHTMLElement(event.target) && event.target.tagName === 'A';
|
|
2363
2362
|
}
|
|
2364
2363
|
function isSpaceIgnored(element) {
|
|
2365
2364
|
return isTypeableElement(element);
|
|
@@ -2584,10 +2583,10 @@ function useDismiss(context, props) {
|
|
|
2584
2583
|
const target = getTarget(event);
|
|
2585
2584
|
const inertSelector = "[" + createAttribute('inert') + "]";
|
|
2586
2585
|
const markers = getDocument$1(elements.floating).querySelectorAll(inertSelector);
|
|
2587
|
-
let targetRootAncestor =
|
|
2588
|
-
while (targetRootAncestor && !
|
|
2589
|
-
const nextParent =
|
|
2590
|
-
if (
|
|
2586
|
+
let targetRootAncestor = floatingUi_utils.isElement(target) ? target : null;
|
|
2587
|
+
while (targetRootAncestor && !floatingUi_utils.isLastTraversableNode(targetRootAncestor)) {
|
|
2588
|
+
const nextParent = floatingUi_utils.getParentNode(targetRootAncestor);
|
|
2589
|
+
if (floatingUi_utils.isLastTraversableNode(nextParent) || !floatingUi_utils.isElement(nextParent)) {
|
|
2591
2590
|
break;
|
|
2592
2591
|
}
|
|
2593
2592
|
targetRootAncestor = nextParent;
|
|
@@ -2595,7 +2594,7 @@ function useDismiss(context, props) {
|
|
|
2595
2594
|
|
|
2596
2595
|
// Check if the click occurred on a third-party element injected after the
|
|
2597
2596
|
// floating element rendered.
|
|
2598
|
-
if (markers.length &&
|
|
2597
|
+
if (markers.length && floatingUi_utils.isElement(target) && !isRootElement(target) &&
|
|
2599
2598
|
// Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
2600
2599
|
!contains(target, elements.floating) &&
|
|
2601
2600
|
// If the target root element contains none of the markers, then the
|
|
@@ -2605,9 +2604,9 @@ function useDismiss(context, props) {
|
|
|
2605
2604
|
}
|
|
2606
2605
|
|
|
2607
2606
|
// Check if the click occurred on the scrollbar
|
|
2608
|
-
if (
|
|
2609
|
-
const lastTraversableNode =
|
|
2610
|
-
const style =
|
|
2607
|
+
if (floatingUi_utils.isHTMLElement(target) && floating) {
|
|
2608
|
+
const lastTraversableNode = floatingUi_utils.isLastTraversableNode(target);
|
|
2609
|
+
const style = floatingUi_utils.getComputedStyle(target);
|
|
2611
2610
|
const scrollRe = /auto|scroll/;
|
|
2612
2611
|
const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
|
|
2613
2612
|
const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
|
|
@@ -2682,7 +2681,7 @@ function useDismiss(context, props) {
|
|
|
2682
2681
|
},
|
|
2683
2682
|
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
2684
2683
|
// Only apply to WebKit for the test to remain 0ms.
|
|
2685
|
-
|
|
2684
|
+
floatingUi_utils.isWebKit() ? 5 : 0);
|
|
2686
2685
|
}
|
|
2687
2686
|
const doc = getDocument$1(elements.floating);
|
|
2688
2687
|
if (escapeKey) {
|
|
@@ -2693,14 +2692,14 @@ function useDismiss(context, props) {
|
|
|
2693
2692
|
outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
2694
2693
|
let ancestors = [];
|
|
2695
2694
|
if (ancestorScroll) {
|
|
2696
|
-
if (
|
|
2697
|
-
ancestors =
|
|
2695
|
+
if (floatingUi_utils.isElement(elements.domReference)) {
|
|
2696
|
+
ancestors = floatingUi_utils.getOverflowAncestors(elements.domReference);
|
|
2698
2697
|
}
|
|
2699
|
-
if (
|
|
2700
|
-
ancestors = ancestors.concat(
|
|
2698
|
+
if (floatingUi_utils.isElement(elements.floating)) {
|
|
2699
|
+
ancestors = ancestors.concat(floatingUi_utils.getOverflowAncestors(elements.floating));
|
|
2701
2700
|
}
|
|
2702
|
-
if (!
|
|
2703
|
-
ancestors = ancestors.concat(
|
|
2701
|
+
if (!floatingUi_utils.isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
|
|
2702
|
+
ancestors = ancestors.concat(floatingUi_utils.getOverflowAncestors(elements.reference.contextElement));
|
|
2704
2703
|
}
|
|
2705
2704
|
}
|
|
2706
2705
|
|
|
@@ -2773,7 +2772,7 @@ function useFloatingRootContext(options) {
|
|
|
2773
2772
|
const nested = useFloatingParentNodeId() != null;
|
|
2774
2773
|
if (process.env.NODE_ENV !== "production") {
|
|
2775
2774
|
const optionDomReference = elementsProp.reference;
|
|
2776
|
-
if (optionDomReference && !
|
|
2775
|
+
if (optionDomReference && !floatingUi_utils.isElement(optionDomReference)) {
|
|
2777
2776
|
error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');
|
|
2778
2777
|
}
|
|
2779
2778
|
}
|
|
@@ -2849,7 +2848,7 @@ function useFloating(options) {
|
|
|
2849
2848
|
}
|
|
2850
2849
|
});
|
|
2851
2850
|
const setPositionReference = React__namespace.useCallback(node => {
|
|
2852
|
-
const computedPositionReference =
|
|
2851
|
+
const computedPositionReference = floatingUi_utils.isElement(node) ? {
|
|
2853
2852
|
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
2854
2853
|
getClientRects: () => node.getClientRects(),
|
|
2855
2854
|
contextElement: node
|
|
@@ -2860,18 +2859,18 @@ function useFloating(options) {
|
|
|
2860
2859
|
position.refs.setReference(computedPositionReference);
|
|
2861
2860
|
}, [position.refs]);
|
|
2862
2861
|
const setReference = React__namespace.useCallback(node => {
|
|
2863
|
-
if (
|
|
2862
|
+
if (floatingUi_utils.isElement(node) || node === null) {
|
|
2864
2863
|
domReferenceRef.current = node;
|
|
2865
2864
|
setDomReference(node);
|
|
2866
2865
|
}
|
|
2867
2866
|
|
|
2868
2867
|
// Backwards-compatibility for passing a virtual element to `reference`
|
|
2869
2868
|
// after it has set the DOM reference.
|
|
2870
|
-
if (
|
|
2869
|
+
if (floatingUi_utils.isElement(position.refs.reference.current) || position.refs.reference.current === null ||
|
|
2871
2870
|
// Don't allow setting virtual elements using the old technique back to
|
|
2872
2871
|
// `null` to support `positionReference` + an unstable `reference`
|
|
2873
2872
|
// callback ref.
|
|
2874
|
-
node !== null && !
|
|
2873
|
+
node !== null && !floatingUi_utils.isElement(node)) {
|
|
2875
2874
|
position.refs.setReference(node);
|
|
2876
2875
|
}
|
|
2877
2876
|
}, [position.refs]);
|
|
@@ -3344,7 +3343,7 @@ function useListNavigation(context, props) {
|
|
|
3344
3343
|
stopEvent(event);
|
|
3345
3344
|
}
|
|
3346
3345
|
onOpenChange(false, event.nativeEvent, 'list-navigation');
|
|
3347
|
-
if (
|
|
3346
|
+
if (floatingUi_utils.isHTMLElement(elements.domReference)) {
|
|
3348
3347
|
if (virtual) {
|
|
3349
3348
|
tree == null || tree.events.emit('virtualfocus', elements.domReference);
|
|
3350
3349
|
} else {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var floatingUi_utils = require('./floating-ui.utils-cjs.js');
|
|
4
|
-
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var ReactDOM = require('react-dom');
|
|
7
6
|
|
|
@@ -949,12 +948,12 @@ const size$2 = function (options) {
|
|
|
949
948
|
};
|
|
950
949
|
|
|
951
950
|
function getCssDimensions(element) {
|
|
952
|
-
const css =
|
|
951
|
+
const css = floatingUi_utils.getComputedStyle(element);
|
|
953
952
|
// In testing environments, the `width` and `height` properties are empty
|
|
954
953
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
955
954
|
let width = parseFloat(css.width) || 0;
|
|
956
955
|
let height = parseFloat(css.height) || 0;
|
|
957
|
-
const hasOffset =
|
|
956
|
+
const hasOffset = floatingUi_utils.isHTMLElement(element);
|
|
958
957
|
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
959
958
|
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
960
959
|
const shouldFallback = floatingUi_utils.round(width) !== offsetWidth || floatingUi_utils.round(height) !== offsetHeight;
|
|
@@ -970,12 +969,12 @@ function getCssDimensions(element) {
|
|
|
970
969
|
}
|
|
971
970
|
|
|
972
971
|
function unwrapElement(element) {
|
|
973
|
-
return !
|
|
972
|
+
return !floatingUi_utils.isElement(element) ? element.contextElement : element;
|
|
974
973
|
}
|
|
975
974
|
|
|
976
975
|
function getScale(element) {
|
|
977
976
|
const domElement = unwrapElement(element);
|
|
978
|
-
if (!
|
|
977
|
+
if (!floatingUi_utils.isHTMLElement(domElement)) {
|
|
979
978
|
return floatingUi_utils.createCoords(1);
|
|
980
979
|
}
|
|
981
980
|
const rect = domElement.getBoundingClientRect();
|
|
@@ -1003,8 +1002,8 @@ function getScale(element) {
|
|
|
1003
1002
|
|
|
1004
1003
|
const noOffsets = /*#__PURE__*/floatingUi_utils.createCoords(0);
|
|
1005
1004
|
function getVisualOffsets(element) {
|
|
1006
|
-
const win =
|
|
1007
|
-
if (!
|
|
1005
|
+
const win = floatingUi_utils.getWindow(element);
|
|
1006
|
+
if (!floatingUi_utils.isWebKit() || !win.visualViewport) {
|
|
1008
1007
|
return noOffsets;
|
|
1009
1008
|
}
|
|
1010
1009
|
return {
|
|
@@ -1016,7 +1015,7 @@ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
|
1016
1015
|
if (isFixed === void 0) {
|
|
1017
1016
|
isFixed = false;
|
|
1018
1017
|
}
|
|
1019
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !==
|
|
1018
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== floatingUi_utils.getWindow(element)) {
|
|
1020
1019
|
return false;
|
|
1021
1020
|
}
|
|
1022
1021
|
return isFixed;
|
|
@@ -1034,7 +1033,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1034
1033
|
let scale = floatingUi_utils.createCoords(1);
|
|
1035
1034
|
if (includeScale) {
|
|
1036
1035
|
if (offsetParent) {
|
|
1037
|
-
if (
|
|
1036
|
+
if (floatingUi_utils.isElement(offsetParent)) {
|
|
1038
1037
|
scale = getScale(offsetParent);
|
|
1039
1038
|
}
|
|
1040
1039
|
} else {
|
|
@@ -1047,14 +1046,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1047
1046
|
let width = clientRect.width / scale.x;
|
|
1048
1047
|
let height = clientRect.height / scale.y;
|
|
1049
1048
|
if (domElement) {
|
|
1050
|
-
const win =
|
|
1051
|
-
const offsetWin = offsetParent &&
|
|
1049
|
+
const win = floatingUi_utils.getWindow(domElement);
|
|
1050
|
+
const offsetWin = offsetParent && floatingUi_utils.isElement(offsetParent) ? floatingUi_utils.getWindow(offsetParent) : offsetParent;
|
|
1052
1051
|
let currentWin = win;
|
|
1053
|
-
let currentIFrame =
|
|
1052
|
+
let currentIFrame = floatingUi_utils.getFrameElement(currentWin);
|
|
1054
1053
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1055
1054
|
const iframeScale = getScale(currentIFrame);
|
|
1056
1055
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1057
|
-
const css =
|
|
1056
|
+
const css = floatingUi_utils.getComputedStyle(currentIFrame);
|
|
1058
1057
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1059
1058
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1060
1059
|
x *= iframeScale.x;
|
|
@@ -1063,8 +1062,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1063
1062
|
height *= iframeScale.y;
|
|
1064
1063
|
x += left;
|
|
1065
1064
|
y += top;
|
|
1066
|
-
currentWin =
|
|
1067
|
-
currentIFrame =
|
|
1065
|
+
currentWin = floatingUi_utils.getWindow(currentIFrame);
|
|
1066
|
+
currentIFrame = floatingUi_utils.getFrameElement(currentWin);
|
|
1068
1067
|
}
|
|
1069
1068
|
}
|
|
1070
1069
|
return floatingUi_utils.rectToClientRect({
|
|
@@ -1078,9 +1077,9 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1078
1077
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1079
1078
|
// incorrect for RTL.
|
|
1080
1079
|
function getWindowScrollBarX(element, rect) {
|
|
1081
|
-
const leftScroll =
|
|
1080
|
+
const leftScroll = floatingUi_utils.getNodeScroll(element).scrollLeft;
|
|
1082
1081
|
if (!rect) {
|
|
1083
|
-
return getBoundingClientRect(
|
|
1082
|
+
return getBoundingClientRect(floatingUi_utils.getDocumentElement(element)).left + leftScroll;
|
|
1084
1083
|
}
|
|
1085
1084
|
return rect.left + leftScroll;
|
|
1086
1085
|
}
|
|
@@ -1103,8 +1102,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1103
1102
|
strategy
|
|
1104
1103
|
} = _ref;
|
|
1105
1104
|
const isFixed = strategy === 'fixed';
|
|
1106
|
-
const documentElement =
|
|
1107
|
-
const topLayer = elements ?
|
|
1105
|
+
const documentElement = floatingUi_utils.getDocumentElement(offsetParent);
|
|
1106
|
+
const topLayer = elements ? floatingUi_utils.isTopLayer(elements.floating) : false;
|
|
1108
1107
|
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1109
1108
|
return rect;
|
|
1110
1109
|
}
|
|
@@ -1114,10 +1113,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1114
1113
|
};
|
|
1115
1114
|
let scale = floatingUi_utils.createCoords(1);
|
|
1116
1115
|
const offsets = floatingUi_utils.createCoords(0);
|
|
1117
|
-
const isOffsetParentAnElement =
|
|
1116
|
+
const isOffsetParentAnElement = floatingUi_utils.isHTMLElement(offsetParent);
|
|
1118
1117
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1119
|
-
if (
|
|
1120
|
-
scroll =
|
|
1118
|
+
if (floatingUi_utils.getNodeName(offsetParent) !== 'body' || floatingUi_utils.isOverflowElement(documentElement)) {
|
|
1119
|
+
scroll = floatingUi_utils.getNodeScroll(offsetParent);
|
|
1121
1120
|
}
|
|
1122
1121
|
if (isOffsetParentAnElement) {
|
|
1123
1122
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
@@ -1142,14 +1141,14 @@ function getClientRects(element) {
|
|
|
1142
1141
|
// Gets the entire size of the scrollable document area, even extending outside
|
|
1143
1142
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1144
1143
|
function getDocumentRect(element) {
|
|
1145
|
-
const html =
|
|
1146
|
-
const scroll =
|
|
1144
|
+
const html = floatingUi_utils.getDocumentElement(element);
|
|
1145
|
+
const scroll = floatingUi_utils.getNodeScroll(element);
|
|
1147
1146
|
const body = element.ownerDocument.body;
|
|
1148
1147
|
const width = floatingUi_utils.max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1149
1148
|
const height = floatingUi_utils.max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1150
1149
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1151
1150
|
const y = -scroll.scrollTop;
|
|
1152
|
-
if (
|
|
1151
|
+
if (floatingUi_utils.getComputedStyle(body).direction === 'rtl') {
|
|
1153
1152
|
x += floatingUi_utils.max(html.clientWidth, body.clientWidth) - width;
|
|
1154
1153
|
}
|
|
1155
1154
|
return {
|
|
@@ -1165,8 +1164,8 @@ function getDocumentRect(element) {
|
|
|
1165
1164
|
// Most scrollbars leave 15-18px of space.
|
|
1166
1165
|
const SCROLLBAR_MAX = 25;
|
|
1167
1166
|
function getViewportRect(element, strategy) {
|
|
1168
|
-
const win =
|
|
1169
|
-
const html =
|
|
1167
|
+
const win = floatingUi_utils.getWindow(element);
|
|
1168
|
+
const html = floatingUi_utils.getDocumentElement(element);
|
|
1170
1169
|
const visualViewport = win.visualViewport;
|
|
1171
1170
|
let width = html.clientWidth;
|
|
1172
1171
|
let height = html.clientHeight;
|
|
@@ -1175,7 +1174,7 @@ function getViewportRect(element, strategy) {
|
|
|
1175
1174
|
if (visualViewport) {
|
|
1176
1175
|
width = visualViewport.width;
|
|
1177
1176
|
height = visualViewport.height;
|
|
1178
|
-
const visualViewportBased =
|
|
1177
|
+
const visualViewportBased = floatingUi_utils.isWebKit();
|
|
1179
1178
|
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
1180
1179
|
x = visualViewport.offsetLeft;
|
|
1181
1180
|
y = visualViewport.offsetTop;
|
|
@@ -1212,7 +1211,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
1212
1211
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1213
1212
|
const top = clientRect.top + element.clientTop;
|
|
1214
1213
|
const left = clientRect.left + element.clientLeft;
|
|
1215
|
-
const scale =
|
|
1214
|
+
const scale = floatingUi_utils.isHTMLElement(element) ? getScale(element) : floatingUi_utils.createCoords(1);
|
|
1216
1215
|
const width = element.clientWidth * scale.x;
|
|
1217
1216
|
const height = element.clientHeight * scale.y;
|
|
1218
1217
|
const x = left * scale.x;
|
|
@@ -1229,8 +1228,8 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1229
1228
|
if (clippingAncestor === 'viewport') {
|
|
1230
1229
|
rect = getViewportRect(element, strategy);
|
|
1231
1230
|
} else if (clippingAncestor === 'document') {
|
|
1232
|
-
rect = getDocumentRect(
|
|
1233
|
-
} else if (
|
|
1231
|
+
rect = getDocumentRect(floatingUi_utils.getDocumentElement(element));
|
|
1232
|
+
} else if (floatingUi_utils.isElement(clippingAncestor)) {
|
|
1234
1233
|
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1235
1234
|
} else {
|
|
1236
1235
|
const visualOffsets = getVisualOffsets(element);
|
|
@@ -1244,11 +1243,11 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1244
1243
|
return floatingUi_utils.rectToClientRect(rect);
|
|
1245
1244
|
}
|
|
1246
1245
|
function hasFixedPositionAncestor(element, stopNode) {
|
|
1247
|
-
const parentNode =
|
|
1248
|
-
if (parentNode === stopNode || !
|
|
1246
|
+
const parentNode = floatingUi_utils.getParentNode(element);
|
|
1247
|
+
if (parentNode === stopNode || !floatingUi_utils.isElement(parentNode) || floatingUi_utils.isLastTraversableNode(parentNode)) {
|
|
1249
1248
|
return false;
|
|
1250
1249
|
}
|
|
1251
|
-
return
|
|
1250
|
+
return floatingUi_utils.getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1252
1251
|
}
|
|
1253
1252
|
|
|
1254
1253
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -1259,19 +1258,19 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1259
1258
|
if (cachedResult) {
|
|
1260
1259
|
return cachedResult;
|
|
1261
1260
|
}
|
|
1262
|
-
let result =
|
|
1261
|
+
let result = floatingUi_utils.getOverflowAncestors(element, [], false).filter(el => floatingUi_utils.isElement(el) && floatingUi_utils.getNodeName(el) !== 'body');
|
|
1263
1262
|
let currentContainingBlockComputedStyle = null;
|
|
1264
|
-
const elementIsFixed =
|
|
1265
|
-
let currentNode = elementIsFixed ?
|
|
1263
|
+
const elementIsFixed = floatingUi_utils.getComputedStyle(element).position === 'fixed';
|
|
1264
|
+
let currentNode = elementIsFixed ? floatingUi_utils.getParentNode(element) : element;
|
|
1266
1265
|
|
|
1267
1266
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1268
|
-
while (
|
|
1269
|
-
const computedStyle =
|
|
1270
|
-
const currentNodeIsContaining =
|
|
1267
|
+
while (floatingUi_utils.isElement(currentNode) && !floatingUi_utils.isLastTraversableNode(currentNode)) {
|
|
1268
|
+
const computedStyle = floatingUi_utils.getComputedStyle(currentNode);
|
|
1269
|
+
const currentNodeIsContaining = floatingUi_utils.isContainingBlock(currentNode);
|
|
1271
1270
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1272
1271
|
currentContainingBlockComputedStyle = null;
|
|
1273
1272
|
}
|
|
1274
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') ||
|
|
1273
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || floatingUi_utils.isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1275
1274
|
if (shouldDropCurrentNode) {
|
|
1276
1275
|
// Drop non-containing blocks.
|
|
1277
1276
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -1279,7 +1278,7 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1279
1278
|
// Record last containing block for next iteration.
|
|
1280
1279
|
currentContainingBlockComputedStyle = computedStyle;
|
|
1281
1280
|
}
|
|
1282
|
-
currentNode =
|
|
1281
|
+
currentNode = floatingUi_utils.getParentNode(currentNode);
|
|
1283
1282
|
}
|
|
1284
1283
|
cache.set(element, result);
|
|
1285
1284
|
return result;
|
|
@@ -1294,7 +1293,7 @@ function getClippingRect(_ref) {
|
|
|
1294
1293
|
rootBoundary,
|
|
1295
1294
|
strategy
|
|
1296
1295
|
} = _ref;
|
|
1297
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ?
|
|
1296
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? floatingUi_utils.isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1298
1297
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1299
1298
|
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1300
1299
|
let top = firstRect.top;
|
|
@@ -1328,8 +1327,8 @@ function getDimensions(element) {
|
|
|
1328
1327
|
}
|
|
1329
1328
|
|
|
1330
1329
|
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1331
|
-
const isOffsetParentAnElement =
|
|
1332
|
-
const documentElement =
|
|
1330
|
+
const isOffsetParentAnElement = floatingUi_utils.isHTMLElement(offsetParent);
|
|
1331
|
+
const documentElement = floatingUi_utils.getDocumentElement(offsetParent);
|
|
1333
1332
|
const isFixed = strategy === 'fixed';
|
|
1334
1333
|
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1335
1334
|
let scroll = {
|
|
@@ -1344,8 +1343,8 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1344
1343
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
1345
1344
|
}
|
|
1346
1345
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1347
|
-
if (
|
|
1348
|
-
scroll =
|
|
1346
|
+
if (floatingUi_utils.getNodeName(offsetParent) !== 'body' || floatingUi_utils.isOverflowElement(documentElement)) {
|
|
1347
|
+
scroll = floatingUi_utils.getNodeScroll(offsetParent);
|
|
1349
1348
|
}
|
|
1350
1349
|
if (isOffsetParentAnElement) {
|
|
1351
1350
|
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
@@ -1370,11 +1369,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1370
1369
|
}
|
|
1371
1370
|
|
|
1372
1371
|
function isStaticPositioned(element) {
|
|
1373
|
-
return
|
|
1372
|
+
return floatingUi_utils.getComputedStyle(element).position === 'static';
|
|
1374
1373
|
}
|
|
1375
1374
|
|
|
1376
1375
|
function getTrueOffsetParent(element, polyfill) {
|
|
1377
|
-
if (!
|
|
1376
|
+
if (!floatingUi_utils.isHTMLElement(element) || floatingUi_utils.getComputedStyle(element).position === 'fixed') {
|
|
1378
1377
|
return null;
|
|
1379
1378
|
}
|
|
1380
1379
|
if (polyfill) {
|
|
@@ -1386,7 +1385,7 @@ function getTrueOffsetParent(element, polyfill) {
|
|
|
1386
1385
|
// while Chrome and Safari return the <body> element. The <body> element must
|
|
1387
1386
|
// be used to perform the correct calculations even if the <html> element is
|
|
1388
1387
|
// non-static.
|
|
1389
|
-
if (
|
|
1388
|
+
if (floatingUi_utils.getDocumentElement(element) === rawOffsetParent) {
|
|
1390
1389
|
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1391
1390
|
}
|
|
1392
1391
|
return rawOffsetParent;
|
|
@@ -1395,28 +1394,28 @@ function getTrueOffsetParent(element, polyfill) {
|
|
|
1395
1394
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1396
1395
|
// such as table ancestors and cross browser bugs.
|
|
1397
1396
|
function getOffsetParent(element, polyfill) {
|
|
1398
|
-
const win =
|
|
1399
|
-
if (
|
|
1397
|
+
const win = floatingUi_utils.getWindow(element);
|
|
1398
|
+
if (floatingUi_utils.isTopLayer(element)) {
|
|
1400
1399
|
return win;
|
|
1401
1400
|
}
|
|
1402
|
-
if (!
|
|
1403
|
-
let svgOffsetParent =
|
|
1404
|
-
while (svgOffsetParent && !
|
|
1405
|
-
if (
|
|
1401
|
+
if (!floatingUi_utils.isHTMLElement(element)) {
|
|
1402
|
+
let svgOffsetParent = floatingUi_utils.getParentNode(element);
|
|
1403
|
+
while (svgOffsetParent && !floatingUi_utils.isLastTraversableNode(svgOffsetParent)) {
|
|
1404
|
+
if (floatingUi_utils.isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1406
1405
|
return svgOffsetParent;
|
|
1407
1406
|
}
|
|
1408
|
-
svgOffsetParent =
|
|
1407
|
+
svgOffsetParent = floatingUi_utils.getParentNode(svgOffsetParent);
|
|
1409
1408
|
}
|
|
1410
1409
|
return win;
|
|
1411
1410
|
}
|
|
1412
1411
|
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1413
|
-
while (offsetParent &&
|
|
1412
|
+
while (offsetParent && floatingUi_utils.isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1414
1413
|
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1415
1414
|
}
|
|
1416
|
-
if (offsetParent &&
|
|
1415
|
+
if (offsetParent && floatingUi_utils.isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !floatingUi_utils.isContainingBlock(offsetParent)) {
|
|
1417
1416
|
return win;
|
|
1418
1417
|
}
|
|
1419
|
-
return offsetParent ||
|
|
1418
|
+
return offsetParent || floatingUi_utils.getContainingBlock(element) || win;
|
|
1420
1419
|
}
|
|
1421
1420
|
|
|
1422
1421
|
const getElementRects = async function (data) {
|
|
@@ -1435,19 +1434,19 @@ const getElementRects = async function (data) {
|
|
|
1435
1434
|
};
|
|
1436
1435
|
|
|
1437
1436
|
function isRTL(element) {
|
|
1438
|
-
return
|
|
1437
|
+
return floatingUi_utils.getComputedStyle(element).direction === 'rtl';
|
|
1439
1438
|
}
|
|
1440
1439
|
|
|
1441
1440
|
const platform = {
|
|
1442
1441
|
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1443
|
-
getDocumentElement:
|
|
1442
|
+
getDocumentElement: floatingUi_utils.getDocumentElement,
|
|
1444
1443
|
getClippingRect,
|
|
1445
1444
|
getOffsetParent,
|
|
1446
1445
|
getElementRects,
|
|
1447
1446
|
getClientRects,
|
|
1448
1447
|
getDimensions,
|
|
1449
1448
|
getScale,
|
|
1450
|
-
isElement:
|
|
1449
|
+
isElement: floatingUi_utils.isElement,
|
|
1451
1450
|
isRTL
|
|
1452
1451
|
};
|
|
1453
1452
|
|
|
@@ -1459,7 +1458,7 @@ function rectsAreEqual(a, b) {
|
|
|
1459
1458
|
function observeMove(element, onMove) {
|
|
1460
1459
|
let io = null;
|
|
1461
1460
|
let timeoutId;
|
|
1462
|
-
const root =
|
|
1461
|
+
const root = floatingUi_utils.getDocumentElement(element);
|
|
1463
1462
|
function cleanup() {
|
|
1464
1463
|
var _io;
|
|
1465
1464
|
clearTimeout(timeoutId);
|
|
@@ -1563,7 +1562,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1563
1562
|
animationFrame = false
|
|
1564
1563
|
} = options;
|
|
1565
1564
|
const referenceEl = unwrapElement(reference);
|
|
1566
|
-
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ?
|
|
1565
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? floatingUi_utils.getOverflowAncestors(referenceEl) : []), ...(floating ? floatingUi_utils.getOverflowAncestors(floating) : [])] : [];
|
|
1567
1566
|
ancestors.forEach(ancestor => {
|
|
1568
1567
|
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
1569
1568
|
passive: true
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { k as getDocumentElement, b as isElement, i as isHTMLElement, l as isTopLayer, g as getNodeName, m as isOverflowElement, n as getNodeScroll, o as getWindow, e as getParentNode, d as isLastTraversableNode, p as isTableElement, q as isContainingBlock, r as getContainingBlock, f as getComputedStyle$1, h as getOverflowAncestors, s as getFrameElement, j as isWebKit } from './floating-ui.utils.dom-es.js';
|
|
1
|
+
import { l as getSideAxis, m as getAlignmentAxis, n as getSide, o as getAlignment, p as evaluate, q as getPaddingObject, r as rectToClientRect, s as getOppositePlacement, t as getExpandedPlacements, u as getOppositeAxisPlacements, v as getAlignmentSides, w as clamp, x as min, y as max, z as getAxisLength, A as sides, B as getOppositeAxis, C as placements, D as getOppositeAlignmentPlacement, E as getDocumentElement, b as isElement, i as isHTMLElement, F as createCoords, G as round, H as isTopLayer, g as getNodeName, I as isOverflowElement, J as getNodeScroll, K as getWindow, e as getParentNode, d as isLastTraversableNode, L as isTableElement, M as isContainingBlock, N as getContainingBlock, h as getComputedStyle$1, j as getOverflowAncestors, O as getFrameElement, k as isWebKit, f as floor } from './floating-ui.utils-es.js';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { useLayoutEffect } from 'react';
|
|
5
4
|
import * as ReactDOM from 'react-dom';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { a as isShadowRoot, i as isHTMLElement, b as isElement, c as isNode, g as getNodeName, d as isLastTraversableNode, e as getParentNode,
|
|
4
|
-
import { f as floor } from './floating-ui.utils-es.js';
|
|
3
|
+
import { a as isShadowRoot, i as isHTMLElement, f as floor, b as isElement, c as isNode, g as getNodeName, d as isLastTraversableNode, e as getParentNode, h as getComputedStyle$1, j as getOverflowAncestors, k as isWebKit } from './floating-ui.utils-es.js';
|
|
5
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
5
|
import * as ReactDOM from 'react-dom';
|
|
7
6
|
import { u as useFloating$1 } from './floating-ui.react-dom-es.js';
|