@fluentui/react-popover 9.0.0-alpha.8 → 9.0.0-nightly.f81b28ceb3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +1800 -1
- package/CHANGELOG.md +566 -2
- package/Spec.md +6 -6
- package/dist/react-popover.d.ts +59 -77
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/common/isConformant.d.ts +1 -1
- package/lib/common/isConformant.js +9 -5
- package/lib/common/isConformant.js.map +1 -1
- package/lib/common/mockUsePopoverContext.d.ts +1 -1
- package/lib/common/mockUsePopoverContext.js +28 -6
- package/lib/common/mockUsePopoverContext.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +2 -2
- package/lib/components/Popover/Popover.js +4 -3
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +24 -33
- 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 +29 -17
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.d.ts +2 -3
- package/lib/components/Popover/usePopover.js +110 -88
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.d.ts +3 -3
- package/lib/components/PopoverSurface/PopoverSurface.js +5 -4
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +9 -18
- 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 +18 -10
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -4
- package/lib/components/PopoverSurface/usePopoverSurface.js +94 -54
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -2
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +88 -64
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -2
- package/lib/components/PopoverTrigger/PopoverTrigger.js +4 -3
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
- 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 -3
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +83 -60
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.d.ts +4 -5
- package/lib/popoverContext.js +19 -12
- package/lib/popoverContext.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Popover.js +7 -2
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js +7 -2
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js +7 -2
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/common/isConformant.d.ts +1 -1
- package/lib-commonjs/common/isConformant.js +18 -7
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/common/mockUsePopoverContext.d.ts +1 -1
- package/lib-commonjs/common/mockUsePopoverContext.js +38 -9
- package/lib-commonjs/common/mockUsePopoverContext.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.d.ts +2 -2
- package/lib-commonjs/components/Popover/Popover.js +14 -6
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.d.ts +24 -33
- package/lib-commonjs/components/Popover/Popover.types.js +4 -1
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +10 -2
- 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 +39 -20
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.d.ts +2 -3
- package/lib-commonjs/components/Popover/usePopover.js +127 -93
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +3 -3
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +18 -9
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +9 -18
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js +4 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +11 -2
- 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 +32 -14
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -4
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +110 -60
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -2
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +95 -65
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -2
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +14 -6
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +4 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +10 -2
- 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 +7 -2
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -3
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +98 -65
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +10 -2
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.d.ts +4 -5
- package/lib-commonjs/popoverContext.js +28 -14
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +18 -15
- package/.storybook/main.js +0 -11
- package/.storybook/preview.js +0 -4
- package/bundle-size/Popover.fixture.js +0 -7
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -7
- package/e2e/Popover.e2e.ts +0 -139
- package/etc/react-popover.api.md +0 -135
- package/just.config.ts +0 -3
- package/lib/Popover.stories.d.ts +0 -62
- package/lib/Popover.stories.js +0 -114
- package/lib/Popover.stories.js.map +0 -1
- package/lib/components/Popover/getOffsetWithArrow.d.ts +0 -7
- package/lib/components/Popover/getOffsetWithArrow.js +0 -34
- package/lib/components/Popover/getOffsetWithArrow.js.map +0 -1
- package/lib-amd/Popover.d.ts +0 -1
- package/lib-amd/Popover.js +0 -6
- package/lib-amd/Popover.js.map +0 -1
- package/lib-amd/Popover.stories.d.ts +0 -62
- package/lib-amd/Popover.stories.js +0 -121
- package/lib-amd/Popover.stories.js.map +0 -1
- package/lib-amd/PopoverSurface.d.ts +0 -1
- package/lib-amd/PopoverSurface.js +0 -6
- package/lib-amd/PopoverSurface.js.map +0 -1
- package/lib-amd/PopoverTrigger.d.ts +0 -1
- package/lib-amd/PopoverTrigger.js +0 -6
- package/lib-amd/PopoverTrigger.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -4
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/common/mockUsePopoverContext.d.ts +0 -7
- package/lib-amd/common/mockUsePopoverContext.js +0 -20
- package/lib-amd/common/mockUsePopoverContext.js.map +0 -1
- package/lib-amd/components/Popover/Popover.d.ts +0 -6
- package/lib-amd/components/Popover/Popover.js +0 -15
- package/lib-amd/components/Popover/Popover.js.map +0 -1
- package/lib-amd/components/Popover/Popover.types.d.ts +0 -109
- package/lib-amd/components/Popover/Popover.types.js +0 -5
- package/lib-amd/components/Popover/Popover.types.js.map +0 -1
- package/lib-amd/components/Popover/getOffsetWithArrow.d.ts +0 -7
- package/lib-amd/components/Popover/getOffsetWithArrow.js +0 -40
- package/lib-amd/components/Popover/getOffsetWithArrow.js.map +0 -1
- package/lib-amd/components/Popover/index.d.ts +0 -4
- package/lib-amd/components/Popover/index.js +0 -9
- package/lib-amd/components/Popover/index.js.map +0 -1
- package/lib-amd/components/Popover/renderPopover.d.ts +0 -5
- package/lib-amd/components/Popover/renderPopover.js +0 -29
- package/lib-amd/components/Popover/renderPopover.js.map +0 -1
- package/lib-amd/components/Popover/usePopover.d.ts +0 -11
- package/lib-amd/components/Popover/usePopover.js +0 -112
- package/lib-amd/components/Popover/usePopover.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.d.ts +0 -6
- package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -15
- package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.d.ts +0 -30
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.js +0 -5
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.js.map +0 -1
- package/lib-amd/components/PopoverSurface/index.d.ts +0 -5
- package/lib-amd/components/PopoverSurface/index.js +0 -10
- package/lib-amd/components/PopoverSurface/index.js.map +0 -1
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -21
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurface.d.ts +0 -13
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -69
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -7
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -81
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.d.ts +0 -6
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -15
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -12
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js +0 -5
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/index.d.ts +0 -4
- package/lib-amd/components/PopoverTrigger/index.js +0 -9
- package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js +0 -13
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -11
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js +0 -75
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
- package/lib-amd/index.d.ts +0 -4
- package/lib-amd/index.js +0 -9
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/popoverContext.d.ts +0 -9
- package/lib-amd/popoverContext.js +0 -22
- package/lib-amd/popoverContext.js.map +0 -1
- package/lib-commonjs/Popover.stories.d.ts +0 -62
- package/lib-commonjs/Popover.stories.js +0 -122
- package/lib-commonjs/Popover.stories.js.map +0 -1
- package/lib-commonjs/components/Popover/getOffsetWithArrow.d.ts +0 -7
- package/lib-commonjs/components/Popover/getOffsetWithArrow.js +0 -38
- package/lib-commonjs/components/Popover/getOffsetWithArrow.js.map +0 -1
- package/src/components/Popover/Popover.types.ts +0 -124
- package/src/components/PopoverSurface/PopoverSurface.types.ts +0 -36
- package/src/components/PopoverTrigger/PopoverTrigger.types.ts +0 -13
@@ -1,17 +1,23 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
3
6
|
exports.usePopover = void 0;
|
4
|
-
|
5
|
-
var
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
var
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
*/
|
14
|
-
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var React = /*#__PURE__*/require("react");
|
11
|
+
|
12
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
13
|
+
|
14
|
+
var react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
|
15
|
+
|
16
|
+
var react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
|
17
|
+
|
18
|
+
var react_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
|
19
|
+
|
20
|
+
var index_1 = /*#__PURE__*/require("../PopoverSurface/index");
|
15
21
|
/**
|
16
22
|
* Create the state required to render Popover.
|
17
23
|
*
|
@@ -19,99 +25,127 @@ var mergeProps = react_utilities_1.makeMergeProps({});
|
|
19
25
|
* before being passed to renderPopover.
|
20
26
|
*
|
21
27
|
* @param props - props from this instance of Popover
|
22
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
23
28
|
*/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
29
|
+
|
30
|
+
|
31
|
+
var usePopover = function (props) {
|
32
|
+
var _a = react_positioning_1.usePopperMouseTarget(),
|
33
|
+
contextTarget = _a[0],
|
34
|
+
setContextTarget = _a[1];
|
35
|
+
|
36
|
+
var initialState = tslib_1.__assign({
|
37
|
+
size: 'medium',
|
38
|
+
contextTarget: contextTarget,
|
39
|
+
setContextTarget: setContextTarget
|
40
|
+
}, props);
|
41
|
+
|
42
|
+
var _b = useOpenState(initialState),
|
43
|
+
open = _b[0],
|
44
|
+
setOpen = _b[1];
|
45
|
+
|
46
|
+
var popperRefs = usePopoverRefs(initialState);
|
47
|
+
var targetDocument = react_shared_contexts_1.useFluent().targetDocument;
|
48
|
+
react_utilities_1.useOnClickOutside({
|
49
|
+
contains: react_portal_1.elementContains,
|
50
|
+
element: targetDocument,
|
51
|
+
callback: function (ev) {
|
52
|
+
return setOpen(ev, false);
|
53
|
+
},
|
54
|
+
refs: [popperRefs.triggerRef, popperRefs.contentRef],
|
55
|
+
disabled: !open
|
56
|
+
});
|
57
|
+
react_utilities_1.useOnScrollOutside({
|
58
|
+
contains: react_portal_1.elementContains,
|
59
|
+
element: targetDocument,
|
60
|
+
callback: function (ev) {
|
61
|
+
return setOpen(ev, false);
|
62
|
+
},
|
63
|
+
refs: [popperRefs.triggerRef, popperRefs.contentRef],
|
64
|
+
disabled: !open || !initialState.openOnContext
|
65
|
+
});
|
66
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, initialState), popperRefs), {
|
67
|
+
open: open,
|
68
|
+
setOpen: setOpen,
|
69
|
+
setContextTarget: setContextTarget,
|
70
|
+
contextTarget: contextTarget
|
71
|
+
});
|
63
72
|
};
|
73
|
+
|
64
74
|
exports.usePopover = usePopover;
|
65
75
|
/**
|
66
76
|
* Creates and manages the Popover open state
|
67
|
-
* @param state Popover state
|
68
77
|
*/
|
78
|
+
|
69
79
|
function useOpenState(state) {
|
70
|
-
|
71
|
-
var _a
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
80
|
+
var onOpenChange = react_utilities_1.useEventCallback(function (e, data) {
|
81
|
+
var _a;
|
82
|
+
|
83
|
+
return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
|
84
|
+
});
|
85
|
+
|
86
|
+
var _a = react_utilities_1.useControllableState({
|
87
|
+
state: state.open,
|
88
|
+
defaultState: state.defaultOpen,
|
89
|
+
initialState: false
|
90
|
+
}),
|
91
|
+
open = _a[0],
|
92
|
+
setOpenState = _a[1];
|
93
|
+
|
94
|
+
state.open = open !== undefined ? open : state.open;
|
95
|
+
var setContextTarget = state.setContextTarget;
|
96
|
+
var setOpen = React.useCallback(function (e, shouldOpen) {
|
97
|
+
if (shouldOpen && e.type === 'contextmenu') {
|
98
|
+
setContextTarget(e);
|
99
|
+
}
|
100
|
+
|
101
|
+
if (!shouldOpen) {
|
102
|
+
setContextTarget(undefined);
|
103
|
+
}
|
104
|
+
|
105
|
+
setOpenState(function (prevOpen) {
|
106
|
+
// More than one event (mouse, focus, keyboard) can request the Popover to close
|
107
|
+
// We assume the first event is the correct one
|
108
|
+
if (prevOpen !== shouldOpen) {
|
109
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
|
110
|
+
open: shouldOpen
|
89
111
|
});
|
90
|
-
|
91
|
-
|
112
|
+
}
|
113
|
+
|
114
|
+
return shouldOpen;
|
115
|
+
});
|
116
|
+
}, [setOpenState, onOpenChange, setContextTarget]);
|
117
|
+
return [open, setOpen];
|
92
118
|
}
|
93
119
|
/**
|
94
120
|
* Creates and sets the necessary trigger, target and content refs used by Popover
|
95
|
-
* @param state Popover state
|
96
121
|
*/
|
122
|
+
|
123
|
+
|
97
124
|
function usePopoverRefs(state) {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
125
|
+
var popperOptions = tslib_1.__assign({
|
126
|
+
position: 'above',
|
127
|
+
align: 'center',
|
128
|
+
target: state.openOnContext ? state.contextTarget : undefined
|
129
|
+
}, react_positioning_1.resolvePositioningShorthand(state.positioning)); // no reason to render arrow when covering the target
|
130
|
+
|
131
|
+
|
132
|
+
if (popperOptions.coverTarget) {
|
133
|
+
state.noArrow = true;
|
134
|
+
}
|
135
|
+
|
136
|
+
if (!state.noArrow) {
|
137
|
+
popperOptions.offset = react_positioning_1.mergeArrowOffset(popperOptions.offset, index_1.arrowHeights[state.size]);
|
138
|
+
}
|
139
|
+
|
140
|
+
var _a = react_positioning_1.usePopper(popperOptions),
|
141
|
+
triggerRef = _a.targetRef,
|
142
|
+
contentRef = _a.containerRef,
|
143
|
+
arrowRef = _a.arrowRef;
|
144
|
+
|
145
|
+
return {
|
146
|
+
triggerRef: triggerRef,
|
147
|
+
contentRef: contentRef,
|
148
|
+
arrowRef: arrowRef
|
149
|
+
};
|
116
150
|
}
|
117
151
|
//# sourceMappingURL=usePopover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/Popover/usePopover.ts"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAMA,IAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAMA,IAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;;;;;AAOG;;;AACI,IAAM,UAAU,GAAG,UAAC,KAAD,EAAoB;AACtC,MAAA,EAAA,GAAoC,mBAAA,CAAA,oBAAA,EAApC;AAAA,MAAC,aAAa,GAAA,EAAA,CAAA,CAAA,CAAd;AAAA,MAAgB,gBAAgB,GAAA,EAAA,CAAA,CAAA,CAAhC;;AACN,MAAM,YAAY,GAAG,OAAA,CAAA,QAAA,CAAA;AACnB,IAAA,IAAI,EAAE,QADa;AAEnB,IAAA,aAAa,EAAA,aAFM;AAGnB,IAAA,gBAAgB,EAAA;AAHG,GAAA,EAIhB,KAJgB,CAArB;;AAOM,MAAA,EAAA,GAAkB,YAAY,CAAC,YAAD,CAA9B;AAAA,MAAC,IAAI,GAAA,EAAA,CAAA,CAAA,CAAL;AAAA,MAAO,OAAO,GA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N,CAAZ;AACD;;AAED,aAAO,UAAP;AACD,KARW,CAAZ;AASD,GAnBa,EAoBd,CAAC,YAAD,EAAe,YAAf,EAA6B,gBAA7B,CApBc,CAAhB;AAuBA,SAAO,CAAC,IAAD,EAAO,OAAP,CAAP;AACD;AAED;;AAEG;;;AACH,SAAS,cAAT,CACE,KADF,EACuH;AAErH,MAAM,aAAa,GAAA,OAAA,CAAA,QAAA,CAAA;AACjB,IAAA,QAAQ,EAAE,OADO;AAEjB,IAAA,KAAK,EAAE,QAFU;AAGjB,IAAA,MAAM,EAAE,KAAK,CAAC,aAAN,GAAsB,KAAK,CAAC,aAA5B,GAA4C;AAHnC,GAAA,EAId,mBAAA,CAAA,2BAAA,CAA4B,KAAK,CAAC,WAAlC,CAJc,CAAnB,CAFqH,CASrH;;;AACA,MAAI,aAAa,CAAC,WAAlB,EAA+B;AAC7B,IAAA,KAAK,CAAC,OAAN,GAAgB,IAAhB;AACD;;AAED,MAAI,CAAC,KAAK,CAAC,OAAX,EAAoB;AAClB,IAAA,aAAa,CAAC,MAAd,GAAuB,mBAAA,CAAA,gBAAA,CAAiB,aAAa,CAAC,MAA/B,EAAuC,OAAA,CAAA,YAAA,CAAa,KAAK,CAAC,IAAnB,CAAvC,CAAvB;AACD;;AAEK,MAAA,EAAA,GAAgE,mBAAA,CAAA,SAAA,CAAU,aAAV,CAAhE;AAAA,MAAa,UAAU,GAAA,EAAA,CAAA,SAAvB;AAAA,MAAuC,UAAU,GAAA,EAAA,CAAA,YAAjD;AAAA,MAAmD,QAAQ,GAAA,EAAA,CAAA,QAA3D;;AAEN,SAAO;AACL,IAAA,UAAU,EAAA,UADL;AAEL,IAAA,UAAU,EAAA,UAFL;AAGL,IAAA,QAAQ,EAAA;AAHH,GAAP;AAKD","sourceRoot":""}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import type { PopoverSurfaceProps } from './PopoverSurface.types';
|
2
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
3
3
|
/**
|
4
4
|
* PopoverSurface component renders react children in a positioned box
|
5
5
|
*/
|
6
|
-
export declare const PopoverSurface:
|
6
|
+
export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
|
@@ -1,17 +1,26 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
3
6
|
exports.PopoverSurface = void 0;
|
4
|
-
|
5
|
-
var
|
6
|
-
|
7
|
-
var
|
7
|
+
|
8
|
+
var React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
var usePopoverSurface_1 = /*#__PURE__*/require("./usePopoverSurface");
|
11
|
+
|
12
|
+
var renderPopoverSurface_1 = /*#__PURE__*/require("./renderPopoverSurface");
|
13
|
+
|
14
|
+
var usePopoverSurfaceStyles_1 = /*#__PURE__*/require("./usePopoverSurfaceStyles");
|
8
15
|
/**
|
9
16
|
* PopoverSurface component renders react children in a positioned box
|
10
17
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
|
19
|
+
|
20
|
+
exports.PopoverSurface = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
21
|
+
var state = usePopoverSurface_1.usePopoverSurface(props, ref);
|
22
|
+
usePopoverSurfaceStyles_1.usePopoverSurfaceStyles(state);
|
23
|
+
return renderPopoverSurface_1.renderPopoverSurface(state);
|
15
24
|
});
|
16
25
|
exports.PopoverSurface.displayName = 'PopoverSurface';
|
17
26
|
//# sourceMappingURL=PopoverSurface.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,IAAA,yBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,cAAA,gBAA2D,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClG,MAAM,KAAK,GAAG,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAAd;AAEA,EAAA,yBAAA,CAAA,uBAAA,CAAwB,KAAxB;AACA,SAAO,sBAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CALuE,CAA3D;AAOb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B","sourceRoot":""}
|
@@ -1,30 +1,21 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import { PopoverContextValue } from '../../popoverContext';
|
1
|
+
import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
2
|
+
import type { PopoverContextValue } from '../../popoverContext';
|
4
3
|
/**
|
5
4
|
* PopoverSurface Props
|
6
5
|
*/
|
7
|
-
export
|
8
|
-
}
|
6
|
+
export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
|
9
7
|
/**
|
10
|
-
* Names of the
|
8
|
+
* Names of the slots in PopoverSurfaceProps
|
11
9
|
*/
|
12
|
-
export declare type
|
13
|
-
|
14
|
-
|
15
|
-
*/
|
16
|
-
export declare type PopoverSurfaceDefaultedProps = never;
|
10
|
+
export declare type PopoverSurfaceSlots = {
|
11
|
+
root: IntrinsicShorthandProps<'div'>;
|
12
|
+
};
|
17
13
|
/**
|
18
14
|
* PopoverSurface State
|
19
15
|
*/
|
20
|
-
export
|
21
|
-
ref: React.Ref<HTMLElement>;
|
22
|
-
/**
|
23
|
-
* Ref to the arrow element
|
24
|
-
*/
|
25
|
-
arrowRef?: React.Ref<HTMLDivElement>;
|
16
|
+
export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
|
26
17
|
/**
|
27
18
|
* CSS class for the arrow element
|
28
19
|
*/
|
29
20
|
arrowClassName?: string;
|
30
|
-
}
|
21
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
|
@@ -1,9 +1,18 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
+
|
4
9
|
tslib_1.__exportStar(require("./PopoverSurface"), exports);
|
10
|
+
|
5
11
|
tslib_1.__exportStar(require("./PopoverSurface.types"), exports);
|
12
|
+
|
6
13
|
tslib_1.__exportStar(require("./renderPopoverSurface"), exports);
|
14
|
+
|
7
15
|
tslib_1.__exportStar(require("./usePopoverSurface"), exports);
|
16
|
+
|
8
17
|
tslib_1.__exportStar(require("./usePopoverSurfaceStyles"), exports);
|
9
18
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,2BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
|
@@ -1,23 +1,41 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
3
6
|
exports.renderPopoverSurface = void 0;
|
4
|
-
|
5
|
-
var
|
6
|
-
|
7
|
-
var
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var React = /*#__PURE__*/require("react");
|
11
|
+
|
12
|
+
var react_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
|
13
|
+
|
14
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
15
|
+
|
16
|
+
var usePopoverSurface_1 = /*#__PURE__*/require("./usePopoverSurface");
|
8
17
|
/**
|
9
18
|
* Render the final JSX of PopoverSurface
|
10
19
|
*/
|
20
|
+
|
21
|
+
|
11
22
|
var renderPopoverSurface = function (state) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
var _a = react_utilities_1.getSlots(state, usePopoverSurface_1.popoverSurfaceSlots),
|
24
|
+
slots = _a.slots,
|
25
|
+
slotProps = _a.slotProps; // TODO should hidden Popovers be supported ?
|
26
|
+
|
27
|
+
|
28
|
+
if (!state.open) {
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
|
32
|
+
return React.createElement(react_portal_1.Portal, {
|
33
|
+
mountNode: state.mountNode
|
34
|
+
}, React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), !state.noArrow && React.createElement("div", {
|
35
|
+
ref: state.arrowRef,
|
36
|
+
className: state.arrowClassName
|
37
|
+
}), slotProps.root.children));
|
21
38
|
};
|
39
|
+
|
22
40
|
exports.renderPopoverSurface = renderPopoverSurface;
|
23
41
|
//# sourceMappingURL=renderPopoverSurface.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;AAEA;;AAEG;;;AACI,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,iBAAA,CAAA,QAAA,CAA8B,KAA9B,EAAqC,mBAAA,CAAA,mBAArC,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB,CADuD,CAG7D;;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,SACE,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,CAAC,KAAK,CAAC,OAAP,IAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourceRoot":""}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';
|
2
|
+
import type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';
|
3
|
+
export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
|
3
4
|
/**
|
4
5
|
* Create the state required to render PopoverSurface.
|
5
6
|
*
|
@@ -7,7 +8,6 @@ import { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types
|
|
7
8
|
* before being passed to renderPopoverSurface.
|
8
9
|
*
|
9
10
|
* @param props - props from this instance of PopoverSurface
|
10
|
-
* @param ref - reference to root
|
11
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
11
|
+
* @param ref - reference to root HTMLDivElement of PopoverSurface
|
12
12
|
*/
|
13
|
-
export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React.Ref<
|
13
|
+
export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>) => PopoverSurfaceState;
|