@jobber/components 8.23.0 → 8.23.1
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 -1
- package/dist/Autocomplete/index.mjs +1 -1
- package/dist/Card/index.cjs +4 -4
- package/dist/Card/index.mjs +4 -4
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip/index.mjs +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.cjs +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -1
- package/dist/Chips/InternalChipDismissible/index.cjs +1 -1
- package/dist/Chips/InternalChipDismissible/index.mjs +1 -1
- package/dist/Chips/index.cjs +1 -1
- package/dist/Chips/index.mjs +1 -1
- package/dist/ComboboxChipRemove-cjs.js +668 -379
- package/dist/ComboboxChipRemove-es.js +508 -219
- package/dist/ConfirmationModal/index.cjs +1 -1
- package/dist/ConfirmationModal/index.mjs +1 -1
- package/dist/DataDump/index.cjs +4 -4
- package/dist/DataDump/index.mjs +4 -4
- package/dist/DataList/components/DataListActions/index.cjs +1 -1
- package/dist/DataList/components/DataListActions/index.mjs +1 -1
- package/dist/DataList/components/DataListBulkActions/index.cjs +1 -1
- package/dist/DataList/components/DataListBulkActions/index.mjs +1 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -1
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -1
- package/dist/DataList/components/DataListFilters/index.cjs +1 -1
- package/dist/DataList/components/DataListFilters/index.mjs +1 -1
- package/dist/DataList/components/DataListHeader/index.cjs +1 -1
- package/dist/DataList/components/DataListHeader/index.mjs +1 -1
- package/dist/DataList/components/DataListItem/index.cjs +1 -1
- package/dist/DataList/components/DataListItem/index.mjs +1 -1
- package/dist/DataList/components/DataListItemActions/index.cjs +1 -1
- package/dist/DataList/components/DataListItemActions/index.mjs +1 -1
- package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +1 -1
- package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +1 -1
- package/dist/DataList/components/DataListItems/index.cjs +1 -1
- package/dist/DataList/components/DataListItems/index.mjs +1 -1
- package/dist/DataList/components/DataListLayout/index.cjs +1 -1
- package/dist/DataList/components/DataListLayout/index.mjs +1 -1
- package/dist/DataList/components/DataListLayoutActions/index.cjs +1 -1
- package/dist/DataList/components/DataListLayoutActions/index.mjs +1 -1
- package/dist/DataList/index.cjs +1 -1
- package/dist/DataList/index.mjs +1 -1
- package/dist/DatePicker/index.cjs +1 -1
- package/dist/DatePicker/index.mjs +1 -1
- package/dist/Dialog/index.cjs +3 -3
- package/dist/Dialog/index.mjs +3 -3
- package/dist/DrawerDescription-cjs.js +32 -33
- package/dist/DrawerDescription-es.js +19 -20
- package/dist/DrawerTitle-cjs.js +7 -5
- package/dist/DrawerTitle-es.js +7 -5
- package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +1 -1
- package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +1 -1
- package/dist/FilterPicker/components/FilterPickerContent/index.cjs +1 -1
- package/dist/FilterPicker/components/FilterPickerContent/index.mjs +1 -1
- package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +1 -1
- package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +1 -1
- package/dist/FilterPicker/index.cjs +1 -1
- package/dist/FilterPicker/index.mjs +1 -1
- package/dist/FormFieldWrapper-cjs.js +2 -2
- package/dist/FormFieldWrapper-es.js +2 -2
- package/dist/FormatFile/index.cjs +1 -1
- package/dist/FormatFile/index.mjs +1 -1
- package/dist/Gallery/index.cjs +1 -1
- package/dist/Gallery/index.mjs +1 -1
- package/dist/InputDate/index.cjs +1 -1
- package/dist/InputDate/index.mjs +1 -1
- package/dist/InputNumberExperimental-cjs.js +319 -102
- package/dist/InputNumberExperimental-es.js +321 -104
- package/dist/LightBox/index.cjs +1 -1
- package/dist/LightBox/index.mjs +1 -1
- package/dist/Menu/index.cjs +4 -4
- package/dist/Menu/index.mjs +4 -4
- package/dist/MenuSubmenuTrigger-cjs.js +545 -498
- package/dist/MenuSubmenuTrigger-es.js +490 -443
- package/dist/Modal/index.cjs +1 -1
- package/dist/Modal/index.mjs +1 -1
- package/dist/NumberFieldInput-cjs.js +609 -496
- package/dist/NumberFieldInput-es.js +612 -498
- package/dist/Page/index.cjs +4 -4
- package/dist/Page/index.mjs +4 -4
- package/dist/Popover/index.cjs +1 -1
- package/dist/Popover/index.mjs +1 -1
- package/dist/ScrollAreaViewport-cjs.js +326 -601
- package/dist/ScrollAreaViewport-es.js +278 -548
- package/dist/SelectGroupLabel-cjs.js +494 -528
- package/dist/SelectGroupLabel-es.js +411 -445
- package/dist/Separator-cjs.js +1 -0
- package/dist/Separator-es.js +1 -0
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/index.mjs +1 -1
- package/dist/docs/InputTime/InputTime.md +8 -0
- package/dist/docs/SelectPrimitive/SelectPrimitive.md +38 -25
- package/dist/floating-ui.react-cjs.js +586 -10
- package/dist/floating-ui.react-dom-cjs.js +92 -92
- package/dist/floating-ui.react-dom-es.js +1 -1
- package/dist/floating-ui.react-es.js +580 -4
- package/dist/floating-ui.utils-cjs.js +159 -0
- package/dist/floating-ui.utils-es.js +136 -0
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{ToolbarRootContext-cjs.js → isElementDisabled-cjs.js} +5 -0
- package/dist/{ToolbarRootContext-es.js → isElementDisabled-es.js} +5 -1
- package/dist/primitives/BottomSheet/index.cjs +3 -3
- package/dist/primitives/BottomSheet/index.mjs +3 -3
- package/dist/primitives/ComboboxPrimitive/index.cjs +2 -2
- package/dist/primitives/ComboboxPrimitive/index.mjs +2 -2
- package/dist/primitives/InputNumberExperimental/index.cjs +1 -1
- package/dist/primitives/InputNumberExperimental/index.mjs +1 -1
- package/dist/primitives/SelectPrimitive/index.cjs +5 -5
- package/dist/primitives/SelectPrimitive/index.mjs +5 -5
- package/dist/primitives/index.cjs +4 -4
- package/dist/primitives/index.mjs +4 -4
- package/dist/resolveAriaLabelledBy-cjs.js +5 -0
- package/dist/resolveAriaLabelledBy-es.js +5 -1
- package/dist/{CSPContext-cjs.js → scrollEdges-cjs.js} +30 -2
- package/dist/{CSPContext-es.js → scrollEdges-es.js} +28 -3
- package/dist/styles.css +9 -3
- package/dist/unstyledPrimitives/index.cjs +1217 -639
- package/dist/unstyledPrimitives/index.mjs +1163 -585
- package/dist/useButton-cjs.js +283 -317
- package/dist/useButton-es.js +277 -298
- package/dist/useCompositeListItem-cjs.js +328 -279
- package/dist/useCompositeListItem-es.js +293 -246
- package/dist/useLabel-cjs.js +11 -1
- package/dist/useLabel-es.js +11 -2
- package/dist/useLabelableId-cjs.js +37 -91
- package/dist/useLabelableId-es.js +37 -90
- package/dist/useRenderElement-cjs.js +81 -26
- package/dist/useRenderElement-es.js +81 -27
- package/dist/{InternalBackdrop-cjs.js → useScrollLock-cjs.js} +1286 -1220
- package/dist/{InternalBackdrop-es.js → useScrollLock-es.js} +1250 -1207
- package/package.json +3 -3
- package/dist/index.esm-cjs.js +0 -738
- package/dist/index.esm-es.js +0 -712
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var floatingUi_utils = require('./floating-ui.utils-cjs.js');
|
|
4
4
|
var floatingUi_utils_dom = require('./floating-ui.utils.dom-cjs.js');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
@@ -30,10 +30,10 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
30
30
|
reference,
|
|
31
31
|
floating
|
|
32
32
|
} = _ref;
|
|
33
|
-
const sideAxis =
|
|
34
|
-
const alignmentAxis =
|
|
35
|
-
const alignLength =
|
|
36
|
-
const side =
|
|
33
|
+
const sideAxis = floatingUi_utils.getSideAxis(placement);
|
|
34
|
+
const alignmentAxis = floatingUi_utils.getAlignmentAxis(placement);
|
|
35
|
+
const alignLength = floatingUi_utils.getAxisLength(alignmentAxis);
|
|
36
|
+
const side = floatingUi_utils.getSide(placement);
|
|
37
37
|
const isVertical = sideAxis === 'y';
|
|
38
38
|
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
39
39
|
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
@@ -70,7 +70,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
70
70
|
y: reference.y
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
switch (
|
|
73
|
+
switch (floatingUi_utils.getAlignment(placement)) {
|
|
74
74
|
case 'start':
|
|
75
75
|
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
76
76
|
break;
|
|
@@ -108,11 +108,11 @@ async function detectOverflow(state, options) {
|
|
|
108
108
|
elementContext = 'floating',
|
|
109
109
|
altBoundary = false,
|
|
110
110
|
padding = 0
|
|
111
|
-
} =
|
|
112
|
-
const paddingObject =
|
|
111
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
112
|
+
const paddingObject = floatingUi_utils.getPaddingObject(padding);
|
|
113
113
|
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
114
114
|
const element = elements[altBoundary ? altContext : elementContext];
|
|
115
|
-
const clippingClientRect =
|
|
115
|
+
const clippingClientRect = floatingUi_utils.rectToClientRect(await platform.getClippingRect({
|
|
116
116
|
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
117
117
|
boundary,
|
|
118
118
|
rootBoundary,
|
|
@@ -132,7 +132,7 @@ async function detectOverflow(state, options) {
|
|
|
132
132
|
x: 1,
|
|
133
133
|
y: 1
|
|
134
134
|
};
|
|
135
|
-
const elementClientRect =
|
|
135
|
+
const elementClientRect = floatingUi_utils.rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
136
136
|
elements,
|
|
137
137
|
rect,
|
|
138
138
|
offsetParent,
|
|
@@ -266,17 +266,17 @@ const arrow$3 = options => ({
|
|
|
266
266
|
const {
|
|
267
267
|
element,
|
|
268
268
|
padding = 0
|
|
269
|
-
} =
|
|
269
|
+
} = floatingUi_utils.evaluate(options, state) || {};
|
|
270
270
|
if (element == null) {
|
|
271
271
|
return {};
|
|
272
272
|
}
|
|
273
|
-
const paddingObject =
|
|
273
|
+
const paddingObject = floatingUi_utils.getPaddingObject(padding);
|
|
274
274
|
const coords = {
|
|
275
275
|
x,
|
|
276
276
|
y
|
|
277
277
|
};
|
|
278
|
-
const axis =
|
|
279
|
-
const length =
|
|
278
|
+
const axis = floatingUi_utils.getAlignmentAxis(placement);
|
|
279
|
+
const length = floatingUi_utils.getAxisLength(axis);
|
|
280
280
|
const arrowDimensions = await platform.getDimensions(element);
|
|
281
281
|
const isYAxis = axis === 'y';
|
|
282
282
|
const minProp = isYAxis ? 'top' : 'left';
|
|
@@ -296,21 +296,21 @@ const arrow$3 = options => ({
|
|
|
296
296
|
// If the padding is large enough that it causes the arrow to no longer be
|
|
297
297
|
// centered, modify the padding so that it is centered.
|
|
298
298
|
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
299
|
-
const minPadding =
|
|
300
|
-
const maxPadding =
|
|
299
|
+
const minPadding = floatingUi_utils.min(paddingObject[minProp], largestPossiblePadding);
|
|
300
|
+
const maxPadding = floatingUi_utils.min(paddingObject[maxProp], largestPossiblePadding);
|
|
301
301
|
|
|
302
302
|
// Make sure the arrow doesn't overflow the floating element if the center
|
|
303
303
|
// point is outside the floating element's bounds.
|
|
304
304
|
const min$1 = minPadding;
|
|
305
305
|
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
306
306
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
307
|
-
const offset =
|
|
307
|
+
const offset = floatingUi_utils.clamp(min$1, center, max);
|
|
308
308
|
|
|
309
309
|
// If the reference is small enough that the arrow's padding causes it to
|
|
310
310
|
// to point to nothing for an aligned placement, adjust the offset of the
|
|
311
311
|
// floating element itself. To ensure `shift()` continues to take action,
|
|
312
312
|
// a single reset is performed when this is true.
|
|
313
|
-
const shouldAddOffset = !middlewareData.arrow &&
|
|
313
|
+
const shouldAddOffset = !middlewareData.arrow && floatingUi_utils.getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
314
314
|
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
315
315
|
return {
|
|
316
316
|
[axis]: coords[axis] + alignmentOffset,
|
|
@@ -327,10 +327,10 @@ const arrow$3 = options => ({
|
|
|
327
327
|
});
|
|
328
328
|
|
|
329
329
|
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
330
|
-
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement =>
|
|
330
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => floatingUi_utils.getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => floatingUi_utils.getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => floatingUi_utils.getSide(placement) === placement);
|
|
331
331
|
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
332
332
|
if (alignment) {
|
|
333
|
-
return
|
|
333
|
+
return floatingUi_utils.getAlignment(placement) === alignment || (autoAlignment ? floatingUi_utils.getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
334
334
|
}
|
|
335
335
|
return true;
|
|
336
336
|
});
|
|
@@ -360,18 +360,18 @@ const autoPlacement$2 = function (options) {
|
|
|
360
360
|
const {
|
|
361
361
|
crossAxis = false,
|
|
362
362
|
alignment,
|
|
363
|
-
allowedPlacements =
|
|
363
|
+
allowedPlacements = floatingUi_utils.placements,
|
|
364
364
|
autoAlignment = true,
|
|
365
365
|
...detectOverflowOptions
|
|
366
|
-
} =
|
|
367
|
-
const placements$1 = alignment !== undefined || allowedPlacements ===
|
|
366
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
367
|
+
const placements$1 = alignment !== undefined || allowedPlacements === floatingUi_utils.placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
368
368
|
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
369
369
|
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
370
370
|
const currentPlacement = placements$1[currentIndex];
|
|
371
371
|
if (currentPlacement == null) {
|
|
372
372
|
return {};
|
|
373
373
|
}
|
|
374
|
-
const alignmentSides =
|
|
374
|
+
const alignmentSides = floatingUi_utils.getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
375
375
|
|
|
376
376
|
// Make `computeCoords` start from the right place.
|
|
377
377
|
if (placement !== currentPlacement) {
|
|
@@ -381,7 +381,7 @@ const autoPlacement$2 = function (options) {
|
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
const currentOverflows = [overflow[
|
|
384
|
+
const currentOverflows = [overflow[floatingUi_utils.getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
385
385
|
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
386
386
|
placement: currentPlacement,
|
|
387
387
|
overflows: currentOverflows
|
|
@@ -401,7 +401,7 @@ const autoPlacement$2 = function (options) {
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
const placementsSortedByMostSpace = allOverflows.map(d => {
|
|
404
|
-
const alignment =
|
|
404
|
+
const alignment = floatingUi_utils.getAlignment(d.placement);
|
|
405
405
|
return [d.placement, alignment && crossAxis ?
|
|
406
406
|
// Check along the mainAxis and main crossAxis side.
|
|
407
407
|
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
|
|
@@ -411,7 +411,7 @@ const autoPlacement$2 = function (options) {
|
|
|
411
411
|
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
|
|
412
412
|
// Aligned placements should not check their opposite crossAxis
|
|
413
413
|
// side.
|
|
414
|
-
|
|
414
|
+
floatingUi_utils.getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
|
|
415
415
|
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
416
416
|
if (resetPlacement !== placement) {
|
|
417
417
|
return {
|
|
@@ -460,7 +460,7 @@ const flip$2 = function (options) {
|
|
|
460
460
|
fallbackAxisSideDirection = 'none',
|
|
461
461
|
flipAlignment = true,
|
|
462
462
|
...detectOverflowOptions
|
|
463
|
-
} =
|
|
463
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
464
464
|
|
|
465
465
|
// If a reset by the arrow was caused due to an alignment offset being
|
|
466
466
|
// added, we should skip any logic now since `flip()` has already done its
|
|
@@ -469,14 +469,14 @@ const flip$2 = function (options) {
|
|
|
469
469
|
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
470
470
|
return {};
|
|
471
471
|
}
|
|
472
|
-
const side =
|
|
473
|
-
const initialSideAxis =
|
|
474
|
-
const isBasePlacement =
|
|
472
|
+
const side = floatingUi_utils.getSide(placement);
|
|
473
|
+
const initialSideAxis = floatingUi_utils.getSideAxis(initialPlacement);
|
|
474
|
+
const isBasePlacement = floatingUi_utils.getSide(initialPlacement) === initialPlacement;
|
|
475
475
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
476
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [
|
|
476
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [floatingUi_utils.getOppositePlacement(initialPlacement)] : floatingUi_utils.getExpandedPlacements(initialPlacement));
|
|
477
477
|
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
478
478
|
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
479
|
-
fallbackPlacements.push(...
|
|
479
|
+
fallbackPlacements.push(...floatingUi_utils.getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
480
480
|
}
|
|
481
481
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
482
482
|
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
@@ -486,7 +486,7 @@ const flip$2 = function (options) {
|
|
|
486
486
|
overflows.push(overflow[side]);
|
|
487
487
|
}
|
|
488
488
|
if (checkCrossAxis) {
|
|
489
|
-
const sides =
|
|
489
|
+
const sides = floatingUi_utils.getAlignmentSides(placement, rects, rtl);
|
|
490
490
|
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
491
491
|
}
|
|
492
492
|
overflowsData = [...overflowsData, {
|
|
@@ -500,11 +500,11 @@ const flip$2 = function (options) {
|
|
|
500
500
|
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
501
501
|
const nextPlacement = placements[nextIndex];
|
|
502
502
|
if (nextPlacement) {
|
|
503
|
-
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !==
|
|
503
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== floatingUi_utils.getSideAxis(nextPlacement) : false;
|
|
504
504
|
if (!ignoreCrossAxisOverflow ||
|
|
505
505
|
// We leave the current main axis only if every placement on that axis
|
|
506
506
|
// overflows the main axis.
|
|
507
|
-
overflowsData.every(d =>
|
|
507
|
+
overflowsData.every(d => floatingUi_utils.getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
508
508
|
// Try next placement and re-run the lifecycle.
|
|
509
509
|
return {
|
|
510
510
|
data: {
|
|
@@ -530,7 +530,7 @@ const flip$2 = function (options) {
|
|
|
530
530
|
var _overflowsData$filter2;
|
|
531
531
|
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
532
532
|
if (hasFallbackAxisSideDirection) {
|
|
533
|
-
const currentSideAxis =
|
|
533
|
+
const currentSideAxis = floatingUi_utils.getSideAxis(d.placement);
|
|
534
534
|
return currentSideAxis === initialSideAxis ||
|
|
535
535
|
// Create a bias to the `y` side axis due to horizontal
|
|
536
536
|
// reading directions favoring greater width.
|
|
@@ -570,7 +570,7 @@ function getSideOffsets(overflow, rect) {
|
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
572
|
function isAnySideFullyClipped(overflow) {
|
|
573
|
-
return
|
|
573
|
+
return floatingUi_utils.sides.some(side => overflow[side] >= 0);
|
|
574
574
|
}
|
|
575
575
|
/**
|
|
576
576
|
* Provides data to hide the floating element in applicable situations, such as
|
|
@@ -592,7 +592,7 @@ const hide$2 = function (options) {
|
|
|
592
592
|
const {
|
|
593
593
|
strategy = 'referenceHidden',
|
|
594
594
|
...detectOverflowOptions
|
|
595
|
-
} =
|
|
595
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
596
596
|
switch (strategy) {
|
|
597
597
|
case 'referenceHidden':
|
|
598
598
|
{
|
|
@@ -643,12 +643,12 @@ async function convertValueToCoords(state, options) {
|
|
|
643
643
|
elements
|
|
644
644
|
} = state;
|
|
645
645
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
646
|
-
const side =
|
|
647
|
-
const alignment =
|
|
648
|
-
const isVertical =
|
|
646
|
+
const side = floatingUi_utils.getSide(placement);
|
|
647
|
+
const alignment = floatingUi_utils.getAlignment(placement);
|
|
648
|
+
const isVertical = floatingUi_utils.getSideAxis(placement) === 'y';
|
|
649
649
|
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
650
650
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
651
|
-
const rawValue =
|
|
651
|
+
const rawValue = floatingUi_utils.evaluate(options, state);
|
|
652
652
|
|
|
653
653
|
// eslint-disable-next-line prefer-const
|
|
654
654
|
let {
|
|
@@ -752,14 +752,14 @@ const shift$2 = function (options) {
|
|
|
752
752
|
}
|
|
753
753
|
},
|
|
754
754
|
...detectOverflowOptions
|
|
755
|
-
} =
|
|
755
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
756
756
|
const coords = {
|
|
757
757
|
x,
|
|
758
758
|
y
|
|
759
759
|
};
|
|
760
760
|
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
761
|
-
const crossAxis =
|
|
762
|
-
const mainAxis =
|
|
761
|
+
const crossAxis = floatingUi_utils.getSideAxis(floatingUi_utils.getSide(placement));
|
|
762
|
+
const mainAxis = floatingUi_utils.getOppositeAxis(crossAxis);
|
|
763
763
|
let mainAxisCoord = coords[mainAxis];
|
|
764
764
|
let crossAxisCoord = coords[crossAxis];
|
|
765
765
|
if (checkMainAxis) {
|
|
@@ -767,14 +767,14 @@ const shift$2 = function (options) {
|
|
|
767
767
|
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
768
768
|
const min = mainAxisCoord + overflow[minSide];
|
|
769
769
|
const max = mainAxisCoord - overflow[maxSide];
|
|
770
|
-
mainAxisCoord =
|
|
770
|
+
mainAxisCoord = floatingUi_utils.clamp(min, mainAxisCoord, max);
|
|
771
771
|
}
|
|
772
772
|
if (checkCrossAxis) {
|
|
773
773
|
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
774
774
|
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
775
775
|
const min = crossAxisCoord + overflow[minSide];
|
|
776
776
|
const max = crossAxisCoord - overflow[maxSide];
|
|
777
|
-
crossAxisCoord =
|
|
777
|
+
crossAxisCoord = floatingUi_utils.clamp(min, crossAxisCoord, max);
|
|
778
778
|
}
|
|
779
779
|
const limitedCoords = limiter.fn({
|
|
780
780
|
...state,
|
|
@@ -816,16 +816,16 @@ const limitShift$2 = function (options) {
|
|
|
816
816
|
offset = 0,
|
|
817
817
|
mainAxis: checkMainAxis = true,
|
|
818
818
|
crossAxis: checkCrossAxis = true
|
|
819
|
-
} =
|
|
819
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
820
820
|
const coords = {
|
|
821
821
|
x,
|
|
822
822
|
y
|
|
823
823
|
};
|
|
824
|
-
const crossAxis =
|
|
825
|
-
const mainAxis =
|
|
824
|
+
const crossAxis = floatingUi_utils.getSideAxis(placement);
|
|
825
|
+
const mainAxis = floatingUi_utils.getOppositeAxis(crossAxis);
|
|
826
826
|
let mainAxisCoord = coords[mainAxis];
|
|
827
827
|
let crossAxisCoord = coords[crossAxis];
|
|
828
|
-
const rawOffset =
|
|
828
|
+
const rawOffset = floatingUi_utils.evaluate(offset, state);
|
|
829
829
|
const computedOffset = typeof rawOffset === 'number' ? {
|
|
830
830
|
mainAxis: rawOffset,
|
|
831
831
|
crossAxis: 0
|
|
@@ -847,7 +847,7 @@ const limitShift$2 = function (options) {
|
|
|
847
847
|
if (checkCrossAxis) {
|
|
848
848
|
var _middlewareData$offse, _middlewareData$offse2;
|
|
849
849
|
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
850
|
-
const isOriginSide = originSides.has(
|
|
850
|
+
const isOriginSide = originSides.has(floatingUi_utils.getSide(placement));
|
|
851
851
|
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
852
852
|
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
853
853
|
if (crossAxisCoord < limitMin) {
|
|
@@ -888,11 +888,11 @@ const size$2 = function (options) {
|
|
|
888
888
|
const {
|
|
889
889
|
apply = () => {},
|
|
890
890
|
...detectOverflowOptions
|
|
891
|
-
} =
|
|
891
|
+
} = floatingUi_utils.evaluate(options, state);
|
|
892
892
|
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
893
|
-
const side =
|
|
894
|
-
const alignment =
|
|
895
|
-
const isYAxis =
|
|
893
|
+
const side = floatingUi_utils.getSide(placement);
|
|
894
|
+
const alignment = floatingUi_utils.getAlignment(placement);
|
|
895
|
+
const isYAxis = floatingUi_utils.getSideAxis(placement) === 'y';
|
|
896
896
|
const {
|
|
897
897
|
width,
|
|
898
898
|
height
|
|
@@ -908,8 +908,8 @@ const size$2 = function (options) {
|
|
|
908
908
|
}
|
|
909
909
|
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
910
910
|
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
911
|
-
const overflowAvailableHeight =
|
|
912
|
-
const overflowAvailableWidth =
|
|
911
|
+
const overflowAvailableHeight = floatingUi_utils.min(height - overflow[heightSide], maximumClippingHeight);
|
|
912
|
+
const overflowAvailableWidth = floatingUi_utils.min(width - overflow[widthSide], maximumClippingWidth);
|
|
913
913
|
const noShift = !state.middlewareData.shift;
|
|
914
914
|
let availableHeight = overflowAvailableHeight;
|
|
915
915
|
let availableWidth = overflowAvailableWidth;
|
|
@@ -920,14 +920,14 @@ const size$2 = function (options) {
|
|
|
920
920
|
availableHeight = maximumClippingHeight;
|
|
921
921
|
}
|
|
922
922
|
if (noShift && !alignment) {
|
|
923
|
-
const xMin =
|
|
924
|
-
const xMax =
|
|
925
|
-
const yMin =
|
|
926
|
-
const yMax =
|
|
923
|
+
const xMin = floatingUi_utils.max(overflow.left, 0);
|
|
924
|
+
const xMax = floatingUi_utils.max(overflow.right, 0);
|
|
925
|
+
const yMin = floatingUi_utils.max(overflow.top, 0);
|
|
926
|
+
const yMax = floatingUi_utils.max(overflow.bottom, 0);
|
|
927
927
|
if (isYAxis) {
|
|
928
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax :
|
|
928
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : floatingUi_utils.max(overflow.left, overflow.right));
|
|
929
929
|
} else {
|
|
930
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax :
|
|
930
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : floatingUi_utils.max(overflow.top, overflow.bottom));
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
await apply({
|
|
@@ -957,7 +957,7 @@ function getCssDimensions(element) {
|
|
|
957
957
|
const hasOffset = floatingUi_utils_dom.isHTMLElement(element);
|
|
958
958
|
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
959
959
|
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
960
|
-
const shouldFallback =
|
|
960
|
+
const shouldFallback = floatingUi_utils.round(width) !== offsetWidth || floatingUi_utils.round(height) !== offsetHeight;
|
|
961
961
|
if (shouldFallback) {
|
|
962
962
|
width = offsetWidth;
|
|
963
963
|
height = offsetHeight;
|
|
@@ -976,7 +976,7 @@ function unwrapElement(element) {
|
|
|
976
976
|
function getScale(element) {
|
|
977
977
|
const domElement = unwrapElement(element);
|
|
978
978
|
if (!floatingUi_utils_dom.isHTMLElement(domElement)) {
|
|
979
|
-
return
|
|
979
|
+
return floatingUi_utils.createCoords(1);
|
|
980
980
|
}
|
|
981
981
|
const rect = domElement.getBoundingClientRect();
|
|
982
982
|
const {
|
|
@@ -984,8 +984,8 @@ function getScale(element) {
|
|
|
984
984
|
height,
|
|
985
985
|
$
|
|
986
986
|
} = getCssDimensions(domElement);
|
|
987
|
-
let x = ($ ?
|
|
988
|
-
let y = ($ ?
|
|
987
|
+
let x = ($ ? floatingUi_utils.round(rect.width) : rect.width) / width;
|
|
988
|
+
let y = ($ ? floatingUi_utils.round(rect.height) : rect.height) / height;
|
|
989
989
|
|
|
990
990
|
// 0, NaN, or Infinity should always fallback to 1.
|
|
991
991
|
|
|
@@ -1001,7 +1001,7 @@ function getScale(element) {
|
|
|
1001
1001
|
};
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
1004
|
-
const noOffsets = /*#__PURE__*/
|
|
1004
|
+
const noOffsets = /*#__PURE__*/floatingUi_utils.createCoords(0);
|
|
1005
1005
|
function getVisualOffsets(element) {
|
|
1006
1006
|
const win = floatingUi_utils_dom.getWindow(element);
|
|
1007
1007
|
if (!floatingUi_utils_dom.isWebKit() || !win.visualViewport) {
|
|
@@ -1031,7 +1031,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1031
1031
|
}
|
|
1032
1032
|
const clientRect = element.getBoundingClientRect();
|
|
1033
1033
|
const domElement = unwrapElement(element);
|
|
1034
|
-
let scale =
|
|
1034
|
+
let scale = floatingUi_utils.createCoords(1);
|
|
1035
1035
|
if (includeScale) {
|
|
1036
1036
|
if (offsetParent) {
|
|
1037
1037
|
if (floatingUi_utils_dom.isElement(offsetParent)) {
|
|
@@ -1041,7 +1041,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1041
1041
|
scale = getScale(element);
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) :
|
|
1044
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floatingUi_utils.createCoords(0);
|
|
1045
1045
|
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1046
1046
|
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1047
1047
|
let width = clientRect.width / scale.x;
|
|
@@ -1067,7 +1067,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1067
1067
|
currentIFrame = floatingUi_utils_dom.getFrameElement(currentWin);
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
|
-
return
|
|
1070
|
+
return floatingUi_utils.rectToClientRect({
|
|
1071
1071
|
width,
|
|
1072
1072
|
height,
|
|
1073
1073
|
x,
|
|
@@ -1112,8 +1112,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1112
1112
|
scrollLeft: 0,
|
|
1113
1113
|
scrollTop: 0
|
|
1114
1114
|
};
|
|
1115
|
-
let scale =
|
|
1116
|
-
const offsets =
|
|
1115
|
+
let scale = floatingUi_utils.createCoords(1);
|
|
1116
|
+
const offsets = floatingUi_utils.createCoords(0);
|
|
1117
1117
|
const isOffsetParentAnElement = floatingUi_utils_dom.isHTMLElement(offsetParent);
|
|
1118
1118
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1119
1119
|
if (floatingUi_utils_dom.getNodeName(offsetParent) !== 'body' || floatingUi_utils_dom.isOverflowElement(documentElement)) {
|
|
@@ -1126,7 +1126,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1126
1126
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) :
|
|
1129
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : floatingUi_utils.createCoords(0);
|
|
1130
1130
|
return {
|
|
1131
1131
|
width: rect.width * scale.x,
|
|
1132
1132
|
height: rect.height * scale.y,
|
|
@@ -1145,12 +1145,12 @@ function getDocumentRect(element) {
|
|
|
1145
1145
|
const html = floatingUi_utils_dom.getDocumentElement(element);
|
|
1146
1146
|
const scroll = floatingUi_utils_dom.getNodeScroll(element);
|
|
1147
1147
|
const body = element.ownerDocument.body;
|
|
1148
|
-
const width =
|
|
1149
|
-
const height =
|
|
1148
|
+
const width = floatingUi_utils.max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1149
|
+
const height = floatingUi_utils.max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1150
1150
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1151
1151
|
const y = -scroll.scrollTop;
|
|
1152
1152
|
if (floatingUi_utils_dom.getComputedStyle(body).direction === 'rtl') {
|
|
1153
|
-
x +=
|
|
1153
|
+
x += floatingUi_utils.max(html.clientWidth, body.clientWidth) - width;
|
|
1154
1154
|
}
|
|
1155
1155
|
return {
|
|
1156
1156
|
width,
|
|
@@ -1212,7 +1212,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
1212
1212
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1213
1213
|
const top = clientRect.top + element.clientTop;
|
|
1214
1214
|
const left = clientRect.left + element.clientLeft;
|
|
1215
|
-
const scale = floatingUi_utils_dom.isHTMLElement(element) ? getScale(element) :
|
|
1215
|
+
const scale = floatingUi_utils_dom.isHTMLElement(element) ? getScale(element) : floatingUi_utils.createCoords(1);
|
|
1216
1216
|
const width = element.clientWidth * scale.x;
|
|
1217
1217
|
const height = element.clientHeight * scale.y;
|
|
1218
1218
|
const x = left * scale.x;
|
|
@@ -1241,7 +1241,7 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1241
1241
|
height: clippingAncestor.height
|
|
1242
1242
|
};
|
|
1243
1243
|
}
|
|
1244
|
-
return
|
|
1244
|
+
return floatingUi_utils.rectToClientRect(rect);
|
|
1245
1245
|
}
|
|
1246
1246
|
function hasFixedPositionAncestor(element, stopNode) {
|
|
1247
1247
|
const parentNode = floatingUi_utils_dom.getParentNode(element);
|
|
@@ -1303,10 +1303,10 @@ function getClippingRect(_ref) {
|
|
|
1303
1303
|
let left = firstRect.left;
|
|
1304
1304
|
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
1305
1305
|
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1306
|
-
top =
|
|
1307
|
-
right =
|
|
1308
|
-
bottom =
|
|
1309
|
-
left =
|
|
1306
|
+
top = floatingUi_utils.max(rect.top, top);
|
|
1307
|
+
right = floatingUi_utils.min(rect.right, right);
|
|
1308
|
+
bottom = floatingUi_utils.min(rect.bottom, bottom);
|
|
1309
|
+
left = floatingUi_utils.max(rect.left, left);
|
|
1310
1310
|
}
|
|
1311
1311
|
return {
|
|
1312
1312
|
width: right - left,
|
|
@@ -1336,7 +1336,7 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1336
1336
|
scrollLeft: 0,
|
|
1337
1337
|
scrollTop: 0
|
|
1338
1338
|
};
|
|
1339
|
-
const offsets =
|
|
1339
|
+
const offsets = floatingUi_utils.createCoords(0);
|
|
1340
1340
|
|
|
1341
1341
|
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
1342
1342
|
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
@@ -1358,7 +1358,7 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1358
1358
|
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
1359
1359
|
setLeftRTLScrollbarOffset();
|
|
1360
1360
|
}
|
|
1361
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) :
|
|
1361
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : floatingUi_utils.createCoords(0);
|
|
1362
1362
|
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1363
1363
|
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1364
1364
|
return {
|
|
@@ -1487,14 +1487,14 @@ function observeMove(element, onMove) {
|
|
|
1487
1487
|
if (!width || !height) {
|
|
1488
1488
|
return;
|
|
1489
1489
|
}
|
|
1490
|
-
const insetTop =
|
|
1491
|
-
const insetRight =
|
|
1492
|
-
const insetBottom =
|
|
1493
|
-
const insetLeft =
|
|
1490
|
+
const insetTop = floatingUi_utils.floor(top);
|
|
1491
|
+
const insetRight = floatingUi_utils.floor(root.clientWidth - (left + width));
|
|
1492
|
+
const insetBottom = floatingUi_utils.floor(root.clientHeight - (top + height));
|
|
1493
|
+
const insetLeft = floatingUi_utils.floor(left);
|
|
1494
1494
|
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1495
1495
|
const options = {
|
|
1496
1496
|
rootMargin,
|
|
1497
|
-
threshold:
|
|
1497
|
+
threshold: floatingUi_utils.max(0, floatingUi_utils.min(1, threshold)) || 1
|
|
1498
1498
|
};
|
|
1499
1499
|
let isFirstUpdate = true;
|
|
1500
1500
|
function handleObserve(entries) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getSideAxis,
|
|
1
|
+
import { g as getSideAxis, a as getAlignmentAxis, b as getSide, c as getAlignment, e as evaluate, d as getPaddingObject, r as rectToClientRect, h as getOppositePlacement, i as getExpandedPlacements, j as getOppositeAxisPlacements, k as getAlignmentSides, l as clamp, m as min, n as max, o as getAxisLength, s as sides, p as getOppositeAxis, q as placements, t as getOppositeAlignmentPlacement, u as createCoords, v as round, f as floor } from './floating-ui.utils-es.js';
|
|
2
2
|
import { k as getDocumentElement, b as isElement, a 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';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useLayoutEffect } from 'react';
|