@fluentui/react-positioning 0.0.0-nightlya372ad979820211103.1 → 0.0.0-nightlya54302c0b220211124.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +45 -10
- package/CHANGELOG.md +18 -7
- package/dist/react-positioning.d.ts +28 -0
- package/lib/createArrowStyles.d.ts +27 -0
- package/lib/createArrowStyles.js +75 -0
- package/lib/createArrowStyles.js.map +1 -0
- package/lib/createVirtualElementFromClick.js +9 -9
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/usePopper.js +64 -71
- package/lib/usePopper.js.map +1 -1
- package/lib/usePopperMouseTarget.js +5 -5
- package/lib/usePopperMouseTarget.js.map +1 -1
- package/lib/utils/getBoundary.js +1 -1
- package/lib/utils/getReactFiberFromNode.d.ts +0 -1
- package/lib/utils/getReactFiberFromNode.js +1 -1
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +6 -6
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +5 -5
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/positioningHelper.d.ts +1 -1
- package/lib/utils/positioningHelper.js +14 -14
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js +6 -6
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.d.ts +27 -0
- package/lib-commonjs/createArrowStyles.js +79 -0
- package/lib-commonjs/createArrowStyles.js.map +1 -0
- package/lib-commonjs/createVirtualElementFromClick.js +9 -9
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.js +3 -2
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/usePopper.js +69 -76
- package/lib-commonjs/usePopper.js.map +1 -1
- package/lib-commonjs/usePopperMouseTarget.js +7 -7
- package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +2 -2
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.d.ts +0 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +6 -6
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +5 -5
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/positioningHelper.d.ts +1 -1
- package/lib-commonjs/utils/positioningHelper.js +14 -14
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +8 -8
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +4 -4
package/lib/usePopper.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePopper.js","sourceRoot":"","sources":["../src/usePopper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,EAAE;AACF,uDAAuD;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C,CACvB,CAAC;IAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,mDAAmD;QACnD,sDAAsD;QACtD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;YACnB,IAAI,YAAY,CAAC,OAAO,EAAE;gBACxB,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC;gBACzC,MAAM,UAAU,SAAG,WAAW,CAAC,aAAa,0CAAE,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC,YAAY,EAAE;oBACnG,UAAU,EAAE,kBAAkB;iBAC/B,CAAC,CAAC;gBAEH,OAAO,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,IAAI;oBAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC;oBACpC,sCAAsC;oBACtC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;oBAChC,sCAAsC;oBACtC,OAAO,CAAC,IAAI,CACV;wBACE,gGAAgG;wBAChG,qGAAqG;wBACrG,2EAA2E;wBAC3E,uEAAuE;wBACvE,IAAI;wBACJ,yFAAyF;wBACzF,oGAAoG;wBACpG,kGAAkG;wBAClG,WAAW;wBACX,4FAA4F;wBAC5F,6FAA6F;wBAC7F,IAAI;wBACJ,2FAA2F;wBAC3F,2CAA2C;wBAC3C,8EAA8E;qBAC/E,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;iBACH;aACF;YACD,mDAAmD;YACnD,0EAA0E;YAC1E,uDAAuD;QACzD,CAAC,EAAE,EAAE,CAAC,CAAC;KACR;IAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
|
@@ -8,14 +8,14 @@ import { createVirtualElementFromClick } from './createVirtualElementFromClick';
|
|
8
8
|
* @param initialState - initializes a user provided state similare to useState
|
9
9
|
* @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
|
10
10
|
*/
|
11
|
-
export
|
12
|
-
|
13
|
-
|
11
|
+
export const usePopperMouseTarget = (initialState) => {
|
12
|
+
const [virtualElement, setVirtualElement] = React.useState(initialState);
|
13
|
+
const setVirtualMouseTarget = (event) => {
|
14
14
|
if (event === undefined || event === null) {
|
15
15
|
setVirtualElement(undefined);
|
16
16
|
return;
|
17
17
|
}
|
18
|
-
|
18
|
+
let mouseevent;
|
19
19
|
if (!(event instanceof MouseEvent)) {
|
20
20
|
mouseevent = event.nativeEvent;
|
21
21
|
}
|
@@ -26,7 +26,7 @@ export var usePopperMouseTarget = function (initialState) {
|
|
26
26
|
// eslint-disable-next-line no-console
|
27
27
|
console.error('usePopperMouseTarget should only be used with MouseEvent');
|
28
28
|
}
|
29
|
-
|
29
|
+
const contextTarget = createVirtualElementFromClick(mouseevent);
|
30
30
|
setVirtualElement(contextTarget);
|
31
31
|
};
|
32
32
|
return [virtualElement, setVirtualMouseTarget];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usePopperMouseTarget.js","sourceRoot":"","sources":["../src/usePopperMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF;;;;;;;GAOG;AACH,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"usePopperMouseTarget.js","sourceRoot":"","sources":["../src/usePopperMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAwE,EAAE,EAAE;IAC/G,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAsC,YAAY,CAAC,CAAC;IAE9G,MAAM,qBAAqB,GAAG,CAAC,KAAuD,EAAE,EAAE;QACxF,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;YACzC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC7B,OAAO;SACR;QAED,IAAI,UAAsB,CAAC;QAC3B,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE;YAClC,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC;SAChC;aAAM;YACL,UAAU,GAAG,KAAK,CAAC;SACpB;QAED,IAAI,CAAC,CAAC,UAAU,YAAY,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;YAChF,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;SAC3E;QAED,MAAM,aAAa,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;QAChE,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,OAAO,CAAC,cAAc,EAAE,qBAAqB,CAAU,CAAC;AAC1D,CAAC,CAAC"}
|
package/lib/utils/getBoundary.js
CHANGED
@@ -7,7 +7,7 @@ export function getBoundary(element, boundary) {
|
|
7
7
|
return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
8
8
|
}
|
9
9
|
if (boundary === 'scrollParent') {
|
10
|
-
|
10
|
+
let boundariesNode = getScrollParent(element);
|
11
11
|
if (boundariesNode.nodeName === 'BODY') {
|
12
12
|
boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
13
13
|
}
|
@@ -27,7 +27,7 @@ export function getReactFiberFromNode(elm) {
|
|
27
27
|
if (!elm) {
|
28
28
|
return null;
|
29
29
|
}
|
30
|
-
for (
|
30
|
+
for (const k in elm) {
|
31
31
|
// React 16 uses "__reactInternalInstance$" prefix
|
32
32
|
// React 17 uses "__reactFiber$" prefix
|
33
33
|
// https://github.com/facebook/react/pull/18377
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getReactFiberFromNode.js","sourceRoot":"","sources":["../../src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAuBJ;AAvBD,WAAK,OAAO;IACV,+DAAqB,CAAA;IACrB,yDAAkB,CAAA;IAClB,yEAA0B,CAAA;IAC1B,6CAAY,CAAA;IACZ,iDAAc,CAAA;IACd,uDAAiB,CAAA;IACjB,6CAAY,CAAA;IACZ,6CAAY,CAAA;IACZ,qCAAQ,CAAA;IACR,2DAAmB,CAAA;IACnB,4DAAoB,CAAA;IACpB,kDAAe,CAAA;IACf,8CAAa,CAAA;IACb,gEAAsB,CAAA;IACtB,wDAAkB,CAAA;IAClB,oEAAwB,CAAA;IACxB,wDAAkB,CAAA;IAClB,8EAA6B,CAAA;IAC7B,kEAAuB,CAAA;IACvB,wEAA0B,CAAA;IAC1B,sEAAyB,CAAA;IACzB,0DAAmB,CAAA;AACrB,CAAC,EAvBI,OAAO,KAAP,OAAO,QAuBX;AA+JD,MAAM,UAAU,qBAAqB,CAAC,GAAqB;IACzD,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,IAAI,CAAC;KACb;IAED,KAAK,
|
1
|
+
{"version":3,"file":"getReactFiberFromNode.js","sourceRoot":"","sources":["../../src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAuBJ;AAvBD,WAAK,OAAO;IACV,+DAAqB,CAAA;IACrB,yDAAkB,CAAA;IAClB,yEAA0B,CAAA;IAC1B,6CAAY,CAAA;IACZ,iDAAc,CAAA;IACd,uDAAiB,CAAA;IACjB,6CAAY,CAAA;IACZ,6CAAY,CAAA;IACZ,qCAAQ,CAAA;IACR,2DAAmB,CAAA;IACnB,4DAAoB,CAAA;IACpB,kDAAe,CAAA;IACf,8CAAa,CAAA;IACb,gEAAsB,CAAA;IACtB,wDAAkB,CAAA;IAClB,oEAAwB,CAAA;IACxB,wDAAkB,CAAA;IAClB,8EAA6B,CAAA;IAC7B,kEAAuB,CAAA;IACvB,wEAA0B,CAAA;IAC1B,sEAAyB,CAAA;IACzB,0DAAmB,CAAA;AACrB,CAAC,EAvBI,OAAO,KAAP,OAAO,QAuBX;AA+JD,MAAM,UAAU,qBAAqB,CAAC,GAAqB;IACzD,IAAI,CAAC,GAAG,EAAE;QACR,OAAO,IAAI,CAAC;KACb;IAED,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE;QACnB,kDAAkD;QAClD,uCAAuC;QACvC,+CAA+C;QAC/C,IAAI,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;YACnF,6DAA6D;YAC7D,aAAa;YACb,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;SACf;KACF;IAED,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC7E,CAAC"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* @param node - DOM node.
|
4
4
|
* @returns - parent DOM node.
|
5
5
|
*/
|
6
|
-
export
|
6
|
+
export const getParentNode = (node) => {
|
7
7
|
if (node.nodeName === 'HTML') {
|
8
8
|
return node;
|
9
9
|
}
|
@@ -15,12 +15,12 @@ export var getParentNode = function (node) {
|
|
15
15
|
* @param node - DOM node.
|
16
16
|
* @returns - CSS styles.
|
17
17
|
*/
|
18
|
-
|
18
|
+
const getStyleComputedProperty = (node) => {
|
19
19
|
var _a;
|
20
20
|
if (node.nodeType !== 1) {
|
21
21
|
return {};
|
22
22
|
}
|
23
|
-
|
23
|
+
const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
|
24
24
|
return window.getComputedStyle(node, null);
|
25
25
|
};
|
26
26
|
/**
|
@@ -28,9 +28,9 @@ var getStyleComputedProperty = function (node) {
|
|
28
28
|
* @param node - DOM node.
|
29
29
|
* @returns - the first scrollable parent.
|
30
30
|
*/
|
31
|
-
export
|
31
|
+
export const getScrollParent = (node) => {
|
32
32
|
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
|
33
|
-
|
33
|
+
const parentNode = node && getParentNode(node);
|
34
34
|
// eslint-disable-next-line
|
35
35
|
if (!parentNode)
|
36
36
|
return document.body;
|
@@ -42,7 +42,7 @@ export var getScrollParent = function (node) {
|
|
42
42
|
return parentNode.body;
|
43
43
|
}
|
44
44
|
// If any of the overflow props is defined for the node then we return it as the parent
|
45
|
-
|
45
|
+
const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);
|
46
46
|
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
47
47
|
return parentNode;
|
48
48
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getScrollParent.js","sourceRoot":"","sources":["../../src/utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"getScrollParent.js","sourceRoot":"","sources":["../../src/utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAiB,EAAe,EAAE;IAC9D,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IACD,8DAA8D;IAC9D,OAAO,IAAI,CAAC,UAAU,IAAK,IAAY,CAAC,IAAI,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,IAAiB,EAAgC,EAAE;;IACnF,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;QACvB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,MAAM,SAAG,IAAI,CAAC,aAAa,0CAAE,WAAW,CAAC;IAC/C,OAAO,MAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAmC,EAAe,EAAE;IAClF,iFAAiF;IACjF,MAAM,UAAU,GAAG,IAAI,IAAI,aAAa,CAAC,IAAmB,CAAC,CAAC;IAC9D,2BAA2B;IAC3B,IAAI,CAAC,UAAU;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;IAEtC,QAAQ,UAAU,CAAC,QAAQ,EAAE;QAC3B,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,UAAU,CAAC,aAAc,CAAC,IAAI,CAAC;QACxC,KAAK,WAAW;YACd,OAAS,UAAmC,CAAC,IAAI,CAAC;KACrD;IAED,uFAAuF;IACvF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;IAChF,IAAI,uBAAuB,CAAC,IAAI,CAAC,QAAS,GAAG,SAAU,GAAG,SAAS,CAAC,EAAE;QACpE,OAAO,UAAU,CAAC;KACnB;IAED,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC,CAAC"}
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* @returns User offset augmented with arrow height
|
8
8
|
*/
|
9
9
|
export function mergeArrowOffset(userOffset, arrowHeight) {
|
10
|
-
|
10
|
+
let offsetWithArrow = userOffset;
|
11
11
|
if (!userOffset) {
|
12
12
|
return [0, arrowHeight];
|
13
13
|
}
|
@@ -16,9 +16,9 @@ export function mergeArrowOffset(userOffset, arrowHeight) {
|
|
16
16
|
return offsetWithArrow;
|
17
17
|
}
|
18
18
|
if (typeof offsetWithArrow === 'function') {
|
19
|
-
|
20
|
-
offsetWithArrow =
|
21
|
-
|
19
|
+
const userOffsetFn = offsetWithArrow;
|
20
|
+
offsetWithArrow = offsetParams => {
|
21
|
+
const offset = userOffsetFn(offsetParams);
|
22
22
|
setArrowOffset(offset, arrowHeight);
|
23
23
|
return offset;
|
24
24
|
};
|
@@ -26,7 +26,7 @@ export function mergeArrowOffset(userOffset, arrowHeight) {
|
|
26
26
|
// This should never happen
|
27
27
|
return [0, 0];
|
28
28
|
}
|
29
|
-
|
29
|
+
const setArrowOffset = (offset, arrowHeight) => {
|
30
30
|
if (offset[1] !== null && offset[1] !== undefined) {
|
31
31
|
offset[1] += arrowHeight;
|
32
32
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mergeArrowOffset.js","sourceRoot":"","sources":["../../src/utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAqC,EAAE,WAAmB;IACzF,IAAI,eAAe,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;KACzB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QAClC,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC7C,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;QACzC,
|
1
|
+
{"version":3,"file":"mergeArrowOffset.js","sourceRoot":"","sources":["../../src/utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAqC,EAAE,WAAmB;IACzF,IAAI,eAAe,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;KACzB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QAClC,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC7C,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;QACzC,MAAM,YAAY,GAAG,eAAe,CAAC;QACrC,eAAe,GAAG,YAAY,CAAC,EAAE;YAC/B,MAAM,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;YAC1C,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAU,CAAC;AACzB,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,MAA8D,EAAE,WAAmB,EAAE,EAAE;IAC7G,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QACjD,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC;KAC1B;SAAM;QACL,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;KACzB;AACH,CAAC,CAAC"}
|
@@ -3,5 +3,5 @@ import type { Offset } from '../types';
|
|
3
3
|
/**
|
4
4
|
* @see positioninHelper.test.ts for expected placement values
|
5
5
|
*/
|
6
|
-
export declare const getPlacement: (align?: "
|
6
|
+
export declare const getPlacement: (align?: "bottom" | "top" | "center" | "start" | "end" | undefined, position?: "above" | "below" | "before" | "after" | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
|
7
7
|
export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
|
@@ -1,34 +1,34 @@
|
|
1
|
-
|
1
|
+
const getPositionMap = (rtl) => ({
|
2
2
|
above: 'top',
|
3
3
|
below: 'bottom',
|
4
4
|
before: rtl ? 'right' : 'left',
|
5
5
|
after: rtl ? 'left' : 'right',
|
6
|
-
});
|
7
|
-
|
6
|
+
});
|
7
|
+
const getAlignmentMap = (rtl) => ({
|
8
8
|
start: rtl ? 'end' : 'start',
|
9
9
|
end: rtl ? 'start' : 'end',
|
10
10
|
top: 'start',
|
11
11
|
bottom: 'end',
|
12
12
|
center: '',
|
13
|
-
});
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
});
|
14
|
+
const shouldAlignToCenter = (p, a) => {
|
15
|
+
const positionedVertically = p === 'above' || p === 'below';
|
16
|
+
const alignedVertically = a === 'top' || a === 'bottom';
|
17
17
|
return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);
|
18
18
|
};
|
19
19
|
/**
|
20
20
|
* @see positioninHelper.test.ts for expected placement values
|
21
21
|
*/
|
22
|
-
export
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
export const getPlacement = (align, position, rtl) => {
|
23
|
+
const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
|
24
|
+
const computedPosition = position && getPositionMap(rtl)[position];
|
25
|
+
const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];
|
26
26
|
if (computedPosition && computedAlignmnent) {
|
27
|
-
return computedPosition
|
27
|
+
return `${computedPosition}-${computedAlignmnent}`;
|
28
28
|
}
|
29
29
|
return computedPosition || 'auto';
|
30
30
|
};
|
31
|
-
export
|
31
|
+
export const applyRtlToOffset = (offset) => {
|
32
32
|
if (typeof offset === 'undefined') {
|
33
33
|
return undefined;
|
34
34
|
}
|
@@ -36,6 +36,6 @@ export var applyRtlToOffset = function (offset) {
|
|
36
36
|
offset[0] = offset[0] * -1;
|
37
37
|
return offset;
|
38
38
|
}
|
39
|
-
return (
|
39
|
+
return ((param) => applyRtlToOffset(offset(param)));
|
40
40
|
};
|
41
41
|
//# sourceMappingURL=positioningHelper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positioningHelper.js","sourceRoot":"","sources":["../../src/utils/positioningHelper.ts"],"names":[],"mappings":"AAMA,
|
1
|
+
{"version":3,"file":"positioningHelper.js","sourceRoot":"","sources":["../../src/utils/positioningHelper.ts"],"names":[],"mappings":"AAMA,MAAM,cAAc,GAAG,CAAC,GAAa,EAAuC,EAAE,CAAC,CAAC;IAC9E,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;IAC9B,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;CAC9B,CAAC,CAAC;A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AC,MAA0B,EAAsB,EAAE;IACjF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACzB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC;QAE5B,OAAO,MAAM,CAAC;KACf;IAED,OAAO,CAAC,CAAC,KAA0B,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAmB,CAAC;AAC7F,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resolvePositioningShorthand.js","sourceRoot":"","sources":["../../src/utils/resolvePositioningShorthand.ts"],"names":[],"mappings":"AAEA,uDAAuD;AACvD,
|
1
|
+
{"version":3,"file":"resolvePositioningShorthand.js","sourceRoot":"","sources":["../../src/utils/resolvePositioningShorthand.ts"],"names":[],"mappings":"AAEA,uDAAuD;AACvD,MAAM,eAAe,GAAoF;IACvG,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC7C,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IACpD,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IAChD,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC7C,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IACpD,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IAChD,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC/C,YAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;IAClD,eAAe,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACxD,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC7C,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IAChD,cAAc,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;CACvD,CAAC;AAEF,MAAM,UAAU,2BAA2B,CACzC,SAAkD;IAElD,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE;QACjD,OAAO,EAAE,CAAC;KACX;IAED,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QACjC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;KACnC;IAED,OAAO,SAAuC,CAAC;AACjD,CAAC"}
|
@@ -18,19 +18,19 @@ import { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
|
18
18
|
* // prints 0 -> 1
|
19
19
|
*/
|
20
20
|
export function useCallbackRef(initialValue, callback, skipInitialResolve) {
|
21
|
-
|
22
|
-
|
21
|
+
const isFirst = React.useRef(true);
|
22
|
+
const [ref] = React.useState(() => ({
|
23
23
|
// value
|
24
24
|
value: initialValue,
|
25
25
|
// last callback
|
26
|
-
callback
|
26
|
+
callback,
|
27
27
|
// "memoized" public interface
|
28
28
|
facade: {
|
29
29
|
get current() {
|
30
30
|
return ref.value;
|
31
31
|
},
|
32
32
|
set current(value) {
|
33
|
-
|
33
|
+
const last = ref.value;
|
34
34
|
if (last !== value) {
|
35
35
|
ref.value = value;
|
36
36
|
if (skipInitialResolve && isFirst.current) {
|
@@ -40,8 +40,8 @@ export function useCallbackRef(initialValue, callback, skipInitialResolve) {
|
|
40
40
|
}
|
41
41
|
},
|
42
42
|
},
|
43
|
-
})
|
44
|
-
useIsomorphicLayoutEffect(
|
43
|
+
}));
|
44
|
+
useIsomorphicLayoutEffect(() => {
|
45
45
|
isFirst.current = false;
|
46
46
|
}, []);
|
47
47
|
// update callback
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useCallbackRef.js","sourceRoot":"","sources":["../../src/utils/useCallbackRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAC5B,YAAsB,EACtB,QAA2D,EAC3D,kBAA4B;IAE5B,
|
1
|
+
{"version":3,"file":"useCallbackRef.js","sourceRoot":"","sources":["../../src/utils/useCallbackRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAC5B,YAAsB,EACtB,QAA2D,EAC3D,kBAA4B;IAE5B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,QAAQ;QACR,KAAK,EAAE,YAAY;QACnB,gBAAgB;QAChB,QAAQ;QACR,8BAA8B;QAC9B,MAAM,EAAE;YACN,IAAI,OAAO;gBACT,OAAO,GAAG,CAAC,KAAK,CAAC;YACnB,CAAC;YACD,IAAI,OAAO,CAAC,KAAK;gBACf,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;gBAEvB,IAAI,IAAI,KAAK,KAAK,EAAE;oBAClB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;oBAElB,IAAI,kBAAkB,IAAI,OAAO,CAAC,OAAO,EAAE;wBACzC,OAAO;qBACR;oBAED,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;iBAC3B;YACH,CAAC;SACF;KACF,CAAC,CAAC,CAAC;IAEJ,yBAAyB,CAAC,GAAG,EAAE;QAC7B,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,kBAAkB;IAClB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAExB,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { MakeStylesStyleRule } from '@fluentui/make-styles';
|
2
|
+
import type { Theme } from '@fluentui/react-theme';
|
3
|
+
/**
|
4
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
5
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
6
|
+
*
|
7
|
+
* ```ts
|
8
|
+
* makeStyles({
|
9
|
+
* arrowWithSize: createArrowStyles(5),
|
10
|
+
*
|
11
|
+
* arrowWithoutSize: createArrowStyles(),
|
12
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
13
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
14
|
+
* })
|
15
|
+
* ...
|
16
|
+
*
|
17
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
18
|
+
* state.arrowWithoutSize.className = mergeClases(
|
19
|
+
* styles.arrowWithoutSize,
|
20
|
+
* state.smallArrow && styles.smallArrow,
|
21
|
+
* state.mediumArrow && styles.mediumArrow,
|
22
|
+
* )
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* @param size - dimensions of the square arrow element in pixels.
|
26
|
+
*/
|
27
|
+
export declare function createArrowStyles(size?: number): MakeStylesStyleRule<Theme>;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createArrowStyles = void 0;
|
4
|
+
/**
|
5
|
+
* Helper that creates a makeStyles rule for an arrow element.
|
6
|
+
* For runtime arrow size toggling simply create extra classnames to apply to the arrow element
|
7
|
+
*
|
8
|
+
* ```ts
|
9
|
+
* makeStyles({
|
10
|
+
* arrowWithSize: createArrowStyles(5),
|
11
|
+
*
|
12
|
+
* arrowWithoutSize: createArrowStyles(),
|
13
|
+
* mediumArrow: { aspectRatio: 1, width: '4px' }
|
14
|
+
* smallArrow: { aspectRatio: 1, width: '2px' }
|
15
|
+
* })
|
16
|
+
* ...
|
17
|
+
*
|
18
|
+
* state.arrowWithSize.clasName = styles.arrowWithSize
|
19
|
+
* state.arrowWithoutSize.className = mergeClases(
|
20
|
+
* styles.arrowWithoutSize,
|
21
|
+
* state.smallArrow && styles.smallArrow,
|
22
|
+
* state.mediumArrow && styles.mediumArrow,
|
23
|
+
* )
|
24
|
+
* ```
|
25
|
+
*
|
26
|
+
* @param size - dimensions of the square arrow element in pixels.
|
27
|
+
*/
|
28
|
+
function createArrowStyles(size) {
|
29
|
+
return theme => {
|
30
|
+
const arrowHCBorderStyle = `1px solid transparent`;
|
31
|
+
const arrowHCBorder = {
|
32
|
+
borderRight: arrowHCBorderStyle,
|
33
|
+
borderBottom: arrowHCBorderStyle,
|
34
|
+
};
|
35
|
+
return {
|
36
|
+
position: 'absolute',
|
37
|
+
background: 'inherit',
|
38
|
+
visibility: 'hidden',
|
39
|
+
zIndex: -1,
|
40
|
+
...(size && {
|
41
|
+
aspectRatio: 1,
|
42
|
+
width: `${size}px`,
|
43
|
+
}),
|
44
|
+
':before': {
|
45
|
+
content: '""',
|
46
|
+
borderRadius: '4px',
|
47
|
+
position: 'absolute',
|
48
|
+
width: 'inherit',
|
49
|
+
height: 'inherit',
|
50
|
+
background: 'inherit',
|
51
|
+
visibility: 'visible',
|
52
|
+
borderBottomRightRadius: theme.borderRadiusSmall,
|
53
|
+
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
|
54
|
+
},
|
55
|
+
':global([data-popper-placement])': {
|
56
|
+
':before': arrowHCBorder,
|
57
|
+
},
|
58
|
+
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
59
|
+
':global([data-popper-placement^="top"])': {
|
60
|
+
bottom: 0,
|
61
|
+
'--angle': '0',
|
62
|
+
},
|
63
|
+
':global([data-popper-placement^="right"])': {
|
64
|
+
left: 0,
|
65
|
+
'--angle': '90deg',
|
66
|
+
},
|
67
|
+
':global([data-popper-placement^="bottom"])': {
|
68
|
+
top: 0,
|
69
|
+
'--angle': '180deg',
|
70
|
+
},
|
71
|
+
':global([data-popper-placement^="left"])': {
|
72
|
+
right: 0,
|
73
|
+
'--angle': '270deg',
|
74
|
+
},
|
75
|
+
};
|
76
|
+
};
|
77
|
+
}
|
78
|
+
exports.createArrowStyles = createArrowStyles;
|
79
|
+
//# sourceMappingURL=createArrowStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createArrowStyles.js","sourceRoot":"","sources":["../src/createArrowStyles.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,iBAAiB,CAAC,IAAa;IAC7C,OAAO,KAAK,CAAC,EAAE;QACb,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;QACnD,MAAM,aAAa,GAAG;YACpB,WAAW,EAAE,kBAAkB;YAC/B,YAAY,EAAE,kBAAkB;SACjC,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,CAAC,CAAC;YAEV,GAAG,CAAC,IAAI,IAAI;gBACV,WAAW,EAAE,CAAC;gBACd,KAAK,EAAE,GAAG,IAAI,IAAI;aACnB,CAAC;YAEF,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,KAAK;gBACnB,QAAQ,EAAE,UAAU;gBACpB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,SAAS;gBACrB,UAAU,EAAE,SAAS;gBACrB,uBAAuB,EAAE,KAAK,CAAC,iBAAiB;gBAChD,SAAS,EAAE,sDAAsD;aAClE;YAED,kCAAkC,EAAE;gBAClC,SAAS,EAAE,aAAa;aACzB;YAED,0FAA0F;YAC1F,yCAAyC,EAAE;gBACzC,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,GAAG;aACf;YAED,2CAA2C,EAAE;gBAC3C,IAAI,EAAE,CAAC;gBACP,SAAS,EAAE,OAAO;aACnB;YACD,4CAA4C,EAAE;gBAC5C,GAAG,EAAE,CAAC;gBACN,SAAS,EAAE,QAAQ;aACpB;YACD,0CAA0C,EAAE;gBAC1C,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,QAAQ;aACpB;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAvDD,8CAuDC"}
|
@@ -6,22 +6,22 @@ exports.createVirtualElementFromClick = void 0;
|
|
6
6
|
* Can be used as a target for popper in scenarios such as context menus
|
7
7
|
*/
|
8
8
|
function createVirtualElementFromClick(nativeEvent) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
const left = nativeEvent.clientX;
|
10
|
+
const top = nativeEvent.clientY;
|
11
|
+
const right = left + 1;
|
12
|
+
const bottom = top + 1;
|
13
13
|
function getBoundingClientRect() {
|
14
14
|
return {
|
15
|
-
left
|
16
|
-
top
|
17
|
-
right
|
18
|
-
bottom
|
15
|
+
left,
|
16
|
+
top,
|
17
|
+
right,
|
18
|
+
bottom,
|
19
19
|
height: 1,
|
20
20
|
width: 1,
|
21
21
|
};
|
22
22
|
}
|
23
23
|
return {
|
24
|
-
getBoundingClientRect
|
24
|
+
getBoundingClientRect,
|
25
25
|
};
|
26
26
|
}
|
27
27
|
exports.createVirtualElementFromClick = createVirtualElementFromClick;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createVirtualElementFromClick.js","sourceRoot":"","sources":["../src/createVirtualElementFromClick.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,6BAA6B,CAAC,WAAuB;IACnE,
|
1
|
+
{"version":3,"file":"createVirtualElementFromClick.js","sourceRoot":"","sources":["../src/createVirtualElementFromClick.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,6BAA6B,CAAC,WAAuB;IACnE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC;IACjC,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC;IAEvB,SAAS,qBAAqB;QAC5B,OAAO;YACL,IAAI;YACJ,GAAG;YACH,KAAK;YACL,MAAM;YAEN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,CAAC;SACT,CAAC;IACJ,CAAC;IAED,OAAO;QACL,qBAAqB;KACtB,CAAC;AACJ,CAAC;AArBD,sEAqBC"}
|
package/lib-commonjs/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
export * from './usePopper';
|
2
1
|
export * from './createVirtualElementFromClick';
|
2
|
+
export * from './createArrowStyles';
|
3
|
+
export * from './usePopper';
|
3
4
|
export * from './usePopperMouseTarget';
|
4
5
|
export { resolvePositioningShorthand, mergeArrowOffset } from './utils/index';
|
5
6
|
export * from './types';
|
package/lib-commonjs/index.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.mergeArrowOffset = exports.resolvePositioningShorthand = void 0;
|
4
|
-
|
5
|
-
tslib_1.__exportStar(require("./usePopper"), exports);
|
4
|
+
const tslib_1 = require("tslib");
|
6
5
|
tslib_1.__exportStar(require("./createVirtualElementFromClick"), exports);
|
6
|
+
tslib_1.__exportStar(require("./createArrowStyles"), exports);
|
7
|
+
tslib_1.__exportStar(require("./usePopper"), exports);
|
7
8
|
tslib_1.__exportStar(require("./usePopperMouseTarget"), exports);
|
8
9
|
var index_1 = require("./utils/index");
|
9
10
|
Object.defineProperty(exports, "resolvePositioningShorthand", { enumerable: true, get: function () { return index_1.resolvePositioningShorthand; } });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,sDAA4B;AAC5B,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,0EAAgD;AAChD,8DAAoC;AACpC,sDAA4B;AAC5B,iEAAuC;AACvC,uCAA8E;AAArE,oHAAA,2BAA2B,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AACtD,kDAAwB"}
|