@fluentui/react-positioning 0.0.0-nightly0e0cf06c3420211029.1 → 0.0.0-nightly554221a5aa20211202.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/CHANGELOG.json +114 -8
  2. package/CHANGELOG.md +35 -7
  3. package/dist/react-positioning.d.ts +28 -0
  4. package/lib/createArrowStyles.d.ts +27 -0
  5. package/lib/createArrowStyles.js +73 -0
  6. package/lib/createArrowStyles.js.map +1 -0
  7. package/lib/createVirtualElementFromClick.js +17 -15
  8. package/lib/createVirtualElementFromClick.js.map +1 -1
  9. package/lib/index.d.ts +2 -1
  10. package/lib/index.js +2 -1
  11. package/lib/index.js.map +1 -1
  12. package/lib/usePopper.js +363 -320
  13. package/lib/usePopper.js.map +1 -1
  14. package/lib/usePopperMouseTarget.js +28 -22
  15. package/lib/usePopperMouseTarget.js.map +1 -1
  16. package/lib/utils/getBasePlacement.js +1 -1
  17. package/lib/utils/getBasePlacement.js.map +1 -1
  18. package/lib/utils/getBoundary.js +15 -10
  19. package/lib/utils/getBoundary.js.map +1 -1
  20. package/lib/utils/getReactFiberFromNode.d.ts +0 -1
  21. package/lib/utils/getReactFiberFromNode.js +39 -35
  22. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  23. package/lib/utils/getScrollParent.js +46 -32
  24. package/lib/utils/getScrollParent.js.map +1 -1
  25. package/lib/utils/mergeArrowOffset.js +30 -25
  26. package/lib/utils/mergeArrowOffset.js.map +1 -1
  27. package/lib/utils/positioningHelper.d.ts +1 -1
  28. package/lib/utils/positioningHelper.js +42 -34
  29. package/lib/utils/positioningHelper.js.map +1 -1
  30. package/lib/utils/resolvePositioningShorthand.js +58 -20
  31. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  32. package/lib/utils/useCallbackRef.js +35 -29
  33. package/lib/utils/useCallbackRef.js.map +1 -1
  34. package/lib-commonjs/createArrowStyles.d.ts +27 -0
  35. package/lib-commonjs/createArrowStyles.js +83 -0
  36. package/lib-commonjs/createArrowStyles.js.map +1 -0
  37. package/lib-commonjs/createVirtualElementFromClick.js +23 -16
  38. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  39. package/lib-commonjs/index.d.ts +2 -1
  40. package/lib-commonjs/index.js +28 -6
  41. package/lib-commonjs/index.js.map +1 -1
  42. package/lib-commonjs/types.js +4 -1
  43. package/lib-commonjs/types.js.map +1 -1
  44. package/lib-commonjs/usePopper.js +377 -324
  45. package/lib-commonjs/usePopper.js.map +1 -1
  46. package/lib-commonjs/usePopperMouseTarget.js +38 -25
  47. package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
  48. package/lib-commonjs/utils/getBasePlacement.js +7 -2
  49. package/lib-commonjs/utils/getBasePlacement.js.map +1 -1
  50. package/lib-commonjs/utils/getBoundary.js +23 -12
  51. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  52. package/lib-commonjs/utils/getReactFiberFromNode.d.ts +0 -1
  53. package/lib-commonjs/utils/getReactFiberFromNode.js +44 -36
  54. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  55. package/lib-commonjs/utils/getScrollParent.js +53 -33
  56. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  57. package/lib-commonjs/utils/index.js +14 -2
  58. package/lib-commonjs/utils/index.js.map +1 -1
  59. package/lib-commonjs/utils/mergeArrowOffset.js +36 -26
  60. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  61. package/lib-commonjs/utils/positioningHelper.d.ts +1 -1
  62. package/lib-commonjs/utils/positioningHelper.js +50 -35
  63. package/lib-commonjs/utils/positioningHelper.js.map +1 -1
  64. package/lib-commonjs/utils/resolvePositioningShorthand.js +66 -23
  65. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  66. package/lib-commonjs/utils/useCallbackRef.js +45 -32
  67. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  68. package/package.json +8 -8
package/CHANGELOG.json CHANGED
@@ -2,28 +2,134 @@
2
2
  "name": "@fluentui/react-positioning",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 29 Oct 2021 06:39:52 GMT",
6
- "tag": "@fluentui/react-positioning_v0.0.0-nightly0e0cf06c3420211029.1",
7
- "version": "0.0.0-nightly0e0cf06c3420211029.1",
5
+ "date": "Thu, 02 Dec 2021 04:16:16 GMT",
6
+ "tag": "@fluentui/react-positioning_v0.0.0-nightly554221a5aa20211202.1",
7
+ "version": "0.0.0-nightly554221a5aa20211202.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
11
11
  "author": "email not defined",
12
12
  "package": "@fluentui/react-positioning",
13
- "commit": "3535f78f7af73f13f2c1e7470293fb5e592866de",
13
+ "commit": "09da80c5c669ccd56bbfd16c53fd632f4579aa3b",
14
14
  "comment": "Release nightly v9"
15
15
  },
16
+ {
17
+ "author": "olfedias@microsoft.com",
18
+ "package": "@fluentui/react-positioning",
19
+ "commit": "a76afe26daad901ff5458ffdda7e66e600d5bcac",
20
+ "comment": "use new types from makeStyles core"
21
+ },
22
+ {
23
+ "author": "olfedias@microsoft.com",
24
+ "package": "@fluentui/react-positioning",
25
+ "commit": "967d6b74cf0507685a24e0cfaa8c7b9d52a351e1",
26
+ "comment": "update styles to not use CSS shorthands"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-positioning",
31
+ "comment": "Bump @fluentui/react-make-styles to v0.0.0-nightly554221a5aa20211202.1",
32
+ "commit": "09da80c5c669ccd56bbfd16c53fd632f4579aa3b"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-positioning",
37
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly554221a5aa20211202.1",
38
+ "commit": "09da80c5c669ccd56bbfd16c53fd632f4579aa3b"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-positioning",
43
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly554221a5aa20211202.1",
44
+ "commit": "09da80c5c669ccd56bbfd16c53fd632f4579aa3b"
45
+ },
16
46
  {
17
47
  "author": "beachball",
18
48
  "package": "@fluentui/react-positioning",
19
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly0e0cf06c3420211029.1",
20
- "commit": "3535f78f7af73f13f2c1e7470293fb5e592866de"
49
+ "comment": "Bump @fluentui/babel-make-styles to v0.0.0-nightly554221a5aa20211202.1",
50
+ "commit": "09da80c5c669ccd56bbfd16c53fd632f4579aa3b"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Thu, 25 Nov 2021 08:34:15 GMT",
57
+ "tag": "@fluentui/react-positioning_v9.0.0-beta.4",
58
+ "version": "9.0.0-beta.4",
59
+ "comments": {
60
+ "none": [
61
+ {
62
+ "author": "lingfangao@hotmail.com",
63
+ "package": "@fluentui/react-positioning",
64
+ "commit": "718e63006d8d07d24efab9c32942041963d78dc7",
65
+ "comment": "Migrate package to use solution style ts-configs"
66
+ }
67
+ ],
68
+ "prerelease": [
69
+ {
70
+ "author": "lingfangao@hotmail.com",
71
+ "package": "@fluentui/react-positioning",
72
+ "commit": "58db204f28af1d68df7260ff580cf91f0adcfb66",
73
+ "comment": "Add utility function to create styles for an arrow element"
21
74
  },
22
75
  {
23
76
  "author": "beachball",
24
77
  "package": "@fluentui/react-positioning",
25
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly0e0cf06c3420211029.1",
26
- "commit": "3535f78f7af73f13f2c1e7470293fb5e592866de"
78
+ "comment": "Bump @fluentui/react-make-styles to v9.0.0-beta.4",
79
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
80
+ },
81
+ {
82
+ "author": "beachball",
83
+ "package": "@fluentui/react-positioning",
84
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-beta.4",
85
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
86
+ },
87
+ {
88
+ "author": "beachball",
89
+ "package": "@fluentui/react-positioning",
90
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-beta.4",
91
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
92
+ },
93
+ {
94
+ "author": "beachball",
95
+ "package": "@fluentui/react-positioning",
96
+ "comment": "Bump @fluentui/babel-make-styles to v9.0.0-beta.4",
97
+ "commit": "48d236ac53a4950fabc3ddd52f91dac93ca0195b"
98
+ }
99
+ ]
100
+ }
101
+ },
102
+ {
103
+ "date": "Fri, 12 Nov 2021 13:25:30 GMT",
104
+ "tag": "@fluentui/react-positioning_v9.0.0-beta.3",
105
+ "version": "9.0.0-beta.3",
106
+ "comments": {
107
+ "prerelease": [
108
+ {
109
+ "author": "gcox@microsoft.com",
110
+ "package": "@fluentui/react-positioning",
111
+ "commit": "c9bd5b5a02ae94a8239ce1b56cac2f0d0dbd3586",
112
+ "comment": "Updated beta and RC components to ES2019"
113
+ },
114
+ {
115
+ "author": "beachball",
116
+ "package": "@fluentui/react-positioning",
117
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-beta.3",
118
+ "commit": "742342e52c65066f779232e4e1302fedf0dd460d"
119
+ },
120
+ {
121
+ "author": "beachball",
122
+ "package": "@fluentui/react-positioning",
123
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-beta.3",
124
+ "commit": "742342e52c65066f779232e4e1302fedf0dd460d"
125
+ }
126
+ ],
127
+ "none": [
128
+ {
129
+ "author": "lingfangao@hotmail.com",
130
+ "package": "@fluentui/react-positioning",
131
+ "commit": "00f70581480b536e723fb69edf0ae617beac4807",
132
+ "comment": "Remove beta release tag"
27
133
  }
28
134
  ]
29
135
  }
package/CHANGELOG.md CHANGED
@@ -1,19 +1,47 @@
1
1
  # Change Log - @fluentui/react-positioning
2
2
 
3
- This log was last generated on Fri, 29 Oct 2021 06:39:52 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 02 Dec 2021 04:16:16 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly0e0cf06c3420211029.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightly0e0cf06c3420211029.1)
7
+ ## [0.0.0-nightly554221a5aa20211202.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightly554221a5aa20211202.1)
8
8
 
9
- Fri, 29 Oct 2021 06:39:52 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.2..@fluentui/react-positioning_v0.0.0-nightly0e0cf06c3420211029.1)
9
+ Thu, 02 Dec 2021 04:16:16 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.4..@fluentui/react-positioning_v0.0.0-nightly554221a5aa20211202.1)
11
11
 
12
12
  ### Changes
13
13
 
14
- - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/3535f78f7af73f13f2c1e7470293fb5e592866de) by email not defined)
15
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly0e0cf06c3420211029.1 ([commit](https://github.com/microsoft/fluentui/commit/3535f78f7af73f13f2c1e7470293fb5e592866de) by beachball)
16
- - Bump @fluentui/react-utilities to v0.0.0-nightly0e0cf06c3420211029.1 ([commit](https://github.com/microsoft/fluentui/commit/3535f78f7af73f13f2c1e7470293fb5e592866de) by beachball)
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/09da80c5c669ccd56bbfd16c53fd632f4579aa3b) by email not defined)
15
+ - use new types from makeStyles core ([PR #20786](https://github.com/microsoft/fluentui/pull/20786) by olfedias@microsoft.com)
16
+ - update styles to not use CSS shorthands ([PR #20842](https://github.com/microsoft/fluentui/pull/20842) by olfedias@microsoft.com)
17
+ - Bump @fluentui/react-make-styles to v0.0.0-nightly554221a5aa20211202.1 ([commit](https://github.com/microsoft/fluentui/commit/09da80c5c669ccd56bbfd16c53fd632f4579aa3b) by beachball)
18
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly554221a5aa20211202.1 ([commit](https://github.com/microsoft/fluentui/commit/09da80c5c669ccd56bbfd16c53fd632f4579aa3b) by beachball)
19
+ - Bump @fluentui/react-utilities to v0.0.0-nightly554221a5aa20211202.1 ([commit](https://github.com/microsoft/fluentui/commit/09da80c5c669ccd56bbfd16c53fd632f4579aa3b) by beachball)
20
+ - Bump @fluentui/babel-make-styles to v0.0.0-nightly554221a5aa20211202.1 ([commit](https://github.com/microsoft/fluentui/commit/09da80c5c669ccd56bbfd16c53fd632f4579aa3b) by beachball)
21
+
22
+ ## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.4)
23
+
24
+ Thu, 25 Nov 2021 08:34:15 GMT
25
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.3..@fluentui/react-positioning_v9.0.0-beta.4)
26
+
27
+ ### Changes
28
+
29
+ - Add utility function to create styles for an arrow element ([PR #20541](https://github.com/microsoft/fluentui/pull/20541) by lingfangao@hotmail.com)
30
+ - Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
31
+ - Bump @fluentui/react-shared-contexts to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
32
+ - Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
33
+ - Bump @fluentui/babel-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
34
+
35
+ ## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.3)
36
+
37
+ Fri, 12 Nov 2021 13:25:30 GMT
38
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.0.0-beta.2..@fluentui/react-positioning_v9.0.0-beta.3)
39
+
40
+ ### Changes
41
+
42
+ - Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
43
+ - Bump @fluentui/react-shared-contexts to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
44
+ - Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
17
45
 
18
46
  ## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.0.0-beta.2)
19
47
 
@@ -1,5 +1,7 @@
1
+ import type { MakeStylesStyleRule } from '@fluentui/react-make-styles';
1
2
  import * as PopperJs from '@popperjs/core';
2
3
  import * as React_2 from 'react';
4
+ import type { Theme } from '@fluentui/react-theme';
3
5
 
4
6
  export declare type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';
5
7
 
@@ -7,6 +9,32 @@ export declare type AutoSize = 'height' | 'height-always' | 'width' | 'width-alw
7
9
 
8
10
  export declare type Boundary = PopperJs.Boundary | 'scrollParent' | 'window';
9
11
 
12
+ /**
13
+ * Helper that creates a makeStyles rule for an arrow element.
14
+ * For runtime arrow size toggling simply create extra classnames to apply to the arrow element
15
+ *
16
+ * ```ts
17
+ * makeStyles({
18
+ * arrowWithSize: createArrowStyles(5),
19
+ *
20
+ * arrowWithoutSize: createArrowStyles(),
21
+ * mediumArrow: { aspectRatio: 1, width: '4px' }
22
+ * smallArrow: { aspectRatio: 1, width: '2px' }
23
+ * })
24
+ * ...
25
+ *
26
+ * state.arrowWithSize.className = styles.arrowWithSize
27
+ * state.arrowWithoutSize.className = mergeClasses(
28
+ * styles.arrowWithoutSize,
29
+ * state.smallArrow && styles.smallArrow,
30
+ * state.mediumArrow && styles.mediumArrow,
31
+ * )
32
+ * ```
33
+ *
34
+ * @param size - dimensions of the square arrow element in pixels.
35
+ */
36
+ export declare function createArrowStyles(size?: number): MakeStylesStyleRule<Theme>;
37
+
10
38
  /**
11
39
  * Creates a virtual element based on the position of a click event
12
40
  * Can be used as a target for popper in scenarios such as context menus
@@ -0,0 +1,27 @@
1
+ import type { MakeStylesStyleRule } from '@fluentui/react-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.className = styles.arrowWithSize
18
+ * state.arrowWithoutSize.className = mergeClasses(
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,73 @@
1
+ import { shorthands } from '@fluentui/react-make-styles';
2
+ /**
3
+ * Helper that creates a makeStyles rule for an arrow element.
4
+ * For runtime arrow size toggling simply create extra classnames to apply to the arrow element
5
+ *
6
+ * ```ts
7
+ * makeStyles({
8
+ * arrowWithSize: createArrowStyles(5),
9
+ *
10
+ * arrowWithoutSize: createArrowStyles(),
11
+ * mediumArrow: { aspectRatio: 1, width: '4px' }
12
+ * smallArrow: { aspectRatio: 1, width: '2px' }
13
+ * })
14
+ * ...
15
+ *
16
+ * state.arrowWithSize.className = styles.arrowWithSize
17
+ * state.arrowWithoutSize.className = mergeClasses(
18
+ * styles.arrowWithoutSize,
19
+ * state.smallArrow && styles.smallArrow,
20
+ * state.mediumArrow && styles.mediumArrow,
21
+ * )
22
+ * ```
23
+ *
24
+ * @param size - dimensions of the square arrow element in pixels.
25
+ */
26
+
27
+ export function createArrowStyles(size) {
28
+ return theme => ({
29
+ position: 'absolute',
30
+ backgroundColor: 'inherit',
31
+ visibility: 'hidden',
32
+ zIndex: -1,
33
+ ...(size && {
34
+ aspectRatio: '1',
35
+ width: `${size}px`
36
+ }),
37
+ ':before': {
38
+ content: '""',
39
+ ...shorthands.borderRadius('4px'),
40
+ position: 'absolute',
41
+ width: 'inherit',
42
+ height: 'inherit',
43
+ backgroundColor: 'inherit',
44
+ visibility: 'visible',
45
+ borderBottomRightRadius: theme.borderRadiusSmall,
46
+ transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)'
47
+ },
48
+ ':global([data-popper-placement])': {
49
+ ':before': { // Special border for High Contrast mode
50
+ ...shorthands.borderRight('1px', 'solid', 'transparent'),
51
+ ...shorthands.borderBottom('1px', 'solid', 'transparent')
52
+ }
53
+ },
54
+ // Popper sets data-popper-placement on the root element, which is used to align the arrow
55
+ ':global([data-popper-placement^="top"])': {
56
+ bottom: 0,
57
+ '--angle': '0'
58
+ },
59
+ ':global([data-popper-placement^="right"])': {
60
+ left: 0,
61
+ '--angle': '90deg'
62
+ },
63
+ ':global([data-popper-placement^="bottom"])': {
64
+ top: 0,
65
+ '--angle': '180deg'
66
+ },
67
+ ':global([data-popper-placement^="left"])': {
68
+ right: 0,
69
+ '--angle': '270deg'
70
+ }
71
+ });
72
+ }
73
+ //# sourceMappingURL=createArrowStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,6BAA3B;AAIA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;;AACH,OAAM,SAAU,iBAAV,CAA4B,IAA5B,EAAyC;AAC7C,SAAO,KAAK,KAAK;AACf,IAAA,QAAQ,EAAE,UADK;AAEf,IAAA,eAAe,EAAE,SAFF;AAGf,IAAA,UAAU,EAAE,QAHG;AAIf,IAAA,MAAM,EAAE,CAAC,CAJM;AAMf,QAAI,IAAI,IAAI;AACV,MAAA,WAAW,EAAE,GADH;AAEV,MAAA,KAAK,EAAE,GAAG,IAAI;AAFJ,KAAZ,CANe;AAWf,eAAW;AACT,MAAA,OAAO,EAAE,IADA;AAET,SAAG,UAAU,CAAC,YAAX,CAAwB,KAAxB,CAFM;AAGT,MAAA,QAAQ,EAAE,UAHD;AAIT,MAAA,KAAK,EAAE,SAJE;AAKT,MAAA,MAAM,EAAE,SALC;AAMT,MAAA,eAAe,EAAE,SANR;AAOT,MAAA,UAAU,EAAE,SAPH;AAQT,MAAA,uBAAuB,EAAE,KAAK,CAAC,iBARtB;AAST,MAAA,SAAS,EAAE;AATF,KAXI;AAuBf,wCAAoC;AAClC,iBAAW,EACT;AACA,WAAG,UAAU,CAAC,WAAX,CAAuB,KAAvB,EAA8B,OAA9B,EAAuC,aAAvC,CAFM;AAGT,WAAG,UAAU,CAAC,YAAX,CAAwB,KAAxB,EAA+B,OAA/B,EAAwC,aAAxC;AAHM;AADuB,KAvBrB;AA+Bf;AACA,+CAA2C;AACzC,MAAA,MAAM,EAAE,CADiC;AAEzC,iBAAW;AAF8B,KAhC5B;AAqCf,iDAA6C;AAC3C,MAAA,IAAI,EAAE,CADqC;AAE3C,iBAAW;AAFgC,KArC9B;AAyCf,kDAA8C;AAC5C,MAAA,GAAG,EAAE,CADuC;AAE5C,iBAAW;AAFiC,KAzC/B;AA6Cf,gDAA4C;AAC1C,MAAA,KAAK,EAAE,CADmC;AAE1C,iBAAW;AAF+B;AA7C7B,GAAL,CAAZ;AAkDD","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
- var left = nativeEvent.clientX;
7
- var top = nativeEvent.clientY;
8
- var right = left + 1;
9
- var bottom = top + 1;
10
- function getBoundingClientRect() {
11
- return {
12
- left: left,
13
- top: top,
14
- right: right,
15
- bottom: 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
- getBoundingClientRect: getBoundingClientRect,
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,"file":"createVirtualElementFromClick.js","sourceRoot":"","sources":["../src/createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAC,WAAuB;IACnE,IAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC;IACjC,IAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC;IAChC,IAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;IACvB,IAAM,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC;IAEvB,SAAS,qBAAqB;QAC5B,OAAO;YACL,IAAI,MAAA;YACJ,GAAG,KAAA;YACH,KAAK,OAAA;YACL,MAAM,QAAA;YAEN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,CAAC;SACT,CAAC;IACJ,CAAC;IAED,OAAO;QACL,qBAAqB,uBAAA;KACtB,CAAC;AACJ,CAAC"}
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":""}
package/lib/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/index.js 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/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9E,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9E,cAAc,SAAS,CAAC"}