@fluentui/react-popover 9.0.0-nightly.b5b7401007.0 → 9.0.0-rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. package/CHANGELOG.json +425 -29
  2. package/CHANGELOG.md +104 -20
  3. package/dist/react-popover.d.ts +31 -20
  4. package/lib/Popover.js.map +1 -1
  5. package/lib/PopoverSurface.js.map +1 -1
  6. package/lib/PopoverTrigger.js.map +1 -1
  7. package/lib/components/Popover/Popover.js +5 -5
  8. package/lib/components/Popover/Popover.js.map +1 -1
  9. package/lib/components/Popover/Popover.types.d.ts +2 -1
  10. package/lib/components/Popover/Popover.types.js.map +1 -1
  11. package/lib/components/Popover/index.js.map +1 -1
  12. package/lib/components/Popover/renderPopover.d.ts +1 -1
  13. package/lib/components/Popover/renderPopover.js +27 -25
  14. package/lib/components/Popover/renderPopover.js.map +1 -1
  15. package/lib/components/Popover/usePopover.d.ts +2 -2
  16. package/lib/components/Popover/usePopover.js +42 -53
  17. package/lib/components/Popover/usePopover.js.map +1 -1
  18. package/lib/components/PopoverSurface/PopoverSurface.js +7 -7
  19. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  20. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  21. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  22. package/lib/components/PopoverSurface/index.js.map +1 -1
  23. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  24. package/lib/components/PopoverSurface/renderPopoverSurface.js +7 -8
  25. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  26. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  27. package/lib/components/PopoverSurface/usePopoverSurface.js +44 -58
  28. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  29. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
  30. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +34 -22
  31. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  32. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  33. package/lib/components/PopoverTrigger/PopoverTrigger.js +6 -5
  34. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  35. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  36. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  37. package/lib/components/PopoverTrigger/index.js.map +1 -1
  38. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  39. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  40. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  41. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  42. package/lib/components/PopoverTrigger/usePopoverTrigger.js +39 -54
  43. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  44. package/lib/index.js.map +1 -1
  45. package/lib/popoverContext.d.ts +1 -1
  46. package/lib/popoverContext.js +3 -7
  47. package/lib/popoverContext.js.map +1 -1
  48. package/lib-commonjs/Popover.js +1 -1
  49. package/lib-commonjs/Popover.js.map +1 -1
  50. package/lib-commonjs/PopoverSurface.js +1 -1
  51. package/lib-commonjs/PopoverSurface.js.map +1 -1
  52. package/lib-commonjs/PopoverTrigger.js +1 -1
  53. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  54. package/lib-commonjs/components/Popover/Popover.js +5 -5
  55. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  56. package/lib-commonjs/components/Popover/Popover.types.d.ts +2 -1
  57. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  58. package/lib-commonjs/components/Popover/index.js +1 -1
  59. package/lib-commonjs/components/Popover/index.js.map +1 -1
  60. package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
  61. package/lib-commonjs/components/Popover/renderPopover.js +31 -29
  62. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  63. package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
  64. package/lib-commonjs/components/Popover/usePopover.js +50 -62
  65. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  66. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +8 -8
  67. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  68. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  69. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  70. package/lib-commonjs/components/PopoverSurface/index.js +1 -1
  71. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  72. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  73. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +12 -15
  74. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  75. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  76. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +50 -65
  77. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  78. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
  79. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +38 -24
  80. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  81. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  82. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +6 -5
  83. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  84. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  85. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  86. package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
  87. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  88. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  89. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
  90. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  91. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  92. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +44 -60
  93. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  94. package/lib-commonjs/index.js +1 -1
  95. package/lib-commonjs/index.js.map +1 -1
  96. package/lib-commonjs/popoverContext.d.ts +1 -1
  97. package/lib-commonjs/popoverContext.js +5 -9
  98. package/lib-commonjs/popoverContext.js.map +1 -1
  99. package/package.json +13 -15
  100. package/lib/common/isConformant.d.ts +0 -4
  101. package/lib/common/isConformant.js +0 -13
  102. package/lib/common/isConformant.js.map +0 -1
  103. package/lib/common/mockUsePopoverContext.d.ts +0 -7
  104. package/lib/common/mockUsePopoverContext.js +0 -38
  105. package/lib/common/mockUsePopoverContext.js.map +0 -1
  106. package/lib-commonjs/common/isConformant.d.ts +0 -4
  107. package/lib-commonjs/common/isConformant.js +0 -24
  108. package/lib-commonjs/common/isConformant.js.map +0 -1
  109. package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
  110. package/lib-commonjs/common/mockUsePopoverContext.js +0 -49
  111. package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -3,9 +3,16 @@ import * as React from 'react';
3
3
  * PopoverTrigger Props
4
4
  */
5
5
  export declare type PopoverTriggerProps = {
6
- children: React.ReactElement;
6
+ children: (React.ReactElement & {
7
+ ref?: React.Ref<unknown>;
8
+ }) | ((props: PopoverTriggerChildProps) => React.ReactElement | null);
7
9
  };
8
10
  /**
9
11
  * PopoverTrigger State
10
12
  */
11
- export declare type PopoverTriggerState = PopoverTriggerProps;
13
+ export declare type PopoverTriggerState = {
14
+ children: React.ReactElement | null;
15
+ };
16
+ export declare type PopoverTriggerChildProps = {
17
+ ref?: React.Ref<never>;
18
+ } & Pick<React.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var tslib_1 = /*#__PURE__*/require("tslib");
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./PopoverTrigger"), exports);
10
10
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import type { PopoverTriggerState } from './PopoverTrigger.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverTrigger
4
4
  */
5
- export declare const renderPopoverTrigger: (state: PopoverTriggerState) => JSX.Element;
5
+ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderPopoverTrigger = void 0;
6
+ exports.renderPopoverTrigger_unstable = void 0;
7
7
  /**
8
8
  * Render the final JSX of PopoverTrigger
9
9
  */
10
10
 
11
- var renderPopoverTrigger = function (state) {
11
+ const renderPopoverTrigger_unstable = state => {
12
12
  return state.children;
13
13
  };
14
14
 
15
- exports.renderPopoverTrigger = renderPopoverTrigger;
15
+ exports.renderPopoverTrigger_unstable = renderPopoverTrigger_unstable;
16
16
  //# sourceMappingURL=renderPopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AAC7D,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourcesContent":["import type { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger_unstable = (state: PopoverTriggerState) => {\n return state.children;\n};\n"],"sourceRoot":"../src/"}
@@ -3,8 +3,8 @@ import type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.
3
3
  * Create the state required to render PopoverTrigger.
4
4
  *
5
5
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
6
- * before being passed to renderPopoverTrigger.
6
+ * before being passed to renderPopoverTrigger_unstable.
7
7
  *
8
8
  * @param props - props from this instance of PopoverTrigger
9
9
  */
10
- export declare const usePopoverTrigger: (props: PopoverTriggerProps) => PopoverTriggerState;
10
+ export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
@@ -3,65 +3,57 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopoverTrigger = void 0;
6
+ exports.usePopoverTrigger_unstable = void 0;
7
7
 
8
- var tslib_1 = /*#__PURE__*/require("tslib");
8
+ const React = /*#__PURE__*/require("react");
9
9
 
10
- var React = /*#__PURE__*/require("react");
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
11
 
12
- var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
12
+ const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
13
13
 
14
- var react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
15
-
16
- var popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
14
+ const popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
17
15
  /**
18
16
  * Create the state required to render PopoverTrigger.
19
17
  *
20
18
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
21
- * before being passed to renderPopoverTrigger.
19
+ * before being passed to renderPopoverTrigger_unstable.
22
20
  *
23
21
  * @param props - props from this instance of PopoverTrigger
24
22
  */
25
23
 
26
24
 
27
- var usePopoverTrigger = function (props) {
28
- var setOpen = popoverContext_1.usePopoverContext(function (context) {
29
- return context.setOpen;
30
- });
31
- var open = popoverContext_1.usePopoverContext(function (context) {
32
- return context.open;
33
- });
34
- var triggerRef = popoverContext_1.usePopoverContext(function (context) {
35
- return context.triggerRef;
36
- });
37
- var openOnHover = popoverContext_1.usePopoverContext(function (context) {
38
- return context.openOnHover;
39
- });
40
- var openOnContext = popoverContext_1.usePopoverContext(function (context) {
41
- return context.openOnContext;
42
- });
43
- var triggerAttributes = react_tabster_1.useModalAttributes().triggerAttributes;
44
- var onContextMenu = react_utilities_1.useEventCallback(function (e) {
45
- var _a, _b;
46
-
25
+ const usePopoverTrigger_unstable = props => {
26
+ var _a, _b, _c, _d, _e;
27
+
28
+ const {
29
+ children
30
+ } = props;
31
+ const child = React.isValidElement(children) ? react_utilities_1.getTriggerChild(children) : undefined;
32
+ const setOpen = popoverContext_1.usePopoverContext_unstable(context => context.setOpen);
33
+ const open = popoverContext_1.usePopoverContext_unstable(context => context.open);
34
+ const triggerRef = popoverContext_1.usePopoverContext_unstable(context => context.triggerRef);
35
+ const openOnHover = popoverContext_1.usePopoverContext_unstable(context => context.openOnHover);
36
+ const openOnContext = popoverContext_1.usePopoverContext_unstable(context => context.openOnContext);
37
+ const trapFocus = popoverContext_1.usePopoverContext_unstable(context => context.trapFocus);
38
+ const {
39
+ triggerAttributes
40
+ } = react_tabster_1.useModalAttributes();
41
+
42
+ const onContextMenu = e => {
47
43
  if (openOnContext) {
48
44
  e.preventDefault();
49
45
  setOpen(e, true);
50
46
  }
47
+ };
51
48
 
52
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
53
- });
54
- var onClick = react_utilities_1.useEventCallback(function (e) {
55
- var _a, _b;
56
-
49
+ const onClick = e => {
57
50
  if (!openOnContext) {
58
51
  setOpen(e, !open);
59
52
  }
53
+ };
60
54
 
61
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
62
- });
63
- var onKeyDown = react_utilities_1.useEventCallback(function (e) {
64
- var _a, _b, _c;
55
+ const onKeyDown = e => {
56
+ var _a;
65
57
 
66
58
  if (react_utilities_1.shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
67
59
  e.preventDefault();
@@ -71,41 +63,33 @@ var usePopoverTrigger = function (props) {
71
63
  if (e.key === 'Escape') {
72
64
  setOpen(e, false);
73
65
  }
66
+ };
74
67
 
75
- (_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
76
- });
77
- var onMouseEnter = react_utilities_1.useEventCallback(function (e) {
78
- var _a, _b;
79
-
68
+ const onMouseEnter = react_utilities_1.useEventCallback(e => {
80
69
  if (openOnHover) {
81
70
  setOpen(e, true);
82
71
  }
83
-
84
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
85
72
  });
86
- var onMouseLeave = react_utilities_1.useEventCallback(function (e) {
87
- var _a, _b;
88
73
 
74
+ const onMouseLeave = e => {
89
75
  if (openOnHover) {
90
76
  setOpen(e, false);
91
77
  }
78
+ };
92
79
 
93
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
94
- });
95
- var child = React.Children.only(props.children);
96
80
  return {
97
- children: React.cloneElement(child, tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, triggerAttributes), {
98
- 'aria-haspopup': 'true'
99
- }), child.props), {
100
- onClick: onClick,
101
- onMouseEnter: onMouseEnter,
102
- onKeyDown: onKeyDown,
103
- onMouseLeave: onMouseLeave,
104
- onContextMenu: onContextMenu,
105
- ref: react_utilities_1.useMergedRefs(child.ref, triggerRef)
106
- }))
81
+ children: react_utilities_1.applyTriggerPropsToChildren(props.children, { ...triggerAttributes,
82
+ 'aria-haspopup': trapFocus ? 'dialog' : 'true',
83
+ ...(child === null || child === void 0 ? void 0 : child.props),
84
+ onClick: react_utilities_1.useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
85
+ onMouseEnter: react_utilities_1.useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
86
+ onKeyDown: react_utilities_1.useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onKeyDown, onKeyDown),
87
+ onMouseLeave: react_utilities_1.useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onMouseLeave, onMouseLeave),
88
+ onContextMenu: react_utilities_1.useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
89
+ ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
90
+ })
107
91
  };
108
92
  };
109
93
 
110
- exports.usePopoverTrigger = usePopoverTrigger;
94
+ exports.usePopoverTrigger_unstable = usePopoverTrigger_unstable;
111
95
  //# sourceMappingURL=usePopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;;;;;;AAOG;;;AACI,IAAM,iBAAiB,GAAG,UAAC,KAAD,EAA2B;AAC1D,MAAM,OAAO,GAAG,gBAAA,CAAA,iBAAA,CAAkB,UAAA,OAAA,EAAO;AAAI,WAAA,OAAO,CAAP,OAAA;AAAe,GAA5C,CAAhB;AACA,MAAM,IAAI,GAAG,gBAAA,CAAA,iBAAA,CAAkB,UAAA,OAAA,EAAO;AAAI,WAAA,OAAO,CAAP,IAAA;AAAY,GAAzC,CAAb;AAC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A,CAAZ,GAAY,EAAA,CAAE,aAAtC,EAAqD,aAArD,CAR+D;AAS9E,MAAA,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,UAAd,EAA0B,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAAjC;AATyE,KAAtE;AADL,GAAP;AAaD,CA7DM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n shouldPreventDefaultOnKeyDown,\n useMergedRefs,\n useMergedEventCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerChildProps, PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\n\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: PopoverTriggerProps): PopoverTriggerState => {\n const { children } = props;\n const child = React.isValidElement(children) ? getTriggerChild(children) : undefined;\n\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const open = usePopoverContext_unstable(context => context.open);\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 trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n setOpen(e, !open);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {\n e.preventDefault();\n (e.target as HTMLElement)?.click();\n }\n\n if (e.key === 'Escape') {\n setOpen(e, false);\n }\n };\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n });\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n\n return {\n children: applyTriggerPropsToChildren<PopoverTriggerChildProps>(props.children, {\n ...triggerAttributes,\n 'aria-haspopup': trapFocus ? 'dialog' : 'true',\n ...child?.props,\n onClick: useMergedEventCallbacks(child?.props?.onClick, onClick),\n onMouseEnter: useMergedEventCallbacks(child?.props?.onMouseEnter, onMouseEnter),\n onKeyDown: useMergedEventCallbacks(child?.props?.onKeyDown, onKeyDown),\n onMouseLeave: useMergedEventCallbacks(child?.props?.onMouseLeave, onMouseLeave),\n onContextMenu: useMergedEventCallbacks(child?.props?.onContextMenu, onContextMenu),\n ref: useMergedRefs(triggerRef, child?.ref),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var tslib_1 = /*#__PURE__*/require("tslib");
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./Popover"), exports);
10
10
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Popover';\nexport * from './PopoverSurface';\nexport * from './popoverContext';\nexport * from './PopoverTrigger';\n"],"sourceRoot":"../src/"}
@@ -5,4 +5,4 @@ export declare const PopoverContext: Context<PopoverContextValue>;
5
5
  * Context shared between Popover and its children components
6
6
  */
7
7
  export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
8
- export declare const usePopoverContext: <T>(selector: ContextSelector<Pick<PopoverState, "mountNode" | "open" | "setOpen" | "triggerRef" | "contentRef" | "openOnHover" | "openOnContext" | "noArrow" | "arrowRef" | "size" | "appearance" | "trapFocus">, T>) => T;
8
+ export declare const usePopoverContext_unstable: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
@@ -3,15 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopoverContext = exports.PopoverContext = void 0;
6
+ exports.usePopoverContext_unstable = exports.PopoverContext = void 0;
7
7
 
8
- var react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
8
+ const react_context_selector_1 = /*#__PURE__*/require("@fluentui/react-context-selector");
9
9
 
10
10
  exports.PopoverContext = /*#__PURE__*/react_context_selector_1.createContext({
11
11
  open: false,
12
- setOpen: function () {
13
- return null;
14
- },
12
+ setOpen: () => null,
15
13
  triggerRef: {
16
14
  current: null
17
15
  },
@@ -27,9 +25,7 @@ exports.PopoverContext = /*#__PURE__*/react_context_selector_1.createContext({
27
25
  trapFocus: false
28
26
  });
29
27
 
30
- var usePopoverContext = function (selector) {
31
- return react_context_selector_1.useContextSelector(exports.PopoverContext, selector);
32
- };
28
+ const usePopoverContext_unstable = selector => react_context_selector_1.useContextSelector(exports.PopoverContext, selector);
33
29
 
34
- exports.usePopoverContext = usePopoverContext;
30
+ exports.usePopoverContext_unstable = usePopoverContext_unstable;
35
31
  //# sourceMappingURL=popoverContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/popoverContext.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAIa,OAAA,CAAA,cAAA,gBAA+C,wBAAA,CAAA,aAAA,CAAmC;AAC7F,EAAA,IAAI,EAAE,KADuF;AAE7F,EAAA,OAAO,EAAE,YAAA;AAAM,WAAA,IAAA;AAAI,GAF0E;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,CAAnC,CAA/C;;AA+BN,IAAM,iBAAiB,GAAG,UAAI,QAAJ,EAAqD;AACpF,SAAA,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,cAAnB,EAAmC,QAAnC,CAAA;AAA4C,CADvC;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourceRoot":""}
1
+ {"version":3,"sources":["popoverContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAIa,OAAA,CAAA,cAAA,gBAA+C,wBAAA,CAAA,aAAA,CAAmC;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,CAAnC,CAA/C;;AA+BN,MAAM,0BAA0B,GAAO,QAAJ,IACxC,wBAAA,CAAA,kBAAA,CAAmB,OAAA,CAAA,cAAnB,EAAmC,QAAnC,CADK;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { PopoverState } from './components/Popover/index';\n\nexport const PopoverContext: Context<PopoverContextValue> = createContext<PopoverContextValue>({\n open: false,\n setOpen: () => null,\n triggerRef: { current: null },\n contentRef: { current: null },\n arrowRef: { current: null },\n openOnContext: false,\n openOnHover: false,\n size: 'medium',\n trapFocus: false,\n});\n\n/**\n * Context shared between Popover and its children components\n */\nexport type PopoverContextValue = Pick<\n PopoverState,\n | 'open'\n | 'setOpen'\n | 'triggerRef'\n | 'contentRef'\n | 'openOnHover'\n | 'openOnContext'\n | 'mountNode'\n | 'noArrow'\n | 'arrowRef'\n | 'size'\n | 'appearance'\n | 'trapFocus'\n>;\n\nexport const usePopoverContext_unstable = <T>(selector: ContextSelector<PopoverContextValue, T>): T =>\n useContextSelector(PopoverContext, selector);\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-popover",
3
- "version": "9.0.0-nightly.b5b7401007.0",
3
+ "version": "9.0.0-rc.3",
4
4
  "description": "Popover component for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -20,17 +20,16 @@
20
20
  "lint": "just-scripts lint",
21
21
  "start": "yarn storybook",
22
22
  "e2e": "e2e",
23
- "storybook": "start-storybook",
24
- "test": "jest",
23
+ "storybook": "node ../../scripts/storybook/runner",
24
+ "test": "jest --passWithNoTests",
25
25
  "docs": "api-extractor run --config=config/api-extractor.local.json --local",
26
- "build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-popover/src && yarn docs"
26
+ "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-popover/src && yarn docs",
27
+ "type-check": "tsc -b tsconfig.json"
27
28
  },
28
29
  "devDependencies": {
29
- "@fluentui/babel-make-styles": "9.0.0-nightly.b5b7401007.0",
30
30
  "@fluentui/eslint-plugin": "*",
31
- "@fluentui/jest-serializer-make-styles": "9.0.0-nightly.b5b7401007.0",
32
31
  "@fluentui/react-conformance": "*",
33
- "@fluentui/react-conformance-make-styles": "9.0.0-nightly.b5b7401007.0",
32
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.3",
34
33
  "@fluentui/scripts": "^1.0.0",
35
34
  "@types/enzyme": "3.10.3",
36
35
  "@types/enzyme-adapter-react-16": "1.0.3",
@@ -44,13 +43,13 @@
44
43
  "react-test-renderer": "^16.3.0"
45
44
  },
46
45
  "dependencies": {
47
- "@fluentui/react-context-selector": "9.0.0-nightly.b5b7401007.0",
48
- "@fluentui/react-make-styles": "9.0.0-nightly.b5b7401007.0",
49
- "@fluentui/react-portal": "9.0.0-nightly.b5b7401007.0",
50
- "@fluentui/react-positioning": "9.0.0-nightly.b5b7401007.0",
51
- "@fluentui/react-shared-contexts": "9.0.0-nightly.b5b7401007.0",
52
- "@fluentui/react-tabster": "9.0.0-nightly.b5b7401007.0",
53
- "@fluentui/react-utilities": "9.0.0-nightly.b5b7401007.0",
46
+ "@fluentui/react-context-selector": "9.0.0-rc.3",
47
+ "@griffel/react": "1.0.0",
48
+ "@fluentui/react-portal": "9.0.0-rc.3",
49
+ "@fluentui/react-positioning": "9.0.0-rc.3",
50
+ "@fluentui/react-shared-contexts": "9.0.0-rc.3",
51
+ "@fluentui/react-tabster": "9.0.0-rc.3",
52
+ "@fluentui/react-utilities": "9.0.0-rc.3",
54
53
  "tslib": "^2.1.0"
55
54
  },
56
55
  "peerDependencies": {
@@ -60,7 +59,6 @@
60
59
  "react-dom": ">=16.8.0 <18.0.0"
61
60
  },
62
61
  "beachball": {
63
- "tag": "beta",
64
62
  "disallowedChangeTypes": [
65
63
  "major",
66
64
  "minor",
@@ -1,4 +0,0 @@
1
- import type { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
- componentPath?: string;
4
- }): void;
@@ -1,13 +0,0 @@
1
- import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
2
- import makeStylesTests from '@fluentui/react-conformance-make-styles';
3
- export function isConformant(testInfo) {
4
- var defaultOptions = {
5
- asPropHandlesRef: true,
6
- componentPath: module.parent.filename.replace('.test', ''),
7
- // TODO // https://github.com/microsoft/fluentui/issues/19522
8
- skipAsPropTests: true,
9
- extraTests: makeStylesTests
10
- };
11
- baseIsConformant(defaultOptions, testInfo);
12
- }
13
- //# sourceMappingURL=isConformant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,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;AAL+C,GAA7D;AAQA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
@@ -1,7 +0,0 @@
1
- import type { PopoverContextValue } from '../popoverContext';
2
- /**
3
- * A test utility to mock the usePopoverContext hook that relies on context selector
4
- * Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
5
- * @param options Popover context values to set for testing
6
- */
7
- export declare const mockPopoverContext: (options?: Partial<PopoverContextValue>) => void;
@@ -1,38 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { usePopoverContext } from '../popoverContext';
3
- /**
4
- * A test utility to mock the usePopoverContext hook that relies on context selector
5
- * Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
6
- * @param options Popover context values to set for testing
7
- */
8
-
9
- export var mockPopoverContext = function (options) {
10
- if (options === void 0) {
11
- options = {};
12
- }
13
-
14
- var mockContext = __assign({
15
- open: false,
16
- setOpen: function () {
17
- return null;
18
- },
19
- triggerRef: {
20
- current: null
21
- },
22
- contentRef: {
23
- current: null
24
- },
25
- arrowRef: {
26
- current: null
27
- },
28
- openOnContext: false,
29
- openOnHover: false,
30
- size: 'medium'
31
- }, options); // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
-
33
-
34
- usePopoverContext.mockImplementation(function (selector) {
35
- return selector(mockContext);
36
- });
37
- };
38
- //# sourceMappingURL=mockUsePopoverContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/mockUsePopoverContext.ts"],"names":[],"mappings":";AAAA,SAAS,iBAAT,QAAkC,mBAAlC;AAGA;;;;AAIG;;AACH,OAAO,IAAM,kBAAkB,GAAG,UAAC,OAAD,EAA2C;AAA1C,MAAA,OAAA,KAAA,KAAA,CAAA,EAAA;AAAA,IAAA,OAAA,GAAA,EAAA;AAA0C;;AAC3E,MAAM,WAAW,GAAA,QAAA,CAAA;AACf,IAAA,IAAI,EAAE,KADS;AAEf,IAAA,OAAO,EAAE,YAAA;AAAM,aAAA,IAAA;AAAI,KAFJ;AAGf,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAHG;AAIf,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAJG;AAKf,IAAA,QAAQ,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KALK;AAMf,IAAA,aAAa,EAAE,KANA;AAOf,IAAA,WAAW,EAAE,KAPE;AAQf,IAAA,IAAI,EAAE;AARS,GAAA,EASZ,OATY,CAAjB,CAD2E,CAY3E;;;AACC,EAAA,iBAA+B,CAAC,kBAAhC,CAAmD,UAAC,QAAD,EAAgD;AAClG,WAAO,QAAQ,CAAC,WAAD,CAAf;AACD,GAFA;AAGF,CAhBM","sourceRoot":""}
@@ -1,4 +0,0 @@
1
- import type { IsConformantOptions } from '@fluentui/react-conformance';
2
- export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
3
- componentPath?: string;
4
- }): void;
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isConformant = void 0;
7
-
8
- var react_conformance_1 = /*#__PURE__*/require("@fluentui/react-conformance");
9
-
10
- var react_conformance_make_styles_1 = /*#__PURE__*/require("@fluentui/react-conformance-make-styles");
11
-
12
- function isConformant(testInfo) {
13
- var defaultOptions = {
14
- asPropHandlesRef: true,
15
- componentPath: module.parent.filename.replace('.test', ''),
16
- // TODO // https://github.com/microsoft/fluentui/issues/19522
17
- skipAsPropTests: true,
18
- extraTests: react_conformance_make_styles_1.default
19
- };
20
- react_conformance_1.isConformant(defaultOptions, testInfo);
21
- }
22
-
23
- exports.isConformant = isConformant;
24
- //# sourceMappingURL=isConformant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAEA,IAAA,+BAAA,gBAAA,OAAA,CAAA,yCAAA,CAAA;;AAEA,SAAgB,YAAhB,CACE,QADF,EAC2F;AAEzF,MAAM,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":""}
@@ -1,7 +0,0 @@
1
- import type { PopoverContextValue } from '../popoverContext';
2
- /**
3
- * A test utility to mock the usePopoverContext hook that relies on context selector
4
- * Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
5
- * @param options Popover context values to set for testing
6
- */
7
- export declare const mockPopoverContext: (options?: Partial<PopoverContextValue>) => void;
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.mockPopoverContext = void 0;
7
-
8
- var tslib_1 = /*#__PURE__*/require("tslib");
9
-
10
- var popoverContext_1 = /*#__PURE__*/require("../popoverContext");
11
- /**
12
- * A test utility to mock the usePopoverContext hook that relies on context selector
13
- * Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
14
- * @param options Popover context values to set for testing
15
- */
16
-
17
-
18
- var mockPopoverContext = function (options) {
19
- if (options === void 0) {
20
- options = {};
21
- }
22
-
23
- var mockContext = tslib_1.__assign({
24
- open: false,
25
- setOpen: function () {
26
- return null;
27
- },
28
- triggerRef: {
29
- current: null
30
- },
31
- contentRef: {
32
- current: null
33
- },
34
- arrowRef: {
35
- current: null
36
- },
37
- openOnContext: false,
38
- openOnHover: false,
39
- size: 'medium'
40
- }, options); // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
-
42
-
43
- popoverContext_1.usePopoverContext.mockImplementation(function (selector) {
44
- return selector(mockContext);
45
- });
46
- };
47
-
48
- exports.mockPopoverContext = mockPopoverContext;
49
- //# sourceMappingURL=mockUsePopoverContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/mockUsePopoverContext.ts"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,gBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAGA;;;;AAIG;;;AACI,IAAM,kBAAkB,GAAG,UAAC,OAAD,EAA2C;AAA1C,MAAA,OAAA,KAAA,KAAA,CAAA,EAAA;AAAA,IAAA,OAAA,GAAA,EAAA;AAA0C;;AAC3E,MAAM,WAAW,GAAA,OAAA,CAAA,QAAA,CAAA;AACf,IAAA,IAAI,EAAE,KADS;AAEf,IAAA,OAAO,EAAE,YAAA;AAAM,aAAA,IAAA;AAAI,KAFJ;AAGf,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAHG;AAIf,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAJG;AAKf,IAAA,QAAQ,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KALK;AAMf,IAAA,aAAa,EAAE,KANA;AAOf,IAAA,WAAW,EAAE,KAPE;AAQf,IAAA,IAAI,EAAE;AARS,GAAA,EASZ,OATY,CAAjB,CAD2E,CAY3E;;;AACC,EAAA,gBAAA,CAAA,iBAAA,CAAgC,kBAAhC,CAAmD,UAAC,QAAD,EAAgD;AAClG,WAAO,QAAQ,CAAC,WAAD,CAAf;AACD,GAFA;AAGF,CAhBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourceRoot":""}