@fluentui/react-popover 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230322-0439.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.
Files changed (53) hide show
  1. package/.swcrc +2 -11
  2. package/CHANGELOG.json +104 -23
  3. package/CHANGELOG.md +34 -14
  4. package/lib/Popover.js +1 -1
  5. package/lib/PopoverSurface.js +1 -1
  6. package/lib/PopoverTrigger.js +1 -1
  7. package/lib/components/Popover/Popover.js +4 -4
  8. package/lib/components/Popover/Popover.types.js +1 -1
  9. package/lib/components/Popover/index.js +4 -4
  10. package/lib/components/Popover/renderPopover.js +2 -2
  11. package/lib/components/Popover/usePopover.js +28 -22
  12. package/lib/components/Popover/usePopover.js.map +1 -1
  13. package/lib/components/PopoverSurface/PopoverSurface.js +6 -6
  14. package/lib/components/PopoverSurface/index.js +5 -5
  15. package/lib/components/PopoverSurface/renderPopoverSurface.js +3 -3
  16. package/lib/components/PopoverSurface/usePopoverSurface.js +13 -12
  17. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  18. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +6 -6
  19. package/lib/components/PopoverTrigger/PopoverTrigger.js +4 -4
  20. package/lib/components/PopoverTrigger/PopoverTrigger.types.js +1 -1
  21. package/lib/components/PopoverTrigger/index.js +4 -4
  22. package/lib/components/PopoverTrigger/usePopoverTrigger.js +16 -16
  23. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  24. package/lib/index.js +4 -4
  25. package/lib/popoverContext.js +2 -2
  26. package/lib-commonjs/Popover.js.map +1 -1
  27. package/lib-commonjs/PopoverSurface.js.map +1 -1
  28. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  29. package/lib-commonjs/components/Popover/Popover.js +1 -1
  30. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  31. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  32. package/lib-commonjs/components/Popover/index.js.map +1 -1
  33. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  34. package/lib-commonjs/components/Popover/usePopover.js +20 -14
  35. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  36. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +1 -1
  37. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  38. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  39. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  40. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +9 -8
  41. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  42. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +12 -12
  43. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  44. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +1 -1
  45. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  46. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  47. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  48. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +10 -10
  49. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  50. package/lib-commonjs/index.js.map +1 -1
  51. package/lib-commonjs/popoverContext.js +1 -1
  52. package/lib-commonjs/popoverContext.js.map +1 -1
  53. package/package.json +12 -11
package/.swcrc CHANGED
@@ -1,15 +1,5 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/swcrc",
3
- "env": {
4
- "targets": {
5
- "chrome": "84",
6
- "edge": "84",
7
- "firefox": "75",
8
- "opera": "73",
9
- "safari": "14.1"
10
- },
11
- "bugfixes": true
12
- },
13
3
  "exclude": [
14
4
  "/testing",
15
5
  "/**/*.cy.ts",
@@ -32,7 +22,8 @@
32
22
  "runtime": "classic",
33
23
  "useSpread": true
34
24
  }
35
- }
25
+ },
26
+ "target": "es2019"
36
27
  },
37
28
  "minify": false,
38
29
  "sourceMaps": true
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-popover",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 17 Mar 2023 15:00:01 GMT",
6
- "tag": "@fluentui/react-popover_v0.0.0-nightly-20230317-1454.1",
7
- "version": "0.0.0-nightly-20230317-1454.1",
5
+ "date": "Wed, 22 Mar 2023 04:46:46 GMT",
6
+ "tag": "@fluentui/react-popover_v0.0.0-nightly-20230322-0439.1",
7
+ "version": "0.0.0-nightly-20230322-0439.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,62 +16,143 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-popover",
19
- "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1",
20
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
19
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230322-0439.1",
20
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-popover",
25
- "comment": "Bump @fluentui/react-aria to v0.0.0-nightly-20230317-1454.1",
26
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
25
+ "comment": "Bump @fluentui/react-aria to v0.0.0-nightly-20230322-0439.1",
26
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-popover",
31
- "comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230317-1454.1",
32
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
31
+ "comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230322-0439.1",
32
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
33
33
  },
34
34
  {
35
35
  "author": "beachball",
36
36
  "package": "@fluentui/react-popover",
37
- "comment": "Bump @fluentui/react-portal to v0.0.0-nightly-20230317-1454.1",
38
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
37
+ "comment": "Bump @fluentui/react-portal to v0.0.0-nightly-20230322-0439.1",
38
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
39
39
  },
40
40
  {
41
41
  "author": "beachball",
42
42
  "package": "@fluentui/react-popover",
43
- "comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-20230317-1454.1",
44
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
43
+ "comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-20230322-0439.1",
44
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
45
45
  },
46
46
  {
47
47
  "author": "beachball",
48
48
  "package": "@fluentui/react-popover",
49
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230317-1454.1",
50
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
49
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230322-0439.1",
50
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
51
51
  },
52
52
  {
53
53
  "author": "beachball",
54
54
  "package": "@fluentui/react-popover",
55
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230317-1454.1",
56
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
55
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230322-0439.1",
56
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
57
57
  },
58
58
  {
59
59
  "author": "beachball",
60
60
  "package": "@fluentui/react-popover",
61
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230317-1454.1",
62
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
61
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230322-0439.1",
62
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
63
63
  },
64
64
  {
65
65
  "author": "beachball",
66
66
  "package": "@fluentui/react-popover",
67
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230317-1454.1",
68
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
67
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230322-0439.1",
68
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
69
69
  },
70
70
  {
71
71
  "author": "beachball",
72
72
  "package": "@fluentui/react-popover",
73
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230317-1454.1",
74
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
73
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230322-0439.1",
74
+ "commit": "49dde84493fc2c3e96abac5ce918169c9668ba66"
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "date": "Tue, 21 Mar 2023 21:23:43 GMT",
81
+ "tag": "@fluentui/react-popover_v9.5.5",
82
+ "version": "9.5.5",
83
+ "comments": {
84
+ "patch": [
85
+ {
86
+ "author": "tristan.watanabe@gmail.com",
87
+ "package": "@fluentui/react-popover",
88
+ "commit": "2fac1a139149bd13b76b1306207bc988dca9c72c",
89
+ "comment": "chore: migrate to swc transpilation approach."
90
+ },
91
+ {
92
+ "author": "tristan.watanabe@gmail.com",
93
+ "package": "@fluentui/react-popover",
94
+ "commit": "ead1c6d4c2ac3f3596b62b8cbc07b0a03041f11f",
95
+ "comment": "fix: add node field to package.json exports map."
96
+ },
97
+ {
98
+ "author": "beachball",
99
+ "package": "@fluentui/react-popover",
100
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.2",
101
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
102
+ },
103
+ {
104
+ "author": "beachball",
105
+ "package": "@fluentui/react-popover",
106
+ "comment": "Bump @fluentui/react-aria to v9.3.15",
107
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
108
+ },
109
+ {
110
+ "author": "beachball",
111
+ "package": "@fluentui/react-popover",
112
+ "comment": "Bump @fluentui/react-context-selector to v9.1.15",
113
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
114
+ },
115
+ {
116
+ "author": "beachball",
117
+ "package": "@fluentui/react-popover",
118
+ "comment": "Bump @fluentui/react-portal to v9.2.2",
119
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
120
+ },
121
+ {
122
+ "author": "beachball",
123
+ "package": "@fluentui/react-popover",
124
+ "comment": "Bump @fluentui/react-positioning to v9.5.6",
125
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
126
+ },
127
+ {
128
+ "author": "beachball",
129
+ "package": "@fluentui/react-popover",
130
+ "comment": "Bump @fluentui/react-shared-contexts to v9.3.2",
131
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
132
+ },
133
+ {
134
+ "author": "beachball",
135
+ "package": "@fluentui/react-popover",
136
+ "comment": "Bump @fluentui/react-tabster to v9.6.1",
137
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
138
+ },
139
+ {
140
+ "author": "beachball",
141
+ "package": "@fluentui/react-popover",
142
+ "comment": "Bump @fluentui/react-theme to v9.1.7",
143
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
144
+ },
145
+ {
146
+ "author": "beachball",
147
+ "package": "@fluentui/react-popover",
148
+ "comment": "Bump @fluentui/react-utilities to v9.7.2",
149
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
150
+ },
151
+ {
152
+ "author": "beachball",
153
+ "package": "@fluentui/react-popover",
154
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.20",
155
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
75
156
  }
76
157
  ]
77
158
  }
package/CHANGELOG.md CHANGED
@@ -1,27 +1,47 @@
1
1
  # Change Log - @fluentui/react-popover
2
2
 
3
- This log was last generated on Fri, 17 Mar 2023 15:00:01 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 22 Mar 2023 04:46:46 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230317-1454.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v0.0.0-nightly-20230317-1454.1)
7
+ ## [0.0.0-nightly-20230322-0439.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v0.0.0-nightly-20230322-0439.1)
8
8
 
9
- Fri, 17 Mar 2023 15:00:01 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.5.4..@fluentui/react-popover_v0.0.0-nightly-20230317-1454.1)
9
+ Wed, 22 Mar 2023 04:46:46 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.5.5..@fluentui/react-popover_v0.0.0-nightly-20230322-0439.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
16
- - Bump @fluentui/react-aria to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
17
- - Bump @fluentui/react-context-selector to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
18
- - Bump @fluentui/react-portal to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
19
- - Bump @fluentui/react-positioning to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
20
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
21
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
22
- - Bump @fluentui/react-theme to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
23
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
24
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
16
+ - Bump @fluentui/react-aria to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
17
+ - Bump @fluentui/react-context-selector to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
18
+ - Bump @fluentui/react-portal to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
19
+ - Bump @fluentui/react-positioning to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
20
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
21
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
22
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
23
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
24
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230322-0439.1 ([commit](https://github.com/microsoft/fluentui/commit/49dde84493fc2c3e96abac5ce918169c9668ba66) by beachball)
25
+
26
+ ## [9.5.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.5.5)
27
+
28
+ Tue, 21 Mar 2023 21:23:43 GMT
29
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.5.4..@fluentui/react-popover_v9.5.5)
30
+
31
+ ### Patches
32
+
33
+ - chore: migrate to swc transpilation approach. ([PR #27250](https://github.com/microsoft/fluentui/pull/27250) by tristan.watanabe@gmail.com)
34
+ - fix: add node field to package.json exports map. ([PR #27154](https://github.com/microsoft/fluentui/pull/27154) by tristan.watanabe@gmail.com)
35
+ - Bump @fluentui/keyboard-keys to v9.0.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
36
+ - Bump @fluentui/react-aria to v9.3.15 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
37
+ - Bump @fluentui/react-context-selector to v9.1.15 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
38
+ - Bump @fluentui/react-portal to v9.2.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
39
+ - Bump @fluentui/react-positioning to v9.5.6 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
40
+ - Bump @fluentui/react-shared-contexts to v9.3.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
41
+ - Bump @fluentui/react-tabster to v9.6.1 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
42
+ - Bump @fluentui/react-theme to v9.1.7 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
43
+ - Bump @fluentui/react-utilities to v9.7.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
44
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.20 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
25
45
 
26
46
  ## [9.5.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.5.4)
27
47
 
package/lib/Popover.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./components/Popover/index";
1
+ export * from './components/Popover/index';
2
2
  //# sourceMappingURL=Popover.js.map
@@ -1,2 +1,2 @@
1
- export * from "./components/PopoverSurface/index";
1
+ export * from './components/PopoverSurface/index';
2
2
  //# sourceMappingURL=PopoverSurface.js.map
@@ -1,2 +1,2 @@
1
- export * from "./components/PopoverTrigger/index";
1
+ export * from './components/PopoverTrigger/index';
2
2
  //# sourceMappingURL=PopoverTrigger.js.map
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import { usePopover_unstable } from "./usePopover";
3
- import { renderPopover_unstable } from "./renderPopover";
1
+ import * as React from 'react';
2
+ import { usePopover_unstable } from './usePopover';
3
+ import { renderPopover_unstable } from './renderPopover';
4
4
  /**
5
5
  * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
6
6
  */
@@ -8,5 +8,5 @@ export const Popover = props => {
8
8
  const state = usePopover_unstable(props);
9
9
  return renderPopover_unstable(state);
10
10
  };
11
- Popover.displayName = "Popover";
11
+ Popover.displayName = 'Popover';
12
12
  //# sourceMappingURL=Popover.js.map
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  //# sourceMappingURL=Popover.types.js.map
@@ -1,5 +1,5 @@
1
- export * from "./Popover";
2
- export * from "./Popover.types";
3
- export * from "./renderPopover";
4
- export * from "./usePopover";
1
+ export * from './Popover';
2
+ export * from './Popover.types';
3
+ export * from './renderPopover';
4
+ export * from './usePopover';
5
5
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { PopoverContext } from "../../popoverContext";
1
+ import * as React from 'react';
2
+ import { PopoverContext } from '../../popoverContext';
3
3
  /**
4
4
  * Render the final JSX of Popover
5
5
  */
@@ -1,11 +1,11 @@
1
- import * as React from "react";
2
- import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from "@fluentui/react-utilities";
3
- import { useFluent_unstable as useFluent } from "@fluentui/react-shared-contexts";
4
- import { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget } from "@fluentui/react-positioning";
5
- import { elementContains } from "@fluentui/react-portal";
6
- import { useFocusFinders } from "@fluentui/react-tabster";
7
- import { arrowHeights } from "../PopoverSurface/index";
8
- import { popoverSurfaceBorderRadius } from "./constants";
1
+ import * as React from 'react';
2
+ import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
3
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
4
+ import { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget } from '@fluentui/react-positioning';
5
+ import { elementContains } from '@fluentui/react-portal';
6
+ import { useFocusFinders } from '@fluentui/react-tabster';
7
+ import { arrowHeights } from '../PopoverSurface/index';
8
+ import { popoverSurfaceBorderRadius } from './constants';
9
9
  /**
10
10
  * Create the state required to render Popover.
11
11
  *
@@ -17,20 +17,20 @@ import { popoverSurfaceBorderRadius } from "./constants";
17
17
  export const usePopover_unstable = props => {
18
18
  const [contextTarget, setContextTarget] = usePositioningMouseTarget();
19
19
  const initialState = {
20
- size: "medium",
20
+ size: 'medium',
21
21
  contextTarget,
22
22
  setContextTarget,
23
23
  ...props
24
24
  };
25
25
  const children = React.Children.toArray(props.children);
26
- if (process.env.NODE_ENV !== "production") {
26
+ if (process.env.NODE_ENV !== 'production') {
27
27
  if (children.length === 0) {
28
28
  // eslint-disable-next-line no-console
29
- console.warn("Popover must contain at least one child");
29
+ console.warn('Popover must contain at least one child');
30
30
  }
31
31
  if (children.length > 2) {
32
32
  // eslint-disable-next-line no-console
33
- console.warn("Popover must contain at most two children");
33
+ console.warn('Popover must contain at most two children');
34
34
  }
35
35
  }
36
36
  let popoverTrigger = undefined;
@@ -49,13 +49,14 @@ export const usePopover_unstable = props => {
49
49
  // < React 17 still uses pooled synthetic events
50
50
  e.persist();
51
51
  }
52
- if (e.type === "mouseleave") {
52
+ if (e.type === 'mouseleave') {
53
+ var _props_mouseLeaveDelay;
53
54
  // FIXME leaking Node timeout type
54
55
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
55
56
  // @ts-ignore
56
57
  setOpenTimeoutRef.current = setTimeout(() => {
57
58
  setOpenState(e, shouldOpen);
58
- }, props.mouseLeaveDelay ?? 500);
59
+ }, (_props_mouseLeaveDelay = props.mouseLeaveDelay) !== null && _props_mouseLeaveDelay !== void 0 ? _props_mouseLeaveDelay : 500);
59
60
  } else {
60
61
  setOpenState(e, shouldOpen);
61
62
  }
@@ -98,11 +99,13 @@ export const usePopover_unstable = props => {
98
99
  return;
99
100
  }
100
101
  if (open && positioningRefs.contentRef.current) {
101
- const containerTabIndex = positioningRefs.contentRef.current.getAttribute("tabIndex") ?? undefined;
102
+ var _positioningRefs_contentRef_current_getAttribute;
103
+ const containerTabIndex = (_positioningRefs_contentRef_current_getAttribute = positioningRefs.contentRef.current.getAttribute('tabIndex')) !== null && _positioningRefs_contentRef_current_getAttribute !== void 0 ? _positioningRefs_contentRef_current_getAttribute : undefined;
102
104
  const firstFocusable = isNaN(containerTabIndex) ? findFirstFocusable(positioningRefs.contentRef.current) : positioningRefs.contentRef.current;
103
- firstFocusable?.focus();
105
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
104
106
  }
105
107
  }, [findFirstFocusable, open, positioningRefs.contentRef, props.unstable_disableAutoFocus]);
108
+ var _props_inline;
106
109
  return {
107
110
  ...initialState,
108
111
  ...positioningRefs,
@@ -113,14 +116,17 @@ export const usePopover_unstable = props => {
113
116
  toggleOpen,
114
117
  setContextTarget,
115
118
  contextTarget,
116
- inline: props.inline ?? false
119
+ inline: (_props_inline = props.inline) !== null && _props_inline !== void 0 ? _props_inline : false
117
120
  };
118
121
  };
119
122
  /**
120
123
  * Creates and manages the Popover open state
121
124
  */
122
125
  function useOpenState(state) {
123
- const onOpenChange = useEventCallback((e, data) => state.onOpenChange?.(e, data));
126
+ const onOpenChange = useEventCallback((e, data) => {
127
+ var _state_onOpenChange;
128
+ return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);
129
+ });
124
130
  const [open, setOpenState] = useControllableState({
125
131
  state: state.open,
126
132
  defaultState: state.defaultOpen,
@@ -129,14 +135,14 @@ function useOpenState(state) {
129
135
  state.open = open !== undefined ? open : state.open;
130
136
  const setContextTarget = state.setContextTarget;
131
137
  const setOpen = React.useCallback((e, shouldOpen) => {
132
- if (shouldOpen && e.type === "contextmenu") {
138
+ if (shouldOpen && e.type === 'contextmenu') {
133
139
  setContextTarget(e);
134
140
  }
135
141
  if (!shouldOpen) {
136
142
  setContextTarget(undefined);
137
143
  }
138
144
  setOpenState(shouldOpen);
139
- onOpenChange?.(e, {
145
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
140
146
  open: shouldOpen
141
147
  });
142
148
  }, [setOpenState, onOpenChange, setContextTarget]);
@@ -147,8 +153,8 @@ function useOpenState(state) {
147
153
  */
148
154
  function usePopoverRefs(state) {
149
155
  const positioningOptions = {
150
- position: "above",
151
- align: "center",
156
+ position: 'above',
157
+ align: 'center',
152
158
  arrowPadding: 2 * popoverSurfaceBorderRadius,
153
159
  target: state.openOnContext ? state.contextTarget : undefined,
154
160
  ...resolvePositioningShorthand(state.positioning)
@@ -1 +1 @@
1
- {"version":3,"names":["React","useControllableState","useEventCallback","useOnClickOutside","useOnScrollOutside","useFluent_unstable","useFluent","usePositioning","resolvePositioningShorthand","mergeArrowOffset","usePositioningMouseTarget","elementContains","useFocusFinders","arrowHeights","popoverSurfaceBorderRadius","usePopover_unstable","props","contextTarget","setContextTarget","initialState","size","children","Children","toArray","process","env","NODE_ENV","length","console","warn","popoverTrigger","undefined","popoverSurface","open","setOpenState","useOpenState","setOpenTimeoutRef","useRef","setOpen","e","shouldOpen","clearTimeout","current","Event","persist","type","setTimeout","mouseLeaveDelay","useEffect","toggleOpen","useCallback","positioningRefs","usePopoverRefs","targetDocument","contains","element","callback","ev","refs","triggerRef","contentRef","disabled","closeOnScroll","openOnContext","findFirstFocusable","unstable_disableAutoFocus","containerTabIndex","getAttribute","firstFocusable","isNaN","focus","inline","state","onOpenChange","data","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","target","positioning","coverTarget","withArrow","offset","targetRef","containerRef","arrowRef"],"sources":["../../../src/components/Popover/usePopover.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePositioning,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePositioningMouseTarget,\n} from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\nimport { popoverSurfaceBorderRadius } from './constants';\n\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */\nexport const usePopover_unstable = (props: PopoverProps): PopoverState => {\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const [open, setOpenState] = useOpenState(initialState);\n\n const setOpenTimeoutRef = React.useRef(0);\n\n const setOpen = useEventCallback((e: OpenPopoverEvents, shouldOpen: boolean) => {\n clearTimeout(setOpenTimeoutRef.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave') {\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(() => {\n setOpenState(e, shouldOpen);\n }, props.mouseLeaveDelay ?? 500);\n } else {\n setOpenState(e, shouldOpen);\n }\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeoutRef.current);\n };\n }, []);\n\n const toggleOpen = React.useCallback<PopoverState['toggleOpen']>(\n e => {\n setOpen(e, !open);\n },\n [setOpen, open],\n );\n\n const positioningRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open,\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open || !closeOnScroll,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (props.unstable_disableAutoFocus) {\n return;\n }\n\n if (open && positioningRefs.contentRef.current) {\n const containerTabIndex = positioningRefs.contentRef.current.getAttribute('tabIndex') ?? undefined;\n const firstFocusable = isNaN(containerTabIndex)\n ? findFirstFocusable(positioningRefs.contentRef.current)\n : positioningRefs.contentRef.current;\n firstFocusable?.focus();\n }\n }, [findFirstFocusable, open, positioningRefs.contentRef, props.unstable_disableAutoFocus]);\n\n return {\n ...initialState,\n ...positioningRefs,\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: props.inline ?? false,\n };\n};\n\n/**\n * Creates and manages the Popover open state\n */\nfunction useOpenState(\n state: Pick<PopoverState, 'setContextTarget' | 'onOpenChange'> & Pick<PopoverProps, 'open' | 'defaultOpen'>,\n) {\n const onOpenChange: PopoverState['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n\n const setOpen = React.useCallback(\n (e: OpenPopoverEvents, shouldOpen: boolean) => {\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e as React.MouseEvent);\n }\n\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n\n setOpenState(shouldOpen);\n onOpenChange?.(e, { open: shouldOpen });\n },\n [setOpenState, onOpenChange, setContextTarget],\n );\n\n return [open, setOpen] as const;\n}\n\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */\nfunction usePopoverRefs(\n state: Pick<PopoverState, 'size' | 'contextTarget'> &\n Pick<PopoverProps, 'positioning' | 'openOnContext' | 'withArrow'>,\n) {\n const positioningOptions = {\n position: 'above' as const,\n align: 'center' as const,\n arrowPadding: 2 * popoverSurfaceBorderRadius,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n // no reason to render arrow when covering the target\n if (positioningOptions.coverTarget) {\n state.withArrow = false;\n }\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,QACb;AACP,SAASC,kBAAA,IAAsBC,SAAS,QAAQ;AAChD,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB;AACP,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAE7B,SAASC,0BAA0B,QAAQ;AAE3C;;;;;;;;AAQA,OAAO,MAAMC,mBAAA,GAAuBC,KAAA,IAAsC;EACxE,MAAM,CAACC,aAAA,EAAeC,gBAAA,CAAiB,GAAGR,yBAAA;EAC1C,MAAMS,YAAA,GAAe;IACnBC,IAAA,EAAM;IACNH,aAAA;IACAC,gBAAA;IACA,GAAGF;EACL;EAEA,MAAMK,QAAA,GAAWrB,KAAA,CAAMsB,QAAQ,CAACC,OAAO,CAACP,KAAA,CAAMK,QAAQ;EAEtD,IAAIG,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,IAAIL,QAAA,CAASM,MAAM,KAAK,GAAG;MACzB;MACAC,O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,EAAcvD,gBAAA,CAAiB;EAGhD,OAAO,CAACe,IAAA,EAAMK,OAAA,CAAQ;AACxB;AAEA;;;AAGA,SAASc,eACPoB,KACmE,EACnE;EACA,MAAMK,kBAAA,GAAqB;IACzBC,QAAA,EAAU;IACVC,KAAA,EAAO;IACPC,YAAA,EAAc,IAAIlE,0BAAA;IAClBmE,MAAA,EAAQT,KAAA,CAAMT,aAAa,GAAGS,KAAA,CAAMvD,aAAa,GAAGc,SAAS;IAC7D,GAAGvB,2BAAA,CAA4BgE,KAAA,CAAMU,WAAW;EAClD;EAEA;EACA,IAAIL,kBAAA,CAAmBM,WAAW,EAAE;IAClCX,KAAA,CAAMY,SAAS,GAAG,KAAK;EACzB;EAEA,IAAIZ,KAAA,CAAMY,SAAS,EAAE;IACnBP,kBAAA,CAAmBQ,MAAM,GAAG5E,gBAAA,CAAiBoE,kBAAA,CAAmBQ,MAAM,EAAExE,YAAY,CAAC2D,KAAA,CAAMpD,IAAI,CAAC;EAClG;EAEA,MAAM;IAAEkE,SAAA,EAAW3B,UAAA;IAAY4B,YAAA,EAAc3B,UAAA;IAAY4B;EAAQ,CAAE,GAAGjF,cAAA,CAAesE,kBAAA;EAErF,OAAO;IACLlB,UAAA;IACAC,UAAA;IACA4B;EACF;AACF"}
1
+ {"version":3,"names":["React","useControllableState","useEventCallback","useOnClickOutside","useOnScrollOutside","useFluent_unstable","useFluent","usePositioning","resolvePositioningShorthand","mergeArrowOffset","usePositioningMouseTarget","elementContains","useFocusFinders","arrowHeights","popoverSurfaceBorderRadius","usePopover_unstable","props","contextTarget","setContextTarget","initialState","size","children","Children","toArray","process","env","NODE_ENV","length","console","warn","popoverTrigger","undefined","popoverSurface","open","setOpenState","useOpenState","setOpenTimeoutRef","useRef","setOpen","e","shouldOpen","clearTimeout","current","Event","persist","type","_props_mouseLeaveDelay","setTimeout","mouseLeaveDelay","useEffect","toggleOpen","useCallback","positioningRefs","usePopoverRefs","targetDocument","contains","element","callback","ev","refs","triggerRef","contentRef","disabled","closeOnScroll","openOnContext","findFirstFocusable","unstable_disableAutoFocus","_positioningRefs_contentRef_current_getAttribute","containerTabIndex","getAttribute","firstFocusable","isNaN","focus","_props_inline","inline","state","onOpenChange","data","_state_onOpenChange","call","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","target","positioning","coverTarget","withArrow","offset","targetRef","containerRef","arrowRef"],"sources":["../../../src/components/Popover/usePopover.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePositioning,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePositioningMouseTarget,\n} from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\nimport { popoverSurfaceBorderRadius } from './constants';\n\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */\nexport const usePopover_unstable = (props: PopoverProps): PopoverState => {\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const [open, setOpenState] = useOpenState(initialState);\n\n const setOpenTimeoutRef = React.useRef(0);\n\n const setOpen = useEventCallback((e: OpenPopoverEvents, shouldOpen: boolean) => {\n clearTimeout(setOpenTimeoutRef.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave') {\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(() => {\n setOpenState(e, shouldOpen);\n }, props.mouseLeaveDelay ?? 500);\n } else {\n setOpenState(e, shouldOpen);\n }\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeoutRef.current);\n };\n }, []);\n\n const toggleOpen = React.useCallback<PopoverState['toggleOpen']>(\n e => {\n setOpen(e, !open);\n },\n [setOpen, open],\n );\n\n const positioningRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open,\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [positioningRefs.triggerRef, positioningRefs.contentRef],\n disabled: !open || !closeOnScroll,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (props.unstable_disableAutoFocus) {\n return;\n }\n\n if (open && positioningRefs.contentRef.current) {\n const containerTabIndex = positioningRefs.contentRef.current.getAttribute('tabIndex') ?? undefined;\n const firstFocusable = isNaN(containerTabIndex)\n ? findFirstFocusable(positioningRefs.contentRef.current)\n : positioningRefs.contentRef.current;\n firstFocusable?.focus();\n }\n }, [findFirstFocusable, open, positioningRefs.contentRef, props.unstable_disableAutoFocus]);\n\n return {\n ...initialState,\n ...positioningRefs,\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: props.inline ?? false,\n };\n};\n\n/**\n * Creates and manages the Popover open state\n */\nfunction useOpenState(\n state: Pick<PopoverState, 'setContextTarget' | 'onOpenChange'> & Pick<PopoverProps, 'open' | 'defaultOpen'>,\n) {\n const onOpenChange: PopoverState['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n\n const setOpen = React.useCallback(\n (e: OpenPopoverEvents, shouldOpen: boolean) => {\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e as React.MouseEvent);\n }\n\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n\n setOpenState(shouldOpen);\n onOpenChange?.(e, { open: shouldOpen });\n },\n [setOpenState, onOpenChange, setContextTarget],\n );\n\n return [open, setOpen] as const;\n}\n\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */\nfunction usePopoverRefs(\n state: Pick<PopoverState, 'size' | 'contextTarget'> &\n Pick<PopoverProps, 'positioning' | 'openOnContext' | 'withArrow'>,\n) {\n const positioningOptions = {\n position: 'above' as const,\n align: 'center' as const,\n arrowPadding: 2 * popoverSurfaceBorderRadius,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n // no reason to render arrow when covering the target\n if (positioningOptions.coverTarget) {\n state.withArrow = false;\n }\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePositioning(positioningOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"mappings":"AAAA,YAAYA,K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,KAAA,EAAO;IACPC,YAAA,EAAc,IAAIvE,0BAAA;IAClBwE,MAAA,EAAQX,KAAA,CAAMX,aAAa,GAAGW,KAAA,CAAM1D,aAAa,GAAGc,SAAS;IAC7D,GAAGvB,2BAAA,CAA4BmE,KAAA,CAAMY,WAAW;EAClD;EAEA;EACA,IAAIL,kBAAA,CAAmBM,WAAW,EAAE;IAClCb,KAAA,CAAMc,SAAS,GAAG,KAAK;EACzB;EAEA,IAAId,KAAA,CAAMc,SAAS,EAAE;IACnBP,kBAAA,CAAmBQ,MAAM,GAAGjF,gBAAA,CAAiByE,kBAAA,CAAmBQ,MAAM,EAAE7E,YAAY,CAAC8D,KAAA,CAAMvD,IAAI,CAAC;EAClG;EAEA,MAAM;IAAEuE,SAAA,EAAW/B,UAAA;IAAYgC,YAAA,EAAc/B,UAAA;IAAYgC;EAAQ,CAAE,GAAGtF,cAAA,CAAe2E,kBAAA;EAErF,OAAO;IACLtB,UAAA;IACAC,UAAA;IACAgC;EACF;AACF"}
@@ -1,8 +1,8 @@
1
- import * as React from "react";
2
- import { usePopoverSurface_unstable } from "./usePopoverSurface";
3
- import { renderPopoverSurface_unstable } from "./renderPopoverSurface";
4
- import { usePopoverSurfaceStyles_unstable } from "./usePopoverSurfaceStyles";
5
- import { useCustomStyleHooks_unstable } from "@fluentui/react-shared-contexts";
1
+ import * as React from 'react';
2
+ import { usePopoverSurface_unstable } from './usePopoverSurface';
3
+ import { renderPopoverSurface_unstable } from './renderPopoverSurface';
4
+ import { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';
5
+ import { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';
6
6
  /**
7
7
  * PopoverSurface component renders react children in a positioned box
8
8
  */
@@ -15,5 +15,5 @@ export const PopoverSurface = /*#__PURE__*/React.forwardRef((props, ref) => {
15
15
  useCustomStyles(state);
16
16
  return renderPopoverSurface_unstable(state);
17
17
  });
18
- PopoverSurface.displayName = "PopoverSurface";
18
+ PopoverSurface.displayName = 'PopoverSurface';
19
19
  //# sourceMappingURL=PopoverSurface.js.map
@@ -1,6 +1,6 @@
1
- export * from "./PopoverSurface";
2
- export * from "./PopoverSurface.types";
3
- export * from "./renderPopoverSurface";
4
- export * from "./usePopoverSurface";
5
- export * from "./usePopoverSurfaceStyles";
1
+ export * from './PopoverSurface';
2
+ export * from './PopoverSurface.types';
3
+ export * from './renderPopoverSurface';
4
+ export * from './usePopoverSurface';
5
+ export * from './usePopoverSurfaceStyles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import { Portal } from "@fluentui/react-portal";
3
- import { getSlots } from "@fluentui/react-utilities";
1
+ import * as React from 'react';
2
+ import { Portal } from '@fluentui/react-portal';
3
+ import { getSlots } from '@fluentui/react-utilities';
4
4
  /**
5
5
  * Render the final JSX of PopoverSurface
6
6
  */
@@ -1,7 +1,7 @@
1
- import * as React from "react";
2
- import { getNativeElementProps, useMergedRefs } from "@fluentui/react-utilities";
3
- import { useModalAttributes } from "@fluentui/react-tabster";
4
- import { usePopoverContext_unstable } from "../../popoverContext";
1
+ import * as React from 'react';
2
+ import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
3
+ import { useModalAttributes } from '@fluentui/react-tabster';
4
+ import { usePopoverContext_unstable } from '../../popoverContext';
5
5
  /**
6
6
  * Create the state required to render PopoverSurface.
7
7
  *
@@ -38,12 +38,12 @@ export const usePopoverSurface_unstable = (props, ref) => {
38
38
  arrowRef,
39
39
  mountNode,
40
40
  components: {
41
- root: "div"
41
+ root: 'div'
42
42
  },
43
- root: getNativeElementProps("div", {
43
+ root: getNativeElementProps('div', {
44
44
  ref: useMergedRefs(ref, contentRef),
45
- role: trapFocus ? "dialog" : "group",
46
- "aria-modal": trapFocus ? true : undefined,
45
+ role: trapFocus ? 'dialog' : 'group',
46
+ 'aria-modal': trapFocus ? true : undefined,
47
47
  ...modalAttributes,
48
48
  ...props
49
49
  })
@@ -57,21 +57,22 @@ export const usePopoverSurface_unstable = (props, ref) => {
57
57
  if (openOnHover) {
58
58
  setOpen(e, true);
59
59
  }
60
- onMouseEnterOriginal?.(e);
60
+ onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
61
61
  };
62
62
  state.root.onMouseLeave = e => {
63
63
  if (openOnHover) {
64
64
  setOpen(e, false);
65
65
  }
66
- onMouseLeaveOriginal?.(e);
66
+ onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
67
67
  };
68
68
  state.root.onKeyDown = e => {
69
+ var _contentRef_current;
69
70
  // only close if the event happened inside the current popover
70
71
  // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
71
- if (e.key === "Escape" && contentRef.current?.contains(e.target)) {
72
+ if (e.key === 'Escape' && ((_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.contains(e.target))) {
72
73
  setOpen(e, false);
73
74
  }
74
- onKeyDownOriginal?.(e);
75
+ onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
75
76
  };
76
77
  return state;
77
78
  };