@fluentui/react-positioning 0.0.0-nightlya54302c0b220211124.1 → 0.0.0-nightlyb8537fb52c20211129.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +54 -7
- package/CHANGELOG.md +19 -6
- package/lib/createArrowStyles.js +47 -47
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +17 -15
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/usePopper.js +362 -312
- package/lib/usePopper.js.map +1 -1
- package/lib/usePopperMouseTarget.js +28 -22
- package/lib/usePopperMouseTarget.js.map +1 -1
- package/lib/utils/getBasePlacement.js +1 -1
- package/lib/utils/getBasePlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +15 -10
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +39 -35
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +46 -32
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +29 -24
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/positioningHelper.js +38 -30
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js +57 -19
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js +35 -29
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js +53 -48
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +23 -16
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +26 -5
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js +4 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePopper.js +376 -316
- package/lib-commonjs/usePopper.js.map +1 -1
- package/lib-commonjs/usePopperMouseTarget.js +38 -25
- package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/getBasePlacement.js +7 -2
- package/lib-commonjs/utils/getBasePlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +23 -12
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +44 -36
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +53 -33
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +14 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +35 -25
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/positioningHelper.js +46 -31
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +65 -22
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +45 -32
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.json
CHANGED
@@ -2,10 +2,45 @@
|
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-positioning_v0.0.0-
|
7
|
-
"version": "0.0.0-
|
5
|
+
"date": "Mon, 29 Nov 2021 04:13:47 GMT",
|
6
|
+
"tag": "@fluentui/react-positioning_v0.0.0-nightlyb8537fb52c20211129.1",
|
7
|
+
"version": "0.0.0-nightlyb8537fb52c20211129.1",
|
8
8
|
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-positioning",
|
13
|
+
"comment": "Bump @fluentui/react-make-styles to v0.0.0-nightlyb8537fb52c20211129.1",
|
14
|
+
"commit": "5f550f625ae0c912908d55f3a25d7c68d2950c32"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-positioning",
|
19
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightlyb8537fb52c20211129.1",
|
20
|
+
"commit": "5f550f625ae0c912908d55f3a25d7c68d2950c32"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-positioning",
|
25
|
+
"comment": "Bump @fluentui/babel-make-styles to v0.0.0-nightlyb8537fb52c20211129.1",
|
26
|
+
"commit": "5f550f625ae0c912908d55f3a25d7c68d2950c32"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"date": "Thu, 25 Nov 2021 08:34:15 GMT",
|
33
|
+
"tag": "@fluentui/react-positioning_v9.0.0-beta.4",
|
34
|
+
"version": "9.0.0-beta.4",
|
35
|
+
"comments": {
|
36
|
+
"none": [
|
37
|
+
{
|
38
|
+
"author": "lingfangao@hotmail.com",
|
39
|
+
"package": "@fluentui/react-positioning",
|
40
|
+
"commit": "718e63006d8d07d24efab9c32942041963d78dc7",
|
41
|
+
"comment": "Migrate package to use solution style ts-configs"
|
42
|
+
}
|
43
|
+
],
|
9
44
|
"prerelease": [
|
10
45
|
{
|
11
46
|
"author": "lingfangao@hotmail.com",
|
@@ -16,14 +51,26 @@
|
|
16
51
|
{
|
17
52
|
"author": "beachball",
|
18
53
|
"package": "@fluentui/react-positioning",
|
19
|
-
"comment": "Bump @fluentui/react-make-styles to
|
20
|
-
"commit": "
|
54
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.4",
|
55
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"author": "beachball",
|
59
|
+
"package": "@fluentui/react-positioning",
|
60
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-beta.4",
|
61
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"author": "beachball",
|
65
|
+
"package": "@fluentui/react-positioning",
|
66
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-beta.4",
|
67
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
21
68
|
},
|
22
69
|
{
|
23
70
|
"author": "beachball",
|
24
71
|
"package": "@fluentui/react-positioning",
|
25
|
-
"comment": "Bump @fluentui/
|
26
|
-
"commit": "
|
72
|
+
"comment": "Bump @fluentui/babel-make-styles to v9.0.0-beta.4",
|
73
|
+
"commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
|
27
74
|
}
|
28
75
|
]
|
29
76
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,19 +1,32 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 29 Nov 2021 04:13:47 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-
|
7
|
+
## [0.0.0-nightlyb8537fb52c20211129.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightlyb8537fb52c20211129.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.
|
9
|
+
Mon, 29 Nov 2021 04:13:47 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.4..@fluentui/react-positioning_v0.0.0-nightlyb8537fb52c20211129.1)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump @fluentui/react-make-styles to v0.0.0-nightlyb8537fb52c20211129.1 ([commit](https://github.com/microsoft/fluentui/commit/5f550f625ae0c912908d55f3a25d7c68d2950c32) by beachball)
|
15
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightlyb8537fb52c20211129.1 ([commit](https://github.com/microsoft/fluentui/commit/5f550f625ae0c912908d55f3a25d7c68d2950c32) by beachball)
|
16
|
+
- Bump @fluentui/babel-make-styles to v0.0.0-nightlyb8537fb52c20211129.1 ([commit](https://github.com/microsoft/fluentui/commit/5f550f625ae0c912908d55f3a25d7c68d2950c32) by beachball)
|
17
|
+
|
18
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.4)
|
19
|
+
|
20
|
+
Thu, 25 Nov 2021 08:34:15 GMT
|
21
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.3..@fluentui/react-positioning_v9.0.0-beta.4)
|
11
22
|
|
12
23
|
### Changes
|
13
24
|
|
14
25
|
- Add utility function to create styles for an arrow element ([PR #20541](https://github.com/microsoft/fluentui/pull/20541) by lingfangao@hotmail.com)
|
15
|
-
- Bump @fluentui/react-make-styles to
|
16
|
-
- Bump @fluentui/react-shared-contexts to
|
26
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
27
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
28
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
29
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
17
30
|
|
18
31
|
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.3)
|
19
32
|
|
package/lib/createArrowStyles.js
CHANGED
@@ -23,53 +23,53 @@
|
|
23
23
|
* @param size - dimensions of the square arrow element in pixels.
|
24
24
|
*/
|
25
25
|
export function createArrowStyles(size) {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
};
|
32
|
-
return {
|
33
|
-
position: 'absolute',
|
34
|
-
background: 'inherit',
|
35
|
-
visibility: 'hidden',
|
36
|
-
zIndex: -1,
|
37
|
-
...(size && {
|
38
|
-
aspectRatio: 1,
|
39
|
-
width: `${size}px`,
|
40
|
-
}),
|
41
|
-
':before': {
|
42
|
-
content: '""',
|
43
|
-
borderRadius: '4px',
|
44
|
-
position: 'absolute',
|
45
|
-
width: 'inherit',
|
46
|
-
height: 'inherit',
|
47
|
-
background: 'inherit',
|
48
|
-
visibility: 'visible',
|
49
|
-
borderBottomRightRadius: theme.borderRadiusSmall,
|
50
|
-
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
|
51
|
-
},
|
52
|
-
':global([data-popper-placement])': {
|
53
|
-
':before': arrowHCBorder,
|
54
|
-
},
|
55
|
-
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
56
|
-
':global([data-popper-placement^="top"])': {
|
57
|
-
bottom: 0,
|
58
|
-
'--angle': '0',
|
59
|
-
},
|
60
|
-
':global([data-popper-placement^="right"])': {
|
61
|
-
left: 0,
|
62
|
-
'--angle': '90deg',
|
63
|
-
},
|
64
|
-
':global([data-popper-placement^="bottom"])': {
|
65
|
-
top: 0,
|
66
|
-
'--angle': '180deg',
|
67
|
-
},
|
68
|
-
':global([data-popper-placement^="left"])': {
|
69
|
-
right: 0,
|
70
|
-
'--angle': '270deg',
|
71
|
-
},
|
72
|
-
};
|
26
|
+
return theme => {
|
27
|
+
const arrowHCBorderStyle = `1px solid transparent`;
|
28
|
+
const arrowHCBorder = {
|
29
|
+
borderRight: arrowHCBorderStyle,
|
30
|
+
borderBottom: arrowHCBorderStyle
|
73
31
|
};
|
32
|
+
return {
|
33
|
+
position: 'absolute',
|
34
|
+
background: 'inherit',
|
35
|
+
visibility: 'hidden',
|
36
|
+
zIndex: -1,
|
37
|
+
...(size && {
|
38
|
+
aspectRatio: 1,
|
39
|
+
width: `${size}px`
|
40
|
+
}),
|
41
|
+
':before': {
|
42
|
+
content: '""',
|
43
|
+
borderRadius: '4px',
|
44
|
+
position: 'absolute',
|
45
|
+
width: 'inherit',
|
46
|
+
height: 'inherit',
|
47
|
+
background: 'inherit',
|
48
|
+
visibility: 'visible',
|
49
|
+
borderBottomRightRadius: theme.borderRadiusSmall,
|
50
|
+
transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)'
|
51
|
+
},
|
52
|
+
':global([data-popper-placement])': {
|
53
|
+
':before': arrowHCBorder
|
54
|
+
},
|
55
|
+
// Popper sets data-popper-placement on the root element, which is used to align the arrow
|
56
|
+
':global([data-popper-placement^="top"])': {
|
57
|
+
bottom: 0,
|
58
|
+
'--angle': '0'
|
59
|
+
},
|
60
|
+
':global([data-popper-placement^="right"])': {
|
61
|
+
left: 0,
|
62
|
+
'--angle': '90deg'
|
63
|
+
},
|
64
|
+
':global([data-popper-placement^="bottom"])': {
|
65
|
+
top: 0,
|
66
|
+
'--angle': '180deg'
|
67
|
+
},
|
68
|
+
':global([data-popper-placement^="left"])': {
|
69
|
+
right: 0,
|
70
|
+
'--angle': '270deg'
|
71
|
+
}
|
72
|
+
};
|
73
|
+
};
|
74
74
|
}
|
75
75
|
//# sourceMappingURL=createArrowStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/createArrowStyles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACH,OAAM,SAAU,iBAAV,CAA4B,IAA5B,EAAyC;AAC7C,SAAO,KAAK,IAAG;AACb,UAAM,kBAAkB,GAAG,uBAA3B;AACA,UAAM,aAAa,GAAG;AACpB,MAAA,WAAW,EAAE,kBADO;AAEpB,MAAA,YAAY,EAAE;AAFM,KAAtB;AAKA,WAAO;AACL,MAAA,QAAQ,EAAE,UADL;AAEL,MAAA,UAAU,EAAE,SAFP;AAGL,MAAA,UAAU,EAAE,QAHP;AAIL,MAAA,MAAM,EAAE,CAAC,CAJJ;AAML,UAAI,IAAI,IAAI;AACV,QAAA,WAAW,EAAE,CADH;AAEV,QAAA,KAAK,EAAE,GAAG,IAAI;AAFJ,OAAZ,CANK;AAWL,iBAAW;AACT,QAAA,OAAO,EAAE,IADA;AAET,QAAA,YAAY,EAAE,KAFL;AAGT,QAAA,QAAQ,EAAE,UAHD;AAIT,QAAA,KAAK,EAAE,SAJE;AAKT,QAAA,MAAM,EAAE,SALC;AAMT,QAAA,UAAU,EAAE,SANH;AAOT,QAAA,UAAU,EAAE,SAPH;AAQT,QAAA,uBAAuB,EAAE,KAAK,CAAC,iBARtB;AAST,QAAA,SAAS,EAAE;AATF,OAXN;AAuBL,0CAAoC;AAClC,mBAAW;AADuB,OAvB/B;AA2BL;AACA,iDAA2C;AACzC,QAAA,MAAM,EAAE,CADiC;AAEzC,mBAAW;AAF8B,OA5BtC;AAiCL,mDAA6C;AAC3C,QAAA,IAAI,EAAE,CADqC;AAE3C,mBAAW;AAFgC,OAjCxC;AAqCL,oDAA8C;AAC5C,QAAA,GAAG,EAAE,CADuC;AAE5C,mBAAW;AAFiC,OArCzC;AAyCL,kDAA4C;AAC1C,QAAA,KAAK,EAAE,CADmC;AAE1C,mBAAW;AAF+B;AAzCvC,KAAP;AA8CD,GArDD;AAsDD","sourceRoot":""}
|
@@ -3,22 +3,24 @@
|
|
3
3
|
* Can be used as a target for popper in scenarios such as context menus
|
4
4
|
*/
|
5
5
|
export function createVirtualElementFromClick(nativeEvent) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
left,
|
13
|
-
top,
|
14
|
-
right,
|
15
|
-
bottom,
|
16
|
-
height: 1,
|
17
|
-
width: 1,
|
18
|
-
};
|
19
|
-
}
|
6
|
+
const left = nativeEvent.clientX;
|
7
|
+
const top = nativeEvent.clientY;
|
8
|
+
const right = left + 1;
|
9
|
+
const bottom = top + 1;
|
10
|
+
|
11
|
+
function getBoundingClientRect() {
|
20
12
|
return {
|
21
|
-
|
13
|
+
left,
|
14
|
+
top,
|
15
|
+
right,
|
16
|
+
bottom,
|
17
|
+
height: 1,
|
18
|
+
width: 1
|
22
19
|
};
|
20
|
+
}
|
21
|
+
|
22
|
+
return {
|
23
|
+
getBoundingClientRect
|
24
|
+
};
|
23
25
|
}
|
24
26
|
//# sourceMappingURL=createVirtualElementFromClick.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;AACnE,QAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;AACA,QAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;AACA,QAAM,KAAK,GAAG,IAAI,GAAG,CAArB;AACA,QAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;AAEA,WAAS,qBAAT,GAA8B;AAC5B,WAAO;AACL,MAAA,IADK;AAEL,MAAA,GAFK;AAGL,MAAA,KAHK;AAIL,MAAA,MAJK;AAML,MAAA,MAAM,EAAE,CANH;AAOL,MAAA,KAAK,EAAE;AAPF,KAAP;AASD;;AAED,SAAO;AACL,IAAA;AADK,GAAP;AAGD","sourceRoot":""}
|