@fluentui/react-popover 9.0.0-beta.1 → 9.0.0-beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/CHANGELOG.json +287 -1
  2. package/CHANGELOG.md +72 -2
  3. package/dist/react-popover.d.ts +7 -3
  4. package/lib/components/Popover/Popover.js +2 -2
  5. package/lib/components/Popover/Popover.js.map +1 -1
  6. package/lib/components/Popover/Popover.types.d.ts +5 -3
  7. package/lib/components/Popover/renderPopover.js +27 -25
  8. package/lib/components/Popover/renderPopover.js.map +1 -1
  9. package/lib/components/Popover/usePopover.js +39 -51
  10. package/lib/components/Popover/usePopover.js.map +1 -1
  11. package/lib/components/PopoverSurface/PopoverSurface.js +2 -2
  12. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  13. package/lib/components/PopoverSurface/renderPopoverSurface.js +6 -7
  14. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  15. package/lib/components/PopoverSurface/usePopoverSurface.js +41 -55
  16. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  17. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -0
  18. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +16 -8
  19. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  20. package/lib/components/PopoverTrigger/PopoverTrigger.js +2 -2
  21. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  22. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  23. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  24. package/lib/components/PopoverTrigger/usePopoverTrigger.js +25 -33
  25. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  26. package/lib/popoverContext.js +3 -7
  27. package/lib/popoverContext.js.map +1 -1
  28. package/lib-commonjs/Popover.js +1 -1
  29. package/lib-commonjs/PopoverSurface.js +1 -1
  30. package/lib-commonjs/PopoverTrigger.js +1 -1
  31. package/lib-commonjs/components/Popover/Popover.js +4 -4
  32. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  33. package/lib-commonjs/components/Popover/Popover.types.d.ts +5 -3
  34. package/lib-commonjs/components/Popover/index.js +1 -1
  35. package/lib-commonjs/components/Popover/renderPopover.js +29 -27
  36. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  37. package/lib-commonjs/components/Popover/usePopover.js +45 -58
  38. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  39. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +6 -6
  40. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  41. package/lib-commonjs/components/PopoverSurface/index.js +1 -1
  42. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +10 -12
  43. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  44. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +44 -59
  45. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  46. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -0
  47. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +18 -9
  48. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  49. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +4 -4
  50. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  51. package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
  52. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  53. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  54. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +29 -38
  55. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  56. package/lib-commonjs/index.js +1 -1
  57. package/lib-commonjs/popoverContext.js +3 -7
  58. package/lib-commonjs/popoverContext.js.map +1 -1
  59. package/package.json +13 -13
  60. package/lib/common/isConformant.d.ts +0 -4
  61. package/lib/common/isConformant.js +0 -13
  62. package/lib/common/isConformant.js.map +0 -1
  63. package/lib/common/mockUsePopoverContext.d.ts +0 -7
  64. package/lib/common/mockUsePopoverContext.js +0 -38
  65. package/lib/common/mockUsePopoverContext.js.map +0 -1
  66. package/lib-commonjs/common/isConformant.d.ts +0 -4
  67. package/lib-commonjs/common/isConformant.js +0 -24
  68. package/lib-commonjs/common/isConformant.js.map +0 -1
  69. package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
  70. package/lib-commonjs/common/mockUsePopoverContext.js +0 -49
  71. package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -1,4 +1,3 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
4
3
  import { useFluent } from '@fluentui/react-shared-contexts';
@@ -14,70 +13,59 @@ import { arrowHeights } from '../PopoverSurface/index';
14
13
  * @param props - props from this instance of Popover
15
14
  */
16
15
 
17
- export var usePopover = function (props) {
18
- var _a = usePopperMouseTarget(),
19
- contextTarget = _a[0],
20
- setContextTarget = _a[1];
21
-
22
- var initialState = __assign({
16
+ export const usePopover = props => {
17
+ const [contextTarget, setContextTarget] = usePopperMouseTarget();
18
+ const initialState = {
23
19
  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;
20
+ contextTarget,
21
+ setContextTarget,
22
+ ...props
23
+ };
24
+ const [open, setOpen] = useOpenState(initialState);
25
+ const popperRefs = usePopoverRefs(initialState);
26
+ const {
27
+ targetDocument
28
+ } = useFluent();
34
29
  useOnClickOutside({
35
30
  contains: elementContains,
36
31
  element: targetDocument,
37
- callback: function (ev) {
38
- return setOpen(ev, false);
39
- },
32
+ callback: ev => setOpen(ev, false),
40
33
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
41
34
  disabled: !open
42
35
  });
43
36
  useOnScrollOutside({
44
37
  contains: elementContains,
45
38
  element: targetDocument,
46
- callback: function (ev) {
47
- return setOpen(ev, false);
48
- },
39
+ callback: ev => setOpen(ev, false),
49
40
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
50
41
  disabled: !open || !initialState.openOnContext
51
42
  });
52
- return __assign(__assign(__assign({}, initialState), popperRefs), {
53
- open: open,
54
- setOpen: setOpen,
55
- setContextTarget: setContextTarget,
56
- contextTarget: contextTarget
57
- });
43
+ return { ...initialState,
44
+ ...popperRefs,
45
+ open,
46
+ setOpen,
47
+ setContextTarget,
48
+ contextTarget
49
+ };
58
50
  };
59
51
  /**
60
52
  * Creates and manages the Popover open state
61
53
  */
62
54
 
63
55
  function useOpenState(state) {
64
- var onOpenChange = useEventCallback(function (e, data) {
56
+ const onOpenChange = useEventCallback((e, data) => {
65
57
  var _a;
66
58
 
67
59
  return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
68
60
  });
69
-
70
- var _a = useControllableState({
61
+ const [open, setOpenState] = useControllableState({
71
62
  state: state.open,
72
63
  defaultState: state.defaultOpen,
73
64
  initialState: false
74
- }),
75
- open = _a[0],
76
- setOpenState = _a[1];
77
-
65
+ });
78
66
  state.open = open !== undefined ? open : state.open;
79
- var setContextTarget = state.setContextTarget;
80
- var setOpen = React.useCallback(function (e, shouldOpen) {
67
+ const setContextTarget = state.setContextTarget;
68
+ const setOpen = React.useCallback((e, shouldOpen) => {
81
69
  if (shouldOpen && e.type === 'contextmenu') {
82
70
  setContextTarget(e);
83
71
  }
@@ -86,7 +74,7 @@ function useOpenState(state) {
86
74
  setContextTarget(undefined);
87
75
  }
88
76
 
89
- setOpenState(function (prevOpen) {
77
+ setOpenState(prevOpen => {
90
78
  // More than one event (mouse, focus, keyboard) can request the Popover to close
91
79
  // We assume the first event is the correct one
92
80
  if (prevOpen !== shouldOpen) {
@@ -106,12 +94,12 @@ function useOpenState(state) {
106
94
 
107
95
 
108
96
  function usePopoverRefs(state) {
109
- var popperOptions = __assign({
97
+ const popperOptions = {
110
98
  position: 'above',
111
99
  align: 'center',
112
- target: state.openOnContext ? state.contextTarget : undefined
113
- }, resolvePositioningShorthand(state.positioning)); // no reason to render arrow when covering the target
114
-
100
+ target: state.openOnContext ? state.contextTarget : undefined,
101
+ ...resolvePositioningShorthand(state.positioning)
102
+ }; // no reason to render arrow when covering the target
115
103
 
116
104
  if (popperOptions.coverTarget) {
117
105
  state.noArrow = true;
@@ -121,15 +109,15 @@ function usePopoverRefs(state) {
121
109
  popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
122
110
  }
123
111
 
124
- var _a = usePopper(popperOptions),
125
- triggerRef = _a.targetRef,
126
- contentRef = _a.containerRef,
127
- arrowRef = _a.arrowRef;
128
-
112
+ const {
113
+ targetRef: triggerRef,
114
+ containerRef: contentRef,
115
+ arrowRef
116
+ } = usePopper(popperOptions);
129
117
  return {
130
- triggerRef: triggerRef,
131
- contentRef: contentRef,
132
- arrowRef: arrowRef
118
+ triggerRef,
119
+ contentRef,
120
+ arrowRef
133
121
  };
134
122
  }
135
123
  //# sourceMappingURL=usePopover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/usePopover.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,oBADF,EAEE,gBAFF,EAGE,iBAHF,EAIE,kBAJF,QAKO,2BALP;AAMA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SACE,SADF,EAEE,2BAFF,EAGE,gBAHF,EAIE,oBAJF,QAKO,6BALP;AAMA,SAAS,eAAT,QAAgC,wBAAhC;AACA,SAAS,YAAT,QAA6B,yBAA7B;AAGA;;;;;;;AAOG;;AACH,OAAO,IAAM,UAAU,GAAG,UAAC,KAAD,EAAoB;A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 import { usePopoverSurfaceStyles } from './usePopoverSurfaceStyles';
6
6
  * PopoverSurface component renders react children in a positioned box
7
7
  */
8
8
 
9
- export var PopoverSurface = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var state = usePopoverSurface(props, ref);
9
+ export const PopoverSurface = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = usePopoverSurface(props, ref);
11
11
  usePopoverSurfaceStyles(state);
12
12
  return renderPopoverSurface(state);
13
13
  });
@@ -1 +1 @@
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
+ {"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,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,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,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 var renderPopoverSurface = function (state) {
11
- var _a = getSlots(state, popoverSurfaceSlots),
12
- slots = _a.slots,
13
- slotProps = _a.slotProps; // TODO should hidden Popovers be supported ?
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, __assign({}, slotProps.root), !state.noArrow && /*#__PURE__*/React.createElement("div", {
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":";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,CAAs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,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 var popoverSurfaceSlots = ['root'];
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 var usePopoverSurface = function (props, ref) {
18
- var contentRef = usePopoverContext(function (context) {
19
- return context.contentRef;
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
- 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,
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', __assign(__assign({
42
+ root: getNativeElementProps('div', {
62
43
  ref: useMergedRefs(ref, contentRef),
63
- role: 'dialog'
64
- }, modalAttributes), props))
44
+ role: 'dialog',
45
+ ...modalAttributes,
46
+ ...props
47
+ })
65
48
  };
66
- var _a = state.root,
67
- onMouseEnterOriginal = _a.onMouseEnter,
68
- onMouseLeaveOriginal = _a.onMouseLeave,
69
- onKeyDownOriginal = _a.onKeyDown;
49
+ const {
50
+ onMouseEnter: onMouseEnterOriginal,
51
+ onMouseLeave: onMouseLeaveOriginal,
52
+ onKeyDown: onKeyDownOriginal
53
+ } = state.root;
70
54
 
71
- state.root.onMouseEnter = function (e) {
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 = function (e) {
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 = function (e) {
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
- var findFirstFocusable = useFocusFinders().findFirstFocusable;
100
- React.useEffect(function () {
83
+ const {
84
+ findFirstFocusable
85
+ } = useFocusFinders();
86
+ React.useEffect(() => {
101
87
  if (state.open && contentRef.current) {
102
- var firstFocusable = findFirstFocusable(contentRef.current);
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":";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,IAAM,mBAAmB,GAAqC,CAAC,MAAD,CAA9D;AAEP;;;;;;;;AAQG;;AACH,OAAO,IAAM,iBAAiB,GAAG,UAAC,KAAD,EAA6B,GAA7B,EAA2D;AAC1F,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAA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K;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
- export var arrowHeights = {
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
- var useStyles = /*#__PURE__*/__styles({
13
+ const useStyles = /*#__PURE__*/__styles({
12
14
  "root": {
13
15
  "De3pzq": "fxugw4r",
14
- "E5pizo": ["f1hg901r", "f136t921"],
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": ["fzd2j21", "f2549he"],
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);}", ".f136t921{box-shadow:var(--shadow-16);}", ".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);}", ".f2549he: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^=\"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;}"]
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 var usePopoverSurfaceStyles = function (state) {
95
- var styles = useStyles();
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,IAAM,YAAY,GAAgC;AACvD,EAAA,KAAK,EAAE,CADgD;AAEvD,EAAA,MAAM,EAAE,CAF+C;AAGvD,EAAA,KAAK,EAAE;AAHgD,CAAlD;AAMP;;AAEG;;AACH,IAAM,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,EAAlB;AAqEA;;AAEG;;;AACH,OAAO,IAAM,uBAAuB,GAAG,UAAC,KAAD,EAA2B;AAChE,MAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,C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AA;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 var PopoverTrigger = function (props) {
8
- var state = usePopoverTrigger(props);
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,IAAM,cAAc,GAAkC,UAAA,KAAA,EAAK;AAChE,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,CAA/B;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJM;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
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,7 +1,7 @@
1
1
  /**
2
2
  * Render the final JSX of PopoverTrigger
3
3
  */
4
- export var renderPopoverTrigger = function (state) {
4
+ export const renderPopoverTrigger = state => {
5
5
  return state.children;
6
6
  };
7
7
  //# sourceMappingURL=renderPopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AAC7D,SAAO,KAAK,CAAC,QAAb;AACD,CAFM","sourceRoot":""}
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 var usePopoverTrigger = function (props) {
16
- var setOpen = usePopoverContext(function (context) {
17
- return context.setOpen;
18
- });
19
- var open = usePopoverContext(function (context) {
20
- return context.open;
21
- });
22
- var triggerRef = usePopoverContext(function (context) {
23
- return context.triggerRef;
24
- });
25
- var openOnHover = usePopoverContext(function (context) {
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
- var onClick = useEventCallback(function (e) {
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
- var onKeyDown = useEventCallback(function (e) {
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
- var onMouseEnter = useEventCallback(function (e) {
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
- var onMouseLeave = useEventCallback(function (e) {
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
- var child = React.Children.only(props.children);
75
+ const child = React.Children.only(props.children);
84
76
  return {
85
- children: /*#__PURE__*/React.cloneElement(child, __assign(__assign(__assign(__assign({}, triggerAttributes), {
86
- 'aria-haspopup': 'true'
87
- }), child.props), {
88
- onClick: onClick,
89
- onMouseEnter: onMouseEnter,
90
- onKeyDown: onKeyDown,
91
- onMouseLeave: onMouseLeave,
92
- onContextMenu: 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