@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,14 +1,10 @@
|
|
1
|
+
import { __assign } from "tslib";
|
1
2
|
import * as React from 'react';
|
2
|
-
import {
|
3
|
+
import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
|
3
4
|
import { useFluent } from '@fluentui/react-shared-contexts';
|
4
|
-
import { usePopper,
|
5
|
+
import { usePopper, resolvePositioningShorthand, mergeArrowOffset, usePopperMouseTarget } from '@fluentui/react-positioning';
|
5
6
|
import { elementContains } from '@fluentui/react-portal';
|
6
7
|
import { arrowHeights } from '../PopoverSurface/index';
|
7
|
-
import { getOffsetWithArrow } from './getOffsetWithArrow';
|
8
|
-
/**
|
9
|
-
* Names of the shorthand properties in PopoverProps
|
10
|
-
*/
|
11
|
-
var mergeProps = makeMergeProps({});
|
12
8
|
/**
|
13
9
|
* Create the state required to render Popover.
|
14
10
|
*
|
@@ -16,98 +12,124 @@ var mergeProps = makeMergeProps({});
|
|
16
12
|
* before being passed to renderPopover.
|
17
13
|
*
|
18
14
|
* @param props - props from this instance of Popover
|
19
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
20
15
|
*/
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
16
|
+
|
17
|
+
export var usePopover = function (props) {
|
18
|
+
var _a = usePopperMouseTarget(),
|
19
|
+
contextTarget = _a[0],
|
20
|
+
setContextTarget = _a[1];
|
21
|
+
|
22
|
+
var initialState = __assign({
|
23
|
+
size: 'medium',
|
24
|
+
contextTarget: contextTarget,
|
25
|
+
setContextTarget: setContextTarget
|
26
|
+
}, props);
|
27
|
+
|
28
|
+
var _b = useOpenState(initialState),
|
29
|
+
open = _b[0],
|
30
|
+
setOpen = _b[1];
|
31
|
+
|
32
|
+
var popperRefs = usePopoverRefs(initialState);
|
33
|
+
var targetDocument = useFluent().targetDocument;
|
34
|
+
useOnClickOutside({
|
35
|
+
contains: elementContains,
|
36
|
+
element: targetDocument,
|
37
|
+
callback: function (ev) {
|
38
|
+
return setOpen(ev, false);
|
39
|
+
},
|
40
|
+
refs: [popperRefs.triggerRef, popperRefs.contentRef],
|
41
|
+
disabled: !open
|
42
|
+
});
|
43
|
+
useOnScrollOutside({
|
44
|
+
contains: elementContains,
|
45
|
+
element: targetDocument,
|
46
|
+
callback: function (ev) {
|
47
|
+
return setOpen(ev, false);
|
48
|
+
},
|
49
|
+
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
|
57
|
+
});
|
60
58
|
};
|
61
59
|
/**
|
62
60
|
* Creates and manages the Popover open state
|
63
|
-
* @param state Popover state
|
64
61
|
*/
|
62
|
+
|
65
63
|
function useOpenState(state) {
|
66
|
-
|
67
|
-
var _a
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
64
|
+
var onOpenChange = useEventCallback(function (e, data) {
|
65
|
+
var _a;
|
66
|
+
|
67
|
+
return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
|
68
|
+
});
|
69
|
+
|
70
|
+
var _a = useControllableState({
|
71
|
+
state: state.open,
|
72
|
+
defaultState: state.defaultOpen,
|
73
|
+
initialState: false
|
74
|
+
}),
|
75
|
+
open = _a[0],
|
76
|
+
setOpenState = _a[1];
|
77
|
+
|
78
|
+
state.open = open !== undefined ? open : state.open;
|
79
|
+
var setContextTarget = state.setContextTarget;
|
80
|
+
var setOpen = React.useCallback(function (e, shouldOpen) {
|
81
|
+
if (shouldOpen && e.type === 'contextmenu') {
|
82
|
+
setContextTarget(e);
|
83
|
+
}
|
84
|
+
|
85
|
+
if (!shouldOpen) {
|
86
|
+
setContextTarget(undefined);
|
87
|
+
}
|
88
|
+
|
89
|
+
setOpenState(function (prevOpen) {
|
90
|
+
// More than one event (mouse, focus, keyboard) can request the Popover to close
|
91
|
+
// We assume the first event is the correct one
|
92
|
+
if (prevOpen !== shouldOpen) {
|
93
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
|
94
|
+
open: shouldOpen
|
85
95
|
});
|
86
|
-
|
87
|
-
|
96
|
+
}
|
97
|
+
|
98
|
+
return shouldOpen;
|
99
|
+
});
|
100
|
+
}, [setOpenState, onOpenChange, setContextTarget]);
|
101
|
+
return [open, setOpen];
|
88
102
|
}
|
89
103
|
/**
|
90
104
|
* Creates and sets the necessary trigger, target and content refs used by Popover
|
91
|
-
* @param state Popover state
|
92
105
|
*/
|
106
|
+
|
107
|
+
|
93
108
|
function usePopoverRefs(state) {
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
var popperOptions = __assign({
|
110
|
+
position: 'above',
|
111
|
+
align: 'center',
|
112
|
+
target: state.openOnContext ? state.contextTarget : undefined
|
113
|
+
}, resolvePositioningShorthand(state.positioning)); // no reason to render arrow when covering the target
|
114
|
+
|
115
|
+
|
116
|
+
if (popperOptions.coverTarget) {
|
117
|
+
state.noArrow = true;
|
118
|
+
}
|
119
|
+
|
120
|
+
if (!state.noArrow) {
|
121
|
+
popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
|
122
|
+
}
|
123
|
+
|
124
|
+
var _a = usePopper(popperOptions),
|
125
|
+
triggerRef = _a.targetRef,
|
126
|
+
contentRef = _a.containerRef,
|
127
|
+
arrowRef = _a.arrowRef;
|
128
|
+
|
129
|
+
return {
|
130
|
+
triggerRef: triggerRef,
|
131
|
+
contentRef: contentRef,
|
132
|
+
arrowRef: arrowRef
|
133
|
+
};
|
112
134
|
}
|
113
135
|
//# sourceMappingURL=usePopover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources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AAC,OAAX,EAAoB;AAClB,IAAA,aAAa,CAAC,MAAd,GAAuB,gBAAgB,CAAC,aAAa,CAAC,MAAf,EAAuB,YAAY,CAAC,KAAK,CAAC,IAAP,CAAnC,CAAvC;AACD;;AAEK,MAAA,EAAA,GAAgE,SAAS,CAAC,aAAD,CAAzE;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>;
|
@@ -5,10 +5,11 @@ import { usePopoverSurfaceStyles } from './usePopoverSurfaceStyles';
|
|
5
5
|
/**
|
6
6
|
* PopoverSurface component renders react children in a positioned box
|
7
7
|
*/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
|
9
|
+
export var PopoverSurface = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
10
|
+
var state = usePopoverSurface(props, ref);
|
11
|
+
usePopoverSurfaceStyles(state);
|
12
|
+
return renderPopoverSurface(state);
|
12
13
|
});
|
13
14
|
PopoverSurface.displayName = 'PopoverSurface';
|
14
15
|
//# sourceMappingURL=PopoverSurface.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,uBAAT,QAAwC,2BAAxC;AAIA;;AAEG;;AACH,OAAO,IAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AAEA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AACA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,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,"file":"PopoverSurface.types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"PopoverSurface.types.js","sourceRoot":"","sources":["../../../src/components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PopoverSurface/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
|
@@ -1,19 +1,27 @@
|
|
1
1
|
import { __assign } from "tslib";
|
2
2
|
import * as React from 'react';
|
3
|
-
import { getSlots } from '@fluentui/react-utilities';
|
4
3
|
import { Portal } from '@fluentui/react-portal';
|
4
|
+
import { getSlots } from '@fluentui/react-utilities';
|
5
|
+
import { popoverSurfaceSlots } from './usePopoverSurface';
|
5
6
|
/**
|
6
7
|
* Render the final JSX of PopoverSurface
|
7
8
|
*/
|
9
|
+
|
8
10
|
export var renderPopoverSurface = function (state) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
var _a = getSlots(state, popoverSurfaceSlots),
|
12
|
+
slots = _a.slots,
|
13
|
+
slotProps = _a.slotProps; // TODO should hidden Popovers be supported ?
|
14
|
+
|
15
|
+
|
16
|
+
if (!state.open) {
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
|
20
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
21
|
+
mountNode: state.mountNode
|
22
|
+
}, /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), !state.noArrow && /*#__PURE__*/React.createElement("div", {
|
23
|
+
ref: state.arrowRef,
|
24
|
+
className: state.arrowClassName
|
25
|
+
}), slotProps.root.children));
|
18
26
|
};
|
19
27
|
//# sourceMappingURL=renderPopoverSurface.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,mBAAT,QAAoC,qBAApC;AAEA;;AAEG;;AACH,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,QAAQ,CAAsB,KAAtB,EAA6B,mBAA7B,CAA/B;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,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM","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;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { __assign } from "tslib";
|
2
2
|
import * as React from 'react';
|
3
|
-
import {
|
3
|
+
import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
|
4
4
|
import { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';
|
5
5
|
import { usePopoverContext } from '../../popoverContext';
|
6
|
-
var
|
6
|
+
export var popoverSurfaceSlots = ['root'];
|
7
7
|
/**
|
8
8
|
* Create the state required to render PopoverSurface.
|
9
9
|
*
|
@@ -11,58 +11,98 @@ var mergeProps = makeMergeProps({});
|
|
11
11
|
* before being passed to renderPopoverSurface.
|
12
12
|
*
|
13
13
|
* @param props - props from this instance of PopoverSurface
|
14
|
-
* @param ref - reference to root
|
15
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
14
|
+
* @param ref - reference to root HTMLDivElement of PopoverSurface
|
16
15
|
*/
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
},
|
66
|
-
|
16
|
+
|
17
|
+
export var usePopoverSurface = function (props, ref) {
|
18
|
+
var contentRef = usePopoverContext(function (context) {
|
19
|
+
return context.contentRef;
|
20
|
+
});
|
21
|
+
var open = usePopoverContext(function (context) {
|
22
|
+
return context.open;
|
23
|
+
});
|
24
|
+
var openOnHover = usePopoverContext(function (context) {
|
25
|
+
return context.openOnHover;
|
26
|
+
});
|
27
|
+
var setOpen = usePopoverContext(function (context) {
|
28
|
+
return context.setOpen;
|
29
|
+
});
|
30
|
+
var mountNode = usePopoverContext(function (context) {
|
31
|
+
return context.mountNode;
|
32
|
+
});
|
33
|
+
var arrowRef = usePopoverContext(function (context) {
|
34
|
+
return context.arrowRef;
|
35
|
+
});
|
36
|
+
var size = usePopoverContext(function (context) {
|
37
|
+
return context.size;
|
38
|
+
});
|
39
|
+
var noArrow = usePopoverContext(function (context) {
|
40
|
+
return context.noArrow;
|
41
|
+
});
|
42
|
+
var appearance = usePopoverContext(function (context) {
|
43
|
+
return context.appearance;
|
44
|
+
});
|
45
|
+
var trapFocus = usePopoverContext(function (context) {
|
46
|
+
return context.trapFocus;
|
47
|
+
});
|
48
|
+
var modalAttributes = useModalAttributes({
|
49
|
+
trapFocus: trapFocus
|
50
|
+
}).modalAttributes;
|
51
|
+
var state = {
|
52
|
+
appearance: appearance,
|
53
|
+
noArrow: noArrow,
|
54
|
+
size: size,
|
55
|
+
arrowRef: arrowRef,
|
56
|
+
open: open,
|
57
|
+
mountNode: mountNode,
|
58
|
+
components: {
|
59
|
+
root: 'div'
|
60
|
+
},
|
61
|
+
root: getNativeElementProps('div', __assign(__assign({
|
62
|
+
ref: useMergedRefs(ref, contentRef),
|
63
|
+
role: 'dialog'
|
64
|
+
}, modalAttributes), props))
|
65
|
+
};
|
66
|
+
var _a = state.root,
|
67
|
+
onMouseEnterOriginal = _a.onMouseEnter,
|
68
|
+
onMouseLeaveOriginal = _a.onMouseLeave,
|
69
|
+
onKeyDownOriginal = _a.onKeyDown;
|
70
|
+
|
71
|
+
state.root.onMouseEnter = function (e) {
|
72
|
+
if (openOnHover) {
|
73
|
+
setOpen(e, true);
|
74
|
+
}
|
75
|
+
|
76
|
+
onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
|
77
|
+
};
|
78
|
+
|
79
|
+
state.root.onMouseLeave = function (e) {
|
80
|
+
if (openOnHover) {
|
81
|
+
setOpen(e, false);
|
82
|
+
}
|
83
|
+
|
84
|
+
onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
|
85
|
+
};
|
86
|
+
|
87
|
+
state.root.onKeyDown = function (e) {
|
88
|
+
var _a; // only close if the event happened inside the current popover
|
89
|
+
// If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
|
90
|
+
|
91
|
+
|
92
|
+
if (e.key === 'Escape' && ((_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
93
|
+
setOpen(e, false);
|
94
|
+
}
|
95
|
+
|
96
|
+
onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
|
97
|
+
};
|
98
|
+
|
99
|
+
var findFirstFocusable = useFocusFinders().findFirstFocusable;
|
100
|
+
React.useEffect(function () {
|
101
|
+
if (state.open && contentRef.current) {
|
102
|
+
var firstFocusable = findFirstFocusable(contentRef.current);
|
103
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
104
|
+
}
|
105
|
+
}, [contentRef, findFirstFocusable, state.open]);
|
106
|
+
return state;
|
67
107
|
};
|
68
108
|
//# sourceMappingURL=usePopoverSurface.js.map
|