@fluentui/react-positioning 0.0.0-nightly-20230223-2115.1 → 0.0.0-nightly-20230228-0425.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/CHANGELOG.json +9 -9
- package/CHANGELOG.md +7 -7
- package/lib/constants.js.map +1 -1
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createPositionManager.js +6 -7
- package/lib/createPositionManager.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +2 -1
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/middleware/coverTarget.js.map +1 -1
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/index.js.map +1 -1
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/maxSize.js +6 -7
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js.map +1 -1
- package/lib/middleware/shift.js.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/usePositioning.js +21 -21
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningMouseTarget.js.map +1 -1
- package/lib/utils/debounce.js +2 -1
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getFloatingUIOffset.js +7 -8
- package/lib/utils/getFloatingUIOffset.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +0 -1
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +6 -5
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/hasAutoFocusFilter.js +2 -2
- package/lib/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +4 -2
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/parseFloatingUIPlacement.js +2 -1
- package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/toFloatingUIPadding.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/toggleScrollListener.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js +2 -1
- package/lib/utils/writeArrowUpdates.js.map +1 -1
- package/lib/utils/writeContainerupdates.js +4 -4
- package/lib/utils/writeContainerupdates.js.map +1 -1
- package/lib-commonjs/constants.js +7 -18
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js +88 -60
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createPositionManager.js +116 -103
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +26 -27
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +51 -24
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/middleware/coverTarget.js +37 -34
- package/lib-commonjs/middleware/coverTarget.js.map +1 -1
- package/lib-commonjs/middleware/flip.js +22 -20
- package/lib-commonjs/middleware/flip.js.map +1 -1
- package/lib-commonjs/middleware/index.js +9 -10
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/intersecting.js +22 -24
- package/lib-commonjs/middleware/intersecting.js.map +1 -1
- package/lib-commonjs/middleware/maxSize.js +40 -35
- package/lib-commonjs/middleware/maxSize.js.map +1 -1
- package/lib-commonjs/middleware/offset.js +12 -11
- package/lib-commonjs/middleware/offset.js.map +1 -1
- package/lib-commonjs/middleware/shift.js +37 -29
- package/lib-commonjs/middleware/shift.js.map +1 -1
- package/lib-commonjs/types.js +2 -5
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePositioning.js +161 -195
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/lib-commonjs/usePositioningMouseTarget.js +37 -34
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/debounce.js +21 -22
- package/lib-commonjs/utils/debounce.js.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.js +35 -30
- package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +22 -21
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getFloatingUIOffset.js +35 -24
- package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +41 -45
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +56 -52
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js +17 -18
- package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib-commonjs/utils/index.js +18 -19
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +32 -32
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js +14 -15
- package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +61 -63
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPadding.js +25 -23
- package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js +33 -31
- package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/toggleScrollListener.js +23 -19
- package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +53 -39
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.js +24 -19
- package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
- package/lib-commonjs/utils/writeContainerupdates.js +45 -37
- package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
- package/package.json +6 -6
- package/.swcrc +0 -33
@@ -1,39 +1,42 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "coverTarget", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>coverTarget
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
6
|
+
exports.coverTarget = void 0;
|
7
|
+
const index_1 = /*#__PURE__*/require("../utils/index");
|
10
8
|
function coverTarget() {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
9
|
+
return {
|
10
|
+
name: 'coverTarget',
|
11
|
+
fn: middlewareArguments => {
|
12
|
+
const {
|
13
|
+
placement,
|
14
|
+
rects,
|
15
|
+
x,
|
16
|
+
y
|
17
|
+
} = middlewareArguments;
|
18
|
+
const basePlacement = index_1.parseFloatingUIPlacement(placement).side;
|
19
|
+
const newCoords = {
|
20
|
+
x,
|
21
|
+
y
|
22
|
+
};
|
23
|
+
switch (basePlacement) {
|
24
|
+
case 'bottom':
|
25
|
+
newCoords.y -= rects.reference.height;
|
26
|
+
break;
|
27
|
+
case 'top':
|
28
|
+
newCoords.y += rects.reference.height;
|
29
|
+
break;
|
30
|
+
case 'left':
|
31
|
+
newCoords.x += rects.reference.width;
|
32
|
+
break;
|
33
|
+
case 'right':
|
34
|
+
newCoords.x -= rects.reference.width;
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
return newCoords;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
}
|
41
|
+
exports.coverTarget = coverTarget;
|
39
42
|
//# sourceMappingURL=coverTarget.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AAEA,SAAgBA,WAAW;EACzB,OAAO;IACLC,IAAI,EAAE,aAAa;IACnBC,EAAE,EAAEC,mBAAmB,IAAG;MACxB,MAAM;QAAEC,SAAS;QAAEC,KAAK;QAAEC,CAAC;QAAEC;MAAC,CAAE,GAAGJ,mBAAmB;MACtD,MAAMK,aAAa,GAAGC,gCAAwB,CAACL,SAAS,CAAC,CAACM,IAAI;MAC9D,MAAMC,SAAS,GAAG;QAAEL,CAAC;QAAEC;MAAC,CAAE;MAE1B,QAAQC,aAAa;QACnB,KAAK,QAAQ;UACXG,SAAS,CAACJ,CAAC,IAAIF,KAAK,CAACO,SAAS,CAACC,MAAM;UACrC;QACF,KAAK,KAAK;UACRF,SAAS,CAACJ,CAAC,IAAIF,KAAK,CAACO,SAAS,CAACC,MAAM;UACrC;QACF,KAAK,MAAM;UACTF,SAAS,CAACL,CAAC,IAAID,KAAK,CAACO,SAAS,CAACE,KAAK;UACpC;QACF,KAAK,OAAO;UACVH,SAAS,CAACL,CAAC,IAAID,KAAK,CAACO,SAAS,CAACE,KAAK;UACpC;MAAM;MAGV,OAAOH,SAAS;IAClB;GACD;AACH;AA1BAI","names":["coverTarget","name","fn","middlewareArguments","placement","rects","x","y","basePlacement","index_1","side","newCoords","reference","height","width","exports"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/coverTarget.ts"],"sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function coverTarget(): Middleware {\n return {\n name: 'coverTarget',\n fn: middlewareArguments => {\n const { placement, rects, x, y } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n const newCoords = { x, y };\n\n switch (basePlacement) {\n case 'bottom':\n newCoords.y -= rects.reference.height;\n break;\n case 'top':\n newCoords.y += rects.reference.height;\n break;\n case 'left':\n newCoords.x += rects.reference.width;\n break;\n case 'right':\n newCoords.x -= rects.reference.width;\n break;\n }\n\n return newCoords;\n },\n };\n}\n"]}
|
@@ -1,25 +1,27 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "flip", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>flip
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
6
|
+
exports.flip = void 0;
|
7
|
+
const dom_1 = /*#__PURE__*/require("@floating-ui/dom");
|
8
|
+
const index_1 = /*#__PURE__*/require("../utils/index");
|
11
9
|
function flip(options) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
const {
|
11
|
+
hasScrollableElement,
|
12
|
+
flipBoundary,
|
13
|
+
container
|
14
|
+
} = options;
|
15
|
+
return dom_1.flip({
|
16
|
+
...(hasScrollableElement && {
|
17
|
+
boundary: 'clippingAncestors'
|
18
|
+
}),
|
19
|
+
...(flipBoundary && {
|
20
|
+
altBoundary: true,
|
21
|
+
boundary: index_1.getBoundary(container, flipBoundary)
|
22
|
+
}),
|
23
|
+
fallbackStrategy: 'bestFit'
|
24
|
+
});
|
25
|
+
}
|
26
|
+
exports.flip = flip;
|
25
27
|
//# sourceMappingURL=flip.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAEA;AAOA,SAAgBA,IAAI,CAACC,OAA8B;EACjD,MAAM;IAAEC,oBAAoB;IAAEC,YAAY;IAAEC;EAAS,CAAE,GAAGH,OAAO;EAEjE,OAAOI,UAAQ,CAAC;IACd,IAAIH,oBAAoB,IAAI;MAAEI,QAAQ,EAAE;IAAmB,CAAE,CAAC;IAC9D,IAAIH,YAAY,IAAI;MAAEI,WAAW,EAAE,IAAI;MAAED,QAAQ,EAAEE,mBAAW,CAACJ,SAAS,EAAED,YAAY;IAAC,CAAE,CAAC;IAC1FM,gBAAgB,EAAE;GACnB,CAAC;AACJ;AARAC","names":["flip","options","hasScrollableElement","flipBoundary","container","dom_1","boundary","altBoundary","index_1","fallbackStrategy","exports"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/flip.ts"],"sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface FlipMiddlewareOptions extends Pick<PositioningOptions, 'flipBoundary'> {\n hasScrollableElement?: boolean;\n container: HTMLElement | null;\n}\n\nexport function flip(options: FlipMiddlewareOptions) {\n const { hasScrollableElement, flipBoundary, container } = options;\n\n return baseFlip({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(flipBoundary && { altBoundary: true, boundary: getBoundary(container, flipBoundary) }),\n fallbackStrategy: 'bestFit',\n });\n}\n"]}
|
@@ -1,14 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
+
value: true
|
4
5
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
//# sourceMappingURL=index.js.map
|
13
|
-
|
6
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
7
|
+
tslib_1.__exportStar(require("./coverTarget"), exports);
|
8
|
+
tslib_1.__exportStar(require("./flip"), exports);
|
9
|
+
tslib_1.__exportStar(require("./intersecting"), exports);
|
10
|
+
tslib_1.__exportStar(require("./maxSize"), exports);
|
11
|
+
tslib_1.__exportStar(require("./offset"), exports);
|
12
|
+
tslib_1.__exportStar(require("./shift"), exports);
|
14
13
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/index.ts"],"sourcesContent":["export * from './coverTarget';\nexport * from './flip';\nexport * from './intersecting';\nexport * from './maxSize';\nexport * from './offset';\nexport * from './shift';\n"]}
|
@@ -1,30 +1,28 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "intersecting", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>intersecting
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
6
|
+
exports.intersecting = void 0;
|
7
|
+
const dom_1 = /*#__PURE__*/require("@floating-ui/dom");
|
10
8
|
function intersecting() {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
};
|
9
|
+
return {
|
10
|
+
name: 'intersectionObserver',
|
11
|
+
fn: async middlewareArguments => {
|
12
|
+
const floatingRect = middlewareArguments.rects.floating;
|
13
|
+
const altOverflow = await dom_1.detectOverflow(middlewareArguments, {
|
14
|
+
altBoundary: true
|
15
|
+
});
|
16
|
+
const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;
|
17
|
+
const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;
|
18
|
+
const isIntersecting = isIntersectingTop || isIntersectingBottom;
|
19
|
+
return {
|
20
|
+
data: {
|
21
|
+
intersecting: isIntersecting
|
26
22
|
}
|
27
|
-
|
28
|
-
}
|
29
|
-
|
23
|
+
};
|
24
|
+
}
|
25
|
+
};
|
26
|
+
}
|
27
|
+
exports.intersecting = intersecting;
|
30
28
|
//# sourceMappingURL=intersecting.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AAEA,SAAgBA,YAAY;EAC1B,OAAO;IACLC,IAAI,EAAE,sBAAsB;IAC5BC,EAAE,EAAE,MAAMC,mBAAmB,IAAG;MAC9B,MAAMC,YAAY,GAAGD,mBAAmB,CAACE,KAAK,CAACC,QAAQ;MACvD,MAAMC,WAAW,GAAG,MAAMC,oBAAc,CAACL,mBAAmB,EAAE;QAAEM,WAAW,EAAE;MAAI,CAAE,CAAC;MAEpF,MAAMC,iBAAiB,GAAGH,WAAW,CAACI,GAAG,GAAGP,YAAY,CAACQ,MAAM,IAAIL,WAAW,CAACI,GAAG,GAAG,CAAC;MACtF,MAAME,oBAAoB,GAAGN,WAAW,CAACO,MAAM,GAAGV,YAAY,CAACQ,MAAM,IAAIL,WAAW,CAACO,MAAM,GAAG,CAAC;MAE/F,MAAMC,cAAc,GAAGL,iBAAiB,IAAIG,oBAAoB;MAEhE,OAAO;QACLG,IAAI,EAAE;UACJhB,YAAY,EAAEe;;OAEjB;IACH;GACD;AACH;AAnBAE","names":["intersecting","name","fn","middlewareArguments","floatingRect","rects","floating","altOverflow","dom_1","altBoundary","isIntersectingTop","top","height","isIntersectingBottom","bottom","isIntersecting","data","exports"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/intersecting.ts"],"sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { detectOverflow } from '@floating-ui/dom';\n\nexport function intersecting(): Middleware {\n return {\n name: 'intersectionObserver',\n fn: async middlewareArguments => {\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, { altBoundary: true });\n\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n return {\n data: {\n intersecting: isIntersecting,\n },\n };\n },\n };\n}\n"]}
|
@@ -1,40 +1,45 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "maxSize", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>maxSize
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
6
|
+
exports.maxSize = void 0;
|
7
|
+
const dom_1 = /*#__PURE__*/require("@floating-ui/dom");
|
8
|
+
const getBoundary_1 = /*#__PURE__*/require("../utils/getBoundary");
|
11
9
|
function maxSize(autoSize, options) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
39
|
-
|
10
|
+
const {
|
11
|
+
container,
|
12
|
+
overflowBoundary
|
13
|
+
} = options;
|
14
|
+
return dom_1.size({
|
15
|
+
...(overflowBoundary && {
|
16
|
+
altBoundary: true,
|
17
|
+
boundary: getBoundary_1.getBoundary(container, overflowBoundary)
|
18
|
+
}),
|
19
|
+
apply({
|
20
|
+
availableHeight,
|
21
|
+
availableWidth,
|
22
|
+
elements,
|
23
|
+
rects
|
24
|
+
}) {
|
25
|
+
const applyMaxWidth = autoSize === 'always' || autoSize === 'width-always' || rects.floating.width > availableWidth && (autoSize === true || autoSize === 'width');
|
26
|
+
const applyMaxHeight = autoSize === 'always' || autoSize === 'height-always' || rects.floating.height > availableHeight && (autoSize === true || autoSize === 'height');
|
27
|
+
if (applyMaxHeight) {
|
28
|
+
Object.assign(elements.floating.style, {
|
29
|
+
maxHeight: `${availableHeight}px`,
|
30
|
+
boxSizing: 'border-box',
|
31
|
+
overflowY: 'auto'
|
32
|
+
});
|
33
|
+
}
|
34
|
+
if (applyMaxWidth) {
|
35
|
+
Object.assign(elements.floating.style, {
|
36
|
+
maxWidth: `${availableWidth}px`,
|
37
|
+
boxSizing: 'border-box',
|
38
|
+
overflowX: 'auto'
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}
|
42
|
+
});
|
43
|
+
}
|
44
|
+
exports.maxSize = maxSize;
|
40
45
|
//# sourceMappingURL=maxSize.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAGA;AAKA,SAAgBA,OAAO,CAACC,QAAwC,EAAEC,OAAiC;EACjG,MAAM;IAAEC,SAAS;IAAEC;EAAgB,CAAE,GAAGF,OAAO;EAC/C,OAAOG,UAAI,CAAC;IACV,IAAID,gBAAgB,IAAI;MAAEE,WAAW,EAAE,IAAI;MAAEC,QAAQ,EAAEC,yBAAW,CAACL,SAAS,EAAEC,gBAAgB;IAAC,CAAE,CAAC;IAClGK,KAAK,CAAC;MAAEC,eAAe;MAAEC,cAAc;MAAEC,QAAQ;MAAEC;IAAK,CAAE;MACxD,MAAMC,aAAa,GACjBb,QAAQ,KAAK,QAAQ,IACrBA,QAAQ,KAAK,cAAc,IAC1BY,KAAK,CAACE,QAAQ,CAACC,KAAK,GAAGL,cAAc,KAAKV,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAK,OAAO,CAAE;MAExF,MAAMgB,cAAc,GAClBhB,QAAQ,KAAK,QAAQ,IACrBA,QAAQ,KAAK,eAAe,IAC3BY,KAAK,CAACE,QAAQ,CAACG,MAAM,GAAGR,eAAe,KAAKT,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAK,QAAQ,CAAE;MAE3F,IAAIgB,cAAc,EAAE;QAClBE,MAAM,CAACC,MAAM,CAAoDR,QAAQ,CAACG,QAAQ,CAACM,KAAK,EAAE;UACxFC,SAAS,EAAE,GAAGZ,eAAe,IAAI;UACjCa,SAAS,EAAE,YAAY;UACvBC,SAAS,EAAE;SACZ,CAAC;;MAGJ,IAAIV,aAAa,EAAE;QACjBK,MAAM,CAACC,MAAM,CAAoDR,QAAQ,CAACG,QAAQ,CAACM,KAAK,EAAE;UACxFI,QAAQ,EAAE,GAAGd,cAAc,IAAI;UAC/BY,SAAS,EAAE,YAAY;UACvBG,SAAS,EAAE;SACZ,CAAC;;IAEN;GACD,CAAC;AACJ;AAhCAC","names":["maxSize","autoSize","options","container","overflowBoundary","dom_1","altBoundary","boundary","getBoundary_1","apply","availableHeight","availableWidth","elements","rects","applyMaxWidth","floating","width","applyMaxHeight","height","Object","assign","style","maxHeight","boxSizing","overflowY","maxWidth","overflowX","exports"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/maxSize.ts"],"sourcesContent":["import { size } from '@floating-ui/dom';\nimport type { Middleware } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/getBoundary';\nexport interface MaxSizeMiddlewareOptions extends Pick<PositioningOptions, 'overflowBoundary'> {\n container: HTMLElement | null;\n}\n\nexport function maxSize(autoSize: PositioningOptions['autoSize'], options: MaxSizeMiddlewareOptions): Middleware {\n const { container, overflowBoundary } = options;\n return size({\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n apply({ availableHeight, availableWidth, elements, rects }) {\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (rects.floating.width > availableWidth && (autoSize === true || autoSize === 'width'));\n\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (rects.floating.height > availableHeight && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxHeight) {\n Object.assign<CSSStyleDeclaration, Partial<CSSStyleDeclaration>>(elements.floating.style, {\n maxHeight: `${availableHeight}px`,\n boxSizing: 'border-box',\n overflowY: 'auto',\n });\n }\n\n if (applyMaxWidth) {\n Object.assign<CSSStyleDeclaration, Partial<CSSStyleDeclaration>>(elements.floating.style, {\n maxWidth: `${availableWidth}px`,\n boxSizing: 'border-box',\n overflowX: 'auto',\n });\n }\n },\n });\n}\n"]}
|
@@ -1,16 +1,17 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "offset", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>offset
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
6
|
+
exports.offset = void 0;
|
7
|
+
const dom_1 = /*#__PURE__*/require("@floating-ui/dom");
|
8
|
+
const getFloatingUIOffset_1 = /*#__PURE__*/require("../utils/getFloatingUIOffset");
|
9
|
+
/**
|
10
|
+
* Wraps floating UI offset middleware to to transform offset value
|
11
|
+
*/
|
11
12
|
function offset(offsetValue) {
|
12
|
-
|
13
|
-
|
14
|
-
}
|
15
|
-
|
13
|
+
const floatingUIOffset = getFloatingUIOffset_1.getFloatingUIOffset(offsetValue);
|
14
|
+
return dom_1.offset(floatingUIOffset);
|
15
|
+
}
|
16
|
+
exports.offset = offset;
|
16
17
|
//# sourceMappingURL=offset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAEA;AAEA;;;AAGA,SAAgBA,MAAM,CAACC,WAAyC;EAC9D,MAAMC,gBAAgB,GAAGC,yCAAmB,CAACF,WAAW,CAAC;EACzD,OAAOG,YAAU,CAACF,gBAAgB,CAAC;AACrC;AAHAG","names":["offset","offsetValue","floatingUIOffset","getFloatingUIOffset_1","dom_1","exports"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/offset.ts"],"sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */\nexport function offset(offsetValue: PositioningOptions['offset']) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"]}
|
@@ -1,34 +1,42 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "shift", {
|
6
|
-
enumerable: true,
|
7
|
-
get: ()=>shift
|
4
|
+
value: true
|
8
5
|
});
|
9
|
-
|
10
|
-
const
|
6
|
+
exports.shift = void 0;
|
7
|
+
const dom_1 = /*#__PURE__*/require("@floating-ui/dom");
|
8
|
+
const index_1 = /*#__PURE__*/require("../utils/index");
|
9
|
+
/**
|
10
|
+
* Wraps the floating UI shift middleware for easier usage of our options
|
11
|
+
*/
|
11
12
|
function shift(options) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
13
|
+
const {
|
14
|
+
hasScrollableElement,
|
15
|
+
disableTether,
|
16
|
+
overflowBoundary,
|
17
|
+
container,
|
18
|
+
overflowBoundaryPadding,
|
19
|
+
isRtl
|
20
|
+
} = options;
|
21
|
+
return dom_1.shift({
|
22
|
+
...(hasScrollableElement && {
|
23
|
+
boundary: 'clippingAncestors'
|
24
|
+
}),
|
25
|
+
...(disableTether && {
|
26
|
+
crossAxis: disableTether === 'all',
|
27
|
+
limiter: dom_1.limitShift({
|
28
|
+
crossAxis: disableTether !== 'all',
|
29
|
+
mainAxis: false
|
30
|
+
})
|
31
|
+
}),
|
32
|
+
...(overflowBoundaryPadding && {
|
33
|
+
padding: index_1.toFloatingUIPadding(overflowBoundaryPadding, isRtl)
|
34
|
+
}),
|
35
|
+
...(overflowBoundary && {
|
36
|
+
altBoundary: true,
|
37
|
+
boundary: index_1.getBoundary(container, overflowBoundary)
|
38
|
+
})
|
39
|
+
});
|
40
|
+
}
|
41
|
+
exports.shift = shift;
|
34
42
|
//# sourceMappingURL=shift.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAEA;AAUA;;;AAGA,SAAgBA,KAAK,CAACC,OAA+B;EACnD,MAAM;IAAEC,oBAAoB;IAAEC,aAAa;IAAEC,gBAAgB;IAAEC,SAAS;IAAEC,uBAAuB;IAAEC;EAAK,CAAE,GAAGN,OAAO;EAEpH,OAAOO,WAAS,CAAC;IACf,IAAIN,oBAAoB,IAAI;MAAEO,QAAQ,EAAE;IAAmB,CAAE,CAAC;IAC9D,IAAIN,aAAa,IAAI;MACnBO,SAAS,EAAEP,aAAa,KAAK,KAAK;MAClCQ,OAAO,EAAEH,gBAAU,CAAC;QAAEE,SAAS,EAAEP,aAAa,KAAK,KAAK;QAAES,QAAQ,EAAE;MAAK,CAAE;KAC5E,CAAC;IACF,IAAIN,uBAAuB,IAAI;MAAEO,OAAO,EAAEC,2BAAmB,CAACR,uBAAuB,EAAEC,KAAK;IAAC,CAAE,CAAC;IAChG,IAAIH,gBAAgB,IAAI;MAAEW,WAAW,EAAE,IAAI;MAAEN,QAAQ,EAAEK,mBAAW,CAACT,SAAS,EAAED,gBAAgB;IAAC,CAAE;GAClG,CAAC;AACJ;AAZAY","names":["shift","options","hasScrollableElement","disableTether","overflowBoundary","container","overflowBoundaryPadding","isRtl","dom_1","boundary","crossAxis","limiter","mainAxis","padding","index_1","altBoundary","exports"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/shift.ts"],"sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary, toFloatingUIPadding } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions\n extends Pick<PositioningOptions, 'overflowBoundary' | 'overflowBoundaryPadding'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n isRtl: boolean;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container, overflowBoundaryPadding, isRtl } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundaryPadding && { padding: toFloatingUIPadding(overflowBoundaryPadding, isRtl) }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"]}
|
package/lib-commonjs/types.js
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
3
|
-
|
4
|
+
value: true
|
4
5
|
});
|
5
|
-
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
6
|
-
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
7
|
-
//# sourceMappingURL=types.js.map
|
8
|
-
|
9
6
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":"","names":[],"sourceRoot":"","sources":[],"sourcesContent":[]}
|