@fluentui/react-popover 9.0.0-alpha.8 → 9.0.0-nightly.f81b28ceb3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. package/CHANGELOG.json +1800 -1
  2. package/CHANGELOG.md +566 -2
  3. package/Spec.md +6 -6
  4. package/dist/react-popover.d.ts +59 -77
  5. package/lib/Popover.js.map +1 -1
  6. package/lib/PopoverSurface.js.map +1 -1
  7. package/lib/PopoverTrigger.js.map +1 -1
  8. package/lib/common/isConformant.d.ts +1 -1
  9. package/lib/common/isConformant.js +9 -5
  10. package/lib/common/isConformant.js.map +1 -1
  11. package/lib/common/mockUsePopoverContext.d.ts +1 -1
  12. package/lib/common/mockUsePopoverContext.js +28 -6
  13. package/lib/common/mockUsePopoverContext.js.map +1 -1
  14. package/lib/components/Popover/Popover.d.ts +2 -2
  15. package/lib/components/Popover/Popover.js +4 -3
  16. package/lib/components/Popover/Popover.js.map +1 -1
  17. package/lib/components/Popover/Popover.types.d.ts +24 -33
  18. package/lib/components/Popover/Popover.types.js.map +1 -1
  19. package/lib/components/Popover/index.js.map +1 -1
  20. package/lib/components/Popover/renderPopover.d.ts +1 -1
  21. package/lib/components/Popover/renderPopover.js +29 -17
  22. package/lib/components/Popover/renderPopover.js.map +1 -1
  23. package/lib/components/Popover/usePopover.d.ts +2 -3
  24. package/lib/components/Popover/usePopover.js +110 -88
  25. package/lib/components/Popover/usePopover.js.map +1 -1
  26. package/lib/components/PopoverSurface/PopoverSurface.d.ts +3 -3
  27. package/lib/components/PopoverSurface/PopoverSurface.js +5 -4
  28. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  29. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +9 -18
  30. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  31. package/lib/components/PopoverSurface/index.js.map +1 -1
  32. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  33. package/lib/components/PopoverSurface/renderPopoverSurface.js +18 -10
  34. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  35. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -4
  36. package/lib/components/PopoverSurface/usePopoverSurface.js +94 -54
  37. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  38. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -2
  39. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +88 -64
  40. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  41. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -2
  42. package/lib/components/PopoverTrigger/PopoverTrigger.js +4 -3
  43. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  44. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
  45. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  46. package/lib/components/PopoverTrigger/index.js.map +1 -1
  47. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  48. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  49. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  50. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -3
  51. package/lib/components/PopoverTrigger/usePopoverTrigger.js +83 -60
  52. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  53. package/lib/index.js.map +1 -1
  54. package/lib/popoverContext.d.ts +4 -5
  55. package/lib/popoverContext.js +19 -12
  56. package/lib/popoverContext.js.map +1 -1
  57. package/lib/tsdoc-metadata.json +1 -1
  58. package/lib-commonjs/Popover.js +7 -2
  59. package/lib-commonjs/Popover.js.map +1 -1
  60. package/lib-commonjs/PopoverSurface.js +7 -2
  61. package/lib-commonjs/PopoverSurface.js.map +1 -1
  62. package/lib-commonjs/PopoverTrigger.js +7 -2
  63. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  64. package/lib-commonjs/common/isConformant.d.ts +1 -1
  65. package/lib-commonjs/common/isConformant.js +18 -7
  66. package/lib-commonjs/common/isConformant.js.map +1 -1
  67. package/lib-commonjs/common/mockUsePopoverContext.d.ts +1 -1
  68. package/lib-commonjs/common/mockUsePopoverContext.js +38 -9
  69. package/lib-commonjs/common/mockUsePopoverContext.js.map +1 -1
  70. package/lib-commonjs/components/Popover/Popover.d.ts +2 -2
  71. package/lib-commonjs/components/Popover/Popover.js +14 -6
  72. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  73. package/lib-commonjs/components/Popover/Popover.types.d.ts +24 -33
  74. package/lib-commonjs/components/Popover/Popover.types.js +4 -1
  75. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  76. package/lib-commonjs/components/Popover/index.js +10 -2
  77. package/lib-commonjs/components/Popover/index.js.map +1 -1
  78. package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
  79. package/lib-commonjs/components/Popover/renderPopover.js +39 -20
  80. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  81. package/lib-commonjs/components/Popover/usePopover.d.ts +2 -3
  82. package/lib-commonjs/components/Popover/usePopover.js +127 -93
  83. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  84. package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +3 -3
  85. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +18 -9
  86. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  87. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +9 -18
  88. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js +4 -1
  89. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  90. package/lib-commonjs/components/PopoverSurface/index.js +11 -2
  91. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  92. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  93. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +32 -14
  94. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  95. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -4
  96. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +110 -60
  97. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  98. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -2
  99. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +95 -65
  100. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  101. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -2
  102. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +14 -6
  103. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  104. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
  105. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +4 -1
  106. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  107. package/lib-commonjs/components/PopoverTrigger/index.js +10 -2
  108. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  109. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  110. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +7 -2
  111. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  112. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -3
  113. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +98 -65
  114. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  115. package/lib-commonjs/index.js +10 -2
  116. package/lib-commonjs/index.js.map +1 -1
  117. package/lib-commonjs/popoverContext.d.ts +4 -5
  118. package/lib-commonjs/popoverContext.js +28 -14
  119. package/lib-commonjs/popoverContext.js.map +1 -1
  120. package/package.json +18 -15
  121. package/.storybook/main.js +0 -11
  122. package/.storybook/preview.js +0 -4
  123. package/bundle-size/Popover.fixture.js +0 -7
  124. package/config/api-extractor.json +0 -3
  125. package/config/tests.js +0 -7
  126. package/e2e/Popover.e2e.ts +0 -139
  127. package/etc/react-popover.api.md +0 -135
  128. package/just.config.ts +0 -3
  129. package/lib/Popover.stories.d.ts +0 -62
  130. package/lib/Popover.stories.js +0 -114
  131. package/lib/Popover.stories.js.map +0 -1
  132. package/lib/components/Popover/getOffsetWithArrow.d.ts +0 -7
  133. package/lib/components/Popover/getOffsetWithArrow.js +0 -34
  134. package/lib/components/Popover/getOffsetWithArrow.js.map +0 -1
  135. package/lib-amd/Popover.d.ts +0 -1
  136. package/lib-amd/Popover.js +0 -6
  137. package/lib-amd/Popover.js.map +0 -1
  138. package/lib-amd/Popover.stories.d.ts +0 -62
  139. package/lib-amd/Popover.stories.js +0 -121
  140. package/lib-amd/Popover.stories.js.map +0 -1
  141. package/lib-amd/PopoverSurface.d.ts +0 -1
  142. package/lib-amd/PopoverSurface.js +0 -6
  143. package/lib-amd/PopoverSurface.js.map +0 -1
  144. package/lib-amd/PopoverTrigger.d.ts +0 -1
  145. package/lib-amd/PopoverTrigger.js +0 -6
  146. package/lib-amd/PopoverTrigger.js.map +0 -1
  147. package/lib-amd/common/isConformant.d.ts +0 -4
  148. package/lib-amd/common/isConformant.js +0 -14
  149. package/lib-amd/common/isConformant.js.map +0 -1
  150. package/lib-amd/common/mockUsePopoverContext.d.ts +0 -7
  151. package/lib-amd/common/mockUsePopoverContext.js +0 -20
  152. package/lib-amd/common/mockUsePopoverContext.js.map +0 -1
  153. package/lib-amd/components/Popover/Popover.d.ts +0 -6
  154. package/lib-amd/components/Popover/Popover.js +0 -15
  155. package/lib-amd/components/Popover/Popover.js.map +0 -1
  156. package/lib-amd/components/Popover/Popover.types.d.ts +0 -109
  157. package/lib-amd/components/Popover/Popover.types.js +0 -5
  158. package/lib-amd/components/Popover/Popover.types.js.map +0 -1
  159. package/lib-amd/components/Popover/getOffsetWithArrow.d.ts +0 -7
  160. package/lib-amd/components/Popover/getOffsetWithArrow.js +0 -40
  161. package/lib-amd/components/Popover/getOffsetWithArrow.js.map +0 -1
  162. package/lib-amd/components/Popover/index.d.ts +0 -4
  163. package/lib-amd/components/Popover/index.js +0 -9
  164. package/lib-amd/components/Popover/index.js.map +0 -1
  165. package/lib-amd/components/Popover/renderPopover.d.ts +0 -5
  166. package/lib-amd/components/Popover/renderPopover.js +0 -29
  167. package/lib-amd/components/Popover/renderPopover.js.map +0 -1
  168. package/lib-amd/components/Popover/usePopover.d.ts +0 -11
  169. package/lib-amd/components/Popover/usePopover.js +0 -112
  170. package/lib-amd/components/Popover/usePopover.js.map +0 -1
  171. package/lib-amd/components/PopoverSurface/PopoverSurface.d.ts +0 -6
  172. package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -15
  173. package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
  174. package/lib-amd/components/PopoverSurface/PopoverSurface.types.d.ts +0 -30
  175. package/lib-amd/components/PopoverSurface/PopoverSurface.types.js +0 -5
  176. package/lib-amd/components/PopoverSurface/PopoverSurface.types.js.map +0 -1
  177. package/lib-amd/components/PopoverSurface/index.d.ts +0 -5
  178. package/lib-amd/components/PopoverSurface/index.js +0 -10
  179. package/lib-amd/components/PopoverSurface/index.js.map +0 -1
  180. package/lib-amd/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
  181. package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -21
  182. package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
  183. package/lib-amd/components/PopoverSurface/usePopoverSurface.d.ts +0 -13
  184. package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -69
  185. package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
  186. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -7
  187. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -81
  188. package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
  189. package/lib-amd/components/PopoverTrigger/PopoverTrigger.d.ts +0 -6
  190. package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -15
  191. package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
  192. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -12
  193. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js +0 -5
  194. package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js.map +0 -1
  195. package/lib-amd/components/PopoverTrigger/index.d.ts +0 -4
  196. package/lib-amd/components/PopoverTrigger/index.js +0 -9
  197. package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
  198. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
  199. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js +0 -13
  200. package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js.map +0 -1
  201. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -11
  202. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js +0 -75
  203. package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
  204. package/lib-amd/index.d.ts +0 -4
  205. package/lib-amd/index.js +0 -9
  206. package/lib-amd/index.js.map +0 -1
  207. package/lib-amd/popoverContext.d.ts +0 -9
  208. package/lib-amd/popoverContext.js +0 -22
  209. package/lib-amd/popoverContext.js.map +0 -1
  210. package/lib-commonjs/Popover.stories.d.ts +0 -62
  211. package/lib-commonjs/Popover.stories.js +0 -122
  212. package/lib-commonjs/Popover.stories.js.map +0 -1
  213. package/lib-commonjs/components/Popover/getOffsetWithArrow.d.ts +0 -7
  214. package/lib-commonjs/components/Popover/getOffsetWithArrow.js +0 -38
  215. package/lib-commonjs/components/Popover/getOffsetWithArrow.js.map +0 -1
  216. package/src/components/Popover/Popover.types.ts +0 -124
  217. package/src/components/PopoverSurface/PopoverSurface.types.ts +0 -36
  218. package/src/components/PopoverTrigger/PopoverTrigger.types.ts +0 -13
@@ -1,69 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-tabster", "../../popoverContext"], function (require, exports, tslib_1, React, react_utilities_1, react_tabster_1, popoverContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePopoverSurface = void 0;
5
- var mergeProps = react_utilities_1.makeMergeProps({});
6
- /**
7
- * Create the state required to render PopoverSurface.
8
- *
9
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
10
- * before being passed to renderPopoverSurface.
11
- *
12
- * @param props - props from this instance of PopoverSurface
13
- * @param ref - reference to root HTMLElement of PopoverSurface
14
- * @param defaultProps - (optional) default prop values provided by the implementing type
15
- */
16
- var usePopoverSurface = function (props, ref, defaultProps) {
17
- var contentRef = popoverContext_1.usePopoverContext(function (context) { return context.contentRef; });
18
- var open = popoverContext_1.usePopoverContext(function (context) { return context.open; });
19
- var openOnHover = popoverContext_1.usePopoverContext(function (context) { return context.openOnHover; });
20
- var setOpen = popoverContext_1.usePopoverContext(function (context) { return context.setOpen; });
21
- var mountNode = popoverContext_1.usePopoverContext(function (context) { return context.mountNode; });
22
- var arrowRef = popoverContext_1.usePopoverContext(function (context) { return context.arrowRef; });
23
- var size = popoverContext_1.usePopoverContext(function (context) { return context.size; });
24
- var noArrow = popoverContext_1.usePopoverContext(function (context) { return context.noArrow; });
25
- var brand = popoverContext_1.usePopoverContext(function (context) { return context.brand; });
26
- var inverted = popoverContext_1.usePopoverContext(function (context) { return context.inverted; });
27
- var trapFocus = popoverContext_1.usePopoverContext(function (context) { return context.trapFocus; });
28
- var modalAttributes = react_tabster_1.useModalAttributes({ trapFocus: trapFocus }).modalAttributes;
29
- var state = mergeProps(tslib_1.__assign({ brand: brand,
30
- inverted: inverted,
31
- noArrow: noArrow,
32
- size: size,
33
- arrowRef: arrowRef,
34
- open: open,
35
- mountNode: mountNode, role: 'dialog', ref: react_utilities_1.useMergedRefs(ref, contentRef) }, modalAttributes), defaultProps, props);
36
- var onMouseEnterOriginal = state.onMouseEnter, onMouseLeaveOriginal = state.onMouseLeave, onKeyDownOriginal = state.onKeyDown;
37
- state.onMouseEnter = function (e) {
38
- if (openOnHover) {
39
- setOpen(e, true);
40
- }
41
- onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(e);
42
- };
43
- state.onMouseLeave = function (e) {
44
- if (openOnHover) {
45
- setOpen(e, false);
46
- }
47
- onMouseLeaveOriginal === null || onMouseLeaveOriginal === void 0 ? void 0 : onMouseLeaveOriginal(e);
48
- };
49
- state.onKeyDown = function (e) {
50
- var _a;
51
- // only close if the event happened inside the current popover
52
- // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack
53
- if (e.key === 'Escape' && ((_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
54
- setOpen(e, false);
55
- }
56
- onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(e);
57
- };
58
- var findFirstFocusable = react_tabster_1.useFocusFinders().findFirstFocusable;
59
- React.useEffect(function () {
60
- if (state.open && contentRef.current) {
61
- var firstFocusable = findFirstFocusable(contentRef.current);
62
- firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
63
- }
64
- }, [contentRef, findFirstFocusable, state.open]);
65
- return state;
66
- };
67
- exports.usePopoverSurface = usePopoverSurface;
68
- });
69
- //# sourceMappingURL=usePopoverSurface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePopoverSurface.js","sourceRoot":"../src/","sources":["components/PopoverSurface/usePopoverSurface.ts"],"names":[],"mappings":";;;;IAMA,IAAM,UAAU,GAAG,gCAAc,CAAsB,EAAE,CAAC,CAAC;IAE3D;;;;;;;;;OASG;IACI,IAAM,iBAAiB,GAAG,UAC/B,KAA0B,EAC1B,GAA2B,EAC3B,YAAkC;QAElC,IAAM,UAAU,GAAG,kCAAiB,CAAC,UA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,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE;gBACpC,IAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9D,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,GAAG;aACzB;QACH,CAAC,EAAE,CAAC,UAAU,EAAE,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA3EW,QAAA,iBAAiB,qBA2E5B","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';\nimport { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';\nimport { usePopoverContext } from '../../popoverContext';\n\nconst mergeProps = makeMergeProps<PopoverSurfaceState>({});\n\n/**\n * Create the state required to render PopoverSurface.\n *\n * The returned state can be modified with hooks such as usePopoverSurfaceStyles,\n * before being passed to renderPopoverSurface.\n *\n * @param props - props from this instance of PopoverSurface\n * @param ref - reference to root HTMLElement of PopoverSurface\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePopoverSurface = (\n props: PopoverSurfaceProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: PopoverSurfaceProps,\n): PopoverSurfaceState => {\n const contentRef = usePopoverContext(context => context.contentRef);\n const open = usePopoverContext(context => context.open);\n const openOnHover = usePopoverContext(context => context.openOnHover);\n const setOpen = usePopoverContext(context => context.setOpen);\n const mountNode = usePopoverContext(context => context.mountNode);\n const arrowRef = usePopoverContext(context => context.arrowRef);\n const size = usePopoverContext(context => context.size);\n const noArrow = usePopoverContext(context => context.noArrow);\n const brand = usePopoverContext(context => context.brand);\n const inverted = usePopoverContext(context => context.inverted);\n const trapFocus = usePopoverContext(context => context.trapFocus);\n const { modalAttributes } = useModalAttributes({ trapFocus });\n\n const state = mergeProps(\n {\n brand,\n inverted,\n noArrow,\n size,\n arrowRef,\n open,\n mountNode,\n role: 'dialog',\n ref: useMergedRefs(ref, contentRef),\n ...modalAttributes,\n },\n defaultProps,\n props,\n );\n\n const {\n onMouseEnter: onMouseEnterOriginal,\n onMouseLeave: onMouseLeaveOriginal,\n onKeyDown: onKeyDownOriginal,\n } = state;\n state.onMouseEnter = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n\n onMouseEnterOriginal?.(e);\n };\n\n state.onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n\n onMouseLeaveOriginal?.(e);\n };\n\n state.onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n // only close if the event happened inside the current popover\n // If using a stack of inline popovers, the user should call `stopPropagation` to avoid dismissing the entire stack\n if (e.key === 'Escape' && contentRef.current?.contains(e.target as HTMLElement)) {\n setOpen(e, false);\n }\n\n onKeyDownOriginal?.(e);\n };\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (state.open && contentRef.current) {\n const firstFocusable = findFirstFocusable(contentRef.current);\n firstFocusable?.focus();\n }\n }, [contentRef, findFirstFocusable, state.open]);\n return state;\n};\n"]}
@@ -1,7 +0,0 @@
1
- import { PopoverSize } from '../Popover/Popover.types';
2
- import { PopoverSurfaceState } from './PopoverSurface.types';
3
- export declare const arrowHeights: Record<PopoverSize, number>;
4
- /**
5
- * Apply styling to the PopoverSurface slots based on the state
6
- */
7
- export declare const usePopoverSurfaceStyles: (state: PopoverSurfaceState) => PopoverSurfaceState;
@@ -1,81 +0,0 @@
1
- define(["require", "exports", "@fluentui/react-make-styles"], function (require, exports, react_make_styles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePopoverSurfaceStyles = exports.arrowHeights = void 0;
5
- exports.arrowHeights = {
6
- small: 6,
7
- medium: 8,
8
- large: 8,
9
- };
10
- /**
11
- * Styles for the root slot
12
- */
13
- var useStyles = react_make_styles_1.makeStyles({
14
- root: function (theme) { return ({
15
- backgroundColor: theme.alias.color.neutral.neutralBackground1,
16
- boxShadow: theme.alias.shadow.shadow16,
17
- borderRadius: '4px',
18
- }); },
19
- inverted: function (theme) { return ({
20
- // TODO: neutral background inverted missing from superset and theme
21
- backgroundColor: theme.global.palette.grey[16],
22
- color: theme.alias.color.neutral.neutralForegroundInverted,
23
- }); },
24
- brand: function (theme) { return ({
25
- backgroundColor: theme.alias.color.neutral.brandBackground,
26
- // TODO: clarify with designers what foreground color should be with brand background,
27
- color: theme.alias.color.neutral.neutralForegroundInverted,
28
- }); },
29
- smallPadding: function () { return ({
30
- padding: '12px',
31
- }); },
32
- mediumPadding: function () { return ({
33
- padding: '16px',
34
- }); },
35
- largePadding: function () { return ({
36
- padding: '20px',
37
- }); },
38
- smallArrow: function () { return ({
39
- width: Math.SQRT2 * exports.arrowHeights.small + "px",
40
- height: Math.SQRT2 * exports.arrowHeights.small + "px",
41
- }); },
42
- mediumLargeArrow: function () { return ({
43
- width: Math.SQRT2 * exports.arrowHeights.medium + "px",
44
- height: Math.SQRT2 * exports.arrowHeights.medium + "px",
45
- }); },
46
- // TODO dedupe these styles with tooltip
47
- arrow: function (theme) { return ({
48
- position: 'absolute',
49
- background: 'inherit',
50
- visibility: 'hidden',
51
- zIndex: -1,
52
- ':before': {
53
- content: '""',
54
- borderRadius: '4px',
55
- position: 'absolute',
56
- width: 'inherit',
57
- height: 'inherit',
58
- background: 'inherit',
59
- visibility: 'visible',
60
- borderBottomRightRadius: theme.global.borderRadius.small,
61
- transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',
62
- },
63
- // Popper sets data-popper-placement on the root element, which is used to align the arrow
64
- ':global([data-popper-placement^="top"])': { bottom: 0, '--angle': '0' },
65
- ':global([data-popper-placement^="right"])': { left: 0, '--angle': '90deg' },
66
- ':global([data-popper-placement^="bottom"])': { top: 0, '--angle': '180deg' },
67
- ':global([data-popper-placement^="left"])': { right: 0, '--angle': '270deg' },
68
- }); },
69
- });
70
- /**
71
- * Apply styling to the PopoverSurface slots based on the state
72
- */
73
- var usePopoverSurfaceStyles = function (state) {
74
- var styles = useStyles();
75
- state.className = react_make_styles_1.mergeClasses(styles.root, state.className, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.inverted && styles.inverted, state.brand && styles.brand);
76
- state.arrowClassName = react_make_styles_1.mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
77
- return state;
78
- };
79
- exports.usePopoverSurfaceStyles = usePopoverSurfaceStyles;
80
- });
81
- //# sourceMappingURL=usePopoverSurfaceStyles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePopoverSurfaceStyles.js","sourceRoot":"../src/","sources":["components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":";;;;IAIa,QAAA,YAAY,GAAgC;QACvD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;KACT,CAAC;IAEF;;OAEG;IACH,IAAM,SAAS,GAAG,8BAAU,CAAC;QAC3B,IAAI,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YACd,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB;YAC7D,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ;YACtC,YAAY,EAAE,KAAK;SACpB,CAAC,EAJa,CAIb;QAEF,QAAQ,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAClB,oEAAoE;YACpE,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB;SAC3D,CAAC,EAJiB,CAIjB;QAEF,KAAK,EAAE,UAAA,KAAK,IAAI,OAAA,CAAC;YAC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over.types';\nimport { PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const arrowHeights: Record<PopoverSize, number> = {\n small: 6,\n medium: 8,\n large: 8,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: theme => ({\n backgroundColor: theme.alias.color.neutral.neutralBackground1,\n boxShadow: theme.alias.shadow.shadow16,\n borderRadius: '4px',\n }),\n\n inverted: theme => ({\n // TODO: neutral background inverted missing from superset and theme\n backgroundColor: theme.global.palette.grey[16],\n color: theme.alias.color.neutral.neutralForegroundInverted,\n }),\n\n brand: theme => ({\n backgroundColor: theme.alias.color.neutral.brandBackground,\n // TODO: clarify with designers what foreground color should be with brand background,\n color: theme.alias.color.neutral.neutralForegroundInverted,\n }),\n\n smallPadding: () => ({\n padding: '12px',\n }),\n\n mediumPadding: () => ({\n padding: '16px',\n }),\n\n largePadding: () => ({\n padding: '20px',\n }),\n\n smallArrow: () => ({\n width: `${Math.SQRT2 * arrowHeights.small}px`,\n height: `${Math.SQRT2 * arrowHeights.small}px`,\n }),\n\n mediumLargeArrow: () => ({\n width: `${Math.SQRT2 * arrowHeights.medium}px`,\n height: `${Math.SQRT2 * arrowHeights.medium}px`,\n }),\n\n // TODO dedupe these styles with tooltip\n arrow: theme => ({\n position: 'absolute',\n background: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ':before': {\n content: '\"\"',\n borderRadius: '4px',\n position: 'absolute',\n width: 'inherit',\n height: 'inherit',\n background: 'inherit',\n visibility: 'visible',\n borderBottomRightRadius: theme.global.borderRadius.small,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': { bottom: 0, '--angle': '0' },\n ':global([data-popper-placement^=\"right\"])': { left: 0, '--angle': '90deg' },\n ':global([data-popper-placement^=\"bottom\"])': { top: 0, '--angle': '180deg' },\n ':global([data-popper-placement^=\"left\"])': { right: 0, '--angle': '270deg' },\n }),\n});\n\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles = (state: PopoverSurfaceState): PopoverSurfaceState => {\n const styles = useStyles();\n state.className = mergeClasses(\n styles.root,\n state.className,\n state.size === 'small' && styles.smallPadding,\n state.size === 'medium' && styles.mediumPadding,\n state.size === 'large' && styles.largePadding,\n state.inverted && styles.inverted,\n state.brand && styles.brand,\n );\n\n state.arrowClassName = mergeClasses(\n styles.arrow,\n state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow,\n );\n\n return state;\n};\n"]}
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- import { PopoverTriggerProps } from './PopoverTrigger.types';
3
- /**
4
- * PopoverTrigger component
5
- */
6
- export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
@@ -1,15 +0,0 @@
1
- define(["require", "exports", "./usePopoverTrigger", "./renderPopoverTrigger"], function (require, exports, usePopoverTrigger_1, renderPopoverTrigger_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PopoverTrigger = void 0;
5
- /**
6
- * PopoverTrigger component
7
- */
8
- var PopoverTrigger = function (props) {
9
- var state = usePopoverTrigger_1.usePopoverTrigger(props);
10
- return renderPopoverTrigger_1.renderPopoverTrigger(state);
11
- };
12
- exports.PopoverTrigger = PopoverTrigger;
13
- exports.PopoverTrigger.displayName = 'PopoverTrigger';
14
- });
15
- //# sourceMappingURL=PopoverTrigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopoverTrigger.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;IAKA;;OAEG;IACI,IAAM,cAAc,GAAkC,UAAA,KAAK;QAChE,IAAM,KAAK,GAAG,qCAAiB,CAAC,KAAK,CAAC,CAAC;QAEvC,OAAO,2CAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC;IAJW,QAAA,cAAc,kBAIzB;IAEF,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger } from './usePopoverTrigger';\nimport { PopoverTriggerProps } from './PopoverTrigger.types';\nimport { renderPopoverTrigger } from './renderPopoverTrigger';\n\n/**\n * PopoverTrigger component\n */\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> = props => {\n const state = usePopoverTrigger(props);\n\n return renderPopoverTrigger(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\n"]}
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- /**
3
- * PopoverTrigger Props
4
- */
5
- export interface PopoverTriggerProps {
6
- children: React.ReactElement;
7
- }
8
- /**
9
- * PopoverTrigger State
10
- */
11
- export interface PopoverTriggerState extends PopoverTriggerProps {
12
- }
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=PopoverTrigger.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\n/**\n * PopoverTrigger Props\n */\nexport interface PopoverTriggerProps {\n children: React.ReactElement;\n}\n\n/**\n * PopoverTrigger State\n */\nexport interface PopoverTriggerState extends PopoverTriggerProps {}\n"]}
@@ -1,4 +0,0 @@
1
- export * from './PopoverTrigger';
2
- export * from './PopoverTrigger.types';
3
- export * from './renderPopoverTrigger';
4
- export * from './usePopoverTrigger';
@@ -1,9 +0,0 @@
1
- define(["require", "exports", "tslib", "./PopoverTrigger", "./PopoverTrigger.types", "./renderPopoverTrigger", "./usePopoverTrigger"], function (require, exports, tslib_1, PopoverTrigger_1, PopoverTrigger_types_1, renderPopoverTrigger_1, usePopoverTrigger_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(PopoverTrigger_1, exports);
5
- tslib_1.__exportStar(PopoverTrigger_types_1, exports);
6
- tslib_1.__exportStar(renderPopoverTrigger_1, exports);
7
- tslib_1.__exportStar(usePopoverTrigger_1, exports);
8
- });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/index.ts"],"names":[],"mappings":";;;IAAA,gDAAiC;IACjC,sDAAuC;IACvC,sDAAuC;IACvC,mDAAoC","sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n"]}
@@ -1,5 +0,0 @@
1
- import { PopoverTriggerState } from './PopoverTrigger.types';
2
- /**
3
- * Render the final JSX of PopoverTrigger
4
- */
5
- export declare const renderPopoverTrigger: (state: PopoverTriggerState) => JSX.Element;
@@ -1,13 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderPopoverTrigger = void 0;
5
- /**
6
- * Render the final JSX of PopoverTrigger
7
- */
8
- var renderPopoverTrigger = function (state) {
9
- return state.children;
10
- };
11
- exports.renderPopoverTrigger = renderPopoverTrigger;
12
- });
13
- //# sourceMappingURL=renderPopoverTrigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderPopoverTrigger.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;IAEA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAA0B;QAC7D,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC,CAAC;IAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger = (state: PopoverTriggerState): JSX.Element => {\n return state.children;\n};\n"]}
@@ -1,11 +0,0 @@
1
- import { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';
2
- /**
3
- * Create the state required to render PopoverTrigger.
4
- *
5
- * The returned state can be modified with hooks such as usePopoverTriggerStyles,
6
- * before being passed to renderPopoverTrigger.
7
- *
8
- * @param props - props from this instance of PopoverTrigger
9
- * @param defaultProps - (optional) default prop values provided by the implementing type
10
- */
11
- export declare const usePopoverTrigger: (props: PopoverTriggerProps, defaultProps?: PopoverTriggerProps | undefined) => PopoverTriggerState;
@@ -1,75 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@fluentui/react-tabster", "../../popoverContext"], function (require, exports, tslib_1, React, react_utilities_1, react_tabster_1, popoverContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePopoverTrigger = void 0;
5
- var mergeProps = react_utilities_1.makeMergeProps({});
6
- /**
7
- * Create the state required to render PopoverTrigger.
8
- *
9
- * The returned state can be modified with hooks such as usePopoverTriggerStyles,
10
- * before being passed to renderPopoverTrigger.
11
- *
12
- * @param props - props from this instance of PopoverTrigger
13
- * @param defaultProps - (optional) default prop values provided by the implementing type
14
- */
15
- var usePopoverTrigger = function (props, defaultProps) {
16
- var setOpen = popoverContext_1.usePopoverContext(function (context) { return context.setOpen; });
17
- var open = popoverContext_1.usePopoverContext(function (context) { return context.open; });
18
- var triggerRef = popoverContext_1.usePopoverContext(function (context) { return context.triggerRef; });
19
- var openOnHover = popoverContext_1.usePopoverContext(function (context) { return context.openOnHover; });
20
- var openOnContext = popoverContext_1.usePopoverContext(function (context) { return context.openOnContext; });
21
- var triggerAttributes = react_tabster_1.useModalAttributes().triggerAttributes;
22
- var state = mergeProps({
23
- children: null,
24
- }, defaultProps, props);
25
- var onContextMenu = react_utilities_1.useEventCallback(function (e) {
26
- var _a, _b;
27
- if (openOnContext) {
28
- e.preventDefault();
29
- setOpen(e, true);
30
- }
31
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
32
- });
33
- var onClick = react_utilities_1.useEventCallback(function (e) {
34
- var _a, _b;
35
- if (!openOnContext) {
36
- setOpen(e, !open);
37
- }
38
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
39
- });
40
- var onKeyDown = react_utilities_1.useEventCallback(function (e) {
41
- var _a, _b, _c;
42
- if (react_utilities_1.shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
43
- e.preventDefault();
44
- (_a = e.target) === null || _a === void 0 ? void 0 : _a.click();
45
- }
46
- if (e.key === 'Escape') {
47
- setOpen(e, false);
48
- }
49
- (_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
50
- });
51
- var onMouseEnter = react_utilities_1.useEventCallback(function (e) {
52
- var _a, _b;
53
- if (openOnHover) {
54
- setOpen(e, true);
55
- }
56
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
57
- });
58
- var onMouseLeave = react_utilities_1.useEventCallback(function (e) {
59
- var _a, _b;
60
- if (openOnHover) {
61
- setOpen(e, false);
62
- }
63
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
64
- });
65
- var child = React.Children.only(state.children);
66
- state.children = React.cloneElement(child, tslib_1.__assign({ 'aria-haspopup': 'true', onClick: onClick,
67
- onMouseEnter: onMouseEnter,
68
- onKeyDown: onKeyDown,
69
- onMouseLeave: onMouseLeave,
70
- onContextMenu: onContextMenu, ref: react_utilities_1.useMergedRefs(child.props.ref, triggerRef) }, triggerAttributes));
71
- return state;
72
- };
73
- exports.usePopoverTrigger = usePopoverTrigger;
74
- });
75
- //# sourceMappingURL=usePopoverTrigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"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AE,MAAM,EACvB,OAAO,SAAA;YACP,YAAY,cAAA;YACZ,SAAS,WAAA;YACT,YAAY,cAAA;YACZ,aAAa,eAAA,EACb,GAAG,EAAE,+BAAa,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,IAC5C,iBAAiB,EACpB,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IA3EW,QAAA,iBAAiB,qBA2E5B","sourcesContent":["import * as React from 'react';\nimport {\n makeMergeProps,\n useMergedRefs,\n useEventCallback,\n shouldPreventDefaultOnKeyDown,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\nimport { usePopoverContext } from '../../popoverContext';\n\nconst mergeProps = makeMergeProps<PopoverTriggerState>({});\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.\n *\n * @param props - props from this instance of PopoverTrigger\n * @param defaultProps - (optional) default prop values provided by the implementing type\n */\nexport const usePopoverTrigger = (\n props: PopoverTriggerProps,\n defaultProps?: PopoverTriggerProps,\n): PopoverTriggerState => {\n const setOpen = usePopoverContext(context => context.setOpen);\n const open = usePopoverContext(context => context.open);\n const triggerRef = usePopoverContext(context => context.triggerRef);\n const openOnHover = usePopoverContext(context => context.openOnHover);\n const openOnContext = usePopoverContext(context => context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n\n const state = mergeProps(\n {\n children: (null as unknown) as React.ReactElement,\n },\n defaultProps,\n props,\n );\n\n const onContextMenu = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n\n child.props?.onContextMenu?.(e);\n });\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n setOpen(e, !open);\n }\n child.props?.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((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 child.props?.onKeyDown?.(e);\n });\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n child.props?.onMouseEnter?.(e);\n });\n\n const onMouseLeave = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n child.props?.onMouseLeave?.(e);\n });\n\n const child = React.Children.only(state.children);\n state.children = React.cloneElement(child, {\n 'aria-haspopup': 'true',\n onClick,\n onMouseEnter,\n onKeyDown,\n onMouseLeave,\n onContextMenu,\n ref: useMergedRefs(child.props.ref, triggerRef),\n ...triggerAttributes,\n });\n\n return state;\n};\n"]}
@@ -1,4 +0,0 @@
1
- export * from './Popover';
2
- export * from './PopoverSurface';
3
- export * from './popoverContext';
4
- export * from './PopoverTrigger';
package/lib-amd/index.js DELETED
@@ -1,9 +0,0 @@
1
- define(["require", "exports", "tslib", "./Popover", "./PopoverSurface", "./popoverContext", "./PopoverTrigger"], function (require, exports, tslib_1, Popover_1, PopoverSurface_1, popoverContext_1, PopoverTrigger_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Popover_1, exports);
5
- tslib_1.__exportStar(PopoverSurface_1, exports);
6
- tslib_1.__exportStar(popoverContext_1, exports);
7
- tslib_1.__exportStar(PopoverTrigger_1, exports);
8
- });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;IAAA,yCAA0B;IAC1B,gDAAiC;IACjC,gDAAiC;IACjC,gDAAiC","sourcesContent":["export * from './Popover';\nexport * from './PopoverSurface';\nexport * from './popoverContext';\nexport * from './PopoverTrigger';\n"]}
@@ -1,9 +0,0 @@
1
- import { ContextSelector, Context } from '@fluentui/react-context-selector';
2
- import { PopoverState } from './components/Popover/index';
3
- export declare const PopoverContext: Context<PopoverContextValue>;
4
- /**
5
- * Context shared between Popover and its children components
6
- */
7
- export interface PopoverContextValue extends Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'target' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'brand' | 'inverted' | 'trapFocus'> {
8
- }
9
- export declare const usePopoverContext: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
@@ -1,22 +0,0 @@
1
- define(["require", "exports", "@fluentui/react-context-selector"], function (require, exports, react_context_selector_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.usePopoverContext = exports.PopoverContext = void 0;
5
- exports.PopoverContext = react_context_selector_1.createContext({
6
- open: false,
7
- setOpen: function () { return null; },
8
- triggerRef: { current: null },
9
- contentRef: { current: null },
10
- arrowRef: { current: null },
11
- target: undefined,
12
- openOnContext: false,
13
- openOnHover: false,
14
- size: 'medium',
15
- trapFocus: false,
16
- });
17
- var usePopoverContext = function (selector) {
18
- return react_context_selector_1.useContextSelector(exports.PopoverContext, selector);
19
- };
20
- exports.usePopoverContext = usePopoverContext;
21
- });
22
- //# sourceMappingURL=popoverContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"popoverContext.js","sourceRoot":"../src/","sources":["popoverContext.ts"],"names":[],"mappings":";;;;IAGa,QAAA,cAAc,GAAiC,sCAAa,CAAsB;QAC7F,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QACnB,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC7B,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC7B,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC3B,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;IAwBI,IAAM,iBAAiB,GAAG,UAAI,QAAiD;QACpF,OAAA,2CAAkB,CAAC,sBAAc,EAAE,QAAQ,CAAC;IAA5C,CAA4C,CAAC;IADlC,QAAA,iBAAiB,qBACiB","sourcesContent":["import { createContext, useContextSelector, ContextSelector, Context } from '@fluentui/react-context-selector';\nimport { 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 target: undefined,\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 interface PopoverContextValue\n extends Pick<\n PopoverState,\n | 'open'\n | 'setOpen'\n | 'triggerRef'\n | 'contentRef'\n | 'target'\n | 'openOnHover'\n | 'openOnContext'\n | 'mountNode'\n | 'noArrow'\n | 'arrowRef'\n | 'size'\n | 'brand'\n | 'inverted'\n | 'trapFocus'\n > {}\n\nexport const usePopoverContext = <T>(selector: ContextSelector<PopoverContextValue, T>): T =>\n useContextSelector(PopoverContext, selector);\n"]}
@@ -1,62 +0,0 @@
1
- import * as React from 'react';
2
- import { PopoverProps } from './index';
3
- export declare const Default: {
4
- (props: PopoverProps): JSX.Element;
5
- argTypes: {
6
- open: {
7
- defaultValue: boolean;
8
- control: string;
9
- };
10
- openOnContext: {
11
- defaultValue: boolean;
12
- control: string;
13
- };
14
- openOnHover: {
15
- defaultValue: boolean;
16
- control: string;
17
- };
18
- position: {
19
- type: {
20
- name: string;
21
- required: boolean;
22
- };
23
- control: {
24
- type: string;
25
- options: string[];
26
- };
27
- };
28
- align: {
29
- type: {
30
- name: string;
31
- required: boolean;
32
- };
33
- control: {
34
- type: string;
35
- options: string[];
36
- };
37
- };
38
- size: {
39
- type: {
40
- name: string;
41
- required: boolean;
42
- };
43
- control: {
44
- type: string;
45
- options: string[];
46
- };
47
- };
48
- trapFocus: {
49
- defaultValue: boolean;
50
- control: string;
51
- };
52
- };
53
- };
54
- export declare const AnchorToTarget: () => JSX.Element;
55
- export declare const Controlled: () => JSX.Element;
56
- export declare const WithCustomTrigger: () => JSX.Element;
57
- export declare const NestedPopovers: () => JSX.Element;
58
- declare const _default: {
59
- title: string;
60
- component: React.FC<PopoverProps>;
61
- };
62
- export default _default;