@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,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NestedPopovers = exports.WithCustomTrigger = exports.Controlled = exports.AnchorToTarget = exports.Default = void 0;
4
- var tslib_1 = require("tslib");
5
- var React = require("react");
6
- var index_1 = require("./index");
7
- var ExampleContent = function () {
8
- return (React.createElement("div", null,
9
- React.createElement("h3", null, "Popover content"),
10
- React.createElement("div", null, "This is some popover content")));
11
- };
12
- var Default = function (props) { return (React.createElement(index_1.Popover, tslib_1.__assign({}, props),
13
- React.createElement(index_1.PopoverTrigger, null,
14
- React.createElement("button", null, "Popover trigger")),
15
- React.createElement(index_1.PopoverSurface, null,
16
- React.createElement(ExampleContent, null),
17
- React.createElement("div", null,
18
- React.createElement("button", null, "Action"),
19
- React.createElement("button", null, "Action"))))); };
20
- exports.Default = Default;
21
- exports.Default.argTypes = {
22
- open: {
23
- defaultValue: false,
24
- control: 'boolean',
25
- },
26
- openOnContext: {
27
- defaultValue: false,
28
- control: 'boolean',
29
- },
30
- openOnHover: {
31
- defaultValue: false,
32
- control: 'boolean',
33
- },
34
- position: {
35
- type: { name: 'string', required: false },
36
- control: {
37
- type: 'select',
38
- options: ['above', 'below', 'before', 'after'],
39
- },
40
- },
41
- align: {
42
- type: { name: 'string', required: false },
43
- control: {
44
- type: 'select',
45
- options: ['top', 'bottom', 'start', 'end', 'center'],
46
- },
47
- },
48
- size: {
49
- type: { name: 'string', required: false },
50
- control: {
51
- type: 'select',
52
- options: ['small', 'medium', 'large'],
53
- },
54
- },
55
- trapFocus: {
56
- defaultValue: true,
57
- control: 'boolean',
58
- },
59
- };
60
- var AnchorToTarget = function () {
61
- var _a = React.useState(), target = _a[0], setTarget = _a[1];
62
- return (React.createElement(React.Fragment, null,
63
- React.createElement("div", null,
64
- React.createElement(index_1.Popover, { target: target },
65
- React.createElement(index_1.PopoverTrigger, null,
66
- React.createElement("button", null, "Popover trigger")),
67
- React.createElement(index_1.PopoverSurface, null,
68
- React.createElement(ExampleContent, null)))),
69
- React.createElement("button", { ref: setTarget }, "Custom target")));
70
- };
71
- exports.AnchorToTarget = AnchorToTarget;
72
- var Controlled = function () {
73
- var _a = React.useState(false), open = _a[0], setOpen = _a[1];
74
- var onOpenChange = function (_, data) { return setOpen(data.open || false); };
75
- return (React.createElement(index_1.Popover, { open: open, onOpenChange: onOpenChange },
76
- React.createElement(index_1.PopoverTrigger, null,
77
- React.createElement("button", null, "Controlled trigger")),
78
- React.createElement(index_1.PopoverSurface, null,
79
- React.createElement(ExampleContent, null))));
80
- };
81
- exports.Controlled = Controlled;
82
- var WithCustomTrigger = function () {
83
- var _a = React.useState(false), open = _a[0], setOpen = _a[1];
84
- var _b = React.useState(null), target = _b[0], setTarget = _b[1];
85
- var onClick = function () { return setOpen(function (s) { return !s; }); };
86
- var onOpenChange = function (_, data) { return setOpen(data.open || false); };
87
- return (React.createElement(React.Fragment, null,
88
- React.createElement("button", { "aria-haspopup": true, ref: setTarget, onClick: onClick }, "Custom trigger"),
89
- React.createElement(index_1.Popover, { target: target, open: open, onOpenChange: onOpenChange },
90
- React.createElement(index_1.PopoverSurface, null,
91
- React.createElement(ExampleContent, null)))));
92
- };
93
- exports.WithCustomTrigger = WithCustomTrigger;
94
- var FirstNestedPopover = function () { return (React.createElement(index_1.Popover, { trapFocus: true },
95
- React.createElement(index_1.PopoverTrigger, null,
96
- React.createElement("button", null, "First nested trigger")),
97
- React.createElement(index_1.PopoverSurface, null,
98
- React.createElement(ExampleContent, null),
99
- React.createElement("button", null, "First nested button"),
100
- React.createElement(SecondNestedPopover, null),
101
- React.createElement(SecondNestedPopover, null)))); };
102
- var SecondNestedPopover = function () { return (React.createElement(index_1.Popover, { trapFocus: true },
103
- React.createElement(index_1.PopoverTrigger, null,
104
- React.createElement("button", null, "Second nested trigger")),
105
- React.createElement(index_1.PopoverSurface, null,
106
- React.createElement(ExampleContent, null),
107
- React.createElement("button", null, "Second nested button")))); };
108
- var NestedPopovers = function () {
109
- return (React.createElement(index_1.Popover, { trapFocus: true },
110
- React.createElement(index_1.PopoverTrigger, null,
111
- React.createElement("button", null, "Root trigger")),
112
- React.createElement(index_1.PopoverSurface, null,
113
- React.createElement(ExampleContent, null),
114
- React.createElement("button", null, "Root button"),
115
- React.createElement(FirstNestedPopover, null))));
116
- };
117
- exports.NestedPopovers = NestedPopovers;
118
- exports.default = {
119
- title: 'Components/Popover',
120
- component: index_1.Popover,
121
- };
122
- //# sourceMappingURL=Popover.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Popover.stories.js","sourceRoot":"../src/","sources":["Popover.stories.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,iCAAgF;AAEhF,IAAM,cAAc,GAAG;IACrB,OAAO,CACL;QACE,kDAAwB;QAExB,gEAAuC,CACnC,CACP,CAAC;AACJ,CAAC,CAAC;AAEK,IAAM,OAAO,GAAG,UAAC,KAAmB,IAAK,OAAA,CAC9C,oBAAC,eAAO,uBAAK,KAAK;IAChB,oBAAC,sBAAc;QACb,sDAAgC,CACjB;IAEjB,oBAAC,sBAAc;QACb,oBAAC,cAAc,OAAG;QAElB;YACE,6CAAuB;YACvB,6CAAuB,CACnB,CACS,CACT,CACX,EAf+C,CAe/C,CAAC;AAfW,QAAA,OAAO,WAelB;AAEF,eAAO,CAAC,QAAQ,GAAG;IACjB,IAAI,EAAE;QACJ,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,SAAS;KACnB;IAED,aAAa,EAAE;QACb,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,SAAS;KACnB;IAED,WAAW,EAAE;QACX,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,SAAS;KACnB;IAED,QAAQ,EAAE;QACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;QACzC,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC,OAAO,EAAE,O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ahC,CAAC;AAEF,IAAM,mBAAmB,GAAG,cAAM,OAAA,CAChC,oBAAC,eAAO,IAAC,SAAS;IAChB,oBAAC,sBAAc;QACb,4DAAsC,CACvB;IAEjB,oBAAC,sBAAc;QACb,oBAAC,cAAc,OAAG;QAClB,2DAAqC,CACtB,CACT,CACX,EAXiC,CAWjC,CAAC;AAEK,IAAM,cAAc,GAAG;IAC5B,OAAO,CACL,oBAAC,eAAO,IAAC,SAAS;QAChB,oBAAC,sBAAc;YACb,mDAA6B,CACd;QAEjB,oBAAC,sBAAc;YACb,oBAAC,cAAc,OAAG;YAClB,kDAA4B;YAC5B,oBAAC,kBAAkB,OAAG,CACP,CACT,CACX,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,cAAc,kBAczB;AAEF,kBAAe;IACb,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,eAAO;CACnB,CAAC","sourcesContent":["import * as React from 'react';\nimport { Popover, PopoverTrigger, PopoverSurface, PopoverProps } from './index';\n\nconst ExampleContent = () => {\n return (\n <div>\n <h3>Popover content</h3>\n\n <div>This is some popover content</div>\n </div>\n );\n};\n\nexport const Default = (props: PopoverProps) => (\n <Popover {...props}>\n <PopoverTrigger>\n <button>Popover trigger</button>\n </PopoverTrigger>\n\n <PopoverSurface>\n <ExampleContent />\n\n <div>\n <button>Action</button>\n <button>Action</button>\n </div>\n </PopoverSurface>\n </Popover>\n);\n\nDefault.argTypes = {\n open: {\n defaultValue: false,\n control: 'boolean',\n },\n\n openOnContext: {\n defaultValue: false,\n control: 'boolean',\n },\n\n openOnHover: {\n defaultValue: false,\n control: 'boolean',\n },\n\n position: {\n type: { name: 'string', required: false },\n control: {\n type: 'select',\n options: ['above', 'below', 'before', 'after'],\n },\n },\n\n align: {\n type: { name: 'string', required: false },\n control: {\n type: 'select',\n options: ['top', 'bottom', 'start', 'end', 'center'],\n },\n },\n\n size: {\n type: { name: 'string', required: false },\n control: {\n type: 'select',\n options: ['small', 'medium', 'large'],\n },\n },\n\n trapFocus: {\n defaultValue: true,\n control: 'boolean',\n },\n};\n\nexport const AnchorToTarget = () => {\n const [target, setTarget] = React.useState<HTMLButtonElement | null>();\n\n return (\n <>\n <div>\n <Popover target={target}>\n <PopoverTrigger>\n <button>Popover trigger</button>\n </PopoverTrigger>\n\n <PopoverSurface>\n <ExampleContent />\n </PopoverSurface>\n </Popover>\n </div>\n\n <button ref={setTarget}>Custom target</button>\n </>\n );\n};\n\nexport const Controlled = () => {\n const [open, setOpen] = React.useState(false);\n const onOpenChange: PopoverProps['onOpenChange'] = (_, data) => setOpen(data.open || false);\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger>\n <button>Controlled trigger</button>\n </PopoverTrigger>\n <PopoverSurface>\n <ExampleContent />\n </PopoverSurface>\n </Popover>\n );\n};\n\nexport const WithCustomTrigger = () => {\n const [open, setOpen] = React.useState(false);\n const [target, setTarget] = React.useState<HTMLElement | null>(null);\n const onClick = () => setOpen(s => !s);\n const onOpenChange: PopoverProps['onOpenChange'] = (_, data) => setOpen(data.open || false);\n\n return (\n <>\n <button aria-haspopup ref={setTarget} onClick={onClick}>\n Custom trigger\n </button>\n <Popover target={target} open={open} onOpenChange={onOpenChange}>\n <PopoverSurface>\n <ExampleContent />\n </PopoverSurface>\n </Popover>\n </>\n );\n};\n\nconst FirstNestedPopover = () => (\n <Popover trapFocus>\n <PopoverTrigger>\n <button>First nested trigger</button>\n </PopoverTrigger>\n\n <PopoverSurface>\n <ExampleContent />\n <button>First nested button</button>\n <SecondNestedPopover />\n <SecondNestedPopover />\n </PopoverSurface>\n </Popover>\n);\n\nconst SecondNestedPopover = () => (\n <Popover trapFocus>\n <PopoverTrigger>\n <button>Second nested trigger</button>\n </PopoverTrigger>\n\n <PopoverSurface>\n <ExampleContent />\n <button>Second nested button</button>\n </PopoverSurface>\n </Popover>\n);\n\nexport const NestedPopovers = () => {\n return (\n <Popover trapFocus>\n <PopoverTrigger>\n <button>Root trigger</button>\n </PopoverTrigger>\n\n <PopoverSurface>\n <ExampleContent />\n <button>Root button</button>\n <FirstNestedPopover />\n </PopoverSurface>\n </Popover>\n );\n};\n\nexport default {\n title: 'Components/Popover',\n component: Popover,\n};\n"]}
@@ -1,7 +0,0 @@
1
- import { Offset } from '@fluentui/react-positioning';
2
- /**
3
- * @param userOffset - The offset provided by the user
4
- * @param arrowHeight - The height of the arrow in px
5
- * @returns User offset augmented with arrow height
6
- */
7
- export declare function getOffsetWithArrow(userOffset: Offset | undefined | null, arrowHeight: number): Offset;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOffsetWithArrow = void 0;
4
- /**
5
- * @param userOffset - The offset provided by the user
6
- * @param arrowHeight - The height of the arrow in px
7
- * @returns User offset augmented with arrow height
8
- */
9
- function getOffsetWithArrow(userOffset, arrowHeight) {
10
- var offsetWithArrow = userOffset;
11
- if (!userOffset) {
12
- return [0, arrowHeight];
13
- }
14
- if (Array.isArray(offsetWithArrow)) {
15
- setArrowOffset(offsetWithArrow, arrowHeight);
16
- return offsetWithArrow;
17
- }
18
- if (typeof offsetWithArrow === 'function') {
19
- var userOffsetFn_1 = offsetWithArrow;
20
- offsetWithArrow = function (offsetParams) {
21
- var offset = userOffsetFn_1(offsetParams);
22
- setArrowOffset(offset, arrowHeight);
23
- return offset;
24
- };
25
- }
26
- // This should never happen
27
- return [0, 0];
28
- }
29
- exports.getOffsetWithArrow = getOffsetWithArrow;
30
- var setArrowOffset = function (offset, arrowHeight) {
31
- if (offset[1] !== null && offset[1] !== undefined) {
32
- offset[1] += arrowHeight;
33
- }
34
- else {
35
- offset[1] = arrowHeight;
36
- }
37
- };
38
- //# sourceMappingURL=getOffsetWithArrow.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getOffsetWithArrow.js","sourceRoot":"../src/","sources":["components/Popover/getOffsetWithArrow.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,UAAqC,EAAE,WAAmB;IAC3F,IAAI,eAAe,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;KACzB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QAClC,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC7C,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;QACzC,IAAM,cAAY,GAAG,eAAe,CAAC;QACrC,eAAe,GAAG,UAAA,YAAY;YAC5B,IAAM,MAAM,GAAG,cAAY,CAAC,YAAY,CAAC,CAAC;YAC1C,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAU,CAAC;AACzB,CAAC;AAtBD,gDAsBC;AAED,IAAM,cAAc,GAAG,UAAC,MAA8D,EAAE,WAAmB;IACzG,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QACjD,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC;KAC1B;SAAM;QACL,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;KACzB;AACH,CAAC,CAAC","sourcesContent":["import { Offset } from '@fluentui/react-positioning';\n\n/**\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function getOffsetWithArrow(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n let offsetWithArrow = userOffset;\n if (!userOffset) {\n return [0, arrowHeight];\n }\n\n if (Array.isArray(offsetWithArrow)) {\n setArrowOffset(offsetWithArrow, arrowHeight);\n return offsetWithArrow;\n }\n\n if (typeof offsetWithArrow === 'function') {\n const userOffsetFn = offsetWithArrow;\n offsetWithArrow = offsetParams => {\n const offset = userOffsetFn(offsetParams);\n setArrowOffset(offset, arrowHeight);\n return offset;\n };\n }\n\n // This should never happen\n return [0, 0] as never;\n}\n\nconst setArrowOffset = (offset: [number | null | undefined, number | null | undefined], arrowHeight: number) => {\n if (offset[1] !== null && offset[1] !== undefined) {\n offset[1] += arrowHeight;\n } else {\n offset[1] = arrowHeight;\n }\n};\n"]}
@@ -1,124 +0,0 @@
1
- import * as React from 'react';
2
- import { PopperOptions, PopperVirtualElement } from '@fluentui/react-positioning';
3
- import { PortalProps } from '@fluentui/react-portal';
4
- import { ComponentState } from '@fluentui/react-utilities';
5
-
6
- /**
7
- * Determines popover padding and arrow size
8
- */
9
- export type PopoverSize = 'small' | 'medium' | 'large';
10
-
11
- /**
12
- * Popover Props
13
- */
14
- export interface PopoverProps
15
- extends Pick<PopperOptions, 'position' | 'align' | 'offset' | 'coverTarget' | 'target'>,
16
- Pick<PortalProps, 'mountNode'> {
17
- children: React.ReactNode;
18
- /**
19
- * Controls the opening of the Popover
20
- */
21
- open?: boolean;
22
- /**
23
- * Used to set the initial open state of the Popover in uncontrolled mode
24
- */
25
- defaultOpen?: boolean;
26
- /**
27
- * Call back when the component requests to change value
28
- * The `open` value is used as a hint when directly controlling the component
29
- */
30
- onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
31
- /**
32
- * Flag to open the Popover by hovering the trigger
33
- */
34
- openOnHover?: boolean;
35
- /**
36
- * Flag to open the Popover as a context menu. Disables all other interactions
37
- */
38
- openOnContext?: boolean;
39
- /**
40
- * Do not display the arrow
41
- */
42
- noArrow?: boolean;
43
- /**
44
- * Determines popover padding and arrow size
45
- * @default medium
46
- */
47
- size?: PopoverSize;
48
- /**
49
- * Uses brand colour as background
50
- * Mutually exclusive with `inverted`
51
- */
52
- brand?: boolean;
53
- /**
54
- * Inverts the foreground/background colour of the popover
55
- * Mutually exclusive with `brand`
56
- */
57
- inverted?: boolean;
58
-
59
- /**
60
- * Should trap focus
61
- */
62
- trapFocus?: boolean;
63
- }
64
-
65
- /**
66
- * Names of the shorthand properties in PopoverProps
67
- */
68
- export type PopoverShorthandProps = never;
69
-
70
- /**
71
- * Names of PopoverProps that have a default value in usePopover
72
- */
73
- export type PopoverDefaultedProps = never;
74
-
75
- /**
76
- * Popover State
77
- */
78
- export interface PopoverState extends ComponentState<PopoverProps, PopoverShorthandProps, PopoverDefaultedProps> {
79
- /**
80
- * Open state of the Popover
81
- */
82
- open: boolean;
83
- /**
84
- * Callback to open/close the Popover
85
- */
86
- setOpen: (e: OpenPopoverEvents, open: boolean) => void;
87
- /**
88
- * Ref of the PopoverTrigger
89
- */
90
- triggerRef: React.MutableRefObject<HTMLElement | null>;
91
- /**
92
- * Ref of the PopoverSurface
93
- */
94
- contentRef: React.MutableRefObject<HTMLElement | null>;
95
- /**
96
- * Ref of the pointing arrow
97
- */
98
- arrowRef: React.MutableRefObject<HTMLDivElement | null>;
99
- /**
100
- * Anchors the popper to the mouse click for context events
101
- */
102
- contextTarget: PopperVirtualElement | undefined;
103
- /**
104
- * A callback to set the target of the popper to the mouse click for context events
105
- */
106
- setContextTarget: React.Dispatch<PopperVirtualElement | undefined>;
107
-
108
- size: NonNullable<PopoverProps['size']>;
109
- }
110
-
111
- /**
112
- * Data attached to open/close events
113
- */
114
- export interface OnOpenChangeData extends Pick<PopoverState, 'open'> {}
115
-
116
- /**
117
- * The supported events that will trigger open/close of the menu
118
- */
119
- export type OpenPopoverEvents =
120
- | MouseEvent
121
- | TouchEvent
122
- | React.MouseEvent<HTMLElement>
123
- | React.KeyboardEvent<HTMLElement>
124
- | React.FocusEvent<HTMLElement>;
@@ -1,36 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps, ComponentState } from '@fluentui/react-utilities';
3
- import { PopoverContextValue } from '../../popoverContext';
4
-
5
- /**
6
- * PopoverSurface Props
7
- */
8
- export interface PopoverSurfaceProps extends ComponentProps, React.HTMLAttributes<HTMLElement> {}
9
-
10
- /**
11
- * Names of the shorthand properties in PopoverSurfaceProps
12
- */
13
- export type PopoverSurfaceShorthandProps = never;
14
-
15
- /**
16
- * Names of PopoverSurfaceProps that have a default value in usePopoverSurface
17
- */
18
- export type PopoverSurfaceDefaultedProps = never;
19
-
20
- /**
21
- * PopoverSurface State
22
- */
23
- export interface PopoverSurfaceState
24
- extends ComponentState<PopoverSurfaceProps, PopoverSurfaceShorthandProps, PopoverSurfaceDefaultedProps>,
25
- Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'brand' | 'inverted'> {
26
- ref: React.Ref<HTMLElement>;
27
- /**
28
- * Ref to the arrow element
29
- */
30
- arrowRef?: React.Ref<HTMLDivElement>;
31
-
32
- /**
33
- * CSS class for the arrow element
34
- */
35
- arrowClassName?: string;
36
- }
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
-
3
- /**
4
- * PopoverTrigger Props
5
- */
6
- export interface PopoverTriggerProps {
7
- children: React.ReactElement;
8
- }
9
-
10
- /**
11
- * PopoverTrigger State
12
- */
13
- export interface PopoverTriggerState extends PopoverTriggerProps {}