@fluentui/react-popover 9.5.3 → 9.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +127 -1
  3. package/CHANGELOG.md +36 -2
  4. package/lib/Popover.js.map +1 -1
  5. package/lib/PopoverSurface.js.map +1 -1
  6. package/lib/PopoverTrigger.js.map +1 -1
  7. package/lib/components/Popover/Popover.js +1 -0
  8. package/lib/components/Popover/Popover.js.map +1 -1
  9. package/lib/components/Popover/Popover.types.js +1 -1
  10. package/lib/components/Popover/Popover.types.js.map +1 -1
  11. package/lib/components/Popover/constants.js +1 -2
  12. package/lib/components/Popover/constants.js.map +1 -1
  13. package/lib/components/Popover/index.js.map +1 -1
  14. package/lib/components/Popover/renderPopover.js.map +1 -1
  15. package/lib/components/Popover/usePopover.js +8 -8
  16. package/lib/components/Popover/usePopover.js.map +1 -1
  17. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  18. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  19. package/lib/components/PopoverSurface/index.js.map +1 -1
  20. package/lib/components/PopoverSurface/renderPopoverSurface.js +1 -3
  21. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  22. package/lib/components/PopoverSurface/usePopoverSurface.js +3 -2
  23. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  24. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  25. package/lib/components/PopoverTrigger/PopoverTrigger.js +1 -0
  26. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  27. package/lib/components/PopoverTrigger/PopoverTrigger.types.js +1 -1
  28. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  29. package/lib/components/PopoverTrigger/index.js.map +1 -1
  30. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -2
  31. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  32. package/lib/components/PopoverTrigger/usePopoverTrigger.js +1 -0
  33. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  34. package/lib/index.js.map +1 -1
  35. package/lib/popoverContext.js.map +1 -1
  36. package/lib-commonjs/Popover.js +5 -4
  37. package/lib-commonjs/Popover.js.map +1 -1
  38. package/lib-commonjs/PopoverSurface.js +5 -4
  39. package/lib-commonjs/PopoverSurface.js.map +1 -1
  40. package/lib-commonjs/PopoverTrigger.js +5 -4
  41. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  42. package/lib-commonjs/components/Popover/Popover.js +14 -13
  43. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  44. package/lib-commonjs/components/Popover/Popover.types.js +5 -2
  45. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  46. package/lib-commonjs/components/Popover/constants.js +10 -8
  47. package/lib-commonjs/components/Popover/constants.js.map +1 -1
  48. package/lib-commonjs/components/Popover/index.js +8 -7
  49. package/lib-commonjs/components/Popover/index.js.map +1 -1
  50. package/lib-commonjs/components/Popover/renderPopover.js +31 -47
  51. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  52. package/lib-commonjs/components/Popover/usePopover.js +179 -173
  53. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  54. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +19 -20
  55. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  56. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js +3 -2
  57. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  58. package/lib-commonjs/components/PopoverSurface/index.js +9 -8
  59. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  60. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +23 -28
  61. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  62. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +70 -81
  63. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  64. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +243 -113
  65. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  66. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +15 -14
  67. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  68. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +5 -2
  69. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  70. package/lib-commonjs/components/PopoverTrigger/index.js +8 -7
  71. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  72. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +12 -11
  73. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  74. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +71 -80
  75. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  76. package/lib-commonjs/index.js +30 -92
  77. package/lib-commonjs/index.js.map +1 -1
  78. package/lib-commonjs/popoverContext.js +34 -25
  79. package/lib-commonjs/popoverContext.js.map +1 -1
  80. package/package.json +14 -13
  81. package/lib-amd/Popover.js +0 -6
  82. package/lib-amd/Popover.js.map +0 -1
  83. package/lib-amd/PopoverSurface.js +0 -6
  84. package/lib-amd/PopoverSurface.js.map +0 -1
  85. package/lib-amd/PopoverTrigger.js +0 -6
  86. package/lib-amd/PopoverTrigger.js.map +0 -1
  87. package/lib-amd/components/Popover/Popover.js +0 -15
  88. package/lib-amd/components/Popover/Popover.js.map +0 -1
  89. package/lib-amd/components/Popover/Popover.types.js +0 -5
  90. package/lib-amd/components/Popover/Popover.types.js.map +0 -1
  91. package/lib-amd/components/Popover/constants.js +0 -15
  92. package/lib-amd/components/Popover/constants.js.map +0 -1
  93. package/lib-amd/components/Popover/index.js +0 -9
  94. package/lib-amd/components/Popover/index.js.map +0 -1
  95. package/lib-amd/components/Popover/renderPopover.js +0 -32
  96. package/lib-amd/components/Popover/renderPopover.js.map +0 -1
  97. package/lib-amd/components/Popover/usePopover.js +0 -147
  98. package/lib-amd/components/Popover/usePopover.js.map +0 -1
  99. package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -17
  100. package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
  101. package/lib-amd/components/PopoverSurface/PopoverSurface.types.js +0 -5
  102. package/lib-amd/components/PopoverSurface/PopoverSurface.types.js.map +0 -1
  103. package/lib-amd/components/PopoverSurface/index.js +0 -10
  104. package/lib-amd/components/PopoverSurface/index.js.map +0 -1
  105. package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -20
  106. package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
  107. package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -69
  108. package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
  109. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -44
  110. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
  111. package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -17
  112. package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
  113. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js +0 -5
  114. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js.map +0 -1
  115. package/lib-amd/components/PopoverTrigger/index.js +0 -9
  116. package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
  117. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js +0 -13
  118. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js.map +0 -1
  119. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js +0 -61
  120. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
  121. package/lib-amd/index.js +0 -20
  122. package/lib-amd/index.js.map +0 -1
  123. package/lib-amd/popoverContext.js +0 -28
  124. package/lib-amd/popoverContext.js.map +0 -1
package/.swcrc ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/swcrc",
3
+ "exclude": [
4
+ "/testing",
5
+ "/**/*.cy.ts",
6
+ "/**/*.cy.tsx",
7
+ "/**/*.spec.ts",
8
+ "/**/*.spec.tsx",
9
+ "/**/*.test.ts",
10
+ "/**/*.test.tsx"
11
+ ],
12
+ "jsc": {
13
+ "parser": {
14
+ "syntax": "typescript",
15
+ "tsx": true,
16
+ "decorators": false,
17
+ "dynamicImport": false
18
+ },
19
+ "externalHelpers": true,
20
+ "transform": {
21
+ "react": {
22
+ "runtime": "classic",
23
+ "useSpread": true
24
+ }
25
+ },
26
+ "target": "es2019"
27
+ },
28
+ "minify": false,
29
+ "sourceMaps": true
30
+ }
package/CHANGELOG.json CHANGED
@@ -2,7 +2,133 @@
2
2
  "name": "@fluentui/react-popover",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 15 Mar 2023 10:17:05 GMT",
5
+ "date": "Tue, 21 Mar 2023 21:18:55 GMT",
6
+ "tag": "@fluentui/react-popover_v9.5.5",
7
+ "version": "9.5.5",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "tristan.watanabe@gmail.com",
12
+ "package": "@fluentui/react-popover",
13
+ "commit": "2fac1a139149bd13b76b1306207bc988dca9c72c",
14
+ "comment": "chore: migrate to swc transpilation approach."
15
+ },
16
+ {
17
+ "author": "tristan.watanabe@gmail.com",
18
+ "package": "@fluentui/react-popover",
19
+ "commit": "ead1c6d4c2ac3f3596b62b8cbc07b0a03041f11f",
20
+ "comment": "fix: add node field to package.json exports map."
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-popover",
25
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.2",
26
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-popover",
31
+ "comment": "Bump @fluentui/react-aria to v9.3.15",
32
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-popover",
37
+ "comment": "Bump @fluentui/react-context-selector to v9.1.15",
38
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-popover",
43
+ "comment": "Bump @fluentui/react-portal to v9.2.2",
44
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-popover",
49
+ "comment": "Bump @fluentui/react-positioning to v9.5.6",
50
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-popover",
55
+ "comment": "Bump @fluentui/react-shared-contexts to v9.3.2",
56
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-popover",
61
+ "comment": "Bump @fluentui/react-tabster to v9.6.1",
62
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
63
+ },
64
+ {
65
+ "author": "beachball",
66
+ "package": "@fluentui/react-popover",
67
+ "comment": "Bump @fluentui/react-theme to v9.1.7",
68
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
69
+ },
70
+ {
71
+ "author": "beachball",
72
+ "package": "@fluentui/react-popover",
73
+ "comment": "Bump @fluentui/react-utilities to v9.7.2",
74
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
75
+ },
76
+ {
77
+ "author": "beachball",
78
+ "package": "@fluentui/react-popover",
79
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.20",
80
+ "commit": "b7a26f6263c80e3253c6b8338c33b73bae33e2b5"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "date": "Thu, 16 Mar 2023 14:36:59 GMT",
87
+ "tag": "@fluentui/react-popover_v9.5.4",
88
+ "version": "9.5.4",
89
+ "comments": {
90
+ "patch": [
91
+ {
92
+ "author": "beachball",
93
+ "package": "@fluentui/react-popover",
94
+ "comment": "Bump @fluentui/react-aria to v9.3.14",
95
+ "commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
96
+ },
97
+ {
98
+ "author": "beachball",
99
+ "package": "@fluentui/react-popover",
100
+ "comment": "Bump @fluentui/react-context-selector to v9.1.14",
101
+ "commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
102
+ },
103
+ {
104
+ "author": "beachball",
105
+ "package": "@fluentui/react-popover",
106
+ "comment": "Bump @fluentui/react-portal to v9.2.1",
107
+ "commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
108
+ },
109
+ {
110
+ "author": "beachball",
111
+ "package": "@fluentui/react-popover",
112
+ "comment": "Bump @fluentui/react-positioning to v9.5.5",
113
+ "commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
114
+ },
115
+ {
116
+ "author": "beachball",
117
+ "package": "@fluentui/react-popover",
118
+ "comment": "Bump @fluentui/react-tabster to v9.6.0",
119
+ "commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
120
+ },
121
+ {
122
+ "author": "beachball",
123
+ "package": "@fluentui/react-popover",
124
+ "comment": "Bump @fluentui/react-utilities to v9.7.1",
125
+ "commit": "e7dcadf7cabae6bc6811ca04a630e7d850388f81"
126
+ }
127
+ ]
128
+ }
129
+ },
130
+ {
131
+ "date": "Wed, 15 Mar 2023 10:19:53 GMT",
6
132
  "tag": "@fluentui/react-popover_v9.5.3",
7
133
  "version": "9.5.3",
8
134
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,46 @@
1
1
  # Change Log - @fluentui/react-popover
2
2
 
3
- This log was last generated on Wed, 15 Mar 2023 10:17:05 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 21 Mar 2023 21:18:55 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.5.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.5.5)
8
+
9
+ Tue, 21 Mar 2023 21:18:55 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.5.4..@fluentui/react-popover_v9.5.5)
11
+
12
+ ### Patches
13
+
14
+ - chore: migrate to swc transpilation approach. ([PR #27250](https://github.com/microsoft/fluentui/pull/27250) by tristan.watanabe@gmail.com)
15
+ - fix: add node field to package.json exports map. ([PR #27154](https://github.com/microsoft/fluentui/pull/27154) by tristan.watanabe@gmail.com)
16
+ - Bump @fluentui/keyboard-keys to v9.0.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
17
+ - Bump @fluentui/react-aria to v9.3.15 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
18
+ - Bump @fluentui/react-context-selector to v9.1.15 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
19
+ - Bump @fluentui/react-portal to v9.2.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
20
+ - Bump @fluentui/react-positioning to v9.5.6 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
21
+ - Bump @fluentui/react-shared-contexts to v9.3.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
22
+ - Bump @fluentui/react-tabster to v9.6.1 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
23
+ - Bump @fluentui/react-theme to v9.1.7 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
24
+ - Bump @fluentui/react-utilities to v9.7.2 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
25
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.20 ([PR #27271](https://github.com/microsoft/fluentui/pull/27271) by beachball)
26
+
27
+ ## [9.5.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.5.4)
28
+
29
+ Thu, 16 Mar 2023 14:36:59 GMT
30
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.5.3..@fluentui/react-popover_v9.5.4)
31
+
32
+ ### Patches
33
+
34
+ - Bump @fluentui/react-aria to v9.3.14 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
35
+ - Bump @fluentui/react-context-selector to v9.1.14 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
36
+ - Bump @fluentui/react-portal to v9.2.1 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
37
+ - Bump @fluentui/react-positioning to v9.5.5 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
38
+ - Bump @fluentui/react-tabster to v9.6.0 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
39
+ - Bump @fluentui/react-utilities to v9.7.1 ([PR #27229](https://github.com/microsoft/fluentui/pull/27229) by beachball)
40
+
7
41
  ## [9.5.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.5.3)
8
42
 
9
- Wed, 15 Mar 2023 10:17:05 GMT
43
+ Wed, 15 Mar 2023 10:19:53 GMT
10
44
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.5.2..@fluentui/react-popover_v9.5.3)
11
45
 
12
46
  ### Patches
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/Popover.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Popover/index';\n"]}
1
+ {"version":3,"names":[],"sources":["../src/Popover.ts"],"sourcesContent":["export * from './components/Popover/index';\n"],"mappings":"AAAA,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverSurface.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/PopoverSurface.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/PopoverSurface/index';\n"]}
1
+ {"version":3,"names":[],"sources":["../src/PopoverSurface.ts"],"sourcesContent":["export * from './components/PopoverSurface/index';\n"],"mappings":"AAAA,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverTrigger.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/PopoverTrigger.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/PopoverTrigger/index';\n"]}
1
+ {"version":3,"names":[],"sources":["../src/PopoverTrigger.ts"],"sourcesContent":["export * from './components/PopoverTrigger/index';\n"],"mappings":"AAAA,cAAc"}
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { usePopover_unstable } from './usePopover';
2
3
  import { renderPopover_unstable } from './renderPopover';
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["usePopover_unstable","renderPopover_unstable","Popover","props","state","displayName"],"sources":["../src/packages/react-components/react-popover/src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAClD,SAASC,sBAAsB,QAAQ,iBAAiB;AAGxD;;;AAGA,OAAO,MAAMC,OAAO,GAA2BC,KAAK,IAAG;EACrD,MAAMC,KAAK,GAAGJ,mBAAmB,CAACG,KAAK,CAAC;EAExC,OAAOF,sBAAsB,CAACG,KAAK,CAAC;AACtC,CAAC;AAEDF,OAAO,CAACG,WAAW,GAAG,SAAS"}
1
+ {"version":3,"names":["React","usePopover_unstable","renderPopover_unstable","Popover","props","state","displayName"],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,sBAAsB,QAAQ;AAGvC;;;AAGA,OAAO,MAAMC,OAAA,GAAkCC,KAAA,IAAS;EACtD,MAAMC,KAAA,GAAQJ,mBAAA,CAAoBG,KAAA;EAElC,OAAOF,sBAAA,CAAuBG,KAAA;AAChC;AAEAF,OAAA,CAAQG,WAAW,GAAG"}
@@ -1,2 +1,2 @@
1
- export {};
1
+ import * as React from 'react';
2
2
  //# sourceMappingURL=Popover.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/Popover/Popover.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type {\n PositioningVirtualElement,\n PositioningShorthand,\n SetVirtualMouseTarget,\n} from '@fluentui/react-positioning';\nimport type { PortalProps } from '@fluentui/react-portal';\n\n/**\n * Determines popover padding and arrow size\n */\nexport type PopoverSize = 'small' | 'medium' | 'large';\n\n/**\n * Popover Props\n */\nexport type PopoverProps = Pick<PortalProps, 'mountNode'> & {\n /**\n * A popover can appear styled with brand or inverted.\n * When not specified, the default style is used.\n */\n appearance?: 'brand' | 'inverted';\n\n /**\n * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.\n * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Close when scroll outside of it\n *\n * @default false\n */\n closeOnScroll?: boolean;\n\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Sets the delay for closing popover on mouse leave\n */\n mouseLeaveDelay?: number;\n\n /**\n * Display an arrow pointing to the target.\n *\n * @default false\n */\n withArrow?: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;\n\n /**\n * Controls the opening of the Popover\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n *\n * @default false\n */\n openOnContext?: boolean;\n\n /**\n * Flag to open the Popover by hovering the trigger\n *\n * @default false\n */\n openOnHover?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n\n /**\n * Determines popover padding and arrow size\n *\n * @default medium\n */\n size?: PopoverSize;\n\n /**\n * Should trap focus\n *\n * @default false\n */\n trapFocus?: boolean;\n\n /**\n * Must be used with the `trapFocus` prop\n * Enables older Fluent UI focus trap behavior where the user\n * cannot tab into the window outside of the document. This is now\n * non-standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)\n * where the focus trap involves setting outside elements inert.\n *\n * @deprecated this behavior is default provided now, to opt-out of it in favor of standard behavior use the `inertTrapFocus` property\n */\n legacyTrapFocus?: boolean;\n /**\n * Enables standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)\n * where the focus trap involves setting outside elements inert,\n * making navigation leak from the trapped area back to the browser toolbar and vice-versa.\n *\n * @default false\n */\n inertTrapFocus?: boolean;\n\n /**\n * By default Popover focuses the first focusable element in PopoverSurface on open.\n * Specify `disableAutoFocus` to prevent this behavior.\n *\n * @default false\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableAutoFocus?: boolean;\n};\n\n/**\n * Popover State\n */\nexport type PopoverState = Pick<\n PopoverProps,\n | 'appearance'\n | 'mountNode'\n | 'onOpenChange'\n | 'openOnContext'\n | 'openOnHover'\n | 'trapFocus'\n | 'withArrow'\n | 'inertTrapFocus'\n> &\n Required<Pick<PopoverProps, 'inline' | 'open'>> &\n Pick<PopoverProps, 'children'> & {\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PositioningVirtualElement | undefined;\n\n popoverSurface: React.ReactElement | undefined;\n\n popoverTrigger: React.ReactElement | undefined;\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: SetVirtualMouseTarget;\n\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n\n size: NonNullable<PopoverProps['size']>;\n\n /**\n * Callback to toggle the open state of the Popover\n */\n toggleOpen: (e: OpenPopoverEvents) => void;\n\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n };\n\n/**\n * Data attached to open/close events\n */\nexport type OnOpenChangeData = { open: boolean };\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type OpenPopoverEvents =\n | MouseEvent\n | TouchEvent\n | React.FocusEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement>;\n"]}
1
+ {"version":3,"names":["React"],"sources":["../../../src/components/Popover/Popover.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type {\n PositioningVirtualElement,\n PositioningShorthand,\n SetVirtualMouseTarget,\n} from '@fluentui/react-positioning';\nimport type { PortalProps } from '@fluentui/react-portal';\n\n/**\n * Determines popover padding and arrow size\n */\nexport type PopoverSize = 'small' | 'medium' | 'large';\n\n/**\n * Popover Props\n */\nexport type PopoverProps = Pick<PortalProps, 'mountNode'> & {\n /**\n * A popover can appear styled with brand or inverted.\n * When not specified, the default style is used.\n */\n appearance?: 'brand' | 'inverted';\n\n /**\n * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.\n * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Close when scroll outside of it\n *\n * @default false\n */\n closeOnScroll?: boolean;\n\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Sets the delay for closing popover on mouse leave\n */\n mouseLeaveDelay?: number;\n\n /**\n * Display an arrow pointing to the target.\n *\n * @default false\n */\n withArrow?: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;\n\n /**\n * Controls the opening of the Popover\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n *\n * @default false\n */\n openOnContext?: boolean;\n\n /**\n * Flag to open the Popover by hovering the trigger\n *\n * @default false\n */\n openOnHover?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n\n /**\n * Determines popover padding and arrow size\n *\n * @default medium\n */\n size?: PopoverSize;\n\n /**\n * Should trap focus\n *\n * @default false\n */\n trapFocus?: boolean;\n\n /**\n * Must be used with the `trapFocus` prop\n * Enables older Fluent UI focus trap behavior where the user\n * cannot tab into the window outside of the document. This is now\n * non-standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)\n * where the focus trap involves setting outside elements inert.\n *\n * @deprecated this behavior is default provided now, to opt-out of it in favor of standard behavior use the `inertTrapFocus` property\n */\n legacyTrapFocus?: boolean;\n /**\n * Enables standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)\n * where the focus trap involves setting outside elements inert,\n * making navigation leak from the trapped area back to the browser toolbar and vice-versa.\n *\n * @default false\n */\n inertTrapFocus?: boolean;\n\n /**\n * By default Popover focuses the first focusable element in PopoverSurface on open.\n * Specify `disableAutoFocus` to prevent this behavior.\n *\n * @default false\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableAutoFocus?: boolean;\n};\n\n/**\n * Popover State\n */\nexport type PopoverState = Pick<\n PopoverProps,\n | 'appearance'\n | 'mountNode'\n | 'onOpenChange'\n | 'openOnContext'\n | 'openOnHover'\n | 'trapFocus'\n | 'withArrow'\n | 'inertTrapFocus'\n> &\n Required<Pick<PopoverProps, 'inline' | 'open'>> &\n Pick<PopoverProps, 'children'> & {\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PositioningVirtualElement | undefined;\n\n popoverSurface: React.ReactElement | undefined;\n\n popoverTrigger: React.ReactElement | undefined;\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: SetVirtualMouseTarget;\n\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n\n size: NonNullable<PopoverProps['size']>;\n\n /**\n * Callback to toggle the open state of the Popover\n */\n toggleOpen: (e: OpenPopoverEvents) => void;\n\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n };\n\n/**\n * Data attached to open/close events\n */\nexport type OnOpenChangeData = { open: boolean };\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type OpenPopoverEvents =\n | MouseEvent\n | TouchEvent\n | React.FocusEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement>;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
@@ -5,6 +5,5 @@
5
5
  * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
6
6
  * While we could use getComputedStyle, that adds a performance penalty for something that
7
7
  * will likely never change.
8
- */
9
- export const popoverSurfaceBorderRadius = 4;
8
+ */export const popoverSurfaceBorderRadius = 4;
10
9
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/Popover/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["/**\n * @internal\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const popoverSurfaceBorderRadius = 4;\n"]}
1
+ {"version":3,"names":["popoverSurfaceBorderRadius"],"sources":["../../../src/components/Popover/constants.ts"],"sourcesContent":["/**\n * @internal\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const popoverSurfaceBorderRadius = 4;\n"],"mappings":"AAAA;;;;;;;GAQA,OAAO,MAAMA,0BAAA,GAA6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC","sourcesContent":["export * from './Popover';\nexport * from './Popover.types';\nexport * from './renderPopover';\nexport * from './usePopover';\n"]}
1
+ {"version":3,"names":[],"sources":["../../../src/components/Popover/index.ts"],"sourcesContent":["export * from './Popover';\nexport * from './Popover.types';\nexport * from './renderPopover';\nexport * from './usePopover';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"names":["React","PopoverContext","renderPopover_unstable","state","appearance","arrowRef","contentRef","inline","mountNode","open","openOnContext","openOnHover","setOpen","size","toggleOpen","trapFocus","triggerRef","withArrow","inertTrapFocus","createElement","Provider","value","popoverTrigger","popoverSurface"],"sources":["../src/packages/react-components/react-popover/src/components/Popover/renderPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n size,\n toggleOpen,\n trapFocus,\n triggerRef,\n withArrow,\n inertTrapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n toggleOpen,\n triggerRef,\n size,\n trapFocus,\n inertTrapFocus,\n withArrow,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,cAAc,QAAQ,sBAAsB;AAGrD;;;AAGA,OAAO,MAAMC,sBAAsB,GAAIC,KAAmB,IAAI;EAC5D,MAAM;IACJC,UAAU;IACVC,QAAQ;IACRC,UAAU;IACVC,MAAM;IACNC,SAAS;IACTC,IAAI;IACJC,aAAa;IACbC,WAAW;IACXC,OAAO;IACPC,IAAI;IACJC,UAAU;IACVC,SAAS;IACTC,UAAU;IACVC,SAAS;IACTC;EAAc,CACf,GAAGf,KAAK;EAET,oBACEH,KAAA,CAAAmB,aAAA,CAAClB,cAAc,CAACmB,QAAQ;IACtBC,KAAK,EAAE;MACLjB,UAAU;MACVC,QAAQ;MACRC,UAAU;MACVC,MAAM;MACNC,SAAS;MACTC,IAAI;MACJC,aAAa;MACbC,WAAW;MACXC,OAAO;MACPE,UAAU;MACVE,UAAU;MACVH,IAAI;MACJE,SAAS;MACTG,cAAc;MACdD;;EACD,GAEAd,KAAK,CAACmB,cAAc,EACpBnB,KAAK,CAACM,IAAI,IAAIN,KAAK,CAACoB,cAAc,CACX;AAE9B,CAAC"}
1
+ {"version":3,"names":["React","PopoverContext","renderPopover_unstable","state","appearance","arrowRef","contentRef","inline","mountNode","open","openOnContext","openOnHover","setOpen","size","toggleOpen","trapFocus","triggerRef","withArrow","inertTrapFocus","createElement","Provider","value","popoverTrigger","popoverSurface"],"sources":["../../../src/components/Popover/renderPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n size,\n toggleOpen,\n trapFocus,\n triggerRef,\n withArrow,\n inertTrapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n toggleOpen,\n triggerRef,\n size,\n trapFocus,\n inertTrapFocus,\n withArrow,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,cAAc,QAAQ;AAG/B;;;AAGA,OAAO,MAAMC,sBAAA,GAA0BC,KAAA,IAAwB;EAC7D,MAAM;IACJC,UAAA;IACAC,QAAA;IACAC,UAAA;IACAC,MAAA;IACAC,SAAA;IACAC,IAAA;IACAC,aAAA;IACAC,WAAA;IACAC,OAAA;IACAC,IAAA;IACAC,UAAA;IACAC,SAAA;IACAC,UAAA;IACAC,SAAA;IACAC;EAAc,CACf,GAAGf,KAAA;EAEJ,oBACEH,KAAA,CAAAmB,aAAA,CAAClB,cAAA,CAAemB,QAAQ;IACtBC,KAAA,EAAO;MACLjB,UAAA;MACAC,QAAA;MACAC,UAAA;MACAC,MAAA;MACAC,SAAA;MACAC,IAAA;MACAC,aAAA;MACAC,WAAA;MACAC,OAAA;MACAE,UAAA;MACAE,UAAA;MACAH,IAAA;MACAE,SAAA;MACAG,cAAA;MACAD;IACF;KAECd,KAAA,CAAMmB,cAAc,EACpBnB,KAAA,CAAMM,IAAI,IAAIN,KAAA,CAAMoB,cAAc;AAGzC"}
@@ -15,7 +15,6 @@ import { popoverSurfaceBorderRadius } from './constants';
15
15
  * @param props - props from this instance of Popover
16
16
  */
17
17
  export const usePopover_unstable = props => {
18
- var _a;
19
18
  const [contextTarget, setContextTarget] = usePositioningMouseTarget();
20
19
  const initialState = {
21
20
  size: 'medium',
@@ -45,19 +44,19 @@ export const usePopover_unstable = props => {
45
44
  const [open, setOpenState] = useOpenState(initialState);
46
45
  const setOpenTimeoutRef = React.useRef(0);
47
46
  const setOpen = useEventCallback((e, shouldOpen) => {
48
- var _a;
49
47
  clearTimeout(setOpenTimeoutRef.current);
50
48
  if (!(e instanceof Event) && e.persist) {
51
49
  // < React 17 still uses pooled synthetic events
52
50
  e.persist();
53
51
  }
54
52
  if (e.type === 'mouseleave') {
53
+ var _props_mouseLeaveDelay;
55
54
  // FIXME leaking Node timeout type
56
55
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
56
  // @ts-ignore
58
57
  setOpenTimeoutRef.current = setTimeout(() => {
59
58
  setOpenState(e, shouldOpen);
60
- }, (_a = props.mouseLeaveDelay) !== null && _a !== void 0 ? _a : 500);
59
+ }, (_props_mouseLeaveDelay = props.mouseLeaveDelay) !== null && _props_mouseLeaveDelay !== void 0 ? _props_mouseLeaveDelay : 500);
61
60
  } else {
62
61
  setOpenState(e, shouldOpen);
63
62
  }
@@ -96,16 +95,17 @@ export const usePopover_unstable = props => {
96
95
  findFirstFocusable
97
96
  } = useFocusFinders();
98
97
  React.useEffect(() => {
99
- var _a;
100
98
  if (props.unstable_disableAutoFocus) {
101
99
  return;
102
100
  }
103
101
  if (open && positioningRefs.contentRef.current) {
104
- const containerTabIndex = (_a = positioningRefs.contentRef.current.getAttribute('tabIndex')) !== null && _a !== void 0 ? _a : 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;
105
104
  const firstFocusable = isNaN(containerTabIndex) ? findFirstFocusable(positioningRefs.contentRef.current) : positioningRefs.contentRef.current;
106
105
  firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
107
106
  }
108
107
  }, [findFirstFocusable, open, positioningRefs.contentRef, props.unstable_disableAutoFocus]);
108
+ var _props_inline;
109
109
  return {
110
110
  ...initialState,
111
111
  ...positioningRefs,
@@ -116,7 +116,7 @@ export const usePopover_unstable = props => {
116
116
  toggleOpen,
117
117
  setContextTarget,
118
118
  contextTarget,
119
- inline: (_a = props.inline) !== null && _a !== void 0 ? _a : false
119
+ inline: (_props_inline = props.inline) !== null && _props_inline !== void 0 ? _props_inline : false
120
120
  };
121
121
  };
122
122
  /**
@@ -124,8 +124,8 @@ export const usePopover_unstable = props => {
124
124
  */
125
125
  function useOpenState(state) {
126
126
  const onOpenChange = useEventCallback((e, data) => {
127
- var _a;
128
- return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, 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
129
  });
130
130
  const [open, setOpenState] = useControllableState({
131
131
  state: state.open,
@@ -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","_a","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","call","defaultState","defaultOpen","positioningOptions","position","align","arrowPadding","target","positioning","coverTarget","withArrow","offset","targetRef","containerRef","arrowRef"],"sources":["../src/packages/react-components/react-popover/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,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,QACb,2BAA2B;AAClC,SAASC,kBAAkB,IAAIC,SAAS,QAAQ,iCAAiC;AACjF,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB,6BAA6B;AACpC,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,0BAA0B,QAAQ,aAAa;AAExD;;;;;;;;AAQA,OAAO,MAAMC,mBAAmB,GAAIC,KAAmB,IAAkB;;EACvE,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGR,yBAAyB,EAAE;EACrE,MAAMS,YAAY,GAAG;IACnBC,IAAI,EAAE,QAAQ;IACdH,aAAa;IACbC,gBAAgB;IAChB,GAAGF;GACK;EAEV,MAAMK,QAAQ,GAAGrB,KAAK,CAACsB,QAAQ,CAACC,OAAO,CAACP,KAAK,CAACK,QAAQ,CAAyB;EAE/E,IAAIG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIL,QAAQ,CA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AACrD,IAAI,CAAC,CAAC;;EAGnG,MAAM;IAAEoE,SAAS,EAAE5B,UAAU;IAAE6B,YAAY,EAAE5B,UAAU;IAAE6B;EAAQ,CAAE,GAAGnF,cAAc,CAACwE,kBAAkB,CAAC;EAExG,OAAO;IACLnB,UAAU;IACVC,UAAU;IACV6B;GACQ;AACZ"}
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,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,KA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;IACLtB,UAAA;IACAC,UAAA;IACAgC;EACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"names":["React","usePopoverSurface_unstable","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","useCustomStyleHooks_unstable","PopoverSurface","forwardRef","props","ref","state","useCustomStyles","displayName"],"sources":["../src/packages/react-components/react-popover/src/components/PopoverSurface/PopoverSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePopoverSurface_unstable(props, ref);\n\n usePopoverSurfaceStyles_unstable(state);\n\n const { usePopoverSurfaceStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,gCAAgC,QAAQ,2BAA2B;AAG5E,SAASC,4BAA4B,QAAQ,iCAAiC;AAE9E;;;AAGA,OAAO,MAAMC,cAAc,gBAA6CL,KAAK,CAACM,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EACtG,MAAMC,KAAK,GAAGR,0BAA0B,CAACM,KAAK,EAAEC,GAAG,CAAC;EAEpDL,gCAAgC,CAACM,KAAK,CAAC;EAEvC,MAAM;IAAEN,gCAAgC,EAAEO;EAAe,CAAE,GAAGN,4BAA4B,EAAE;EAC5FM,eAAe,CAACD,KAAK,CAAC;EAEtB,OAAOP,6BAA6B,CAACO,KAAK,CAAC;AAC7C,CAAC,CAAC;AAEFJ,cAAc,CAACM,WAAW,GAAG,gBAAgB"}
1
+ {"version":3,"names":["React","usePopoverSurface_unstable","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","useCustomStyleHooks_unstable","PopoverSurface","forwardRef","props","ref","state","useCustomStyles","displayName"],"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePopoverSurface_unstable(props, ref);\n\n usePopoverSurfaceStyles_unstable(state);\n\n const { usePopoverSurfaceStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,gCAAgC,QAAQ;AAGjD,SAASC,4BAA4B,QAAQ;AAE7C;;;AAGA,OAAO,MAAMC,cAAA,gBAA2DL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACvG,MAAMC,KAAA,GAAQR,0BAAA,CAA2BM,KAAA,EAAOC,GAAA;EAEhDL,gCAAA,CAAiCM,KAAA;EAEjC,MAAM;IAAEN,gCAAA,EAAkCO;EAAe,CAAE,GAAGN,4BAAA;EAC9DM,eAAA,CAAgBD,KAAA;EAEhB,OAAOP,6BAAA,CAA8BO,KAAA;AACvC;AAEAJ,cAAA,CAAeM,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverContextValue } from '../../popoverContext';\n\n/**\n * PopoverSurface Props\n */\nexport type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;\n\n/**\n * Names of the slots in PopoverSurfaceProps\n */\nexport type PopoverSurfaceSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * PopoverSurface State\n */\nexport type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &\n Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'size' | 'withArrow'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"]}
1
+ {"version":3,"names":[],"sources":["../../../src/components/PopoverSurface/PopoverSurface.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverContextValue } from '../../popoverContext';\n\n/**\n * PopoverSurface Props\n */\nexport type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;\n\n/**\n * Names of the slots in PopoverSurfaceProps\n */\nexport type PopoverSurfaceSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * PopoverSurface State\n */\nexport type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &\n Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'size' | 'withArrow'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"],"mappings":"AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/PopoverSurface/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './PopoverSurface';\nexport * from './PopoverSurface.types';\nexport * from './renderPopoverSurface';\nexport * from './usePopoverSurface';\nexport * from './usePopoverSurfaceStyles';\n"]}
1
+ {"version":3,"names":[],"sources":["../../../src/components/PopoverSurface/index.ts"],"sourcesContent":["export * from './PopoverSurface';\nexport * from './PopoverSurface.types';\nexport * from './renderPopoverSurface';\nexport * from './usePopoverSurface';\nexport * from './usePopoverSurfaceStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
@@ -9,9 +9,7 @@ export const renderPopoverSurface_unstable = state => {
9
9
  slots,
10
10
  slotProps
11
11
  } = getSlots(state);
12
- const surface = /*#__PURE__*/React.createElement(slots.root, {
13
- ...slotProps.root
14
- }, state.withArrow && /*#__PURE__*/React.createElement("div", {
12
+ const surface = /*#__PURE__*/React.createElement(slots.root, slotProps.root, state.withArrow && /*#__PURE__*/React.createElement("div", {
15
13
  ref: state.arrowRef,
16
14
  className: state.arrowClassName
17
15
  }), slotProps.root.children);
@@ -1 +1 @@
1
- {"version":3,"names":["React","Portal","getSlots","renderPopoverSurface_unstable","state","slots","slotProps","surface","createElement","root","withArrow","ref","arrowRef","className","arrowClassName","children","inline","mountNode"],"sources":["../src/packages/react-components/react-popover/src/components/PopoverSurface/renderPopoverSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState) => {\n const { slots, slotProps } = getSlots<PopoverSurfaceSlots>(state);\n\n const surface = (\n <slots.root {...slotProps.root}>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {slotProps.root.children}\n </slots.root>\n );\n\n if (state.inline) {\n return surface;\n }\n\n return <Portal mountNode={state.mountNode}>{surface}</Portal>;\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD;;;AAGA,OAAO,MAAMC,6BAA6B,GAAIC,KAA0B,IAAI;EAC1E,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAAsBE,KAAK,CAAC;EAEjE,MAAMG,OAAO,gBACXP,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BL,KAAK,CAACM,SAAS,iBAAIV,KAAA,CAAAQ,aAAA;IAAKG,GAAG,EAAEP,KAAK,CAACQ,QAAQ;IAAEC,SAAS,EAAET,KAAK,CAACU;EAAc,EAAI,EAChFR,SAAS,CAACG,IAAI,CAACM,QAAQ,CAE3B;EAED,IAAIX,KAAK,CAACY,MAAM,EAAE;IAChB,OAAOT,OAAO;;EAGhB,oBAAOP,KAAA,CAAAQ,aAAA,CAACP,MAAM;IAACgB,SAAS,EAAEb,KAAK,CAACa;EAAS,GAAGV,OAAO,CAAU;AAC/D,CAAC"}
1
+ {"version":3,"names":["React","Portal","getSlots","renderPopoverSurface_unstable","state","slots","slotProps","surface","createElement","root","withArrow","ref","arrowRef","className","arrowClassName","children","inline","mountNode"],"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState) => {\n const { slots, slotProps } = getSlots<PopoverSurfaceSlots>(state);\n\n const surface = (\n <slots.root {...slotProps.root}>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {slotProps.root.children}\n </slots.root>\n );\n\n if (state.inline) {\n return surface;\n }\n\n return <Portal mountNode={state.mountNode}>{surface}</Portal>;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,QAAQ,QAAQ;AAGzB;;;AAGA,OAAO,MAAMC,6BAAA,GAAiCC,KAAA,IAA+B;EAC3E,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,QAAA,CAA8BE,KAAA;EAE3D,MAAMG,OAAA,gBACJP,KAAA,CAAAQ,aAAA,CAACH,KAAA,CAAMI,IAAI,EAAKH,SAAA,CAAUG,IAAI,EAC3BL,KAAA,CAAMM,SAAS,iBAAIV,KAAA,CAAAQ,aAAA,CAAC;IAAIG,GAAA,EAAKP,KAAA,CAAMQ,QAAQ;IAAEC,SAAA,EAAWT,KAAA,CAAMU;MAC9DR,SAAA,CAAUG,IAAI,CAACM,QAAQ;EAI5B,IAAIX,KAAA,CAAMY,MAAM,EAAE;IAChB,OAAOT,OAAA;EACT;EAEA,oBAAOP,KAAA,CAAAQ,aAAA,CAACP,MAAA;IAAOgB,SAAA,EAAWb,KAAA,CAAMa;KAAYV,OAAA;AAC9C"}
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
2
3
  import { useModalAttributes } from '@fluentui/react-tabster';
3
4
  import { usePopoverContext_unstable } from '../../popoverContext';
@@ -65,10 +66,10 @@ export const usePopoverSurface_unstable = (props, ref) => {
65
66
  onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
66
67
  };
67
68
  state.root.onKeyDown = e => {
68
- var _a;
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' && ((_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.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
75
  onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
@@ -1 +1 @@
1
- {"version":3,"names":["getNativeElementProps","useMergedRefs","useModalAttributes","usePopoverContext_unstable","usePopoverSurface_unstable","props","ref","contentRef","context","openOnHover","setOpen","mountNode","arrowRef","size","withArrow","appearance","trapFocus","inertTrapFocus","inline","modalAttributes","legacyTrapFocus","alwaysFocusable","state","components","root","role","undefined","onMouseEnter","onMouseEnterOriginal","onMouseLeave","onMouseLeaveOriginal","onKeyDown","onKeyDownOriginal","e","key","_a","current","contains","target"],"sources":["../src/packages/react-components/react-popover/src/components/PopoverSurface/usePopoverSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Create the state required to render PopoverSurface.\n *\n * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,\n * before being passed to renderPopoverSurface_unstable.\n *\n * @param props - props from this instance of PopoverSurface\n * @param ref - reference to root HTMLDivElement of PopoverSurface\n */\nexport const usePopoverSurface_unstable = (\n props: PopoverSurfaceProps,\n ref: React.Ref<HTMLDivElement>,\n): PopoverSurfaceState => {\n const contentRef = usePopoverContext_unstable(context => context.contentRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const mountNode = usePopoverContext_unstable(context => context.mountNode);\n const arrowRef = usePopoverContext_unstable(context => context.arrowRef);\n const size = usePopoverContext_unstable(context => context.size);\n const withArrow = usePopoverContext_unstable(context => context.withArrow);\n const appearance = usePopoverContext_unstable(context => context.appearance);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const inertTrapFocus = usePopoverContext_unstable(context => context.inertTrapFocus);\n const inline = usePopoverContext_unstable(context => context.inline);\n const { modalAttributes } = useModalAttributes({\n trapFocus,\n legacyTrapFocus: !inertTrapFocus,\n alwaysFocusable: !trapFocus,\n });\n\n const state: PopoverSurfaceState = {\n inline,\n appearance,\n withArrow,\n size,\n arrowRef,\n mountNode,\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, contentRef),\n role: trapFocus ? 'dialog' : 'group',\n 'aria-modal': trapFocus ? true : undefined,\n ...modalAttributes,\n ...props,\n }),\n };\n\n const {\n onMouseEnter: onMouseEnterOriginal,\n onMouseLeave: onMouseLeaveOriginal,\n onKeyDown: onKeyDownOriginal,\n } = state.root;\n state.root.onMouseEnter = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n\n onMouseEnterOriginal?.(e);\n };\n\n state.root.onMouseLeave = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n\n onMouseLeaveOriginal?.(e);\n };\n\n state.root.onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n // only close if the event happened inside the current popover\n // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack\n if (e.key === 'Escape' && contentRef.current?.contains(e.target as HTMLDivElement)) {\n setOpen(e, false);\n }\n\n onKeyDownOriginal?.(e);\n };\n\n return state;\n};\n"],"mappings":"AACA,SAASA,qBAAqB,EAAEC,aAAa,QAAQ,2BAA2B;AAChF,SAASC,kBAAkB,QAAQ,yBAA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K;AACd,CAAC"}
1
+ {"version":3,"names":["React","getNativeElementProps","useMergedRefs","useModalAttributes","usePopoverContext_unstable","usePopoverSurface_unstable","props","ref","contentRef","context","openOnHover","setOpen","mountNode","arrowRef","size","withArrow","appearance","trapFocus","inertTrapFocus","inline","modalAttributes","legacyTrapFocus","alwaysFocusable","state","components","root","role","undefined","onMouseEnter","onMouseEnterOriginal","onMouseLeave","onMouseLeaveOriginal","onKeyDown","onKeyDownOriginal","e","_contentRef_current","key","current","contains","target"],"sources":["../../../src/components/PopoverSurface/usePopoverSurface.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Create the state required to render PopoverSurface.\n *\n * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,\n * before being passed to renderPopoverSurface_unstable.\n *\n * @param props - props from this instance of PopoverSurface\n * @param ref - reference to root HTMLDivElement of PopoverSurface\n */\nexport const usePopoverSurface_unstable = (\n props: PopoverSurfaceProps,\n ref: React.Ref<HTMLDivElement>,\n): PopoverSurfaceState => {\n const contentRef = usePopoverContext_unstable(context => context.contentRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const mountNode = usePopoverContext_unstable(context => context.mountNode);\n const arrowRef = usePopoverContext_unstable(context => context.arrowRef);\n const size = usePopoverContext_unstable(context => context.size);\n const withArrow = usePopoverContext_unstable(context => context.withArrow);\n const appearance = usePopoverContext_unstable(context => context.appearance);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const inertTrapFocus = usePopoverContext_unstable(context => context.inertTrapFocus);\n const inline = usePopoverContext_unstable(context => context.inline);\n const { modalAttributes } = useModalAttributes({\n trapFocus,\n legacyTrapFocus: !inertTrapFocus,\n alwaysFocusable: !trapFocus,\n });\n\n const state: PopoverSurfaceState = {\n inline,\n appearance,\n withArrow,\n size,\n arrowRef,\n mountNode,\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, contentRef),\n role: trapFocus ? 'dialog' : 'group',\n 'aria-modal': trapFocus ? true : undefined,\n ...modalAttributes,\n ...props,\n }),\n };\n\n const {\n onMouseEnter: onMouseEnterOriginal,\n onMouseLeave: onMouseLeaveOriginal,\n onKeyDown: onKeyDownOriginal,\n } = state.root;\n state.root.onMouseEnter = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n\n onMouseEnterOriginal?.(e);\n };\n\n state.root.onMouseLeave = (e: React.MouseEvent<HTMLDivElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n\n onMouseLeaveOriginal?.(e);\n };\n\n state.root.onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n // only close if the event happened inside the current popover\n // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack\n if (e.key === 'Escape' && contentRef.current?.contains(e.target as HTMLDivElement)) {\n setOpen(e, false);\n }\n\n onKeyDownOriginal?.(e);\n };\n\n return state;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,EAAEC,aAAa,QAAQ;AACrD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,0BAA0B,QAAQ;AAG3C;;;;;;;;;AASA,OAAO,MAAMC,0BAAA,GAA6BA,CACxCC,KAAA,EACAC,GAAA,KACwB;EACxB,MAAMC,UAAA,GAAaJ,0BAAA,CAA2BK,OAAA,IAAWA,OAAA,CAAQD,UAAU;EAC3E,MAAME,WAAA,GAAcN,0BAAA,CAA2BK,OAAA,IAAWA,OAAA,CAAQC,WAAW;EAC7E,MAAMC,OAAA,GAAUP,0BAAA,CAA2BK,OAAA,IAAWA,OAAA,CAAQE,OAAO;EACrE,MAAMC,SAAA,GAAYR,0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