@fluentui/react-popover 9.0.0-nightly.b5b7401007.0 → 9.0.0-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +425 -29
- package/CHANGELOG.md +104 -20
- package/dist/react-popover.d.ts +31 -20
- 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 +5 -5
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +2 -1
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.d.ts +1 -1
- package/lib/components/Popover/renderPopover.js +27 -25
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.d.ts +2 -2
- package/lib/components/Popover/usePopover.js +42 -53
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js +7 -7
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
- 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 +7 -8
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
- package/lib/components/PopoverSurface/usePopoverSurface.js +44 -58
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +34 -22
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js +6 -5
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +39 -54
- 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 +3 -7
- package/lib/popoverContext.js.map +1 -1
- package/lib-commonjs/Popover.js +1 -1
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js +1 -1
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js +1 -1
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js +5 -5
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.d.ts +2 -1
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +1 -1
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +31 -29
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
- package/lib-commonjs/components/Popover/usePopover.js +50 -62
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +8 -8
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +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 +12 -15
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +50 -65
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +38 -24
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +6 -5
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +44 -60
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.d.ts +1 -1
- package/lib-commonjs/popoverContext.js +5 -9
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +13 -15
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -13
- package/lib/common/isConformant.js.map +0 -1
- package/lib/common/mockUsePopoverContext.d.ts +0 -7
- package/lib/common/mockUsePopoverContext.js +0 -38
- package/lib/common/mockUsePopoverContext.js.map +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -24
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
- package/lib-commonjs/common/mockUsePopoverContext.js +0 -49
- package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,29 +1,113 @@
|
|
1
1
|
# Change Log - @fluentui/react-popover
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Fri, 18 Feb 2022 13:33:48 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [9.0.0-
|
7
|
+
## [9.0.0-rc.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.3)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-
|
11
|
-
|
12
|
-
### Changes
|
13
|
-
|
14
|
-
-
|
15
|
-
-
|
16
|
-
-
|
17
|
-
- Bump @fluentui/react-
|
18
|
-
- Bump @fluentui/react-
|
19
|
-
- Bump @fluentui/react-
|
20
|
-
- Bump @fluentui/react-
|
21
|
-
- Bump @fluentui/react-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
Fri, 18 Feb 2022 13:33:48 GMT
|
10
|
+
[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
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- fix: Source maps contain original source code ([PR #21690](https://github.com/microsoft/fluentui/pull/21690) by lingfangao@hotmail.com)
|
15
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
16
|
+
- Bump @fluentui/react-portal to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
17
|
+
- Bump @fluentui/react-positioning to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
18
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
19
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
20
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
21
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.3 ([PR #21800](https://github.com/microsoft/fluentui/pull/21800) by beachball)
|
22
|
+
|
23
|
+
## [9.0.0-rc.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-rc.1)
|
24
|
+
|
25
|
+
Thu, 10 Feb 2022 08:50:36 GMT
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.5..@fluentui/react-popover_v9.0.0-rc.1)
|
27
|
+
|
28
|
+
### Changes
|
29
|
+
|
30
|
+
- Updating based on removal of functions from makeStyles. ([PR #21239](https://github.com/microsoft/fluentui/pull/21239) by Humberto.Morimoto@microsoft.com)
|
31
|
+
- use Griffel packages ([PR #21392](https://github.com/microsoft/fluentui/pull/21392) by olfedias@microsoft.com)
|
32
|
+
- standardize trigger implementation & cloning ([PR #21609](https://github.com/microsoft/fluentui/pull/21609) by olfedias@microsoft.com)
|
33
|
+
- update styles to not use CSS shorthands ([PR #20796](https://github.com/microsoft/fluentui/pull/20796) by olfedias@microsoft.com)
|
34
|
+
- fix: Use role=complementary for Popovers without focus traps ([PR #21416](https://github.com/microsoft/fluentui/pull/21416) by lingfangao@hotmail.com)
|
35
|
+
- BREAKING: Rename component hooks add the suffix _unstable, as their API has not been finalized yet ([PR #21365](https://github.com/microsoft/fluentui/pull/21365) by behowell@microsoft.com)
|
36
|
+
- Updating based on changes to composition types. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
|
37
|
+
- Replacing use of functions in makeStyles with direct use of tokens ([PR #21049](https://github.com/microsoft/fluentui/pull/21049) by Humberto.Morimoto@microsoft.com)
|
38
|
+
- Remove component's shorthandProps array ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
|
39
|
+
- Fix Popover arrow border in high contrast ([PR #21086](https://github.com/microsoft/fluentui/pull/21086) by behowell@microsoft.com)
|
40
|
+
- Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
|
41
|
+
- fix: Set `aria-modal` on Popover if focus trap is enabled ([PR #21387](https://github.com/microsoft/fluentui/pull/21387) by lingfangao@hotmail.com)
|
42
|
+
- remove export of commons types ([PR #21660](https://github.com/microsoft/fluentui/pull/21660) by mgodbolt@microsoft.com)
|
43
|
+
- Bump Fluent UI packages to 9.0.0-rc ([PR #21623](https://github.com/microsoft/fluentui/pull/21623) by lingfangao@hotmail.com)
|
44
|
+
- Bump @fluentui/react-context-selector to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
45
|
+
- Bump @fluentui/react-portal to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
46
|
+
- Bump @fluentui/react-positioning to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
47
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
48
|
+
- Bump @fluentui/react-tabster to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
49
|
+
- Bump @fluentui/react-utilities to v9.0.0-rc.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
50
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.1 ([commit](https://github.com/microsoft/fluentui/commit/e6c855f6d9019d6c73668d15fc9bc3a13291a6c8) by beachball)
|
51
|
+
|
52
|
+
## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-beta.5)
|
53
|
+
|
54
|
+
Thu, 25 Nov 2021 08:34:15 GMT
|
55
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.4..@fluentui/react-popover_v9.0.0-beta.5)
|
56
|
+
|
57
|
+
### Changes
|
58
|
+
|
59
|
+
- Add transparent outline to arrow for HC ([PR #20541](https://github.com/microsoft/fluentui/pull/20541) by lingfangao@hotmail.com)
|
60
|
+
- Bump @fluentui/react-context-selector to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
61
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
62
|
+
- Bump @fluentui/react-portal to v9.0.0-beta.5 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
63
|
+
- Bump @fluentui/react-positioning to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
64
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
65
|
+
- Bump @fluentui/react-tabster to v9.0.0-beta.5 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
66
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
67
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
68
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
69
|
+
- Bump @fluentui/react-conformance-make-styles to v9.0.0-beta.4 ([PR #20762](https://github.com/microsoft/fluentui/pull/20762) by beachball)
|
70
|
+
|
71
|
+
## [9.0.0-beta.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-beta.4)
|
72
|
+
|
73
|
+
Fri, 12 Nov 2021 13:25:28 GMT
|
74
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.3..@fluentui/react-popover_v9.0.0-beta.4)
|
75
|
+
|
76
|
+
### Changes
|
77
|
+
|
78
|
+
- Updated beta and RC components to ES2019 ([PR #20405](https://github.com/microsoft/fluentui/pull/20405) by gcox@microsoft.com)
|
79
|
+
- fix(Popover): use `dialog` as value for `aria-haspopup` for focus trap ([PR #20494](https://github.com/microsoft/fluentui/pull/20494) by lingfangao@hotmail.com)
|
80
|
+
- export static classes for components ([PR #20450](https://github.com/microsoft/fluentui/pull/20450) by olfedias@microsoft.com)
|
81
|
+
- Bump @fluentui/react-context-selector to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
82
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
83
|
+
- Bump @fluentui/react-portal to v9.0.0-beta.4 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
84
|
+
- Bump @fluentui/react-positioning to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
85
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
86
|
+
- Bump @fluentui/react-tabster to v9.0.0-beta.4 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
87
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
88
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
89
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
90
|
+
- Bump @fluentui/react-conformance-make-styles to v9.0.0-beta.3 ([PR #20583](https://github.com/microsoft/fluentui/pull/20583) by beachball)
|
91
|
+
|
92
|
+
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-beta.3)
|
93
|
+
|
94
|
+
Wed, 27 Oct 2021 12:14:20 GMT
|
95
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.2..@fluentui/react-popover_v9.0.0-beta.3)
|
96
|
+
|
97
|
+
### Changes
|
98
|
+
|
99
|
+
- added styling of documentation ([PR #20193](https://github.com/microsoft/fluentui/pull/20193) by peter@draxler.ml)
|
100
|
+
- Simplify type for OnOpenChangeData ([PR #20096](https://github.com/microsoft/fluentui/pull/20096) by olfedias@microsoft.com)
|
101
|
+
- Bump @fluentui/react-context-selector to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
102
|
+
- Bump @fluentui/react-make-styles to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
103
|
+
- Bump @fluentui/react-portal to v9.0.0-beta.3 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
104
|
+
- Bump @fluentui/react-positioning to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
105
|
+
- Bump @fluentui/react-shared-contexts to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
106
|
+
- Bump @fluentui/react-tabster to v9.0.0-beta.3 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
107
|
+
- Bump @fluentui/react-utilities to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
108
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
109
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
110
|
+
- Bump @fluentui/react-conformance-make-styles to v9.0.0-beta.2 ([PR #20353](https://github.com/microsoft/fluentui/pull/20353) by beachball)
|
27
111
|
|
28
112
|
## [9.0.0-beta.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-beta.2)
|
29
113
|
|
package/dist/react-popover.d.ts
CHANGED
@@ -2,12 +2,15 @@ import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
2
|
import type { ComponentState } from '@fluentui/react-utilities';
|
3
3
|
import type { Context } from '@fluentui/react-context-selector';
|
4
4
|
import type { ContextSelector } from '@fluentui/react-context-selector';
|
5
|
+
import type { FluentTriggerComponent } from '@fluentui/react-utilities';
|
5
6
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
6
|
-
import
|
7
|
+
import { JSXElementConstructor } from 'react';
|
7
8
|
import type { PopperVirtualElement } from '@fluentui/react-positioning';
|
8
9
|
import type { PortalProps } from '@fluentui/react-portal';
|
9
10
|
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
10
11
|
import * as React_2 from 'react';
|
12
|
+
import { ReactElement } from 'react';
|
13
|
+
import type { Slot } from '@fluentui/react-utilities';
|
11
14
|
import type { usePopperMouseTarget } from '@fluentui/react-positioning';
|
12
15
|
|
13
16
|
export declare const arrowHeights: Record<PopoverSize, number>;
|
@@ -29,7 +32,7 @@ export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.MouseE
|
|
29
32
|
*/
|
30
33
|
export declare const Popover: React_2.FC<PopoverProps>;
|
31
34
|
|
32
|
-
|
35
|
+
declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
|
33
36
|
/**
|
34
37
|
* Controls the opening of the Popover
|
35
38
|
*/
|
@@ -134,6 +137,8 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
|
|
134
137
|
*/
|
135
138
|
export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
|
136
139
|
|
140
|
+
export declare const popoverSurfaceClassName = "fui-PopoverSurface";
|
141
|
+
|
137
142
|
/**
|
138
143
|
* PopoverSurface Props
|
139
144
|
*/
|
@@ -143,11 +148,9 @@ export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
|
|
143
148
|
* Names of the slots in PopoverSurfaceProps
|
144
149
|
*/
|
145
150
|
export declare type PopoverSurfaceSlots = {
|
146
|
-
root:
|
151
|
+
root: Slot<'div'>;
|
147
152
|
};
|
148
153
|
|
149
|
-
export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
|
150
|
-
|
151
154
|
/**
|
152
155
|
* PopoverSurface State
|
153
156
|
*/
|
@@ -161,71 +164,79 @@ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &
|
|
161
164
|
/**
|
162
165
|
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
163
166
|
*/
|
164
|
-
export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps
|
167
|
+
export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps> & FluentTriggerComponent;
|
168
|
+
|
169
|
+
export declare type PopoverTriggerChildProps = {
|
170
|
+
ref?: React_2.Ref<never>;
|
171
|
+
} & Pick<React_2.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
|
165
172
|
|
166
173
|
/**
|
167
174
|
* PopoverTrigger Props
|
168
175
|
*/
|
169
176
|
export declare type PopoverTriggerProps = {
|
170
|
-
children: React_2.ReactElement
|
177
|
+
children: (React_2.ReactElement & {
|
178
|
+
ref?: React_2.Ref<unknown>;
|
179
|
+
}) | ((props: PopoverTriggerChildProps) => React_2.ReactElement | null);
|
171
180
|
};
|
172
181
|
|
173
182
|
/**
|
174
183
|
* PopoverTrigger State
|
175
184
|
*/
|
176
|
-
export declare type PopoverTriggerState =
|
185
|
+
export declare type PopoverTriggerState = {
|
186
|
+
children: React_2.ReactElement | null;
|
187
|
+
};
|
177
188
|
|
178
189
|
/**
|
179
190
|
* Render the final JSX of Popover
|
180
191
|
*/
|
181
|
-
export declare const
|
192
|
+
export declare const renderPopover_unstable: (state: PopoverState) => JSX.Element;
|
182
193
|
|
183
194
|
/**
|
184
195
|
* Render the final JSX of PopoverSurface
|
185
196
|
*/
|
186
|
-
export declare const
|
197
|
+
export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
|
187
198
|
|
188
199
|
/**
|
189
200
|
* Render the final JSX of PopoverTrigger
|
190
201
|
*/
|
191
|
-
export declare const
|
202
|
+
export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => ReactElement<any, string | JSXElementConstructor<any>> | null;
|
192
203
|
|
193
204
|
/**
|
194
205
|
* Create the state required to render Popover.
|
195
206
|
*
|
196
207
|
* The returned state can be modified with hooks such as usePopoverStyles,
|
197
|
-
* before being passed to
|
208
|
+
* before being passed to renderPopover_unstable.
|
198
209
|
*
|
199
210
|
* @param props - props from this instance of Popover
|
200
211
|
*/
|
201
|
-
export declare const
|
212
|
+
export declare const usePopover_unstable: (props: PopoverProps) => PopoverState;
|
202
213
|
|
203
|
-
export declare const
|
214
|
+
export declare const usePopoverContext_unstable: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
|
204
215
|
|
205
216
|
/**
|
206
217
|
* Create the state required to render PopoverSurface.
|
207
218
|
*
|
208
|
-
* The returned state can be modified with hooks such as
|
209
|
-
* before being passed to
|
219
|
+
* The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
|
220
|
+
* before being passed to renderPopoverSurface_unstable.
|
210
221
|
*
|
211
222
|
* @param props - props from this instance of PopoverSurface
|
212
223
|
* @param ref - reference to root HTMLDivElement of PopoverSurface
|
213
224
|
*/
|
214
|
-
export declare const
|
225
|
+
export declare const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React_2.Ref<HTMLDivElement>) => PopoverSurfaceState;
|
215
226
|
|
216
227
|
/**
|
217
228
|
* Apply styling to the PopoverSurface slots based on the state
|
218
229
|
*/
|
219
|
-
export declare const
|
230
|
+
export declare const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState;
|
220
231
|
|
221
232
|
/**
|
222
233
|
* Create the state required to render PopoverTrigger.
|
223
234
|
*
|
224
235
|
* The returned state can be modified with hooks such as usePopoverTriggerStyles,
|
225
|
-
* before being passed to
|
236
|
+
* before being passed to renderPopoverTrigger_unstable.
|
226
237
|
*
|
227
238
|
* @param props - props from this instance of PopoverTrigger
|
228
239
|
*/
|
229
|
-
export declare const
|
240
|
+
export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
|
230
241
|
|
231
242
|
export { }
|
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,12 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { usePopover_unstable } from './usePopover';
|
2
|
+
import { renderPopover_unstable } from './renderPopover';
|
3
3
|
/**
|
4
4
|
* Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
|
5
5
|
*/
|
6
6
|
|
7
|
-
export
|
8
|
-
|
9
|
-
return
|
7
|
+
export const Popover = props => {
|
8
|
+
const state = usePopover_unstable(props);
|
9
|
+
return renderPopover_unstable(state);
|
10
10
|
};
|
11
11
|
Popover.displayName = 'Popover';
|
12
12
|
//# sourceMappingURL=Popover.js.map
|
@@ -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/"}
|
@@ -5,7 +5,7 @@ import type { PortalProps } from '@fluentui/react-portal';
|
|
5
5
|
* Determines popover padding and arrow size
|
6
6
|
*/
|
7
7
|
export declare type PopoverSize = 'small' | 'medium' | 'large';
|
8
|
-
|
8
|
+
declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
|
9
9
|
/**
|
10
10
|
* Controls the opening of the Popover
|
11
11
|
*/
|
@@ -100,3 +100,4 @@ export declare type OnOpenChangeData = {
|
|
100
100
|
* The supported events that will trigger open/close of the menu
|
101
101
|
*/
|
102
102
|
export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement> | React.FocusEvent<HTMLElement>;
|
103
|
+
export {};
|
@@ -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 * 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 +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"]}
|
@@ -4,33 +4,35 @@ import { PopoverContext } from '../../popoverContext';
|
|
4
4
|
* Render the final JSX of Popover
|
5
5
|
*/
|
6
6
|
|
7
|
-
export
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
export const renderPopover_unstable = state => {
|
8
|
+
const {
|
9
|
+
open,
|
10
|
+
setOpen,
|
11
|
+
triggerRef,
|
12
|
+
contentRef,
|
13
|
+
openOnContext,
|
14
|
+
openOnHover,
|
15
|
+
mountNode,
|
16
|
+
arrowRef,
|
17
|
+
size,
|
18
|
+
noArrow,
|
19
|
+
appearance,
|
20
|
+
trapFocus
|
21
|
+
} = state;
|
20
22
|
return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
|
21
23
|
value: {
|
22
|
-
open
|
23
|
-
setOpen
|
24
|
-
triggerRef
|
25
|
-
contentRef
|
26
|
-
openOnHover
|
27
|
-
openOnContext
|
28
|
-
mountNode
|
29
|
-
arrowRef
|
30
|
-
size
|
31
|
-
noArrow
|
32
|
-
appearance
|
33
|
-
trapFocus
|
24
|
+
open,
|
25
|
+
setOpen,
|
26
|
+
triggerRef,
|
27
|
+
contentRef,
|
28
|
+
openOnHover,
|
29
|
+
openOnContext,
|
30
|
+
mountNode,
|
31
|
+
arrowRef,
|
32
|
+
size,
|
33
|
+
noArrow,
|
34
|
+
appearance,
|
35
|
+
trapFocus
|
34
36
|
}
|
35
37
|
}, state.children);
|
36
38
|
};
|
@@ -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,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/"}
|
@@ -3,8 +3,8 @@ import type { PopoverProps, PopoverState } from './Popover.types';
|
|
3
3
|
* Create the state required to render Popover.
|
4
4
|
*
|
5
5
|
* The returned state can be modified with hooks such as usePopoverStyles,
|
6
|
-
* before being passed to
|
6
|
+
* before being passed to renderPopover_unstable.
|
7
7
|
*
|
8
8
|
* @param props - props from this instance of Popover
|
9
9
|
*/
|
10
|
-
export declare const
|
10
|
+
export declare const usePopover_unstable: (props: PopoverProps) => PopoverState;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
|
4
3
|
import { useFluent } from '@fluentui/react-shared-contexts';
|
@@ -9,75 +8,65 @@ import { arrowHeights } from '../PopoverSurface/index';
|
|
9
8
|
* Create the state required to render Popover.
|
10
9
|
*
|
11
10
|
* The returned state can be modified with hooks such as usePopoverStyles,
|
12
|
-
* before being passed to
|
11
|
+
* before being passed to renderPopover_unstable.
|
13
12
|
*
|
14
13
|
* @param props - props from this instance of Popover
|
15
14
|
*/
|
16
15
|
|
17
|
-
export
|
18
|
-
|
19
|
-
|
20
|
-
setContextTarget = _a[1];
|
21
|
-
|
22
|
-
var initialState = __assign({
|
16
|
+
export const usePopover_unstable = props => {
|
17
|
+
const [contextTarget, setContextTarget] = usePopperMouseTarget();
|
18
|
+
const initialState = {
|
23
19
|
size: 'medium',
|
24
|
-
contextTarget
|
25
|
-
setContextTarget
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
var targetDocument = useFluent().targetDocument;
|
20
|
+
contextTarget,
|
21
|
+
setContextTarget,
|
22
|
+
...props
|
23
|
+
};
|
24
|
+
const [open, setOpen] = useOpenState(initialState);
|
25
|
+
const popperRefs = usePopoverRefs(initialState);
|
26
|
+
const {
|
27
|
+
targetDocument
|
28
|
+
} = useFluent();
|
34
29
|
useOnClickOutside({
|
35
30
|
contains: elementContains,
|
36
31
|
element: targetDocument,
|
37
|
-
callback:
|
38
|
-
return setOpen(ev, false);
|
39
|
-
},
|
32
|
+
callback: ev => setOpen(ev, false),
|
40
33
|
refs: [popperRefs.triggerRef, popperRefs.contentRef],
|
41
34
|
disabled: !open
|
42
35
|
});
|
43
36
|
useOnScrollOutside({
|
44
37
|
contains: elementContains,
|
45
38
|
element: targetDocument,
|
46
|
-
callback:
|
47
|
-
return setOpen(ev, false);
|
48
|
-
},
|
39
|
+
callback: ev => setOpen(ev, false),
|
49
40
|
refs: [popperRefs.triggerRef, popperRefs.contentRef],
|
50
|
-
disabled: !open || !initialState.openOnContext
|
51
|
-
|
52
|
-
return __assign(__assign(__assign({}, initialState), popperRefs), {
|
53
|
-
open: open,
|
54
|
-
setOpen: setOpen,
|
55
|
-
setContextTarget: setContextTarget,
|
56
|
-
contextTarget: contextTarget
|
41
|
+
disabled: !open || !initialState.openOnContext // only close on scroll for context
|
42
|
+
|
57
43
|
});
|
44
|
+
return { ...initialState,
|
45
|
+
...popperRefs,
|
46
|
+
open,
|
47
|
+
setOpen,
|
48
|
+
setContextTarget,
|
49
|
+
contextTarget
|
50
|
+
};
|
58
51
|
};
|
59
52
|
/**
|
60
53
|
* Creates and manages the Popover open state
|
61
54
|
*/
|
62
55
|
|
63
56
|
function useOpenState(state) {
|
64
|
-
|
57
|
+
const onOpenChange = useEventCallback((e, data) => {
|
65
58
|
var _a;
|
66
59
|
|
67
60
|
return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
|
68
61
|
});
|
69
|
-
|
70
|
-
var _a = useControllableState({
|
62
|
+
const [open, setOpenState] = useControllableState({
|
71
63
|
state: state.open,
|
72
64
|
defaultState: state.defaultOpen,
|
73
65
|
initialState: false
|
74
|
-
})
|
75
|
-
open = _a[0],
|
76
|
-
setOpenState = _a[1];
|
77
|
-
|
66
|
+
});
|
78
67
|
state.open = open !== undefined ? open : state.open;
|
79
|
-
|
80
|
-
|
68
|
+
const setContextTarget = state.setContextTarget;
|
69
|
+
const setOpen = React.useCallback((e, shouldOpen) => {
|
81
70
|
if (shouldOpen && e.type === 'contextmenu') {
|
82
71
|
setContextTarget(e);
|
83
72
|
}
|
@@ -86,7 +75,7 @@ function useOpenState(state) {
|
|
86
75
|
setContextTarget(undefined);
|
87
76
|
}
|
88
77
|
|
89
|
-
setOpenState(
|
78
|
+
setOpenState(prevOpen => {
|
90
79
|
// More than one event (mouse, focus, keyboard) can request the Popover to close
|
91
80
|
// We assume the first event is the correct one
|
92
81
|
if (prevOpen !== shouldOpen) {
|
@@ -106,12 +95,12 @@ function useOpenState(state) {
|
|
106
95
|
|
107
96
|
|
108
97
|
function usePopoverRefs(state) {
|
109
|
-
|
98
|
+
const popperOptions = {
|
110
99
|
position: 'above',
|
111
100
|
align: 'center',
|
112
|
-
target: state.openOnContext ? state.contextTarget : undefined
|
113
|
-
|
114
|
-
|
101
|
+
target: state.openOnContext ? state.contextTarget : undefined,
|
102
|
+
...resolvePositioningShorthand(state.positioning)
|
103
|
+
}; // no reason to render arrow when covering the target
|
115
104
|
|
116
105
|
if (popperOptions.coverTarget) {
|
117
106
|
state.noArrow = true;
|
@@ -121,15 +110,15 @@ function usePopoverRefs(state) {
|
|
121
110
|
popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
|
122
111
|
}
|
123
112
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
113
|
+
const {
|
114
|
+
targetRef: triggerRef,
|
115
|
+
containerRef: contentRef,
|
116
|
+
arrowRef
|
117
|
+
} = usePopper(popperOptions);
|
129
118
|
return {
|
130
|
-
triggerRef
|
131
|
-
contentRef
|
132
|
-
arrowRef
|
119
|
+
triggerRef,
|
120
|
+
contentRef,
|
121
|
+
arrowRef
|
133
122
|
};
|
134
123
|
}
|
135
124
|
//# sourceMappingURL=usePopover.js.map
|