@fluentui/react-popover 9.0.0-rc.1 → 9.0.0-rc.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +166 -1
- package/CHANGELOG.md +49 -2
- package/dist/react-popover.d.ts +9 -3
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +6 -0
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.js +3 -3
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.js +40 -0
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib/components/PopoverSurface/index.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js +1 -6
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.js +1 -13
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +2 -2
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.d.ts +1 -1
- package/lib/popoverContext.js +1 -1
- package/lib/popoverContext.js.map +1 -1
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.d.ts +6 -0
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +3 -3
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.js +41 -0
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +1 -6
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +0 -13
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +2 -2
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.d.ts +1 -1
- package/lib-commonjs/popoverContext.js +1 -1
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +16 -8
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,172 @@
|
|
2
2
|
"name": "@fluentui/react-popover",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Fri, 04 Mar 2022 05:15:52 GMT",
|
6
|
+
"tag": "@fluentui/react-popover_v9.0.0-rc.5",
|
7
|
+
"version": "9.0.0-rc.5",
|
8
|
+
"comments": {
|
9
|
+
"prerelease": [
|
10
|
+
{
|
11
|
+
"author": "dzearing@microsoft.com",
|
12
|
+
"package": "@fluentui/react-popover",
|
13
|
+
"commit": "f2f1c0ea948cc3517eeb442c05433eb0918def29",
|
14
|
+
"comment": "Adding explicit export maps on all consumer packages for FUIR 8 and 9."
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "lingfangao@hotmail.com",
|
18
|
+
"package": "@fluentui/react-popover",
|
19
|
+
"commit": "17a19427f5465577427f5c1c4ed61578a063f990",
|
20
|
+
"comment": "refactor: PopoverSurface should be rendered from the Popover component"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-popover",
|
25
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.5",
|
26
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-popover",
|
31
|
+
"comment": "Bump @fluentui/react-portal to v9.0.0-rc.5",
|
32
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-popover",
|
37
|
+
"comment": "Bump @fluentui/react-positioning to v9.0.0-rc.5",
|
38
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-popover",
|
43
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.4",
|
44
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "beachball",
|
48
|
+
"package": "@fluentui/react-popover",
|
49
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.5",
|
50
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"author": "beachball",
|
54
|
+
"package": "@fluentui/react-popover",
|
55
|
+
"comment": "Bump @fluentui/react-theme to v9.0.0-rc.4",
|
56
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"author": "beachball",
|
60
|
+
"package": "@fluentui/react-popover",
|
61
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
|
62
|
+
"commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"date": "Tue, 01 Mar 2022 02:17:37 GMT",
|
69
|
+
"tag": "@fluentui/react-popover_v9.0.0-rc.4",
|
70
|
+
"version": "9.0.0-rc.4",
|
71
|
+
"comments": {
|
72
|
+
"prerelease": [
|
73
|
+
{
|
74
|
+
"author": "olfedias@microsoft.com",
|
75
|
+
"package": "@fluentui/react-popover",
|
76
|
+
"commit": "084d7408855f3e52b67cbca172da1acef9dcb98f",
|
77
|
+
"comment": "fix: Add react-theme as dependency"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-popover",
|
82
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.4",
|
83
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-popover",
|
88
|
+
"comment": "Bump @fluentui/react-portal to v9.0.0-rc.4",
|
89
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"author": "beachball",
|
93
|
+
"package": "@fluentui/react-popover",
|
94
|
+
"comment": "Bump @fluentui/react-positioning to v9.0.0-rc.4",
|
95
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"author": "beachball",
|
99
|
+
"package": "@fluentui/react-popover",
|
100
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.4",
|
101
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"author": "beachball",
|
105
|
+
"package": "@fluentui/react-popover",
|
106
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
|
107
|
+
"commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
|
108
|
+
}
|
109
|
+
]
|
110
|
+
}
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"date": "Fri, 18 Feb 2022 13:35:33 GMT",
|
114
|
+
"tag": "@fluentui/react-popover_v9.0.0-rc.3",
|
115
|
+
"version": "9.0.0-rc.3",
|
116
|
+
"comments": {
|
117
|
+
"prerelease": [
|
118
|
+
{
|
119
|
+
"author": "lingfangao@hotmail.com",
|
120
|
+
"package": "@fluentui/react-popover",
|
121
|
+
"commit": "1aa9e691fcccd9a64168cea7941c0f1e71fa1d14",
|
122
|
+
"comment": "fix: Source maps contain original source code"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"author": "beachball",
|
126
|
+
"package": "@fluentui/react-popover",
|
127
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.0-rc.3",
|
128
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"author": "beachball",
|
132
|
+
"package": "@fluentui/react-popover",
|
133
|
+
"comment": "Bump @fluentui/react-portal to v9.0.0-rc.3",
|
134
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"author": "beachball",
|
138
|
+
"package": "@fluentui/react-popover",
|
139
|
+
"comment": "Bump @fluentui/react-positioning to v9.0.0-rc.3",
|
140
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"author": "beachball",
|
144
|
+
"package": "@fluentui/react-popover",
|
145
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.0-rc.3",
|
146
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"author": "beachball",
|
150
|
+
"package": "@fluentui/react-popover",
|
151
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-rc.3",
|
152
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"author": "beachball",
|
156
|
+
"package": "@fluentui/react-popover",
|
157
|
+
"comment": "Bump @fluentui/react-utilities to v9.0.0-rc.3",
|
158
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
159
|
+
},
|
160
|
+
{
|
161
|
+
"author": "beachball",
|
162
|
+
"package": "@fluentui/react-popover",
|
163
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3",
|
164
|
+
"commit": "3b9c1e931c23173da3d1af0c696cdc58516ce504"
|
165
|
+
}
|
166
|
+
]
|
167
|
+
}
|
168
|
+
},
|
169
|
+
{
|
170
|
+
"date": "Thu, 10 Feb 2022 08:50:36 GMT",
|
6
171
|
"tag": "@fluentui/react-popover_v9.0.0-rc.1",
|
7
172
|
"version": "9.0.0-rc.1",
|
8
173
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,59 @@
|
|
1
1
|
# Change Log - @fluentui/react-popover
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Fri, 04 Mar 2022 05:15:52 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.5)
|
8
|
+
|
9
|
+
Fri, 04 Mar 2022 05:15:52 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.4..@fluentui/react-popover_v9.0.0-rc.5)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- 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)
|
15
|
+
- refactor: PopoverSurface should be rendered from the Popover component ([PR #21922](https://github.com/microsoft/fluentui/pull/21922) by lingfangao@hotmail.com)
|
16
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
17
|
+
- Bump @fluentui/react-portal to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
18
|
+
- Bump @fluentui/react-positioning to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
19
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
20
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
21
|
+
- Bump @fluentui/react-theme to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
22
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
|
23
|
+
|
24
|
+
## [9.0.0-rc.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.4)
|
25
|
+
|
26
|
+
Tue, 01 Mar 2022 02:17:37 GMT
|
27
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.3..@fluentui/react-popover_v9.0.0-rc.4)
|
28
|
+
|
29
|
+
### Changes
|
30
|
+
|
31
|
+
- fix: Add react-theme as dependency ([PR #21825](https://github.com/microsoft/fluentui/pull/21825) by olfedias@microsoft.com)
|
32
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
33
|
+
- Bump @fluentui/react-portal to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
34
|
+
- Bump @fluentui/react-positioning to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
35
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
36
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
|
37
|
+
|
38
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.3)
|
39
|
+
|
40
|
+
Fri, 18 Feb 2022 13:35:33 GMT
|
41
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-rc.1..@fluentui/react-popover_v9.0.0-rc.3)
|
42
|
+
|
43
|
+
### Changes
|
44
|
+
|
45
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
46
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
47
|
+
- Bump @fluentui/react-portal to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
48
|
+
- Bump @fluentui/react-positioning to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
49
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
50
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
51
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
52
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
53
|
+
|
7
54
|
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.1)
|
8
55
|
|
9
|
-
Thu, 10 Feb 2022 08:
|
56
|
+
Thu, 10 Feb 2022 08:50:36 GMT
|
10
57
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.5..@fluentui/react-popover_v9.0.0-rc.1)
|
11
58
|
|
12
59
|
### Changes
|
package/dist/react-popover.d.ts
CHANGED
@@ -83,7 +83,7 @@ export declare const PopoverContext: Context<PopoverContextValue>;
|
|
83
83
|
/**
|
84
84
|
* Context shared between Popover and its children components
|
85
85
|
*/
|
86
|
-
export declare type PopoverContextValue = Pick<PopoverState, '
|
86
|
+
export declare type PopoverContextValue = Pick<PopoverState, 'toggleOpen' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
|
87
87
|
|
88
88
|
/**
|
89
89
|
* Popover Props
|
@@ -109,6 +109,10 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
|
|
109
109
|
* Callback to open/close the Popover
|
110
110
|
*/
|
111
111
|
setOpen: (e: OpenPopoverEvents, open: boolean) => void;
|
112
|
+
/**
|
113
|
+
* Callback to toggle the open state of the Popover
|
114
|
+
*/
|
115
|
+
toggleOpen: (e: OpenPopoverEvents) => void;
|
112
116
|
/**
|
113
117
|
* Ref of the PopoverTrigger
|
114
118
|
*/
|
@@ -130,6 +134,8 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
|
|
130
134
|
*/
|
131
135
|
setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
|
132
136
|
size: NonNullable<PopoverProps['size']>;
|
137
|
+
popoverTrigger: React_2.ReactElement | undefined;
|
138
|
+
popoverSurface: React_2.ReactElement | undefined;
|
133
139
|
};
|
134
140
|
|
135
141
|
/**
|
@@ -154,7 +160,7 @@ export declare type PopoverSurfaceSlots = {
|
|
154
160
|
/**
|
155
161
|
* PopoverSurface State
|
156
162
|
*/
|
157
|
-
export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, '
|
163
|
+
export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
|
158
164
|
/**
|
159
165
|
* CSS class for the arrow element
|
160
166
|
*/
|
@@ -194,7 +200,7 @@ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Elemen
|
|
194
200
|
/**
|
195
201
|
* Render the final JSX of PopoverSurface
|
196
202
|
*/
|
197
|
-
export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element
|
203
|
+
export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element;
|
198
204
|
|
199
205
|
/**
|
200
206
|
* Render the final JSX of PopoverTrigger
|
package/lib/Popover.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"../src/","sources":["Popover.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Popover/index';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopoverSurface.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"PopoverSurface.js","sourceRoot":"../src/","sources":["PopoverSurface.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/PopoverSurface/index';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"PopoverTrigger.js","sourceRoot":"../src/","sources":["PopoverTrigger.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/PopoverTrigger/index';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/Popover/Popover.tsx"],"names":[],"mappings":"AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AAGA;;AAEG;;AACH,OAAO,MAAM,OAAO,GAA2B,KAAK,IAAG;AACrD,QAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,CAAjC;AAEA,SAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CAJM;AAMP,OAAO,CAAC,WAAR,GAAsB,SAAtB","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"],"sourceRoot":"../src/"}
|
@@ -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":"","sources":["
|
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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["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"]}
|
@@ -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.
|
37
|
+
}, state.popoverTrigger, state.open && state.popoverSurface);
|
38
38
|
};
|
39
39
|
//# sourceMappingURL=renderPopover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
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":["
|
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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K,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 { 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/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;AAEA,EAAA,gCAAgC,CAAC,KAAD,CAAhC;AACA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","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';\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 return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\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, '
|
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":"","sources":["
|
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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["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"]}
|
@@ -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
|
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);
|
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":["
|
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 {
|
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
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverSurface/usePopoverSurface.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,aAAhC,QAAqD,2BAArD;AACA,SAAS,kBAAT,QAAmC,yBAAnC;AACA,SAAS,0BAAT,QAA2C,sBAA3C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,0BAA0B,GAAG,CACxC,KADwC,EAExC,GAFwC,KAGjB;AACvB,QAAM,UAAU,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,UAApB,CAA7C;AACA,QAAM,WAAW,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,WAApB,CAA9C;AACA,QAAM,OAAO,G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wC;AAChE,QAAI,WAAJ,EAAiB;AACf,MAAA,OAAO,CAAC,CAAD,EAAI,IAAJ,CAAP;AACD;;AAED,IAAA,oBAAoB,KAAA,IAApB,IAAA,oBAAoB,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAA,oBAAoB,CAAG,CAAH,CAApB;AACD,GAND;;AAQA,EAAA,KAAK,CAAC,IAAN,CAAW,YAAX,GAA2B,CAAD,IAAwC;AAChE,QAAI,WAAJ,EAAiB;AACf,MAAA,OAAO,CAAC,CAAD,EAAI,KAAJ,CAAP;AACD;;AAED,IAAA,oBAAoB,KAAA,IAApB,IAAA,oBAAoB,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAA,oBAAoB,CAAG,CAAH,CAApB;AACD,GAND;;AAQA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAwB,CAAD,IAA2C;WAAA,CAChE;AACA;;;AACA,QAAI,CAAC,CAAC,GAAF,KAAU,QAAV,KAAsB,CAAA,EAAA,GAAA,UAAU,CAAC,OAAX,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,QAAF,CAAW,CAAC,CAAC,MAAb,CAAxC,CAAJ,EAAoF;AAClF,MAAA,OAAO,CAAC,CAAD,EAAI,KAAJ,CAAP;AACD;;AAED,IAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAG,CAAH,CAAjB;AACD,GARD;;AAUA,SAAO,KAAP;AACD,CAjEM","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 noArrow = usePopoverContext_unstable(context => context.noArrow);\n const appearance = usePopoverContext_unstable(context => context.appearance);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const { modalAttributes } = useModalAttributes({ trapFocus });\n\n const state: PopoverSurfaceState = {\n appearance,\n noArrow,\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' : 'complementary',\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"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,uBAAT,EAAkC,iBAAlC,QAA2D,6BAA3D;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,uBAAuB,GAAG,oBAAhC;AAEP,OAAO,MAAM,YAAY,GAAgC;AACvD,EAAA,KAAK,EAAE,CADgD;AAEvD,EAAA,MAAM,EAAE,CAF+C;AAGvD,EAAA,KAAK,EAAE;AAHgD,CAAlD;AAMP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAqCA;;AAEG;;;AACH,OAAO,MAAM,gCAAgC,GAAI,KAAD,IAAoD;AAClG,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,uBADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YAHA,EAIjC,KAAK,CAAC,IAAN,KAAe,QAAf,IAA2B,MAAM,CAAC,aAJD,EAKjC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YALA,EAMjC,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QANT,EAOjC,KAAK,CAAC,UAAN,KAAqB,OAArB,IAAgC,MAAM,CAAC,KAPN,EAQjC,KAAK,CAAC,IAAN,CAAW,SARsB,CAAnC;AAWA,EAAA,KAAK,CAAC,cAAN,GAAuB,YAAY,CACjC,MAAM,CAAC,KAD0B,EAEjC,KAAK,CAAC,IAAN,KAAe,OAAf,GAAyB,MAAM,CAAC,UAAhC,GAA6C,MAAM,CAAC,gBAFnB,CAAnC;AAKA,SAAO,KAAP;AACD,CAnBM","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport type { PopoverSize } from '../Popover/Popover.types';\nimport type { PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const popoverSurfaceClassName = 'fui-PopoverSurface';\n\nexport const arrowHeights: Record<PopoverSize, number> = {\n small: 6,\n medium: 8,\n large: 8,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n ...shorthands.borderRadius('4px'),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n\n inverted: {\n // TODO: neutral background inverted missing from superset and theme\n backgroundColor: tokens.colorNeutralForeground1,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n brand: {\n backgroundColor: tokens.colorBrandBackground,\n // TODO: clarify with designers what foreground color should be with brand background,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n smallPadding: {\n ...shorthands.padding('12px'),\n },\n\n mediumPadding: {\n ...shorthands.padding('16px'),\n },\n\n largePadding: {\n ...shorthands.padding('20px'),\n },\n\n smallArrow: createArrowHeightStyles(arrowHeights.small),\n mediumLargeArrow: createArrowHeightStyles(arrowHeights.medium),\n arrow: createArrowStyles({ arrowHeight: undefined }),\n});\n\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles_unstable = (state: PopoverSurfaceState): PopoverSurfaceState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n popoverSurfaceClassName,\n styles.root,\n state.size === 'small' && styles.smallPadding,\n state.size === 'medium' && styles.mediumPadding,\n state.size === 'large' && styles.largePadding,\n state.appearance === 'inverted' && styles.inverted,\n state.appearance === 'brand' && styles.brand,\n state.root.className,\n );\n\n state.arrowClassName = mergeClasses(\n styles.arrow,\n state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|