@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index_esm = require('./index.esm-cjs.js');
|
|
4
|
+
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var ReactDOM = require('react-dom');
|
|
6
7
|
|
|
@@ -948,12 +949,12 @@ const size$2 = function (options) {
|
|
|
948
949
|
};
|
|
949
950
|
|
|
950
951
|
function getCssDimensions(element) {
|
|
951
|
-
const css =
|
|
952
|
+
const css = floatingUi_utils_dom.getComputedStyle(element);
|
|
952
953
|
// In testing environments, the `width` and `height` properties are empty
|
|
953
954
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
954
955
|
let width = parseFloat(css.width) || 0;
|
|
955
956
|
let height = parseFloat(css.height) || 0;
|
|
956
|
-
const hasOffset =
|
|
957
|
+
const hasOffset = floatingUi_utils_dom.isHTMLElement(element);
|
|
957
958
|
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
958
959
|
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
959
960
|
const shouldFallback = index_esm.round(width) !== offsetWidth || index_esm.round(height) !== offsetHeight;
|
|
@@ -969,12 +970,12 @@ function getCssDimensions(element) {
|
|
|
969
970
|
}
|
|
970
971
|
|
|
971
972
|
function unwrapElement(element) {
|
|
972
|
-
return !
|
|
973
|
+
return !floatingUi_utils_dom.isElement(element) ? element.contextElement : element;
|
|
973
974
|
}
|
|
974
975
|
|
|
975
976
|
function getScale(element) {
|
|
976
977
|
const domElement = unwrapElement(element);
|
|
977
|
-
if (!
|
|
978
|
+
if (!floatingUi_utils_dom.isHTMLElement(domElement)) {
|
|
978
979
|
return index_esm.createCoords(1);
|
|
979
980
|
}
|
|
980
981
|
const rect = domElement.getBoundingClientRect();
|
|
@@ -1002,8 +1003,8 @@ function getScale(element) {
|
|
|
1002
1003
|
|
|
1003
1004
|
const noOffsets = /*#__PURE__*/index_esm.createCoords(0);
|
|
1004
1005
|
function getVisualOffsets(element) {
|
|
1005
|
-
const win =
|
|
1006
|
-
if (!
|
|
1006
|
+
const win = floatingUi_utils_dom.getWindow(element);
|
|
1007
|
+
if (!floatingUi_utils_dom.isWebKit() || !win.visualViewport) {
|
|
1007
1008
|
return noOffsets;
|
|
1008
1009
|
}
|
|
1009
1010
|
return {
|
|
@@ -1015,7 +1016,7 @@ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
|
1015
1016
|
if (isFixed === void 0) {
|
|
1016
1017
|
isFixed = false;
|
|
1017
1018
|
}
|
|
1018
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !==
|
|
1019
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== floatingUi_utils_dom.getWindow(element)) {
|
|
1019
1020
|
return false;
|
|
1020
1021
|
}
|
|
1021
1022
|
return isFixed;
|
|
@@ -1033,7 +1034,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1033
1034
|
let scale = index_esm.createCoords(1);
|
|
1034
1035
|
if (includeScale) {
|
|
1035
1036
|
if (offsetParent) {
|
|
1036
|
-
if (
|
|
1037
|
+
if (floatingUi_utils_dom.isElement(offsetParent)) {
|
|
1037
1038
|
scale = getScale(offsetParent);
|
|
1038
1039
|
}
|
|
1039
1040
|
} else {
|
|
@@ -1046,14 +1047,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1046
1047
|
let width = clientRect.width / scale.x;
|
|
1047
1048
|
let height = clientRect.height / scale.y;
|
|
1048
1049
|
if (domElement) {
|
|
1049
|
-
const win =
|
|
1050
|
-
const offsetWin = offsetParent &&
|
|
1050
|
+
const win = floatingUi_utils_dom.getWindow(domElement);
|
|
1051
|
+
const offsetWin = offsetParent && floatingUi_utils_dom.isElement(offsetParent) ? floatingUi_utils_dom.getWindow(offsetParent) : offsetParent;
|
|
1051
1052
|
let currentWin = win;
|
|
1052
|
-
let currentIFrame =
|
|
1053
|
+
let currentIFrame = floatingUi_utils_dom.getFrameElement(currentWin);
|
|
1053
1054
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1054
1055
|
const iframeScale = getScale(currentIFrame);
|
|
1055
1056
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1056
|
-
const css =
|
|
1057
|
+
const css = floatingUi_utils_dom.getComputedStyle(currentIFrame);
|
|
1057
1058
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1058
1059
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1059
1060
|
x *= iframeScale.x;
|
|
@@ -1062,8 +1063,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1062
1063
|
height *= iframeScale.y;
|
|
1063
1064
|
x += left;
|
|
1064
1065
|
y += top;
|
|
1065
|
-
currentWin =
|
|
1066
|
-
currentIFrame =
|
|
1066
|
+
currentWin = floatingUi_utils_dom.getWindow(currentIFrame);
|
|
1067
|
+
currentIFrame = floatingUi_utils_dom.getFrameElement(currentWin);
|
|
1067
1068
|
}
|
|
1068
1069
|
}
|
|
1069
1070
|
return index_esm.rectToClientRect({
|
|
@@ -1077,9 +1078,9 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1077
1078
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1078
1079
|
// incorrect for RTL.
|
|
1079
1080
|
function getWindowScrollBarX(element, rect) {
|
|
1080
|
-
const leftScroll =
|
|
1081
|
+
const leftScroll = floatingUi_utils_dom.getNodeScroll(element).scrollLeft;
|
|
1081
1082
|
if (!rect) {
|
|
1082
|
-
return getBoundingClientRect(
|
|
1083
|
+
return getBoundingClientRect(floatingUi_utils_dom.getDocumentElement(element)).left + leftScroll;
|
|
1083
1084
|
}
|
|
1084
1085
|
return rect.left + leftScroll;
|
|
1085
1086
|
}
|
|
@@ -1102,8 +1103,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1102
1103
|
strategy
|
|
1103
1104
|
} = _ref;
|
|
1104
1105
|
const isFixed = strategy === 'fixed';
|
|
1105
|
-
const documentElement =
|
|
1106
|
-
const topLayer = elements ?
|
|
1106
|
+
const documentElement = floatingUi_utils_dom.getDocumentElement(offsetParent);
|
|
1107
|
+
const topLayer = elements ? floatingUi_utils_dom.isTopLayer(elements.floating) : false;
|
|
1107
1108
|
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1108
1109
|
return rect;
|
|
1109
1110
|
}
|
|
@@ -1113,10 +1114,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1113
1114
|
};
|
|
1114
1115
|
let scale = index_esm.createCoords(1);
|
|
1115
1116
|
const offsets = index_esm.createCoords(0);
|
|
1116
|
-
const isOffsetParentAnElement =
|
|
1117
|
+
const isOffsetParentAnElement = floatingUi_utils_dom.isHTMLElement(offsetParent);
|
|
1117
1118
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1118
|
-
if (
|
|
1119
|
-
scroll =
|
|
1119
|
+
if (floatingUi_utils_dom.getNodeName(offsetParent) !== 'body' || floatingUi_utils_dom.isOverflowElement(documentElement)) {
|
|
1120
|
+
scroll = floatingUi_utils_dom.getNodeScroll(offsetParent);
|
|
1120
1121
|
}
|
|
1121
1122
|
if (isOffsetParentAnElement) {
|
|
1122
1123
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
@@ -1141,14 +1142,14 @@ function getClientRects(element) {
|
|
|
1141
1142
|
// Gets the entire size of the scrollable document area, even extending outside
|
|
1142
1143
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1143
1144
|
function getDocumentRect(element) {
|
|
1144
|
-
const html =
|
|
1145
|
-
const scroll =
|
|
1145
|
+
const html = floatingUi_utils_dom.getDocumentElement(element);
|
|
1146
|
+
const scroll = floatingUi_utils_dom.getNodeScroll(element);
|
|
1146
1147
|
const body = element.ownerDocument.body;
|
|
1147
1148
|
const width = index_esm.max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1148
1149
|
const height = index_esm.max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1149
1150
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1150
1151
|
const y = -scroll.scrollTop;
|
|
1151
|
-
if (
|
|
1152
|
+
if (floatingUi_utils_dom.getComputedStyle(body).direction === 'rtl') {
|
|
1152
1153
|
x += index_esm.max(html.clientWidth, body.clientWidth) - width;
|
|
1153
1154
|
}
|
|
1154
1155
|
return {
|
|
@@ -1164,8 +1165,8 @@ function getDocumentRect(element) {
|
|
|
1164
1165
|
// Most scrollbars leave 15-18px of space.
|
|
1165
1166
|
const SCROLLBAR_MAX = 25;
|
|
1166
1167
|
function getViewportRect(element, strategy) {
|
|
1167
|
-
const win =
|
|
1168
|
-
const html =
|
|
1168
|
+
const win = floatingUi_utils_dom.getWindow(element);
|
|
1169
|
+
const html = floatingUi_utils_dom.getDocumentElement(element);
|
|
1169
1170
|
const visualViewport = win.visualViewport;
|
|
1170
1171
|
let width = html.clientWidth;
|
|
1171
1172
|
let height = html.clientHeight;
|
|
@@ -1174,7 +1175,7 @@ function getViewportRect(element, strategy) {
|
|
|
1174
1175
|
if (visualViewport) {
|
|
1175
1176
|
width = visualViewport.width;
|
|
1176
1177
|
height = visualViewport.height;
|
|
1177
|
-
const visualViewportBased =
|
|
1178
|
+
const visualViewportBased = floatingUi_utils_dom.isWebKit();
|
|
1178
1179
|
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
1179
1180
|
x = visualViewport.offsetLeft;
|
|
1180
1181
|
y = visualViewport.offsetTop;
|
|
@@ -1211,7 +1212,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
1211
1212
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1212
1213
|
const top = clientRect.top + element.clientTop;
|
|
1213
1214
|
const left = clientRect.left + element.clientLeft;
|
|
1214
|
-
const scale =
|
|
1215
|
+
const scale = floatingUi_utils_dom.isHTMLElement(element) ? getScale(element) : index_esm.createCoords(1);
|
|
1215
1216
|
const width = element.clientWidth * scale.x;
|
|
1216
1217
|
const height = element.clientHeight * scale.y;
|
|
1217
1218
|
const x = left * scale.x;
|
|
@@ -1228,8 +1229,8 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1228
1229
|
if (clippingAncestor === 'viewport') {
|
|
1229
1230
|
rect = getViewportRect(element, strategy);
|
|
1230
1231
|
} else if (clippingAncestor === 'document') {
|
|
1231
|
-
rect = getDocumentRect(
|
|
1232
|
-
} else if (
|
|
1232
|
+
rect = getDocumentRect(floatingUi_utils_dom.getDocumentElement(element));
|
|
1233
|
+
} else if (floatingUi_utils_dom.isElement(clippingAncestor)) {
|
|
1233
1234
|
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1234
1235
|
} else {
|
|
1235
1236
|
const visualOffsets = getVisualOffsets(element);
|
|
@@ -1243,11 +1244,11 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1243
1244
|
return index_esm.rectToClientRect(rect);
|
|
1244
1245
|
}
|
|
1245
1246
|
function hasFixedPositionAncestor(element, stopNode) {
|
|
1246
|
-
const parentNode =
|
|
1247
|
-
if (parentNode === stopNode || !
|
|
1247
|
+
const parentNode = floatingUi_utils_dom.getParentNode(element);
|
|
1248
|
+
if (parentNode === stopNode || !floatingUi_utils_dom.isElement(parentNode) || floatingUi_utils_dom.isLastTraversableNode(parentNode)) {
|
|
1248
1249
|
return false;
|
|
1249
1250
|
}
|
|
1250
|
-
return
|
|
1251
|
+
return floatingUi_utils_dom.getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1251
1252
|
}
|
|
1252
1253
|
|
|
1253
1254
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -1258,19 +1259,19 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1258
1259
|
if (cachedResult) {
|
|
1259
1260
|
return cachedResult;
|
|
1260
1261
|
}
|
|
1261
|
-
let result =
|
|
1262
|
+
let result = floatingUi_utils_dom.getOverflowAncestors(element, [], false).filter(el => floatingUi_utils_dom.isElement(el) && floatingUi_utils_dom.getNodeName(el) !== 'body');
|
|
1262
1263
|
let currentContainingBlockComputedStyle = null;
|
|
1263
|
-
const elementIsFixed =
|
|
1264
|
-
let currentNode = elementIsFixed ?
|
|
1264
|
+
const elementIsFixed = floatingUi_utils_dom.getComputedStyle(element).position === 'fixed';
|
|
1265
|
+
let currentNode = elementIsFixed ? floatingUi_utils_dom.getParentNode(element) : element;
|
|
1265
1266
|
|
|
1266
1267
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1267
|
-
while (
|
|
1268
|
-
const computedStyle =
|
|
1269
|
-
const currentNodeIsContaining =
|
|
1268
|
+
while (floatingUi_utils_dom.isElement(currentNode) && !floatingUi_utils_dom.isLastTraversableNode(currentNode)) {
|
|
1269
|
+
const computedStyle = floatingUi_utils_dom.getComputedStyle(currentNode);
|
|
1270
|
+
const currentNodeIsContaining = floatingUi_utils_dom.isContainingBlock(currentNode);
|
|
1270
1271
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1271
1272
|
currentContainingBlockComputedStyle = null;
|
|
1272
1273
|
}
|
|
1273
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') ||
|
|
1274
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || floatingUi_utils_dom.isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1274
1275
|
if (shouldDropCurrentNode) {
|
|
1275
1276
|
// Drop non-containing blocks.
|
|
1276
1277
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -1278,7 +1279,7 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1278
1279
|
// Record last containing block for next iteration.
|
|
1279
1280
|
currentContainingBlockComputedStyle = computedStyle;
|
|
1280
1281
|
}
|
|
1281
|
-
currentNode =
|
|
1282
|
+
currentNode = floatingUi_utils_dom.getParentNode(currentNode);
|
|
1282
1283
|
}
|
|
1283
1284
|
cache.set(element, result);
|
|
1284
1285
|
return result;
|
|
@@ -1293,7 +1294,7 @@ function getClippingRect(_ref) {
|
|
|
1293
1294
|
rootBoundary,
|
|
1294
1295
|
strategy
|
|
1295
1296
|
} = _ref;
|
|
1296
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ?
|
|
1297
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? floatingUi_utils_dom.isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1297
1298
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1298
1299
|
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1299
1300
|
let top = firstRect.top;
|
|
@@ -1327,8 +1328,8 @@ function getDimensions(element) {
|
|
|
1327
1328
|
}
|
|
1328
1329
|
|
|
1329
1330
|
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1330
|
-
const isOffsetParentAnElement =
|
|
1331
|
-
const documentElement =
|
|
1331
|
+
const isOffsetParentAnElement = floatingUi_utils_dom.isHTMLElement(offsetParent);
|
|
1332
|
+
const documentElement = floatingUi_utils_dom.getDocumentElement(offsetParent);
|
|
1332
1333
|
const isFixed = strategy === 'fixed';
|
|
1333
1334
|
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1334
1335
|
let scroll = {
|
|
@@ -1343,8 +1344,8 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1343
1344
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
1344
1345
|
}
|
|
1345
1346
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1346
|
-
if (
|
|
1347
|
-
scroll =
|
|
1347
|
+
if (floatingUi_utils_dom.getNodeName(offsetParent) !== 'body' || floatingUi_utils_dom.isOverflowElement(documentElement)) {
|
|
1348
|
+
scroll = floatingUi_utils_dom.getNodeScroll(offsetParent);
|
|
1348
1349
|
}
|
|
1349
1350
|
if (isOffsetParentAnElement) {
|
|
1350
1351
|
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
@@ -1369,11 +1370,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1369
1370
|
}
|
|
1370
1371
|
|
|
1371
1372
|
function isStaticPositioned(element) {
|
|
1372
|
-
return
|
|
1373
|
+
return floatingUi_utils_dom.getComputedStyle(element).position === 'static';
|
|
1373
1374
|
}
|
|
1374
1375
|
|
|
1375
1376
|
function getTrueOffsetParent(element, polyfill) {
|
|
1376
|
-
if (!
|
|
1377
|
+
if (!floatingUi_utils_dom.isHTMLElement(element) || floatingUi_utils_dom.getComputedStyle(element).position === 'fixed') {
|
|
1377
1378
|
return null;
|
|
1378
1379
|
}
|
|
1379
1380
|
if (polyfill) {
|
|
@@ -1385,7 +1386,7 @@ function getTrueOffsetParent(element, polyfill) {
|
|
|
1385
1386
|
// while Chrome and Safari return the <body> element. The <body> element must
|
|
1386
1387
|
// be used to perform the correct calculations even if the <html> element is
|
|
1387
1388
|
// non-static.
|
|
1388
|
-
if (
|
|
1389
|
+
if (floatingUi_utils_dom.getDocumentElement(element) === rawOffsetParent) {
|
|
1389
1390
|
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1390
1391
|
}
|
|
1391
1392
|
return rawOffsetParent;
|
|
@@ -1394,28 +1395,28 @@ function getTrueOffsetParent(element, polyfill) {
|
|
|
1394
1395
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1395
1396
|
// such as table ancestors and cross browser bugs.
|
|
1396
1397
|
function getOffsetParent(element, polyfill) {
|
|
1397
|
-
const win =
|
|
1398
|
-
if (
|
|
1398
|
+
const win = floatingUi_utils_dom.getWindow(element);
|
|
1399
|
+
if (floatingUi_utils_dom.isTopLayer(element)) {
|
|
1399
1400
|
return win;
|
|
1400
1401
|
}
|
|
1401
|
-
if (!
|
|
1402
|
-
let svgOffsetParent =
|
|
1403
|
-
while (svgOffsetParent && !
|
|
1404
|
-
if (
|
|
1402
|
+
if (!floatingUi_utils_dom.isHTMLElement(element)) {
|
|
1403
|
+
let svgOffsetParent = floatingUi_utils_dom.getParentNode(element);
|
|
1404
|
+
while (svgOffsetParent && !floatingUi_utils_dom.isLastTraversableNode(svgOffsetParent)) {
|
|
1405
|
+
if (floatingUi_utils_dom.isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1405
1406
|
return svgOffsetParent;
|
|
1406
1407
|
}
|
|
1407
|
-
svgOffsetParent =
|
|
1408
|
+
svgOffsetParent = floatingUi_utils_dom.getParentNode(svgOffsetParent);
|
|
1408
1409
|
}
|
|
1409
1410
|
return win;
|
|
1410
1411
|
}
|
|
1411
1412
|
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1412
|
-
while (offsetParent &&
|
|
1413
|
+
while (offsetParent && floatingUi_utils_dom.isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1413
1414
|
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1414
1415
|
}
|
|
1415
|
-
if (offsetParent &&
|
|
1416
|
+
if (offsetParent && floatingUi_utils_dom.isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !floatingUi_utils_dom.isContainingBlock(offsetParent)) {
|
|
1416
1417
|
return win;
|
|
1417
1418
|
}
|
|
1418
|
-
return offsetParent ||
|
|
1419
|
+
return offsetParent || floatingUi_utils_dom.getContainingBlock(element) || win;
|
|
1419
1420
|
}
|
|
1420
1421
|
|
|
1421
1422
|
const getElementRects = async function (data) {
|
|
@@ -1434,19 +1435,19 @@ const getElementRects = async function (data) {
|
|
|
1434
1435
|
};
|
|
1435
1436
|
|
|
1436
1437
|
function isRTL(element) {
|
|
1437
|
-
return
|
|
1438
|
+
return floatingUi_utils_dom.getComputedStyle(element).direction === 'rtl';
|
|
1438
1439
|
}
|
|
1439
1440
|
|
|
1440
1441
|
const platform = {
|
|
1441
1442
|
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1442
|
-
getDocumentElement:
|
|
1443
|
+
getDocumentElement: floatingUi_utils_dom.getDocumentElement,
|
|
1443
1444
|
getClippingRect,
|
|
1444
1445
|
getOffsetParent,
|
|
1445
1446
|
getElementRects,
|
|
1446
1447
|
getClientRects,
|
|
1447
1448
|
getDimensions,
|
|
1448
1449
|
getScale,
|
|
1449
|
-
isElement:
|
|
1450
|
+
isElement: floatingUi_utils_dom.isElement,
|
|
1450
1451
|
isRTL
|
|
1451
1452
|
};
|
|
1452
1453
|
|
|
@@ -1458,7 +1459,7 @@ function rectsAreEqual(a, b) {
|
|
|
1458
1459
|
function observeMove(element, onMove) {
|
|
1459
1460
|
let io = null;
|
|
1460
1461
|
let timeoutId;
|
|
1461
|
-
const root =
|
|
1462
|
+
const root = floatingUi_utils_dom.getDocumentElement(element);
|
|
1462
1463
|
function cleanup() {
|
|
1463
1464
|
var _io;
|
|
1464
1465
|
clearTimeout(timeoutId);
|
|
@@ -1562,7 +1563,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1562
1563
|
animationFrame = false
|
|
1563
1564
|
} = options;
|
|
1564
1565
|
const referenceEl = unwrapElement(reference);
|
|
1565
|
-
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ?
|
|
1566
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? floatingUi_utils_dom.getOverflowAncestors(referenceEl) : []), ...(floating ? floatingUi_utils_dom.getOverflowAncestors(floating) : [])] : [];
|
|
1566
1567
|
ancestors.forEach(ancestor => {
|
|
1567
1568
|
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
1568
1569
|
passive: true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as evaluate, g as getSide, b as getSideAxis, c as getOppositePlacement, d as getExpandedPlacements, h as getOppositeAxisPlacements, j as getAlignmentSides, k as getAlignment, m as min, l as max, n as getAlignmentAxis, o as getPaddingObject, r as rectToClientRect, p as clamp, q as getAxisLength, s as sides, u as getOppositeAxis, v as placements, w as getOppositeAlignmentPlacement, x as createCoords, y as round, f as floor } from './index.esm-es.js';
|
|
2
|
+
import { h as getOverflowAncestors, b as isElement, k as getWindow, l as getFrameElement, f as getComputedStyle$1, m as getDocumentElement, a as isHTMLElement, j as isWebKit, n as isTopLayer, g as getNodeName, o as isOverflowElement, p as getNodeScroll, e as getParentNode, d as isLastTraversableNode, q as isTableElement, r as isContainingBlock, s as getContainingBlock } from './floating-ui.utils.dom-es.js';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { useLayoutEffect } from 'react';
|
|
4
5
|
import * as ReactDOM from 'react-dom';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useLayoutEffect } from 'react';
|
|
3
|
-
import { i as isShadowRoot, a as isHTMLElement,
|
|
3
|
+
import { i as isShadowRoot, a as isHTMLElement, b as isElement, c as isNode, g as getNodeName, d as isLastTraversableNode, e as getParentNode, f as getComputedStyle, h as getOverflowAncestors, j as isWebKit } from './floating-ui.utils.dom-es.js';
|
|
4
|
+
import { t as tabbable, f as floor, i as isTabbable, a as focusable } from './index.esm-es.js';
|
|
4
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
6
|
import * as ReactDOM from 'react-dom';
|
|
6
7
|
import { u as useFloating$1 } from './floating-ui.react-dom-es.js';
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function hasWindow() {
|
|
4
|
+
return typeof window !== 'undefined';
|
|
5
|
+
}
|
|
6
|
+
function getNodeName(node) {
|
|
7
|
+
if (isNode(node)) {
|
|
8
|
+
return (node.nodeName || '').toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
11
|
+
// returning `#document` an infinite loop won't occur.
|
|
12
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
13
|
+
return '#document';
|
|
14
|
+
}
|
|
15
|
+
function getWindow(node) {
|
|
16
|
+
var _node$ownerDocument;
|
|
17
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
18
|
+
}
|
|
19
|
+
function getDocumentElement(node) {
|
|
20
|
+
var _ref;
|
|
21
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
22
|
+
}
|
|
23
|
+
function isNode(value) {
|
|
24
|
+
if (!hasWindow()) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
28
|
+
}
|
|
29
|
+
function isElement(value) {
|
|
30
|
+
if (!hasWindow()) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
34
|
+
}
|
|
35
|
+
function isHTMLElement(value) {
|
|
36
|
+
if (!hasWindow()) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
40
|
+
}
|
|
41
|
+
function isShadowRoot(value) {
|
|
42
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
46
|
+
}
|
|
47
|
+
function isOverflowElement(element) {
|
|
48
|
+
const {
|
|
49
|
+
overflow,
|
|
50
|
+
overflowX,
|
|
51
|
+
overflowY,
|
|
52
|
+
display
|
|
53
|
+
} = getComputedStyle(element);
|
|
54
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
|
55
|
+
}
|
|
56
|
+
function isTableElement(element) {
|
|
57
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
58
|
+
}
|
|
59
|
+
function isTopLayer(element) {
|
|
60
|
+
try {
|
|
61
|
+
if (element.matches(':popover-open')) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
} catch (_e) {
|
|
65
|
+
// no-op
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
return element.matches(':modal');
|
|
69
|
+
} catch (_e) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
74
|
+
const containRe = /paint|layout|strict|content/;
|
|
75
|
+
const isNotNone = value => !!value && value !== 'none';
|
|
76
|
+
let isWebKitValue;
|
|
77
|
+
function isContainingBlock(elementOrCss) {
|
|
78
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
79
|
+
|
|
80
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
81
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
82
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
|
83
|
+
}
|
|
84
|
+
function getContainingBlock(element) {
|
|
85
|
+
let currentNode = getParentNode(element);
|
|
86
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
87
|
+
if (isContainingBlock(currentNode)) {
|
|
88
|
+
return currentNode;
|
|
89
|
+
} else if (isTopLayer(currentNode)) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
currentNode = getParentNode(currentNode);
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
function isWebKit() {
|
|
97
|
+
if (isWebKitValue == null) {
|
|
98
|
+
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
|
99
|
+
}
|
|
100
|
+
return isWebKitValue;
|
|
101
|
+
}
|
|
102
|
+
function isLastTraversableNode(node) {
|
|
103
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
104
|
+
}
|
|
105
|
+
function getComputedStyle(element) {
|
|
106
|
+
return getWindow(element).getComputedStyle(element);
|
|
107
|
+
}
|
|
108
|
+
function getNodeScroll(element) {
|
|
109
|
+
if (isElement(element)) {
|
|
110
|
+
return {
|
|
111
|
+
scrollLeft: element.scrollLeft,
|
|
112
|
+
scrollTop: element.scrollTop
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
scrollLeft: element.scrollX,
|
|
117
|
+
scrollTop: element.scrollY
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function getParentNode(node) {
|
|
121
|
+
if (getNodeName(node) === 'html') {
|
|
122
|
+
return node;
|
|
123
|
+
}
|
|
124
|
+
const result =
|
|
125
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
126
|
+
node.assignedSlot ||
|
|
127
|
+
// DOM Element detected.
|
|
128
|
+
node.parentNode ||
|
|
129
|
+
// ShadowRoot detected.
|
|
130
|
+
isShadowRoot(node) && node.host ||
|
|
131
|
+
// Fallback.
|
|
132
|
+
getDocumentElement(node);
|
|
133
|
+
return isShadowRoot(result) ? result.host : result;
|
|
134
|
+
}
|
|
135
|
+
function getNearestOverflowAncestor(node) {
|
|
136
|
+
const parentNode = getParentNode(node);
|
|
137
|
+
if (isLastTraversableNode(parentNode)) {
|
|
138
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
139
|
+
}
|
|
140
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
141
|
+
return parentNode;
|
|
142
|
+
}
|
|
143
|
+
return getNearestOverflowAncestor(parentNode);
|
|
144
|
+
}
|
|
145
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
146
|
+
var _node$ownerDocument2;
|
|
147
|
+
if (list === void 0) {
|
|
148
|
+
list = [];
|
|
149
|
+
}
|
|
150
|
+
if (traverseIframes === void 0) {
|
|
151
|
+
traverseIframes = true;
|
|
152
|
+
}
|
|
153
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
154
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
155
|
+
const win = getWindow(scrollableAncestor);
|
|
156
|
+
if (isBody) {
|
|
157
|
+
const frameElement = getFrameElement(win);
|
|
158
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
159
|
+
} else {
|
|
160
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function getFrameElement(win) {
|
|
164
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
exports.getComputedStyle = getComputedStyle;
|
|
168
|
+
exports.getContainingBlock = getContainingBlock;
|
|
169
|
+
exports.getDocumentElement = getDocumentElement;
|
|
170
|
+
exports.getFrameElement = getFrameElement;
|
|
171
|
+
exports.getNodeName = getNodeName;
|
|
172
|
+
exports.getNodeScroll = getNodeScroll;
|
|
173
|
+
exports.getOverflowAncestors = getOverflowAncestors;
|
|
174
|
+
exports.getParentNode = getParentNode;
|
|
175
|
+
exports.getWindow = getWindow;
|
|
176
|
+
exports.isContainingBlock = isContainingBlock;
|
|
177
|
+
exports.isElement = isElement;
|
|
178
|
+
exports.isHTMLElement = isHTMLElement;
|
|
179
|
+
exports.isLastTraversableNode = isLastTraversableNode;
|
|
180
|
+
exports.isNode = isNode;
|
|
181
|
+
exports.isOverflowElement = isOverflowElement;
|
|
182
|
+
exports.isShadowRoot = isShadowRoot;
|
|
183
|
+
exports.isTableElement = isTableElement;
|
|
184
|
+
exports.isTopLayer = isTopLayer;
|
|
185
|
+
exports.isWebKit = isWebKit;
|