@fluentui/react-popover 9.0.0-rc.3 → 9.0.0-rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/CHANGELOG.json +198 -1
  2. package/CHANGELOG.md +51 -2
  3. package/dist/react-popover.d.ts +15 -3
  4. package/lib/components/Popover/Popover.types.d.ts +6 -0
  5. package/lib/components/Popover/Popover.types.js.map +1 -1
  6. package/lib/components/Popover/renderPopover.js +3 -3
  7. package/lib/components/Popover/renderPopover.js.map +1 -1
  8. package/lib/components/Popover/usePopover.js +40 -0
  9. package/lib/components/Popover/usePopover.js.map +1 -1
  10. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +1 -1
  11. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  12. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  13. package/lib/components/PopoverSurface/renderPopoverSurface.js +1 -6
  14. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  15. package/lib/components/PopoverSurface/usePopoverSurface.js +1 -13
  16. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  17. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +6 -1
  18. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +8 -1
  19. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  20. package/lib/components/PopoverTrigger/usePopoverTrigger.js +2 -2
  21. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  22. package/lib/popoverContext.d.ts +1 -1
  23. package/lib/popoverContext.js +1 -1
  24. package/lib/popoverContext.js.map +1 -1
  25. package/lib-commonjs/components/Popover/Popover.types.d.ts +6 -0
  26. package/lib-commonjs/components/Popover/renderPopover.js +3 -3
  27. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  28. package/lib-commonjs/components/Popover/usePopover.js +41 -0
  29. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  30. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +1 -1
  31. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  32. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +1 -6
  33. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  34. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +0 -13
  35. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  36. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +6 -1
  37. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +9 -2
  38. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  39. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +2 -2
  40. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  41. package/lib-commonjs/popoverContext.d.ts +1 -1
  42. package/lib-commonjs/popoverContext.js +1 -1
  43. package/lib-commonjs/popoverContext.js.map +1 -1
  44. package/package.json +18 -20
package/CHANGELOG.json CHANGED
@@ -2,7 +2,204 @@
2
2
  "name": "@fluentui/react-popover",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 18 Feb 2022 13:33:48 GMT",
5
+ "date": "Tue, 19 Apr 2022 19:13:57 GMT",
6
+ "tag": "@fluentui/react-popover_v9.0.0-rc.6",
7
+ "version": "9.0.0-rc.6",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "seanmonahan@microsoft.com",
12
+ "package": "@fluentui/react-popover",
13
+ "commit": "086a675fd0c648944ff4048450190a0a13467de3",
14
+ "comment": "Add static classnames to Popover"
15
+ },
16
+ {
17
+ "author": "olfedias@microsoft.com",
18
+ "package": "@fluentui/react-popover",
19
+ "commit": "e569d6e04d83cbcc6225e61db52ff81d2addd363",
20
+ "comment": "chore: Update Griffel to latest version"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-popover",
25
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.6",
26
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-popover",
31
+ "comment": "Bump @fluentui/react-portal to v9.0.0-rc.6",
32
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-popover",
37
+ "comment": "Bump @fluentui/react-positioning to v9.0.0-rc.6",
38
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-popover",
43
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.5",
44
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-popover",
49
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.6",
50
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-popover",
55
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.5",
56
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-popover",
61
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.6",
62
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
63
+ },
64
+ {
65
+ "author": "beachball",
66
+ "package": "@fluentui/react-popover",
67
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4",
68
+ "commit": "9c8592decacb9f7b1dc608a03c9f991918806008"
69
+ }
70
+ ],
71
+ "none": [
72
+ {
73
+ "author": "lingfangao@hotmail.com",
74
+ "package": "@fluentui/react-popover",
75
+ "commit": "67dd475e49182d17dbf7d9195c5df9bce02b7b3c",
76
+ "comment": "chore: Update e2e tests to use cypress component testing"
77
+ },
78
+ {
79
+ "author": "elcraig@microsoft.com",
80
+ "package": "@fluentui/react-popover",
81
+ "commit": "b7f17e976f9e058f39c9fce4f0f9bb6eb4dfa577",
82
+ "comment": "Update React dev deps and hoist them to the repo root"
83
+ },
84
+ {
85
+ "author": "mgodbolt@microsoft.com",
86
+ "package": "@fluentui/react-popover",
87
+ "commit": "905e46db07ada986fd7885531f72a71b7bbaabdc",
88
+ "comment": "create v9 api extractor config and set all v9 packags to use it, suppress forgotten export"
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ {
94
+ "date": "Fri, 04 Mar 2022 05:17:38 GMT",
95
+ "tag": "@fluentui/react-popover_v9.0.0-rc.5",
96
+ "version": "9.0.0-rc.5",
97
+ "comments": {
98
+ "prerelease": [
99
+ {
100
+ "author": "dzearing@microsoft.com",
101
+ "package": "@fluentui/react-popover",
102
+ "commit": "f2f1c0ea948cc3517eeb442c05433eb0918def29",
103
+ "comment": "Adding explicit export maps on all consumer packages for FUIR 8 and 9."
104
+ },
105
+ {
106
+ "author": "lingfangao@hotmail.com",
107
+ "package": "@fluentui/react-popover",
108
+ "commit": "17a19427f5465577427f5c1c4ed61578a063f990",
109
+ "comment": "refactor: PopoverSurface should be rendered from the Popover component"
110
+ },
111
+ {
112
+ "author": "beachball",
113
+ "package": "@fluentui/react-popover",
114
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.5",
115
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
116
+ },
117
+ {
118
+ "author": "beachball",
119
+ "package": "@fluentui/react-popover",
120
+ "comment": "Bump @fluentui/react-portal to v9.0.0-rc.5",
121
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
122
+ },
123
+ {
124
+ "author": "beachball",
125
+ "package": "@fluentui/react-popover",
126
+ "comment": "Bump @fluentui/react-positioning to v9.0.0-rc.5",
127
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
128
+ },
129
+ {
130
+ "author": "beachball",
131
+ "package": "@fluentui/react-popover",
132
+ "comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.4",
133
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
134
+ },
135
+ {
136
+ "author": "beachball",
137
+ "package": "@fluentui/react-popover",
138
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.5",
139
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
140
+ },
141
+ {
142
+ "author": "beachball",
143
+ "package": "@fluentui/react-popover",
144
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.4",
145
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
146
+ },
147
+ {
148
+ "author": "beachball",
149
+ "package": "@fluentui/react-popover",
150
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
151
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
152
+ }
153
+ ]
154
+ }
155
+ },
156
+ {
157
+ "date": "Tue, 01 Mar 2022 02:17:37 GMT",
158
+ "tag": "@fluentui/react-popover_v9.0.0-rc.4",
159
+ "version": "9.0.0-rc.4",
160
+ "comments": {
161
+ "prerelease": [
162
+ {
163
+ "author": "olfedias@microsoft.com",
164
+ "package": "@fluentui/react-popover",
165
+ "commit": "084d7408855f3e52b67cbca172da1acef9dcb98f",
166
+ "comment": "fix: Add react-theme as dependency"
167
+ },
168
+ {
169
+ "author": "beachball",
170
+ "package": "@fluentui/react-popover",
171
+ "comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.4",
172
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
173
+ },
174
+ {
175
+ "author": "beachball",
176
+ "package": "@fluentui/react-popover",
177
+ "comment": "Bump @fluentui/react-portal to v9.0.0-rc.4",
178
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
179
+ },
180
+ {
181
+ "author": "beachball",
182
+ "package": "@fluentui/react-popover",
183
+ "comment": "Bump @fluentui/react-positioning to v9.0.0-rc.4",
184
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
185
+ },
186
+ {
187
+ "author": "beachball",
188
+ "package": "@fluentui/react-popover",
189
+ "comment": "Bump @fluentui/react-tabster to v9.0.0-rc.4",
190
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
191
+ },
192
+ {
193
+ "author": "beachball",
194
+ "package": "@fluentui/react-popover",
195
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
196
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
197
+ }
198
+ ]
199
+ }
200
+ },
201
+ {
202
+ "date": "Fri, 18 Feb 2022 13:35:33 GMT",
6
203
  "tag": "@fluentui/react-popover_v9.0.0-rc.3",
7
204
  "version": "9.0.0-rc.3",
8
205
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,61 @@
1
1
  # Change Log - @fluentui/react-popover
2
2
 
3
- This log was last generated on Fri, 18 Feb 2022 13:33:48 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 19 Apr 2022 19:13:57 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-rc.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.6)
8
+
9
+ Tue, 19 Apr 2022 19:13:57 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.5..@fluentui/react-popover_v9.0.0-rc.6)
11
+
12
+ ### Changes
13
+
14
+ - Add static classnames to Popover ([PR #21960](https://github.com/microsoft/fluentui/pull/21960) by seanmonahan@microsoft.com)
15
+ - chore: Update Griffel to latest version ([PR #21976](https://github.com/microsoft/fluentui/pull/21976) by olfedias@microsoft.com)
16
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
17
+ - Bump @fluentui/react-portal to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
18
+ - Bump @fluentui/react-positioning to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
19
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.5 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
20
+ - Bump @fluentui/react-tabster to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
21
+ - Bump @fluentui/react-theme to v9.0.0-rc.5 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
22
+ - Bump @fluentui/react-utilities to v9.0.0-rc.6 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
23
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.4 ([PR #22367](https://github.com/microsoft/fluentui/pull/22367) by beachball)
24
+
25
+ ## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.5)
26
+
27
+ Fri, 04 Mar 2022 05:17:38 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.4..@fluentui/react-popover_v9.0.0-rc.5)
29
+
30
+ ### Changes
31
+
32
+ - Adding explicit export maps on all consumer packages for FUIR 8 and 9. ([PR #21508](https://github.com/microsoft/fluentui/pull/21508) by dzearing@microsoft.com)
33
+ - refactor: PopoverSurface should be rendered from the Popover component ([PR #21922](https://github.com/microsoft/fluentui/pull/21922) by lingfangao@hotmail.com)
34
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
35
+ - Bump @fluentui/react-portal to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
36
+ - Bump @fluentui/react-positioning to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
37
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
38
+ - Bump @fluentui/react-tabster to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
39
+ - Bump @fluentui/react-theme to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
40
+ - Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
41
+
42
+ ## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.4)
43
+
44
+ Tue, 01 Mar 2022 02:17:37 GMT
45
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.3..@fluentui/react-popover_v9.0.0-rc.4)
46
+
47
+ ### Changes
48
+
49
+ - fix: Add react-theme as dependency ([PR #21825](https://github.com/microsoft/fluentui/pull/21825) by olfedias@microsoft.com)
50
+ - Bump @fluentui/react-context-selector to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
51
+ - Bump @fluentui/react-portal to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
52
+ - Bump @fluentui/react-positioning to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
53
+ - Bump @fluentui/react-tabster to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
54
+ - Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
55
+
7
56
  ## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.3)
8
57
 
9
- Fri, 18 Feb 2022 13:33:48 GMT
58
+ Fri, 18 Feb 2022 13:35:33 GMT
10
59
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.1..@fluentui/react-popover_v9.0.0-rc.3)
11
60
 
12
61
  ### Changes
@@ -11,6 +11,7 @@ import type { PositioningShorthand } from '@fluentui/react-positioning';
11
11
  import * as React_2 from 'react';
12
12
  import { ReactElement } from 'react';
13
13
  import type { Slot } from '@fluentui/react-utilities';
14
+ import type { SlotClassNames } from '@fluentui/react-utilities';
14
15
  import type { usePopperMouseTarget } from '@fluentui/react-positioning';
15
16
 
16
17
  export declare const arrowHeights: Record<PopoverSize, number>;
@@ -83,7 +84,7 @@ export declare const PopoverContext: Context<PopoverContextValue>;
83
84
  /**
84
85
  * Context shared between Popover and its children components
85
86
  */
86
- export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
87
+ export declare type PopoverContextValue = Pick<PopoverState, 'toggleOpen' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
87
88
 
88
89
  /**
89
90
  * Popover Props
@@ -109,6 +110,10 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
109
110
  * Callback to open/close the Popover
110
111
  */
111
112
  setOpen: (e: OpenPopoverEvents, open: boolean) => void;
113
+ /**
114
+ * Callback to toggle the open state of the Popover
115
+ */
116
+ toggleOpen: (e: OpenPopoverEvents) => void;
112
117
  /**
113
118
  * Ref of the PopoverTrigger
114
119
  */
@@ -130,6 +135,8 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
130
135
  */
131
136
  setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
132
137
  size: NonNullable<PopoverProps['size']>;
138
+ popoverTrigger: React_2.ReactElement | undefined;
139
+ popoverSurface: React_2.ReactElement | undefined;
133
140
  };
134
141
 
135
142
  /**
@@ -137,8 +144,13 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
137
144
  */
138
145
  export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
139
146
 
147
+ /**
148
+ * @deprecated Use `popoverSurfaceClassNames.root` instead.
149
+ */
140
150
  export declare const popoverSurfaceClassName = "fui-PopoverSurface";
141
151
 
152
+ export declare const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots>;
153
+
142
154
  /**
143
155
  * PopoverSurface Props
144
156
  */
@@ -154,7 +166,7 @@ export declare type PopoverSurfaceSlots = {
154
166
  /**
155
167
  * PopoverSurface State
156
168
  */
157
- export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
169
+ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
158
170
  /**
159
171
  * CSS class for the arrow element
160
172
  */
@@ -194,7 +206,7 @@ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Elemen
194
206
  /**
195
207
  * Render the final JSX of PopoverSurface
196
208
  */
197
- export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
209
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element;
198
210
 
199
211
  /**
200
212
  * Render the final JSX of PopoverTrigger
@@ -68,6 +68,10 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
68
68
  * Callback to open/close the Popover
69
69
  */
70
70
  setOpen: (e: OpenPopoverEvents, open: boolean) => void;
71
+ /**
72
+ * Callback to toggle the open state of the Popover
73
+ */
74
+ toggleOpen: (e: OpenPopoverEvents) => void;
71
75
  /**
72
76
  * Ref of the PopoverTrigger
73
77
  */
@@ -89,6 +93,8 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
89
93
  */
90
94
  setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
91
95
  size: NonNullable<PopoverProps['size']>;
96
+ popoverTrigger: React.ReactElement | undefined;
97
+ popoverSurface: React.ReactElement | undefined;
92
98
  };
93
99
  /**
94
100
  * Data attached to open/close events
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.types.js","sourceRoot":"../src/","sources":["components/Popover/Popover.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } 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\ntype PopoverCommons = Pick<PortalProps, 'mountNode'> & {\n /**\n * Controls the opening of the Popover\n */\n open: boolean;\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n */\n defaultOpen?: boolean;\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 * Flag to open the Popover by hovering the trigger\n */\n openOnHover?: boolean;\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n */\n openOnContext?: boolean;\n /**\n * Do not display the arrow\n */\n noArrow?: boolean;\n /**\n * Determines popover padding and arrow size\n * @default medium\n */\n size?: PopoverSize;\n\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 * Should trap focus\n */\n trapFocus?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n};\n\n/**\n * Popover Props\n */\nexport type PopoverProps = Partial<PopoverCommons> & {\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/**\n * Popover State\n */\nexport type PopoverState = PopoverCommons &\n Pick<PopoverProps, 'children'> & {\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PopperVirtualElement | undefined;\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];\n\n size: NonNullable<PopoverProps['size']>;\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.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n"]}
1
+ {"version":3,"file":"Popover.types.js","sourceRoot":"../src/","sources":["components/Popover/Popover.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } 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\ntype PopoverCommons = Pick<PortalProps, 'mountNode'> & {\n /**\n * Controls the opening of the Popover\n */\n open: boolean;\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n */\n defaultOpen?: boolean;\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 * Flag to open the Popover by hovering the trigger\n */\n openOnHover?: boolean;\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n */\n openOnContext?: boolean;\n /**\n * Do not display the arrow\n */\n noArrow?: boolean;\n /**\n * Determines popover padding and arrow size\n * @default medium\n */\n size?: PopoverSize;\n\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 * Should trap focus\n */\n trapFocus?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n};\n\n/**\n * Popover Props\n */\nexport type PopoverProps = Partial<PopoverCommons> & {\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/**\n * Popover State\n */\nexport type PopoverState = PopoverCommons &\n Pick<PopoverProps, 'children'> & {\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n /**\n * Callback to toggle the open state of the Popover\n */\n toggleOpen: (e: OpenPopoverEvents) => void;\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PopperVirtualElement | undefined;\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];\n\n size: NonNullable<PopoverProps['size']>;\n\n popoverTrigger: React.ReactElement | undefined;\n\n popoverSurface: React.ReactElement | undefined;\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.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n"]}
@@ -6,8 +6,8 @@ import { PopoverContext } from '../../popoverContext';
6
6
 
7
7
  export const renderPopover_unstable = state => {
8
8
  const {
9
- open,
10
9
  setOpen,
10
+ toggleOpen,
11
11
  triggerRef,
12
12
  contentRef,
13
13
  openOnContext,
@@ -21,8 +21,8 @@ export const renderPopover_unstable = state => {
21
21
  } = state;
22
22
  return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
23
23
  value: {
24
- open,
25
24
  setOpen,
25
+ toggleOpen,
26
26
  triggerRef,
27
27
  contentRef,
28
28
  openOnHover,
@@ -34,6 +34,6 @@ export const renderPopover_unstable = state => {
34
34
  appearance,
35
35
  trapFocus
36
36
  }
37
- }, state.children);
37
+ }, state.popoverTrigger, state.open && state.popoverSurface);
38
38
  };
39
39
  //# sourceMappingURL=renderPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Popover/renderPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,sBAA/B;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AACJ,IAAA,IADI;AAEJ,IAAA,OAFI;AAGJ,IAAA,UAHI;AAIJ,IAAA,UAJI;AAKJ,IAAA,aALI;AAMJ,IAAA,WANI;AAOJ,IAAA,SAPI;AAQJ,IAAA,QARI;AASJ,IAAA,IATI;AAUJ,IAAA,OAVI;AAWJ,IAAA,UAXI;AAYJ,IAAA;AAZI,MAaF,KAbJ;AAeA,sBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;AACtB,IAAA,KAAK,EAAE;AACL,MAAA,IADK;AAEL,MAAA,OAFK;AAGL,MAAA,UAHK;AAIL,MAAA,UAJK;AAKL,MAAA,WALK;AAML,MAAA,aANK;AAOL,MAAA,SAPK;AAQL,MAAA,QARK;AASL,MAAA,IATK;AAUL,MAAA,OAVK;AAWL,MAAA,UAXK;AAYL,MAAA;AAZK;AADe,GAAxB,EAgBG,KAAK,CAAC,QAhBT,CADF;AAoBD,CApCM","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 open,\n setOpen,\n triggerRef,\n contentRef,\n openOnContext,\n openOnHover,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n open,\n setOpen,\n triggerRef,\n contentRef,\n openOnHover,\n openOnContext,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n }}\n >\n {state.children}\n </PopoverContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Popover/renderPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,sBAA/B;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AACJ,IAAA,OADI;AAEJ,IAAA,UAFI;AAGJ,IAAA,UAHI;AAIJ,IAAA,UAJI;AAKJ,IAAA,aALI;AAMJ,IAAA,WANI;AAOJ,IAAA,SAPI;AAQJ,IAAA,QARI;AASJ,IAAA,IATI;AAUJ,IAAA,OAVI;AAWJ,IAAA,UAXI;AAYJ,IAAA;AAZI,MAaF,KAbJ;AAeA,sBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;AACtB,IAAA,KAAK,EAAE;AACL,MAAA,OADK;AAEL,MAAA,UAFK;AAGL,MAAA,UAHK;AAIL,MAAA,UAJK;AAKL,MAAA,WALK;AAML,MAAA,aANK;AAOL,MAAA,SAPK;AAQL,MAAA,QARK;AASL,MAAA,IATK;AAUL,MAAA,OAVK;AAWL,MAAA,UAXK;AAYL,MAAA;AAZK;AADe,GAAxB,EAgBG,KAAK,CAAC,cAhBT,EAiBG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,cAjBvB,CADF;AAqBD,CArCM","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 setOpen,\n toggleOpen,\n triggerRef,\n contentRef,\n openOnContext,\n openOnHover,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n setOpen,\n toggleOpen,\n triggerRef,\n contentRef,\n openOnHover,\n openOnContext,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -3,6 +3,7 @@ import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollO
3
3
  import { useFluent } from '@fluentui/react-shared-contexts';
4
4
  import { usePopper, resolvePositioningShorthand, mergeArrowOffset, usePopperMouseTarget } from '@fluentui/react-positioning';
5
5
  import { elementContains } from '@fluentui/react-portal';
6
+ import { useFocusFinders } from '@fluentui/react-tabster';
6
7
  import { arrowHeights } from '../PopoverSurface/index';
7
8
  /**
8
9
  * Create the state required to render Popover.
@@ -21,7 +22,34 @@ export const usePopover_unstable = props => {
21
22
  setContextTarget,
22
23
  ...props
23
24
  };
25
+ const children = React.Children.toArray(props.children);
26
+
27
+ if (process.env.NODE_ENV !== 'production') {
28
+ if (children.length === 0) {
29
+ // eslint-disable-next-line no-console
30
+ console.warn('Popover must contain at least one child');
31
+ }
32
+
33
+ if (children.length > 2) {
34
+ // eslint-disable-next-line no-console
35
+ console.warn('Popover must contain at most two children');
36
+ }
37
+ }
38
+
39
+ let popoverTrigger = undefined;
40
+ let popoverSurface = undefined;
41
+
42
+ if (children.length === 2) {
43
+ popoverTrigger = children[0];
44
+ popoverSurface = children[1];
45
+ } else if (children.length === 1) {
46
+ popoverSurface = children[0];
47
+ }
48
+
24
49
  const [open, setOpen] = useOpenState(initialState);
50
+ const toggleOpen = React.useCallback(e => {
51
+ setOpen(e, !open);
52
+ }, [setOpen, open]);
25
53
  const popperRefs = usePopoverRefs(initialState);
26
54
  const {
27
55
  targetDocument
@@ -41,10 +69,22 @@ export const usePopover_unstable = props => {
41
69
  disabled: !open || !initialState.openOnContext // only close on scroll for context
42
70
 
43
71
  });
72
+ const {
73
+ findFirstFocusable
74
+ } = useFocusFinders();
75
+ React.useEffect(() => {
76
+ if (open && popperRefs.contentRef.current) {
77
+ const firstFocusable = findFirstFocusable(popperRefs.contentRef.current);
78
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
79
+ }
80
+ }, [findFirstFocusable, open, popperRefs.contentRef]);
44
81
  return { ...initialState,
45
82
  ...popperRefs,
83
+ popoverTrigger,
84
+ popoverSurface,
46
85
  open,
47
86
  setOpen,
87
+ toggleOpen,
48
88
  setContextTarget,
49
89
  contextTarget
50
90
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Popover/usePopover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,oBADF,EAEE,gBAFF,EAGE,iBAHF,EAIE,kBAJF,QAKO,2BALP;AAMA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SACE,SADF,EAEE,2BAFF,EAGE,gBAHF,EAIE,oBAJF,QAKO,6BALP;AAMA,SAAS,eAAT,QAAgC,wBAAhC;AACA,SAAS,YAAT,QAA6B,yBAA7B;AAGA;;;;;;;AAOG;;AACH,OAAO,MAAM,mBAAmB,GAAI,KAAD,IAAsC;AACvE,QAAM,CAAC,aAAD,EAAgB,gBAAhB,IAAoC,oBAAoB,EAA9D;AACA,QAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,QADa;AAEnB,IAAA,aAFmB;AAGnB,IAAA,gBAHmB;AAInB,OAAG;AAJgB,GAArB;AAOA,QAAM,CAAC,IAAD,EAAO,OAAP,IAAkB,YAAY,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2BAA2B,CAAC,KAAK,CAAC,WAAP;AAJV,GAAtB,CAFqH,CASrH;;AACA,MAAI,aAAa,CAAC,WAAlB,EAA+B;AAC7B,IAAA,KAAK,CAAC,OAAN,GAAgB,IAAhB;AACD;;AAED,MAAI,CAAC,KAAK,CAAC,OAAX,EAAoB;AAClB,IAAA,aAAa,CAAC,MAAd,GAAuB,gBAAgB,CAAC,aAAa,CAAC,MAAf,EAAuB,YAAY,CAAC,KAAK,CAAC,IAAP,CAAnC,CAAvC;AACD;;AAED,QAAM;AAAE,IAAA,SAAS,EAAE,UAAb;AAAyB,IAAA,YAAY,EAAE,UAAvC;AAAmD,IAAA;AAAnD,MAAgE,SAAS,CAAC,aAAD,CAA/E;AAEA,SAAO;AACL,IAAA,UADK;AAEL,IAAA,UAFK;AAGL,IAAA;AAHK,GAAP;AAKD","sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePopper,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePopperMouseTarget,\n} from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\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] = usePopperMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\n } as const;\n\n const [open, setOpen] = useOpenState(initialState);\n const popperRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open,\n });\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open || !initialState.openOnContext, // only close on scroll for context\n });\n\n return {\n ...initialState,\n ...popperRefs,\n open,\n setOpen,\n setContextTarget,\n contextTarget,\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(prevOpen => {\n // More than one event (mouse, focus, keyboard) can request the Popover to close\n // We assume the first event is the correct one\n if (prevOpen !== shouldOpen) {\n onOpenChange?.(e, { open: shouldOpen });\n }\n\n return shouldOpen;\n });\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'> & Pick<PopoverProps, 'positioning' | 'openOnContext' | 'noArrow'>,\n) {\n const popperOptions = {\n position: 'above' as const,\n align: 'center' as const,\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 (popperOptions.coverTarget) {\n state.noArrow = true;\n }\n\n if (!state.noArrow) {\n popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePopper(popperOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Popover/usePopover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,oBADF,EAEE,gBAFF,EAGE,iBAHF,EAIE,kBAJF,QAKO,2BALP;AAMA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SACE,SADF,EAEE,2BAFF,EAGE,gBAHF,EAIE,oBAJF,QAKO,6BALP;AAMA,SAAS,eAAT,QAAgC,wBAAhC;AACA,SAAS,eAAT,QAAgC,yBAAhC;AACA,SAAS,YAAT,QAA6B,yBAA7B;AAGA;;;;;;;AAOG;;AACH,OAAO,MAAM,mBAAmB,GAAI,KAAD,IAAsC;AACvE,QAAM,CAAC,aAAD,EAAgB,gBAAhB,IAAoC,oBAAoB,EAA9D;AACA,QAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,QADa;AAEnB,IAAA,aAFmB;AAGnB,IAAA,gBAHmB;AAInB,OAAG;AAJgB,GAArB;AAOA,QAAM,QAAQ,GAAG,KAAK,CAAC,QAAN,CAAe,OAAf,CAAuB,KAAK,CAAC,QAA7B,CAAjB;;AAEA,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,QAAI,QAAQ,CAAC,MAAT,KAAoB,CAAxB,EAA2B;AACzB;AACA,MAAA,OAAO,CAAC,IAAR,CAAa,yCAAb;AACD;;AAED,QAAI,QAAQ,CAAC,MAAT,GAAkB,CAAtB,EAAyB;AACvB;AACA,MAAA,OAAO,CAAC,IAAR,CAAa,2CAAb;AACD;AACF;;AAED,MAAI,cAAc,GAAmC,SAArD;AACA,MAAI,cAAc,GAAmC,SAArD;;AACA,MAAI,QAAQ,CAAC,MAAT,KAAoB,CAAxB,EAA2B;AACzB,I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AM;AAAE,IAAA,SAAS,EAAE,UAAb;AAAyB,IAAA,YAAY,EAAE,UAAvC;AAAmD,IAAA;AAAnD,MAAgE,SAAS,CAAC,aAAD,CAA/E;AAEA,SAAO;AACL,IAAA,UADK;AAEL,IAAA,UAFK;AAGL,IAAA;AAHK,GAAP;AAKD","sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePopper,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePopperMouseTarget,\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';\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] = usePopperMouseTarget();\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, setOpen] = useOpenState(initialState);\n const toggleOpen = React.useCallback<PopoverState['toggleOpen']>(\n e => {\n setOpen(e, !open);\n },\n [setOpen, open],\n );\n\n const popperRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open,\n });\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open || !initialState.openOnContext, // only close on scroll for context\n });\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (open && popperRefs.contentRef.current) {\n const firstFocusable = findFirstFocusable(popperRefs.contentRef.current);\n firstFocusable?.focus();\n }\n }, [findFirstFocusable, open, popperRefs.contentRef]);\n\n return {\n ...initialState,\n ...popperRefs,\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\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(prevOpen => {\n // More than one event (mouse, focus, keyboard) can request the Popover to close\n // We assume the first event is the correct one\n if (prevOpen !== shouldOpen) {\n onOpenChange?.(e, { open: shouldOpen });\n }\n\n return shouldOpen;\n });\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'> & Pick<PopoverProps, 'positioning' | 'openOnContext' | 'noArrow'>,\n) {\n const popperOptions = {\n position: 'above' as const,\n align: 'center' as const,\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 (popperOptions.coverTarget) {\n state.noArrow = true;\n }\n\n if (!state.noArrow) {\n popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePopper(popperOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"sourceRoot":"../src/"}
@@ -13,7 +13,7 @@ export declare type PopoverSurfaceSlots = {
13
13
  /**
14
14
  * PopoverSurface State
15
15
  */
16
- export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
16
+ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
17
17
  /**
18
18
  * CSS class for the arrow element
19
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"../src/","sources":["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, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"]}
1
+ {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"../src/","sources":["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, 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"]}
@@ -2,4 +2,4 @@ import type { PopoverSurfaceState } from './PopoverSurface.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverSurface
4
4
  */
5
- export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
5
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element;
@@ -9,12 +9,7 @@ export const renderPopoverSurface_unstable = state => {
9
9
  const {
10
10
  slots,
11
11
  slotProps
12
- } = getSlots(state); // TODO should hidden Popovers be supported ?
13
-
14
- if (!state.open) {
15
- return null;
16
- }
17
-
12
+ } = getSlots(state);
18
13
  return /*#__PURE__*/React.createElement(Portal, {
19
14
  mountNode: state.mountNode
20
15
  }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
@@ -1 +1 @@
1
- {"version":3,"sources":["components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,CAArC,CAD0E,CAG1E;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM","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 // TODO should hidden Popovers be supported ?\n if (!state.open) {\n return null;\n }\n\n return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root}>\n {!state.noArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {slotProps.root.children}\n </slots.root>\n </Portal>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAXM","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 return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root}>\n {!state.noArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {slotProps.root.children}\n </slots.root>\n </Portal>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,5 @@
1
- import * as React from 'react';
2
1
  import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
3
- import { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';
2
+ import { useModalAttributes } from '@fluentui/react-tabster';
4
3
  import { usePopoverContext_unstable } from '../../popoverContext';
5
4
  /**
6
5
  * Create the state required to render PopoverSurface.
@@ -14,7 +13,6 @@ import { usePopoverContext_unstable } from '../../popoverContext';
14
13
 
15
14
  export const usePopoverSurface_unstable = (props, ref) => {
16
15
  const contentRef = usePopoverContext_unstable(context => context.contentRef);
17
- const open = usePopoverContext_unstable(context => context.open);
18
16
  const openOnHover = usePopoverContext_unstable(context => context.openOnHover);
19
17
  const setOpen = usePopoverContext_unstable(context => context.setOpen);
20
18
  const mountNode = usePopoverContext_unstable(context => context.mountNode);
@@ -33,7 +31,6 @@ export const usePopoverSurface_unstable = (props, ref) => {
33
31
  noArrow,
34
32
  size,
35
33
  arrowRef,
36
- open,
37
34
  mountNode,
38
35
  components: {
39
36
  root: 'div'
@@ -80,15 +77,6 @@ export const usePopoverSurface_unstable = (props, ref) => {
80
77
  onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
81
78
  };
82
79
 
83
- const {
84
- findFirstFocusable
85
- } = useFocusFinders();
86
- React.useEffect(() => {
87
- if (state.open && contentRef.current) {
88
- const firstFocusable = findFirstFocusable(contentRef.current);
89
- firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
90
- }
91
- }, [contentRef, findFirstFocusable, state.open]);
92
80
  return state;
93
81
  };
94
82
  //# sourceMappingURL=usePopoverSurface.js.map