@fluentui/react-popover 0.0.0-nightlya372ad979820211103.1 → 0.0.0-nightlya54302c0b220211124.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +113 -32
- package/CHANGELOG.md +34 -15
- package/dist/react-popover.d.ts +2 -0
- package/lib/common/isConformant.js +1 -1
- package/lib/common/isConformant.js.map +1 -1
- package/lib/common/mockUsePopoverContext.js +7 -14
- package/lib/common/mockUsePopoverContext.js.map +1 -1
- package/lib/components/Popover/Popover.js +2 -2
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/renderPopover.js +27 -25
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.js +39 -51
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js +2 -2
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js +6 -7
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.js +41 -55
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -0
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +16 -8
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js +2 -2
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +25 -33
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +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/PopoverSurface.js +1 -1
- package/lib-commonjs/PopoverTrigger.js +1 -1
- package/lib-commonjs/common/isConformant.js +3 -3
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/common/mockUsePopoverContext.js +8 -16
- package/lib-commonjs/common/mockUsePopoverContext.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js +4 -4
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +29 -27
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.js +45 -58
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +6 -6
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +10 -12
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +44 -59
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -0
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +18 -9
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +4 -4
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +29 -38
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/popoverContext.js +3 -7
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +11 -12
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { Portal } from '@fluentui/react-portal';
|
4
3
|
import { getSlots } from '@fluentui/react-utilities';
|
@@ -7,11 +6,11 @@ import { popoverSurfaceSlots } from './usePopoverSurface';
|
|
7
6
|
* Render the final JSX of PopoverSurface
|
8
7
|
*/
|
9
8
|
|
10
|
-
export
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
export const renderPopoverSurface = state => {
|
10
|
+
const {
|
11
|
+
slots,
|
12
|
+
slotProps
|
13
|
+
} = getSlots(state, popoverSurfaceSlots); // TODO should hidden Popovers be supported ?
|
15
14
|
|
16
15
|
if (!state.open) {
|
17
16
|
return null;
|
@@ -19,7 +18,7 @@ export var renderPopoverSurface = function (state) {
|
|
19
18
|
|
20
19
|
return /*#__PURE__*/React.createElement(Portal, {
|
21
20
|
mountNode: state.mountNode
|
22
|
-
}, /*#__PURE__*/React.createElement(slots.root,
|
21
|
+
}, /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root), !state.noArrow && /*#__PURE__*/React.createElement("div", {
|
23
22
|
ref: state.arrowRef,
|
24
23
|
className: state.arrowClassName
|
25
24
|
}), slotProps.root.children));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":"
|
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,MAAM,oBAAoB,GAAI,KAAD,IAA+B;AACjE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,EAA6B,mBAA7B,CAArC,CADiE,CAGjE;;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,MAAA,CAAA,MAAA,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,9 +1,8 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';
|
4
3
|
import { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';
|
5
4
|
import { usePopoverContext } from '../../popoverContext';
|
6
|
-
export
|
5
|
+
export const popoverSurfaceSlots = ['root'];
|
7
6
|
/**
|
8
7
|
* Create the state required to render PopoverSurface.
|
9
8
|
*
|
@@ -14,61 +13,46 @@ export var popoverSurfaceSlots = ['root'];
|
|
14
13
|
* @param ref - reference to root HTMLDivElement of PopoverSurface
|
15
14
|
*/
|
16
15
|
|
17
|
-
export
|
18
|
-
|
19
|
-
|
16
|
+
export const usePopoverSurface = (props, ref) => {
|
17
|
+
const contentRef = usePopoverContext(context => context.contentRef);
|
18
|
+
const open = usePopoverContext(context => context.open);
|
19
|
+
const openOnHover = usePopoverContext(context => context.openOnHover);
|
20
|
+
const setOpen = usePopoverContext(context => context.setOpen);
|
21
|
+
const mountNode = usePopoverContext(context => context.mountNode);
|
22
|
+
const arrowRef = usePopoverContext(context => context.arrowRef);
|
23
|
+
const size = usePopoverContext(context => context.size);
|
24
|
+
const noArrow = usePopoverContext(context => context.noArrow);
|
25
|
+
const appearance = usePopoverContext(context => context.appearance);
|
26
|
+
const trapFocus = usePopoverContext(context => context.trapFocus);
|
27
|
+
const {
|
28
|
+
modalAttributes
|
29
|
+
} = useModalAttributes({
|
30
|
+
trapFocus
|
20
31
|
});
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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,
|
32
|
+
const state = {
|
33
|
+
appearance,
|
34
|
+
noArrow,
|
35
|
+
size,
|
36
|
+
arrowRef,
|
37
|
+
open,
|
38
|
+
mountNode,
|
58
39
|
components: {
|
59
40
|
root: 'div'
|
60
41
|
},
|
61
|
-
root: getNativeElementProps('div',
|
42
|
+
root: getNativeElementProps('div', {
|
62
43
|
ref: useMergedRefs(ref, contentRef),
|
63
|
-
role: 'dialog'
|
64
|
-
|
44
|
+
role: 'dialog',
|
45
|
+
...modalAttributes,
|
46
|
+
...props
|
47
|
+
})
|
65
48
|
};
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
49
|
+
const {
|
50
|
+
onMouseEnter: onMouseEnterOriginal,
|
51
|
+
onMouseLeave: onMouseLeaveOriginal,
|
52
|
+
onKeyDown: onKeyDownOriginal
|
53
|
+
} = state.root;
|
70
54
|
|
71
|
-
state.root.onMouseEnter =
|
55
|
+
state.root.onMouseEnter = e => {
|
72
56
|
if (openOnHover) {
|
73
57
|
setOpen(e, true);
|
74
58
|
}
|
@@ -76,7 +60,7 @@ export var usePopoverSurface = function (props, ref) {
|
|
76
60
|
onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
|
77
61
|
};
|
78
62
|
|
79
|
-
state.root.onMouseLeave =
|
63
|
+
state.root.onMouseLeave = e => {
|
80
64
|
if (openOnHover) {
|
81
65
|
setOpen(e, false);
|
82
66
|
}
|
@@ -84,7 +68,7 @@ export var usePopoverSurface = function (props, ref) {
|
|
84
68
|
onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
|
85
69
|
};
|
86
70
|
|
87
|
-
state.root.onKeyDown =
|
71
|
+
state.root.onKeyDown = e => {
|
88
72
|
var _a; // only close if the event happened inside the current popover
|
89
73
|
// If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
|
90
74
|
|
@@ -96,10 +80,12 @@ export var usePopoverSurface = function (props, ref) {
|
|
96
80
|
onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
|
97
81
|
};
|
98
82
|
|
99
|
-
|
100
|
-
|
83
|
+
const {
|
84
|
+
findFirstFocusable
|
85
|
+
} = useFocusFinders();
|
86
|
+
React.useEffect(() => {
|
101
87
|
if (state.open && contentRef.current) {
|
102
|
-
|
88
|
+
const firstFocusable = findFirstFocusable(contentRef.current);
|
103
89
|
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
104
90
|
}
|
105
91
|
}, [contentRef, findFirstFocusable, state.open]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurface.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,aAAhC,QAAqD,2BAArD;AACA,SAAS,eAAT,EAA0B,kBAA1B,QAAoD,yBAApD;AACA,SAAS,iBAAT,QAAkC,sBAAlC;AAGA,OAAO,MAAM,mBAAmB,GAAqC,CAAC,MAAD,CAA9D;AAEP;;;;;;;;AAQG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAA6B,GAA7B,KAAoF;AACnH,QAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,UAApB,CAApC;AACA,QAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,IAApB,CAA9B;AACA,QAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,WAApB,CAArC;AACA,QAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,OAApB,CAAjC;AACA,QAAM,SAAS,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,SAApB,CAAnC;AACA,QAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,QAApB,CAAlC;AACA,QAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,IAApB,CAA9B;AACA,QAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,OAAO,CAAC,OAApB,CAAjC;AACA,QAAM,UAAU,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AAoB,KAAA,CAApB,GAAA,oBAAoB,CAAG,CAAH,CAApB;AACD,GAND;;AAQA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAwB,CAAD,IAA2C;WAAA,CAChE;AACA;;;AACA,QAAI,CAAC,CAAC,GAAF,KAAU,QAAV,KAAkB,CAAA,EAAA,GAAI,UAAU,CAAC,OAAf,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,QAAF,CAAW,CAAC,CAAC,MAAb,CAAxC,CAAJ,EAAoF;AAClF,MAAA,OAAO,CAAC,CAAD,EAAI,KAAJ,CAAP;AACD;;AAED,IAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAG,CAAH,CAAjB;AACD,GARD;;AAUA,QAAM;AAAE,IAAA;AAAF,MAAyB,eAAe,EAA9C;AAEA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,QAAI,KAAK,CAAC,IAAN,IAAc,UAAU,CAAC,OAA7B,EAAsC;AACpC,YAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,OAAZ,CAAzC;AACA,MAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,KAAhB,EAAA;AACD;AACF,GALD,EAKG,CAAC,UAAD,EAAa,kBAAb,EAAiC,KAAK,CAAC,IAAvC,CALH;AAMA,SAAO,KAAP;AACD,CAvEM","sourceRoot":""}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { PopoverSize } from '../Popover/Popover.types';
|
2
2
|
import type { PopoverSurfaceState } from './PopoverSurface.types';
|
3
|
+
export declare const popoverSurfaceClassName = "fui-PopoverSurface";
|
3
4
|
export declare const arrowHeights: Record<PopoverSize, number>;
|
4
5
|
/**
|
5
6
|
* Apply styling to the PopoverSurface slots based on the state
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { __styles, mergeClasses } from '@fluentui/react-make-styles';
|
2
|
-
|
2
|
+
import { createArrowStyles } from '@fluentui/react-positioning';
|
3
|
+
export const popoverSurfaceClassName = 'fui-PopoverSurface';
|
4
|
+
export const arrowHeights = {
|
3
5
|
small: 6,
|
4
6
|
medium: 8,
|
5
7
|
large: 8
|
@@ -8,10 +10,10 @@ export var arrowHeights = {
|
|
8
10
|
* Styles for the root slot
|
9
11
|
*/
|
10
12
|
|
11
|
-
|
13
|
+
const useStyles = /*#__PURE__*/__styles({
|
12
14
|
"root": {
|
13
15
|
"De3pzq": "fxugw4r",
|
14
|
-
"E5pizo":
|
16
|
+
"E5pizo": "f1hg901r",
|
15
17
|
"Dimara": "ff3glw6",
|
16
18
|
"B4j52fo": "f5ogflp",
|
17
19
|
"Bekrc4i": ["f1hqa2wf", "finvdd3"],
|
@@ -73,7 +75,13 @@ var useStyles = /*#__PURE__*/__styles({
|
|
73
75
|
"B4zgs9e": "ffo048g",
|
74
76
|
"Bex5imi": "fkk33zh",
|
75
77
|
"px8gyy": ["f5bg3dr", "f1rfdd74"],
|
76
|
-
"h6z6rw":
|
78
|
+
"h6z6rw": "fzd2j21",
|
79
|
+
"Iykf4b": ["feexxpo", "f7s5fvx"],
|
80
|
+
"F42hee": ["f1jq8eg5", "f12n7c5j"],
|
81
|
+
"Blxsnla": ["f1wv7y6t", "fi4qyh6"],
|
82
|
+
"t2scew": "fcvru7r",
|
83
|
+
"Emsed9": "f7ybgnc",
|
84
|
+
"E11wbp": "f16xtfle",
|
77
85
|
"hl6cv3": "fotnskf",
|
78
86
|
"Bh2vraf": "f1n8855c",
|
79
87
|
"yayu3t": ["f1nq055x", "f13ohf3"],
|
@@ -84,16 +92,16 @@ var useStyles = /*#__PURE__*/__styles({
|
|
84
92
|
"Bwwlvwl": "fm1ycve"
|
85
93
|
}
|
86
94
|
}, {
|
87
|
-
"d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".
|
95
|
+
"d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".ff3glw6{border-radius:4px;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f1c73kur{background-color:var(--colorNeutralForeground1);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fc7z3ec{padding-top:20px;}", ".fat0sn4{padding-right:20px;}", ".fekwl8i{padding-left:20px;}", ".fe2my4m{padding-bottom:20px;}", ".f1smug5u{width:8.485281374238571px;}", ".f11ci07v{height:8.485281374238571px;}", ".ftmg478{width:11.313708498984761px;}", ".f7bsbfx{height:11.313708498984761px;}", ".f1euv43f{position:absolute;}", ".f1uo6wrk{background:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".fuzzvh5:before{content:\"\";}", ".f1qudtws:before{border-radius:4px;}", ".fxf9f1y:before{position:absolute;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".ffo048g:before{background:inherit;}", ".fkk33zh:before{visibility:visible;}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", "[data-popper-placement] .feexxpo:before{border-right-width:1px;}", "[data-popper-placement] .f7s5fvx:before{border-left-width:1px;}", "[data-popper-placement] .f1jq8eg5:before{border-right-style:solid;}", "[data-popper-placement] .f12n7c5j:before{border-left-style:solid;}", "[data-popper-placement] .f1wv7y6t:before{border-right-color:transparent;}", "[data-popper-placement] .fi4qyh6:before{border-left-color:transparent;}", "[data-popper-placement] .fcvru7r:before{border-bottom-width:1px;}", "[data-popper-placement] .f7ybgnc:before{border-bottom-style:solid;}", "[data-popper-placement] .f16xtfle:before{border-bottom-color:transparent;}", "[data-popper-placement^=\"top\"] .fotnskf{bottom:0;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1nq055x{left:0;}", "[data-popper-placement^=\"right\"] .f13ohf3{right:0;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .ftghsr9{top:0;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f1l8vbt4{right:0;}", "[data-popper-placement^=\"left\"] .fsxzh25{left:0;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
|
88
96
|
});
|
89
97
|
/**
|
90
98
|
* Apply styling to the PopoverSurface slots based on the state
|
91
99
|
*/
|
92
100
|
|
93
101
|
|
94
|
-
export
|
95
|
-
|
96
|
-
state.root.className = mergeClasses(styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
102
|
+
export const usePopoverSurfaceStyles = state => {
|
103
|
+
const styles = useStyles();
|
104
|
+
state.root.className = mergeClasses(popoverSurfaceClassName, styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
|
97
105
|
state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
|
98
106
|
return state;
|
99
107
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAIA,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,iBAAT,QAAkC,6BAAlC;AAIA,OAAO,MAAM,uBAAuB,GAAG,oBAAhC;AAEP,OAAO,MAAM,YAAY,GAAgC;AACvD,EAAA,KAAK,EAAE,CADgD;AAEvD,EAAA,MAAM,EAAE,CAF+C;AAGvD,EAAA,KAAK,EAAE;AAHgD,CAAlD;AAMP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AA6CA;;AAEG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAoD;AACzF,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,uBADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YAHA,EAIjC,KAAK,CAAC,IAAN,KAAe,QAAf,IAA2B,MAAM,CAAC,aAJD,EAKjC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YALA,EAMjC,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QANT,EAOjC,KAAK,CAAC,UAAN,KAAqB,OAArB,IAAgC,MAAM,CAAC,KAPN,EAQjC,KAAK,CAAC,IAAN,CAAW,SARsB,CAAnC;AAWA,EAAA,KAAK,CAAC,cAAN,GAAuB,YAAY,CACjC,MAAM,CAAC,KAD0B,EAEjC,KAAK,CAAC,IAAN,KAAe,OAAf,GAAyB,MAAM,CAAC,UAAhC,GAA6C,MAAM,CAAC,gBAFnB,CAAnC;AAKA,SAAO,KAAP;AACD,CAnBM","sourceRoot":""}
|
@@ -4,8 +4,8 @@ import { renderPopoverTrigger } from './renderPopoverTrigger';
|
|
4
4
|
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
5
5
|
*/
|
6
6
|
|
7
|
-
export
|
8
|
-
|
7
|
+
export const PopoverTrigger = props => {
|
8
|
+
const state = usePopoverTrigger(props);
|
9
9
|
return renderPopoverTrigger(state);
|
10
10
|
};
|
11
11
|
PopoverTrigger.displayName = 'PopoverTrigger';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AAGA;;AAEG;;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AAGA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAAkC,KAAK,IAAG;AACnE,QAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,CAA/B;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJM;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAA4C;AAC9E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { useMergedRefs, useEventCallback, shouldPreventDefaultOnKeyDown } from '@fluentui/react-utilities';
|
4
3
|
import { useModalAttributes } from '@fluentui/react-tabster';
|
@@ -12,24 +11,17 @@ import { usePopoverContext } from '../../popoverContext';
|
|
12
11
|
* @param props - props from this instance of PopoverTrigger
|
13
12
|
*/
|
14
13
|
|
15
|
-
export
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
});
|
25
|
-
|
26
|
-
return context.openOnHover;
|
27
|
-
});
|
28
|
-
var openOnContext = usePopoverContext(function (context) {
|
29
|
-
return context.openOnContext;
|
30
|
-
});
|
31
|
-
var triggerAttributes = useModalAttributes().triggerAttributes;
|
32
|
-
var onContextMenu = useEventCallback(function (e) {
|
14
|
+
export const usePopoverTrigger = props => {
|
15
|
+
const setOpen = usePopoverContext(context => context.setOpen);
|
16
|
+
const open = usePopoverContext(context => context.open);
|
17
|
+
const triggerRef = usePopoverContext(context => context.triggerRef);
|
18
|
+
const openOnHover = usePopoverContext(context => context.openOnHover);
|
19
|
+
const openOnContext = usePopoverContext(context => context.openOnContext);
|
20
|
+
const trapFocus = usePopoverContext(context => context.trapFocus);
|
21
|
+
const {
|
22
|
+
triggerAttributes
|
23
|
+
} = useModalAttributes();
|
24
|
+
const onContextMenu = useEventCallback(e => {
|
33
25
|
var _a, _b;
|
34
26
|
|
35
27
|
if (openOnContext) {
|
@@ -39,7 +31,7 @@ export var usePopoverTrigger = function (props) {
|
|
39
31
|
|
40
32
|
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
41
33
|
});
|
42
|
-
|
34
|
+
const onClick = useEventCallback(e => {
|
43
35
|
var _a, _b;
|
44
36
|
|
45
37
|
if (!openOnContext) {
|
@@ -48,7 +40,7 @@ export var usePopoverTrigger = function (props) {
|
|
48
40
|
|
49
41
|
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
50
42
|
});
|
51
|
-
|
43
|
+
const onKeyDown = useEventCallback(e => {
|
52
44
|
var _a, _b, _c;
|
53
45
|
|
54
46
|
if (shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
|
@@ -62,7 +54,7 @@ export var usePopoverTrigger = function (props) {
|
|
62
54
|
|
63
55
|
(_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
|
64
56
|
});
|
65
|
-
|
57
|
+
const onMouseEnter = useEventCallback(e => {
|
66
58
|
var _a, _b;
|
67
59
|
|
68
60
|
if (openOnHover) {
|
@@ -71,7 +63,7 @@ export var usePopoverTrigger = function (props) {
|
|
71
63
|
|
72
64
|
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
73
65
|
});
|
74
|
-
|
66
|
+
const onMouseLeave = useEventCallback(e => {
|
75
67
|
var _a, _b;
|
76
68
|
|
77
69
|
if (openOnHover) {
|
@@ -80,18 +72,18 @@ export var usePopoverTrigger = function (props) {
|
|
80
72
|
|
81
73
|
(_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
82
74
|
});
|
83
|
-
|
75
|
+
const child = React.Children.only(props.children);
|
84
76
|
return {
|
85
|
-
children: /*#__PURE__*/React.cloneElement(child,
|
86
|
-
'aria-haspopup': 'true'
|
87
|
-
|
88
|
-
onClick
|
89
|
-
onMouseEnter
|
90
|
-
onKeyDown
|
91
|
-
onMouseLeave
|
92
|
-
onContextMenu
|
77
|
+
children: /*#__PURE__*/React.cloneElement(child, { ...triggerAttributes,
|
78
|
+
'aria-haspopup': trapFocus ? 'dialog' : 'true',
|
79
|
+
...child.props,
|
80
|
+
onClick,
|
81
|
+
onMouseEnter,
|
82
|
+
onKeyDown,
|
83
|
+
onMouseLeave,
|
84
|
+
onContextMenu,
|
93
85
|
ref: useMergedRefs(child.ref, triggerRef)
|
94
|
-
})
|
86
|
+
})
|
95
87
|
};
|
96
88
|
};
|
97
89
|
//# sourceMappingURL=usePopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/PopoverTrigger/usePopoverTrigger.ts"],"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lib/popoverContext.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
2
|
-
export
|
2
|
+
export const PopoverContext = /*#__PURE__*/createContext({
|
3
3
|
open: false,
|
4
|
-
setOpen:
|
5
|
-
return null;
|
6
|
-
},
|
4
|
+
setOpen: () => null,
|
7
5
|
triggerRef: {
|
8
6
|
current: null
|
9
7
|
},
|
@@ -18,7 +16,5 @@ export var PopoverContext = /*#__PURE__*/createContext({
|
|
18
16
|
size: 'medium',
|
19
17
|
trapFocus: false
|
20
18
|
});
|
21
|
-
export
|
22
|
-
return useContextSelector(PopoverContext, selector);
|
23
|
-
};
|
19
|
+
export const usePopoverContext = selector => useContextSelector(PopoverContext, selector);
|
24
20
|
//# sourceMappingURL=popoverContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/popoverContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAIA,OAAO,
|
1
|
+
{"version":3,"sources":["../src/popoverContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAIA,OAAO,MAAM,cAAc,gBAAiC,aAAa,CAAsB;AAC7F,EAAA,IAAI,EAAE,KADuF;AAE7F,EAAA,OAAO,EAAE,MAAM,IAF8E;AAG7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAHiF;AAI7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAJiF;AAK7F,EAAA,QAAQ,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GALmF;AAM7F,EAAA,aAAa,EAAE,KAN8E;AAO7F,EAAA,WAAW,EAAE,KAPgF;AAQ7F,EAAA,IAAI,EAAE,QARuF;AAS7F,EAAA,SAAS,EAAE;AATkF,CAAtB,CAAlE;AA+BP,OAAO,MAAM,iBAAiB,GAAO,QAAJ,IAC/B,kBAAkB,CAAC,cAAD,EAAiB,QAAjB,CADb","sourceRoot":""}
|
package/lib-commonjs/Popover.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/Popover/index"), exports);
|
10
10
|
//# sourceMappingURL=Popover.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/PopoverSurface/index"), exports);
|
10
10
|
//# sourceMappingURL=PopoverSurface.js.map
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
|
7
|
-
|
7
|
+
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
8
|
|
9
9
|
tslib_1.__exportStar(require("./components/PopoverTrigger/index"), exports);
|
10
10
|
//# sourceMappingURL=PopoverTrigger.js.map
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.isConformant = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const react_conformance_1 = /*#__PURE__*/require("@fluentui/react-conformance");
|
9
9
|
|
10
|
-
|
10
|
+
const react_conformance_make_styles_1 = /*#__PURE__*/require("@fluentui/react-conformance-make-styles");
|
11
11
|
|
12
12
|
function isConformant(testInfo) {
|
13
|
-
|
13
|
+
const defaultOptions = {
|
14
14
|
asPropHandlesRef: true,
|
15
15
|
componentPath: module.parent.filename.replace('.test', ''),
|
16
16
|
// TODO // https://github.com/microsoft/fluentui/issues/19522
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,
|
1
|
+
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,MAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAEA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,QAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D;AACA,IAAA,eAAe,EAAE,IAJ0C;AAK3D,IAAA,UAAU,EAAE,+BAAA,CAAA;AAL+C,GAA7D;AAQA,EAAA,mBAAA,CAAA,YAAA,CAAiB,cAAjB,EAAiC,QAAjC;AACD;;AAZD,OAAA,CAAA,YAAA,GAAA,YAAA","sourceRoot":""}
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.mockPopoverContext = void 0;
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
var popoverContext_1 = /*#__PURE__*/require("../popoverContext");
|
8
|
+
const popoverContext_1 = /*#__PURE__*/require("../popoverContext");
|
11
9
|
/**
|
12
10
|
* A test utility to mock the usePopoverContext hook that relies on context selector
|
13
11
|
* Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
|
@@ -15,16 +13,10 @@ var popoverContext_1 = /*#__PURE__*/require("../popoverContext");
|
|
15
13
|
*/
|
16
14
|
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
options = {};
|
21
|
-
}
|
22
|
-
|
23
|
-
var mockContext = tslib_1.__assign({
|
16
|
+
const mockPopoverContext = (options = {}) => {
|
17
|
+
const mockContext = {
|
24
18
|
open: false,
|
25
|
-
setOpen:
|
26
|
-
return null;
|
27
|
-
},
|
19
|
+
setOpen: () => null,
|
28
20
|
triggerRef: {
|
29
21
|
current: null
|
30
22
|
},
|
@@ -36,11 +28,11 @@ var mockPopoverContext = function (options) {
|
|
36
28
|
},
|
37
29
|
openOnContext: false,
|
38
30
|
openOnHover: false,
|
39
|
-
size: 'medium'
|
40
|
-
|
41
|
-
|
31
|
+
size: 'medium',
|
32
|
+
...options
|
33
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
42
34
|
|
43
|
-
popoverContext_1.usePopoverContext.mockImplementation(
|
35
|
+
popoverContext_1.usePopoverContext.mockImplementation(selector => {
|
44
36
|
return selector(mockContext);
|
45
37
|
});
|
46
38
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/common/mockUsePopoverContext.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/common/mockUsePopoverContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,gBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAGA;;;;AAIG;;;AACI,MAAM,kBAAkB,GAAG,CAAC,OAAA,GAAwC,EAAzC,KAA+C;AAC/E,QAAM,WAAW,GAAwB;AACvC,IAAA,IAAI,EAAE,KADiC;AAEvC,IAAA,OAAO,EAAE,MAAM,IAFwB;AAGvC,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAH2B;AAIvC,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAJ2B;AAKvC,IAAA,QAAQ,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAL6B;AAMvC,IAAA,aAAa,EAAE,KANwB;AAOvC,IAAA,WAAW,EAAE,KAP0B;AAQvC,IAAA,IAAI,EAAE,QARiC;AASvC,OAAG;AAToC,GAAzC,CAD+E,CAY/E;;AACC,EAAA,gBAAA,CAAA,iBAAA,CAAgC,kBAAhC,CAAoD,QAAD,IAAoD;AACtG,WAAO,QAAQ,CAAC,WAAD,CAAf;AACD,GAFA;AAGF,CAhBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourceRoot":""}
|
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.Popover = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
const usePopover_1 = /*#__PURE__*/require("./usePopover");
|
9
9
|
|
10
|
-
|
10
|
+
const renderPopover_1 = /*#__PURE__*/require("./renderPopover");
|
11
11
|
/**
|
12
12
|
* Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
|
13
13
|
*/
|
14
14
|
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
const Popover = props => {
|
17
|
+
const state = usePopover_1.usePopover(props);
|
18
18
|
return renderPopover_1.renderPopover(state);
|
19
19
|
};
|
20
20
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";;;;;;;AACA,
|
1
|
+
{"version":3,"sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,OAAO,GAA2B,KAAK,IAAG;AACrD,QAAM,KAAK,GAAG,YAAA,CAAA,UAAA,CAAW,KAAX,CAAd;AAEA,SAAO,eAAA,CAAA,aAAA,CAAc,KAAd,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,OAAA,GAAO,OAAP;AAMb,OAAA,CAAA,OAAA,CAAQ,WAAR,GAAsB,SAAtB","sourceRoot":""}
|