@fluentui/react-popover 9.5.3 → 9.5.5
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +127 -1
- package/CHANGELOG.md +36 -2
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/components/Popover/Popover.js +1 -0
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.js +1 -1
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/constants.js +1 -2
- package/lib/components/Popover/constants.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.js +8 -8
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib/components/PopoverSurface/index.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js +1 -3
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.js +3 -2
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.js +1 -0
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -2
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +1 -0
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.js.map +1 -1
- package/lib-commonjs/Popover.js +5 -4
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js +5 -4
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js +5 -4
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.js +14 -13
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.js +5 -2
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/constants.js +10 -8
- package/lib-commonjs/components/Popover/constants.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +8 -7
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +31 -47
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.js +179 -173
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +19 -20
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js +3 -2
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +9 -8
- package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +23 -28
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +70 -81
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +243 -113
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +15 -14
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +5 -2
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +8 -7
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +12 -11
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +71 -80
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +30 -92
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.js +34 -25
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +14 -13
- package/lib-amd/Popover.js +0 -6
- package/lib-amd/Popover.js.map +0 -1
- package/lib-amd/PopoverSurface.js +0 -6
- package/lib-amd/PopoverSurface.js.map +0 -1
- package/lib-amd/PopoverTrigger.js +0 -6
- package/lib-amd/PopoverTrigger.js.map +0 -1
- 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.js +0 -5
- package/lib-amd/components/Popover/Popover.types.js.map +0 -1
- package/lib-amd/components/Popover/constants.js +0 -15
- package/lib-amd/components/Popover/constants.js.map +0 -1
- 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.js +0 -32
- package/lib-amd/components/Popover/renderPopover.js.map +0 -1
- package/lib-amd/components/Popover/usePopover.js +0 -147
- package/lib-amd/components/Popover/usePopover.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -17
- package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
- 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.js +0 -10
- package/lib-amd/components/PopoverSurface/index.js.map +0 -1
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -20
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
- 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.js +0 -44
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -17
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
- 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.js +0 -9
- package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
- 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.js +0 -61
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
- package/lib-amd/index.js +0 -20
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/popoverContext.js +0 -28
- package/lib-amd/popoverContext.js.map +0 -1
@@ -1,20 +1,21 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "PopoverTrigger", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>PopoverTrigger
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
const state = usePopoverTrigger_1.usePopoverTrigger_unstable(props);
|
14
|
-
return renderPopoverTrigger_1.renderPopoverTrigger_unstable(state);
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _usePopoverTrigger = require("./usePopoverTrigger");
|
12
|
+
const _renderPopoverTrigger = require("./renderPopoverTrigger");
|
13
|
+
const PopoverTrigger = (props)=>{
|
14
|
+
const state = (0, _usePopoverTrigger.usePopoverTrigger_unstable)(props);
|
15
|
+
return (0, _renderPopoverTrigger.renderPopoverTrigger_unstable)(state);
|
15
16
|
};
|
16
|
-
|
17
|
-
exports.PopoverTrigger.displayName = 'PopoverTrigger';
|
17
|
+
PopoverTrigger.displayName = 'PopoverTrigger';
|
18
18
|
// type casting here is required to ensure internal type FluentTriggerComponent is not leaked
|
19
|
-
|
19
|
+
PopoverTrigger.isFluentTriggerComponent = true; //# sourceMappingURL=PopoverTrigger.js.map
|
20
|
+
|
20
21
|
//# sourceMappingURL=PopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/PopoverTrigger/PopoverTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger_unstable } from './usePopoverTrigger';\nimport { renderPopoverTrigger_unstable } from './renderPopoverTrigger';\n/**\n * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.\n */\nexport const PopoverTrigger = props => {\n const state = usePopoverTrigger_unstable(props);\n return renderPopoverTrigger_unstable(state);\n};\nPopoverTrigger.displayName = 'PopoverTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\nPopoverTrigger.isFluentTriggerComponent = true;\n//# sourceMappingURL=PopoverTrigger.js.map"],"names":["PopoverTrigger","props","state","usePopoverTrigger_unstable","renderPopoverTrigger_unstable","displayName","isFluentTriggerComponent"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;mCACoB;sCACG;AAIvC,MAAMA,iBAAiBC,CAAAA,QAAS;IACrC,MAAMC,QAAQC,IAAAA,6CAA0B,EAACF;IACzC,OAAOG,IAAAA,mDAA6B,EAACF;AACvC;AACAF,eAAeK,WAAW,GAAG;AAC7B,6FAA6F;AAC7FL,eAAeM,wBAAwB,GAAG,IAAI,EAC9C,0CAA0C"}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
5
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
6
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
7
|
+
//# sourceMappingURL=PopoverTrigger.types.js.map
|
8
|
+
|
6
9
|
//# sourceMappingURL=PopoverTrigger.types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/PopoverTrigger/PopoverTrigger.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=PopoverTrigger.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,gDAAgD"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
6
|
+
_exportStar(require("./PopoverTrigger"), exports);
|
7
|
+
_exportStar(require("./PopoverTrigger.types"), exports);
|
8
|
+
_exportStar(require("./renderPopoverTrigger"), exports);
|
9
|
+
_exportStar(require("./usePopoverTrigger"), exports);
|
10
|
+
//# sourceMappingURL=index.js.map
|
11
|
+
|
11
12
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/PopoverTrigger/index.js"],"sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;CACd,iCAAiC"}
|
@@ -1,14 +1,15 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.renderPopoverTrigger_unstable = void 0;
|
7
1
|
/**
|
8
2
|
* Render the final JSX of PopoverTrigger
|
9
|
-
*/
|
10
|
-
|
11
|
-
|
12
|
-
};
|
13
|
-
exports
|
3
|
+
*/ "use strict";
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
Object.defineProperty(exports, "renderPopoverTrigger_unstable", {
|
8
|
+
enumerable: true,
|
9
|
+
get: ()=>renderPopoverTrigger_unstable
|
10
|
+
});
|
11
|
+
const renderPopoverTrigger_unstable = (state)=>{
|
12
|
+
return state.children;
|
13
|
+
}; //# sourceMappingURL=renderPopoverTrigger.js.map
|
14
|
+
|
14
15
|
//# sourceMappingURL=renderPopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/PopoverTrigger/renderPopoverTrigger.js"],"sourcesContent":["/**\n * Render the final JSX of PopoverTrigger\n */export const renderPopoverTrigger_unstable = state => {\n return state.children;\n};\n//# sourceMappingURL=renderPopoverTrigger.js.map"],"names":["renderPopoverTrigger_unstable","state","children"],"mappings":"AAAA;;CAEC;;;;+BAAeA;;aAAAA;;AAAN,MAAMA,gCAAgCC,CAAAA,QAAS;IACvD,OAAOA,MAAMC,QAAQ;AACvB,GACA,gDAAgD"}
|
@@ -1,84 +1,75 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "usePopoverTrigger_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>usePopoverTrigger_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
const
|
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
|
-
'
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
};
|
73
|
-
const triggerChildProps = {
|
74
|
-
...contextMenuProps,
|
75
|
-
onClick: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
|
76
|
-
onKeyDown: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
|
77
|
-
};
|
78
|
-
const ariaButtonTriggerChildProps = react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);
|
79
|
-
return {
|
80
|
-
children: react_utilities_1.applyTriggerPropsToChildren(props.children, react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))
|
81
|
-
};
|
82
|
-
};
|
83
|
-
exports.usePopoverTrigger_unstable = usePopoverTrigger_unstable;
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
12
|
+
const _reactTabster = require("@fluentui/react-tabster");
|
13
|
+
const _popoverContext = require("../../popoverContext");
|
14
|
+
const _reactAria = require("@fluentui/react-aria");
|
15
|
+
const _keyboardKeys = require("@fluentui/keyboard-keys");
|
16
|
+
const usePopoverTrigger_unstable = (props)=>{
|
17
|
+
const { children , disableButtonEnhancement =false } = props;
|
18
|
+
const child = (0, _reactUtilities.getTriggerChild)(children);
|
19
|
+
const open = (0, _popoverContext.usePopoverContext_unstable)((context)=>context.open);
|
20
|
+
const setOpen = (0, _popoverContext.usePopoverContext_unstable)((context)=>context.setOpen);
|
21
|
+
const toggleOpen = (0, _popoverContext.usePopoverContext_unstable)((context)=>context.toggleOpen);
|
22
|
+
const triggerRef = (0, _popoverContext.usePopoverContext_unstable)((context)=>context.triggerRef);
|
23
|
+
const openOnHover = (0, _popoverContext.usePopoverContext_unstable)((context)=>context.openOnHover);
|
24
|
+
const openOnContext = (0, _popoverContext.usePopoverContext_unstable)((context)=>context.openOnContext);
|
25
|
+
const { triggerAttributes } = (0, _reactTabster.useModalAttributes)();
|
26
|
+
const onContextMenu = (e)=>{
|
27
|
+
if (openOnContext) {
|
28
|
+
e.preventDefault();
|
29
|
+
setOpen(e, true);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
const onClick = (e)=>{
|
33
|
+
if (!openOnContext) {
|
34
|
+
toggleOpen(e);
|
35
|
+
}
|
36
|
+
};
|
37
|
+
const onKeyDown = (e)=>{
|
38
|
+
if (e.key === _keyboardKeys.Escape && open) {
|
39
|
+
setOpen(e, false);
|
40
|
+
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
41
|
+
// e,g: Dialog, Menu
|
42
|
+
e.stopPropagation();
|
43
|
+
}
|
44
|
+
};
|
45
|
+
const onMouseEnter = (e)=>{
|
46
|
+
if (openOnHover) {
|
47
|
+
setOpen(e, true);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
const onMouseLeave = (e)=>{
|
51
|
+
if (openOnHover) {
|
52
|
+
setOpen(e, false);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
const contextMenuProps = {
|
56
|
+
...triggerAttributes,
|
57
|
+
'aria-expanded': `${open}`,
|
58
|
+
...child === null || child === void 0 ? void 0 : child.props,
|
59
|
+
onMouseEnter: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),
|
60
|
+
onMouseLeave: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),
|
61
|
+
onContextMenu: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),
|
62
|
+
ref: (0, _reactUtilities.useMergedRefs)(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
|
63
|
+
};
|
64
|
+
const triggerChildProps = {
|
65
|
+
...contextMenuProps,
|
66
|
+
onClick: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
|
67
|
+
onKeyDown: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
|
68
|
+
};
|
69
|
+
const ariaButtonTriggerChildProps = (0, _reactAria.useARIAButtonProps)((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);
|
70
|
+
return {
|
71
|
+
children: (0, _reactUtilities.applyTriggerPropsToChildren)(props.children, (0, _reactAria.useARIAButtonProps)((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))
|
72
|
+
};
|
73
|
+
}; //# sourceMappingURL=usePopoverTrigger.js.map
|
74
|
+
|
84
75
|
//# sourceMappingURL=usePopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/PopoverTrigger/usePopoverTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { applyTriggerPropsToChildren, getTriggerChild, mergeCallbacks, useMergedRefs, useEventCallback } from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = props => {\n const {\n children,\n disableButtonEnhancement = false\n } = props;\n const child = getTriggerChild(children);\n const open = usePopoverContext_unstable(context => context.open);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const toggleOpen = usePopoverContext_unstable(context => context.toggleOpen);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const {\n triggerAttributes\n } = useModalAttributes();\n const onContextMenu = e => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n const onClick = e => {\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n const onKeyDown = e => {\n if (e.key === Escape && open) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Menu\n e.stopPropagation();\n }\n };\n const onMouseEnter = e => {\n if (openOnHover) {\n setOpen(e, true);\n }\n };\n const onMouseLeave = e => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n const contextMenuProps = {\n ...triggerAttributes,\n 'aria-expanded': `${open}`,\n ...(child === null || child === void 0 ? void 0 : child.props),\n onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),\n ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)\n };\n const triggerChildProps = {\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))\n };\n const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);\n return {\n children: applyTriggerPropsToChildren(props.children, useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))\n };\n};\n//# sourceMappingURL=usePopoverTrigger.js.map"],"names":["usePopoverTrigger_unstable","props","children","disableButtonEnhancement","child","getTriggerChild","open","usePopoverContext_unstable","context","setOpen","toggleOpen","triggerRef","openOnHover","openOnContext","triggerAttributes","useModalAttributes","onContextMenu","e","preventDefault","onClick","onKeyDown","key","Escape","stopPropagation","onMouseEnter","onMouseLeave","contextMenuProps","useEventCallback","mergeCallbacks","ref","useMergedRefs","triggerChildProps","ariaButtonTriggerChildProps","useARIAButtonProps","type","applyTriggerPropsToChildren"],"mappings":"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"}
|
package/lib-commonjs/index.js
CHANGED
@@ -1,95 +1,33 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
5
|
-
});
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
enumerable: true,
|
35
|
-
get: function () {
|
36
|
-
return PopoverSurface_1.arrowHeights;
|
37
|
-
}
|
38
|
-
});
|
39
|
-
Object.defineProperty(exports, "popoverSurfaceClassNames", {
|
40
|
-
enumerable: true,
|
41
|
-
get: function () {
|
42
|
-
return PopoverSurface_1.popoverSurfaceClassNames;
|
43
|
-
}
|
44
|
-
});
|
45
|
-
Object.defineProperty(exports, "renderPopoverSurface_unstable", {
|
46
|
-
enumerable: true,
|
47
|
-
get: function () {
|
48
|
-
return PopoverSurface_1.renderPopoverSurface_unstable;
|
49
|
-
}
|
50
|
-
});
|
51
|
-
Object.defineProperty(exports, "usePopoverSurfaceStyles_unstable", {
|
52
|
-
enumerable: true,
|
53
|
-
get: function () {
|
54
|
-
return PopoverSurface_1.usePopoverSurfaceStyles_unstable;
|
55
|
-
}
|
56
|
-
});
|
57
|
-
Object.defineProperty(exports, "usePopoverSurface_unstable", {
|
58
|
-
enumerable: true,
|
59
|
-
get: function () {
|
60
|
-
return PopoverSurface_1.usePopoverSurface_unstable;
|
61
|
-
}
|
62
|
-
});
|
63
|
-
var popoverContext_1 = /*#__PURE__*/require("./popoverContext");
|
64
|
-
Object.defineProperty(exports, "PopoverProvider", {
|
65
|
-
enumerable: true,
|
66
|
-
get: function () {
|
67
|
-
return popoverContext_1.PopoverProvider;
|
68
|
-
}
|
69
|
-
});
|
70
|
-
Object.defineProperty(exports, "usePopoverContext_unstable", {
|
71
|
-
enumerable: true,
|
72
|
-
get: function () {
|
73
|
-
return popoverContext_1.usePopoverContext_unstable;
|
74
|
-
}
|
75
|
-
});
|
76
|
-
var PopoverTrigger_1 = /*#__PURE__*/require("./PopoverTrigger");
|
77
|
-
Object.defineProperty(exports, "PopoverTrigger", {
|
78
|
-
enumerable: true,
|
79
|
-
get: function () {
|
80
|
-
return PopoverTrigger_1.PopoverTrigger;
|
81
|
-
}
|
82
|
-
});
|
83
|
-
Object.defineProperty(exports, "renderPopoverTrigger_unstable", {
|
84
|
-
enumerable: true,
|
85
|
-
get: function () {
|
86
|
-
return PopoverTrigger_1.renderPopoverTrigger_unstable;
|
87
|
-
}
|
88
|
-
});
|
89
|
-
Object.defineProperty(exports, "usePopoverTrigger_unstable", {
|
90
|
-
enumerable: true,
|
91
|
-
get: function () {
|
92
|
-
return PopoverTrigger_1.usePopoverTrigger_unstable;
|
93
|
-
}
|
94
|
-
});
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
Popover: ()=>_popover.Popover,
|
13
|
+
renderPopover_unstable: ()=>_popover.renderPopover_unstable,
|
14
|
+
usePopover_unstable: ()=>_popover.usePopover_unstable,
|
15
|
+
PopoverSurface: ()=>_popoverSurface.PopoverSurface,
|
16
|
+
arrowHeights: ()=>_popoverSurface.arrowHeights,
|
17
|
+
popoverSurfaceClassNames: ()=>_popoverSurface.popoverSurfaceClassNames,
|
18
|
+
renderPopoverSurface_unstable: ()=>_popoverSurface.renderPopoverSurface_unstable,
|
19
|
+
usePopoverSurfaceStyles_unstable: ()=>_popoverSurface.usePopoverSurfaceStyles_unstable,
|
20
|
+
usePopoverSurface_unstable: ()=>_popoverSurface.usePopoverSurface_unstable,
|
21
|
+
PopoverProvider: ()=>_popoverContext.PopoverProvider,
|
22
|
+
usePopoverContext_unstable: ()=>_popoverContext.usePopoverContext_unstable,
|
23
|
+
PopoverTrigger: ()=>_popoverTrigger.PopoverTrigger,
|
24
|
+
renderPopoverTrigger_unstable: ()=>_popoverTrigger.renderPopoverTrigger_unstable,
|
25
|
+
usePopoverTrigger_unstable: ()=>_popoverTrigger.usePopoverTrigger_unstable
|
26
|
+
});
|
27
|
+
const _popover = require("./Popover");
|
28
|
+
const _popoverSurface = require("./PopoverSurface");
|
29
|
+
const _popoverContext = require("./popoverContext");
|
30
|
+
const _popoverTrigger = require("./PopoverTrigger");
|
31
|
+
//# sourceMappingURL=index.js.map
|
32
|
+
|
95
33
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Popover, renderPopover_unstable, usePopover_unstable } from './Popover';\nexport { PopoverSurface, arrowHeights, popoverSurfaceClassNames, renderPopoverSurface_unstable, usePopoverSurfaceStyles_unstable, usePopoverSurface_unstable } from './PopoverSurface';\nexport { PopoverProvider, usePopoverContext_unstable } from './popoverContext';\nexport { PopoverTrigger, renderPopoverTrigger_unstable, usePopoverTrigger_unstable } from './PopoverTrigger';\n//# sourceMappingURL=index.js.map"],"names":["Popover","renderPopover_unstable","usePopover_unstable","PopoverSurface","arrowHeights","popoverSurfaceClassNames","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","usePopoverSurface_unstable","PopoverProvider","usePopoverContext_unstable","PopoverTrigger","renderPopoverTrigger_unstable","usePopoverTrigger_unstable"],"mappings":";;;;;;;;;;;IAASA,OAAO,MAAPA,gBAAO;IAAEC,sBAAsB,MAAtBA,+BAAsB;IAAEC,mBAAmB,MAAnBA,4BAAmB;IACpDC,cAAc,MAAdA,8BAAc;IAAEC,YAAY,MAAZA,4BAAY;IAAEC,wBAAwB,MAAxBA,wCAAwB;IAAEC,6BAA6B,MAA7BA,6CAA6B;IAAEC,gCAAgC,MAAhCA,gDAAgC;IAAEC,0BAA0B,MAA1BA,0CAA0B;IACnJC,eAAe,MAAfA,+BAAe;IAAEC,0BAA0B,MAA1BA,0CAA0B;IAC3CC,cAAc,MAAdA,8BAAc;IAAEC,6BAA6B,MAA7BA,6CAA6B;IAAEC,0BAA0B,MAA1BA,0CAA0B;;yBAHb;gCAC+F;gCACxG;gCAC8B;CAC1F,iCAAiC"}
|
@@ -1,31 +1,40 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
PopoverContext: ()=>PopoverContext,
|
13
|
+
PopoverProvider: ()=>PopoverProvider,
|
14
|
+
usePopoverContext_unstable: ()=>usePopoverContext_unstable
|
5
15
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
exports.PopoverContext = /*#__PURE__*/react_context_selector_1.createContext(undefined);
|
16
|
+
const _reactContextSelector = require("@fluentui/react-context-selector");
|
17
|
+
const PopoverContext = /*#__PURE__*/ (0, _reactContextSelector.createContext)(undefined);
|
9
18
|
const popoverContextDefaultValue = {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
open: false,
|
20
|
+
setOpen: ()=>null,
|
21
|
+
toggleOpen: ()=>null,
|
22
|
+
triggerRef: {
|
23
|
+
current: null
|
24
|
+
},
|
25
|
+
contentRef: {
|
26
|
+
current: null
|
27
|
+
},
|
28
|
+
arrowRef: {
|
29
|
+
current: null
|
30
|
+
},
|
31
|
+
openOnContext: false,
|
32
|
+
openOnHover: false,
|
33
|
+
size: 'medium',
|
34
|
+
trapFocus: false,
|
35
|
+
inline: false
|
27
36
|
};
|
28
|
-
|
29
|
-
const usePopoverContext_unstable = selector
|
30
|
-
|
37
|
+
const PopoverProvider = PopoverContext.Provider;
|
38
|
+
const usePopoverContext_unstable = (selector)=>(0, _reactContextSelector.useContextSelector)(PopoverContext, (ctx = popoverContextDefaultValue)=>selector(ctx)); //# sourceMappingURL=popoverContext.js.map
|
39
|
+
|
31
40
|
//# sourceMappingURL=popoverContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/popoverContext.js"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nexport const PopoverContext = /*#__PURE__*/createContext(undefined);\nconst popoverContextDefaultValue = {\n open: false,\n setOpen: () => null,\n toggleOpen: () => null,\n triggerRef: {\n current: null\n },\n contentRef: {\n current: null\n },\n arrowRef: {\n current: null\n },\n openOnContext: false,\n openOnHover: false,\n size: 'medium',\n trapFocus: false,\n inline: false\n};\nexport const PopoverProvider = PopoverContext.Provider;\nexport const usePopoverContext_unstable = selector => useContextSelector(PopoverContext, (ctx = popoverContextDefaultValue) => selector(ctx));\n//# sourceMappingURL=popoverContext.js.map"],"names":["PopoverContext","PopoverProvider","usePopoverContext_unstable","createContext","undefined","popoverContextDefaultValue","open","setOpen","toggleOpen","triggerRef","current","contentRef","arrowRef","openOnContext","openOnHover","size","trapFocus","inline","Provider","selector","useContextSelector","ctx"],"mappings":";;;;;;;;;;;IACaA,cAAc,MAAdA;IAoBAC,eAAe,MAAfA;IACAC,0BAA0B,MAA1BA;;sCAtBqC;AAC3C,MAAMF,iBAAiB,WAAW,GAAEG,IAAAA,mCAAa,EAACC;AACzD,MAAMC,6BAA6B;IACjCC,MAAM,KAAK;IACXC,SAAS,IAAM,IAAI;IACnBC,YAAY,IAAM,IAAI;IACtBC,YAAY;QACVC,SAAS,IAAI;IACf;IACAC,YAAY;QACVD,SAAS,IAAI;IACf;IACAE,UAAU;QACRF,SAAS,IAAI;IACf;IACAG,eAAe,KAAK;IACpBC,aAAa,KAAK;IAClBC,MAAM;IACNC,WAAW,KAAK;IAChBC,QAAQ,KAAK;AACf;AACO,MAAMhB,kBAAkBD,eAAekB,QAAQ;AAC/C,MAAMhB,6BAA6BiB,CAAAA,WAAYC,IAAAA,wCAAkB,EAACpB,gBAAgB,CAACqB,MAAMhB,0BAA0B,GAAKc,SAASE,OACxI,0CAA0C"}
|