@fluentui/react-popover 9.0.0-rc.7 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.json +543 -1
  2. package/CHANGELOG.md +216 -76
  3. package/Spec.md +25 -5
  4. package/dist/{react-popover.d.ts → index.d.ts} +95 -61
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/components/Popover/Popover.js.map +1 -1
  7. package/lib/components/Popover/Popover.types.js.map +1 -1
  8. package/lib/components/Popover/constants.js +10 -0
  9. package/lib/components/Popover/constants.js.map +1 -0
  10. package/lib/components/Popover/renderPopover.js +22 -16
  11. package/lib/components/Popover/renderPopover.js.map +1 -1
  12. package/lib/components/Popover/usePopover.js +56 -21
  13. package/lib/components/Popover/usePopover.js.map +1 -1
  14. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  15. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  16. package/lib/components/PopoverSurface/renderPopoverSurface.js +11 -5
  17. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  18. package/lib/components/PopoverSurface/usePopoverSurface.js +7 -3
  19. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  20. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +20 -25
  21. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  22. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  23. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  24. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  25. package/lib/components/PopoverTrigger/usePopoverTrigger.js +2 -2
  26. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  27. package/lib/index.js +4 -4
  28. package/lib/index.js.map +1 -1
  29. package/lib/popoverContext.js +4 -1
  30. package/lib/popoverContext.js.map +1 -1
  31. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  32. package/lib-commonjs/components/Popover/constants.js +17 -0
  33. package/lib-commonjs/components/Popover/constants.js.map +1 -0
  34. package/lib-commonjs/components/Popover/renderPopover.js +22 -16
  35. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  36. package/lib-commonjs/components/Popover/usePopover.js +56 -20
  37. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  38. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  39. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +11 -5
  40. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  41. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +7 -3
  42. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  43. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +21 -26
  44. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  45. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  46. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  47. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +2 -2
  48. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  49. package/lib-commonjs/index.js +92 -5
  50. package/lib-commonjs/index.js.map +1 -1
  51. package/lib-commonjs/popoverContext.js +5 -2
  52. package/lib-commonjs/popoverContext.js.map +1 -1
  53. package/package.json +18 -18
  54. package/lib/Popover.d.ts +0 -1
  55. package/lib/PopoverSurface.d.ts +0 -1
  56. package/lib/PopoverTrigger.d.ts +0 -1
  57. package/lib/components/Popover/Popover.d.ts +0 -6
  58. package/lib/components/Popover/Popover.types.d.ts +0 -109
  59. package/lib/components/Popover/index.d.ts +0 -4
  60. package/lib/components/Popover/renderPopover.d.ts +0 -5
  61. package/lib/components/Popover/usePopover.d.ts +0 -10
  62. package/lib/components/PopoverSurface/PopoverSurface.d.ts +0 -6
  63. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +0 -21
  64. package/lib/components/PopoverSurface/index.d.ts +0 -5
  65. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
  66. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +0 -12
  67. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -13
  68. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +0 -7
  69. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -18
  70. package/lib/components/PopoverTrigger/index.d.ts +0 -4
  71. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
  72. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -10
  73. package/lib/index.d.ts +0 -4
  74. package/lib/popoverContext.d.ts +0 -8
  75. package/lib-commonjs/Popover.d.ts +0 -1
  76. package/lib-commonjs/PopoverSurface.d.ts +0 -1
  77. package/lib-commonjs/PopoverTrigger.d.ts +0 -1
  78. package/lib-commonjs/components/Popover/Popover.d.ts +0 -6
  79. package/lib-commonjs/components/Popover/Popover.types.d.ts +0 -109
  80. package/lib-commonjs/components/Popover/index.d.ts +0 -4
  81. package/lib-commonjs/components/Popover/renderPopover.d.ts +0 -5
  82. package/lib-commonjs/components/Popover/usePopover.d.ts +0 -10
  83. package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +0 -6
  84. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +0 -21
  85. package/lib-commonjs/components/PopoverSurface/index.d.ts +0 -5
  86. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
  87. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +0 -12
  88. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -13
  89. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +0 -7
  90. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -18
  91. package/lib-commonjs/components/PopoverTrigger/index.d.ts +0 -4
  92. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
  93. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -10
  94. package/lib-commonjs/index.d.ts +0 -4
  95. package/lib-commonjs/popoverContext.d.ts +0 -8
package/Spec.md CHANGED
@@ -238,6 +238,11 @@ export type PopoverProps = {
238
238
  */
239
239
  onOpenChange?: (e: OpenPopoverEvents, data: OpenEventData) => void;
240
240
 
241
+ /**
242
+ * Flag to open the Popover by hovering the trigger
243
+ */
244
+ openOnHover?: boolean;
245
+
241
246
  /**
242
247
  * Anchor the popover to an element other than the trigger
243
248
  */
@@ -284,6 +289,16 @@ export type PopoverProps = {
284
289
  * Do not render an arrow pointing to the target element. This is the `PopoverTrigger` unless `target` prop is used
285
290
  */
286
291
  noArrow?: boolean;
292
+
293
+ /**
294
+ * Sets the delay for closing popover on mouse leave
295
+ */
296
+ mouseLeaveDelay?: number;
297
+
298
+ /**
299
+ * Close when scrolling outside of it
300
+ */
301
+ closeOnScroll?: boolean;
287
302
  };
288
303
  ```
289
304
 
@@ -329,7 +344,7 @@ Default popover
329
344
 
330
345
  // Expected Markup
331
346
  <div id="container">
332
- <button aria-haspopup="dialog">Trigger</button>
347
+ <button aria-expanded="false">Trigger</button>
333
348
  </div>
334
349
 
335
350
  // on document.body
@@ -355,7 +370,7 @@ Popover that traps focus
355
370
 
356
371
  // Expected Markup
357
372
  <div id="container">
358
- <button aria-haspopup="dialog">Trigger</button>
373
+ <button aria-expanded="false">Trigger</button>
359
374
  </div>
360
375
 
361
376
  // on document.body
@@ -381,7 +396,7 @@ Inline popover
381
396
 
382
397
  // Expected Markup
383
398
  <div id="container">
384
- <button aria-haspopup="dialog">Trigger</button>
399
+ <button aria-expanded="false">Trigger</button>
385
400
  <div>
386
401
  {/** content */}
387
402
  </div>
@@ -445,6 +460,11 @@ The popover closes with the escape key when the trigger or popover content has f
445
460
 
446
461
  The popover closes when a click happens outside the popover trigger or content.
447
462
 
463
+ #### Scroll outside
464
+
465
+ The context menu popover closes when scroll happens outside the popover trigger or content.
466
+ When popover is configured with `closeOnScroll`, popover closes when scroll happens outside the popover trigger or content.
467
+
448
468
  ### Focus trap
449
469
 
450
470
  When the popover is configured to be a focus trap, focus the first focusable element inside the popover on open.
@@ -478,7 +498,7 @@ Accessible markup is divided into two scenarios:
478
498
 
479
499
  ```tsx
480
500
  // Popover that does not trap focus
481
- <button aria-haspopup="dialog">Trigger</button>
501
+ <button aria-expanded="false">Trigger</button>
482
502
  <div role="complementary">
483
503
  No focus trap
484
504
  </div>
@@ -487,7 +507,7 @@ Accessible markup is divided into two scenarios:
487
507
  <div aria-hidden="true" /> // other content
488
508
  <div aria-hidden="true" /> // other content
489
509
  <div aria-hidden="true" className='fui-provider'>
490
- <button aria-haspopup="dialog">Trigger</button>
510
+ <button aria-expanded="false">Trigger</button>
491
511
  </div>
492
512
 
493
513
  <div role="dialog" aria-modal="true">
@@ -1,18 +1,21 @@
1
1
  import type { ComponentProps } from '@fluentui/react-utilities';
2
2
  import type { ComponentState } from '@fluentui/react-utilities';
3
- import type { Context } from '@fluentui/react-context-selector';
4
3
  import type { ContextSelector } from '@fluentui/react-context-selector';
4
+ import { FC } from 'react';
5
5
  import type { FluentTriggerComponent } from '@fluentui/react-utilities';
6
6
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
7
7
  import { JSXElementConstructor } from 'react';
8
- import type { PopperVirtualElement } from '@fluentui/react-positioning';
9
8
  import type { PortalProps } from '@fluentui/react-portal';
10
9
  import type { PositioningShorthand } from '@fluentui/react-positioning';
10
+ import type { PositioningVirtualElement } from '@fluentui/react-positioning';
11
+ import { Provider } from 'react';
12
+ import { ProviderProps } from 'react';
11
13
  import * as React_2 from 'react';
12
14
  import { ReactElement } from 'react';
13
15
  import type { Slot } from '@fluentui/react-utilities';
14
16
  import type { SlotClassNames } from '@fluentui/react-utilities';
15
- import type { usePopperMouseTarget } from '@fluentui/react-positioning';
17
+ import type { UseModalAttributesOptions } from '@fluentui/react-tabster';
18
+ import type { usePositioningMouseTarget } from '@fluentui/react-positioning';
16
19
 
17
20
  export declare const arrowHeights: Record<PopoverSize, number>;
18
21
 
@@ -26,76 +29,112 @@ export declare type OnOpenChangeData = {
26
29
  /**
27
30
  * The supported events that will trigger open/close of the menu
28
31
  */
29
- export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.FocusEvent<HTMLElement>;
32
+ export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.FocusEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement>;
30
33
 
31
34
  /**
32
35
  * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
33
36
  */
34
37
  export declare const Popover: React_2.FC<PopoverProps>;
35
38
 
36
- declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
39
+ /**
40
+ * Context shared between Popover and its children components
41
+ */
42
+ export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'toggleOpen' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'withArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus' | 'legacyTrapFocus' | 'inline'>;
43
+
44
+ /**
45
+ * Popover Props
46
+ */
47
+ export declare type PopoverProps = Pick<PortalProps, 'mountNode'> & {
37
48
  /**
38
- * Controls the opening of the Popover
49
+ * A popover can appear styled with brand or inverted.
50
+ * When not specified, the default style is used.
39
51
  */
40
- open: boolean;
52
+ appearance?: 'brand' | 'inverted';
53
+ /**
54
+ * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.
55
+ * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.
56
+ */
57
+ children: [JSX.Element, JSX.Element] | JSX.Element;
58
+ /**
59
+ * Close when scroll outside of it
60
+ *
61
+ * @default false
62
+ */
63
+ closeOnScroll?: boolean;
41
64
  /**
42
65
  * Used to set the initial open state of the Popover in uncontrolled mode
66
+ *
67
+ * @default false
43
68
  */
44
69
  defaultOpen?: boolean;
70
+ /**
71
+ * Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order
72
+ *
73
+ * @default false
74
+ */
75
+ inline?: boolean;
76
+ /**
77
+ * Sets the delay for closing popover on mouse leave
78
+ */
79
+ mouseLeaveDelay?: number;
80
+ /**
81
+ * Display an arrow pointing to the target.
82
+ *
83
+ * @default false
84
+ */
85
+ withArrow?: boolean;
45
86
  /**
46
87
  * Call back when the component requests to change value
47
88
  * The `open` value is used as a hint when directly controlling the component
48
89
  */
49
90
  onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
50
91
  /**
51
- * Flag to open the Popover by hovering the trigger
92
+ * Controls the opening of the Popover
93
+ *
94
+ * @default false
52
95
  */
53
- openOnHover?: boolean;
96
+ open?: boolean;
54
97
  /**
55
98
  * Flag to open the Popover as a context menu. Disables all other interactions
99
+ *
100
+ * @default false
56
101
  */
57
102
  openOnContext?: boolean;
58
103
  /**
59
- * Do not display the arrow
104
+ * Flag to open the Popover by hovering the trigger
105
+ *
106
+ * @default false
107
+ */
108
+ openOnHover?: boolean;
109
+ /**
110
+ * Configures the position of the Popover
60
111
  */
61
- noArrow?: boolean;
112
+ positioning?: PositioningShorthand;
62
113
  /**
63
114
  * Determines popover padding and arrow size
115
+ *
64
116
  * @default medium
65
117
  */
66
118
  size?: PopoverSize;
67
- /**
68
- * A popover can appear styled with brand or inverted.
69
- * When not specified, the default style is used.
70
- */
71
- appearance?: 'brand' | 'inverted';
72
119
  /**
73
120
  * Should trap focus
121
+ *
122
+ * @default false
74
123
  */
75
- trapFocus?: boolean;
124
+ trapFocus?: UseModalAttributesOptions['trapFocus'];
76
125
  /**
77
- * Configures the position of the Popover
126
+ * Must be used with the `trapFocus` prop
127
+ * Enables older Fluent UI focus trap behavior where the user
128
+ * cannot tab into the window outside of the document. This is now
129
+ * non-standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)
130
+ * where the focus trap involves setting outside elements inert.
131
+ *
132
+ * @default false
78
133
  */
79
- positioning?: PositioningShorthand;
134
+ legacyTrapFocus?: UseModalAttributesOptions['legacyTrapFocus'];
80
135
  };
81
136
 
82
- export declare const PopoverContext: Context<PopoverContextValue>;
83
-
84
- /**
85
- * Context shared between Popover and its children components
86
- */
87
- export declare type PopoverContextValue = Pick<PopoverState, 'toggleOpen' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
88
-
89
- /**
90
- * Popover Props
91
- */
92
- export declare type PopoverProps = Partial<PopoverCommons> & {
93
- /**
94
- * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.
95
- * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.
96
- */
97
- children: [JSX.Element, JSX.Element] | JSX.Element;
98
- };
137
+ export declare const PopoverProvider: Provider<PopoverContextValue> & FC<ProviderProps<PopoverContextValue>>;
99
138
 
100
139
  /**
101
140
  * Determines popover padding and arrow size
@@ -105,38 +144,38 @@ export declare type PopoverSize = 'small' | 'medium' | 'large';
105
144
  /**
106
145
  * Popover State
107
146
  */
108
- export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children'> & {
147
+ export declare type PopoverState = Pick<PopoverProps, 'appearance' | 'mountNode' | 'onOpenChange' | 'openOnContext' | 'openOnHover' | 'trapFocus' | 'withArrow' | 'legacyTrapFocus'> & Required<Pick<PopoverProps, 'inline' | 'open'>> & Pick<PopoverProps, 'children'> & {
109
148
  /**
110
- * Callback to open/close the Popover
149
+ * Ref of the pointing arrow
111
150
  */
112
- setOpen: (e: OpenPopoverEvents, open: boolean) => void;
151
+ arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
113
152
  /**
114
- * Callback to toggle the open state of the Popover
153
+ * Ref of the PopoverSurface
115
154
  */
116
- toggleOpen: (e: OpenPopoverEvents) => void;
155
+ contentRef: React_2.MutableRefObject<HTMLElement | null>;
117
156
  /**
118
- * Ref of the PopoverTrigger
157
+ * Anchors the popper to the mouse click for context events
119
158
  */
120
- triggerRef: React_2.MutableRefObject<HTMLElement | null>;
159
+ contextTarget: PositioningVirtualElement | undefined;
160
+ popoverSurface: React_2.ReactElement | undefined;
161
+ popoverTrigger: React_2.ReactElement | undefined;
121
162
  /**
122
- * Ref of the PopoverSurface
163
+ * A callback to set the target of the popper to the mouse click for context events
123
164
  */
124
- contentRef: React_2.MutableRefObject<HTMLElement | null>;
165
+ setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];
125
166
  /**
126
- * Ref of the pointing arrow
167
+ * Callback to open/close the Popover
127
168
  */
128
- arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
169
+ setOpen: (e: OpenPopoverEvents, open: boolean) => void;
170
+ size: NonNullable<PopoverProps['size']>;
129
171
  /**
130
- * Anchors the popper to the mouse click for context events
172
+ * Callback to toggle the open state of the Popover
131
173
  */
132
- contextTarget: PopperVirtualElement | undefined;
174
+ toggleOpen: (e: OpenPopoverEvents) => void;
133
175
  /**
134
- * A callback to set the target of the popper to the mouse click for context events
176
+ * Ref of the PopoverTrigger
135
177
  */
136
- setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
137
- size: NonNullable<PopoverProps['size']>;
138
- popoverTrigger: React_2.ReactElement | undefined;
139
- popoverSurface: React_2.ReactElement | undefined;
178
+ triggerRef: React_2.MutableRefObject<HTMLElement | null>;
140
179
  };
141
180
 
142
181
  /**
@@ -144,11 +183,6 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
144
183
  */
145
184
  export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
146
185
 
147
- /**
148
- * @deprecated Use `popoverSurfaceClassNames.root` instead.
149
- */
150
- export declare const popoverSurfaceClassName = "fui-PopoverSurface";
151
-
152
186
  export declare const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots>;
153
187
 
154
188
  /**
@@ -166,7 +200,7 @@ export declare type PopoverSurfaceSlots = {
166
200
  /**
167
201
  * PopoverSurface State
168
202
  */
169
- export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
203
+ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'size' | 'withArrow'> & {
170
204
  /**
171
205
  * CSS class for the arrow element
172
206
  */
@@ -180,7 +214,7 @@ export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps> & FluentTri
180
214
 
181
215
  export declare type PopoverTriggerChildProps = {
182
216
  ref?: React_2.Ref<never>;
183
- } & Pick<React_2.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
217
+ } & Pick<React_2.HTMLAttributes<HTMLElement>, 'aria-expanded' | 'onClick' | 'onContextMenu' | 'onKeyDown' | 'onMouseEnter' | 'onMouseLeave'>;
184
218
 
185
219
  /**
186
220
  * PopoverTrigger Props
File without changes
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Popover/Popover.tsx"],"names":[],"mappings":"AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AAGA;;AAEG;;AACH,OAAO,MAAM,OAAO,GAA2B,KAAK,IAAG;AACrD,QAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,CAAjC;AAEA,SAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CAJM;AAMP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Popover/Popover.tsx"],"names":[],"mappings":"AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AAGA;;AAEG;;AACH,OAAO,MAAM,OAAO,GAA2B,KAAK,IAAG;EACrD,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,CAAjC;EAEA,OAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CAJM;AAMP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.types.js","sourceRoot":"../src/","sources":["components/Popover/Popover.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } from '@fluentui/react-positioning';\nimport type { PortalProps } from '@fluentui/react-portal';\n\n/**\n * Determines popover padding and arrow size\n */\nexport type PopoverSize = 'small' | 'medium' | 'large';\n\ntype PopoverCommons = Pick<PortalProps, 'mountNode'> & {\n /**\n * Controls the opening of the Popover\n */\n open: boolean;\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n */\n defaultOpen?: boolean;\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;\n /**\n * Flag to open the Popover by hovering the trigger\n */\n openOnHover?: boolean;\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n */\n openOnContext?: boolean;\n /**\n * Do not display the arrow\n */\n noArrow?: boolean;\n /**\n * Determines popover padding and arrow size\n * @default medium\n */\n size?: PopoverSize;\n\n /**\n * A popover can appear styled with brand or inverted.\n * When not specified, the default style is used.\n */\n appearance?: 'brand' | 'inverted';\n\n /**\n * Should trap focus\n */\n trapFocus?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n};\n\n/**\n * Popover Props\n */\nexport type PopoverProps = Partial<PopoverCommons> & {\n /**\n * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.\n * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n};\n\n/**\n * Popover State\n */\nexport type PopoverState = PopoverCommons &\n Pick<PopoverProps, 'children'> & {\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n /**\n * Callback to toggle the open state of the Popover\n */\n toggleOpen: (e: OpenPopoverEvents) => void;\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PopperVirtualElement | undefined;\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];\n\n size: NonNullable<PopoverProps['size']>;\n\n popoverTrigger: React.ReactElement | undefined;\n\n popoverSurface: React.ReactElement | undefined;\n };\n\n/**\n * Data attached to open/close events\n */\nexport type OnOpenChangeData = { open: boolean };\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type OpenPopoverEvents =\n | MouseEvent\n | TouchEvent\n | React.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n"]}
1
+ {"version":3,"file":"Popover.types.js","sourceRoot":"../src/","sources":["components/Popover/Popover.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type {\n PositioningVirtualElement,\n PositioningShorthand,\n usePositioningMouseTarget,\n} from '@fluentui/react-positioning';\nimport type { PortalProps } from '@fluentui/react-portal';\nimport type { UseModalAttributesOptions } from '@fluentui/react-tabster';\n\n/**\n * Determines popover padding and arrow size\n */\nexport type PopoverSize = 'small' | 'medium' | 'large';\n\n/**\n * Popover Props\n */\nexport type PopoverProps = Pick<PortalProps, 'mountNode'> & {\n /**\n * A popover can appear styled with brand or inverted.\n * When not specified, the default style is used.\n */\n appearance?: 'brand' | 'inverted';\n\n /**\n * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.\n * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Close when scroll outside of it\n *\n * @default false\n */\n closeOnScroll?: boolean;\n\n /**\n * Used to set the initial open state of the Popover in uncontrolled mode\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Sets the delay for closing popover on mouse leave\n */\n mouseLeaveDelay?: number;\n\n /**\n * Display an arrow pointing to the target.\n *\n * @default false\n */\n withArrow?: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;\n\n /**\n * Controls the opening of the Popover\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Flag to open the Popover as a context menu. Disables all other interactions\n *\n * @default false\n */\n openOnContext?: boolean;\n\n /**\n * Flag to open the Popover by hovering the trigger\n *\n * @default false\n */\n openOnHover?: boolean;\n\n /**\n * Configures the position of the Popover\n */\n positioning?: PositioningShorthand;\n\n /**\n * Determines popover padding and arrow size\n *\n * @default medium\n */\n size?: PopoverSize;\n\n /**\n * Should trap focus\n *\n * @default false\n */\n trapFocus?: UseModalAttributesOptions['trapFocus'];\n\n /**\n * Must be used with the `trapFocus` prop\n * Enables older Fluent UI focus trap behavior where the user\n * cannot tab into the window outside of the document. This is now\n * non-standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)\n * where the focus trap involves setting outside elements inert.\n *\n * @default false\n */\n legacyTrapFocus?: UseModalAttributesOptions['legacyTrapFocus'];\n};\n\n/**\n * Popover State\n */\nexport type PopoverState = Pick<\n PopoverProps,\n | 'appearance'\n | 'mountNode'\n | 'onOpenChange'\n | 'openOnContext'\n | 'openOnHover'\n | 'trapFocus'\n | 'withArrow'\n | 'legacyTrapFocus'\n> &\n Required<Pick<PopoverProps, 'inline' | 'open'>> &\n Pick<PopoverProps, 'children'> & {\n /**\n * Ref of the pointing arrow\n */\n arrowRef: React.MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Ref of the PopoverSurface\n */\n contentRef: React.MutableRefObject<HTMLElement | null>;\n\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: PositioningVirtualElement | undefined;\n\n popoverSurface: React.ReactElement | undefined;\n\n popoverTrigger: React.ReactElement | undefined;\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];\n\n /**\n * Callback to open/close the Popover\n */\n setOpen: (e: OpenPopoverEvents, open: boolean) => void;\n\n size: NonNullable<PopoverProps['size']>;\n\n /**\n * Callback to toggle the open state of the Popover\n */\n toggleOpen: (e: OpenPopoverEvents) => void;\n\n /**\n * Ref of the PopoverTrigger\n */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n };\n\n/**\n * Data attached to open/close events\n */\nexport type OnOpenChangeData = { open: boolean };\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type OpenPopoverEvents =\n | MouseEvent\n | TouchEvent\n | React.FocusEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement>;\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @internal
3
+ * The default value of the tooltip's border radius (borderRadiusMedium).
4
+ *
5
+ * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
6
+ * While we could use getComputedStyle, that adds a performance penalty for something that
7
+ * will likely never change.
8
+ */
9
+ export const popoverSurfaceBorderRadius = 4;
10
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"../src/","sources":["components/Popover/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["/**\n * @internal\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const popoverSurfaceBorderRadius = 4;\n"]}
@@ -6,33 +6,39 @@ import { PopoverContext } from '../../popoverContext';
6
6
 
7
7
  export const renderPopover_unstable = state => {
8
8
  const {
9
- setOpen,
10
- toggleOpen,
11
- triggerRef,
9
+ appearance,
10
+ arrowRef,
12
11
  contentRef,
12
+ inline,
13
+ mountNode,
14
+ open,
13
15
  openOnContext,
14
16
  openOnHover,
15
- mountNode,
16
- arrowRef,
17
+ setOpen,
17
18
  size,
18
- noArrow,
19
- appearance,
20
- trapFocus
19
+ toggleOpen,
20
+ trapFocus,
21
+ triggerRef,
22
+ withArrow,
23
+ legacyTrapFocus
21
24
  } = state;
22
25
  return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
23
26
  value: {
27
+ appearance,
28
+ arrowRef,
29
+ contentRef,
30
+ inline,
31
+ mountNode,
32
+ open,
33
+ openOnContext,
34
+ openOnHover,
24
35
  setOpen,
25
36
  toggleOpen,
26
37
  triggerRef,
27
- contentRef,
28
- openOnHover,
29
- openOnContext,
30
- mountNode,
31
- arrowRef,
32
38
  size,
33
- noArrow,
34
- appearance,
35
- trapFocus
39
+ trapFocus,
40
+ legacyTrapFocus,
41
+ withArrow
36
42
  }
37
43
  }, state.popoverTrigger, state.open && state.popoverSurface);
38
44
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Popover/renderPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,sBAA/B;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AACJ,IAAA,OADI;AAEJ,IAAA,UAFI;AAGJ,IAAA,UAHI;AAIJ,IAAA,UAJI;AAKJ,IAAA,aALI;AAMJ,IAAA,WANI;AAOJ,IAAA,SAPI;AAQJ,IAAA,QARI;AASJ,IAAA,IATI;AAUJ,IAAA,OAVI;AAWJ,IAAA,UAXI;AAYJ,IAAA;AAZI,MAaF,KAbJ;AAeA,sBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;AACtB,IAAA,KAAK,EAAE;AACL,MAAA,OADK;AAEL,MAAA,UAFK;AAGL,MAAA,UAHK;AAIL,MAAA,UAJK;AAKL,MAAA,WALK;AAML,MAAA,aANK;AAOL,MAAA,SAPK;AAQL,MAAA,QARK;AASL,MAAA,IATK;AAUL,MAAA,OAVK;AAWL,MAAA,UAXK;AAYL,MAAA;AAZK;AADe,GAAxB,EAgBG,KAAK,CAAC,cAhBT,EAiBG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,cAjBvB,CADF;AAqBD,CArCM","sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n setOpen,\n toggleOpen,\n triggerRef,\n contentRef,\n openOnContext,\n openOnHover,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n setOpen,\n toggleOpen,\n triggerRef,\n contentRef,\n openOnHover,\n openOnContext,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Popover/renderPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,sBAA/B;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;EAC5D,MAAM;IACJ,UADI;IAEJ,QAFI;IAGJ,UAHI;IAIJ,MAJI;IAKJ,SALI;IAMJ,IANI;IAOJ,aAPI;IAQJ,WARI;IASJ,OATI;IAUJ,IAVI;IAWJ,UAXI;IAYJ,SAZI;IAaJ,UAbI;IAcJ,SAdI;IAeJ;EAfI,IAgBF,KAhBJ;EAkBA,oBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;IACtB,KAAK,EAAE;MACL,UADK;MAEL,QAFK;MAGL,UAHK;MAIL,MAJK;MAKL,SALK;MAML,IANK;MAOL,aAPK;MAQL,WARK;MASL,OATK;MAUL,UAVK;MAWL,UAXK;MAYL,IAZK;MAaL,SAbK;MAcL,eAdK;MAeL;IAfK;EADe,CAAxB,EAmBG,KAAK,CAAC,cAnBT,EAoBG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,cApBvB,CADF;AAwBD,CA3CM","sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n size,\n toggleOpen,\n trapFocus,\n triggerRef,\n withArrow,\n legacyTrapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n open,\n openOnContext,\n openOnHover,\n setOpen,\n toggleOpen,\n triggerRef,\n size,\n trapFocus,\n legacyTrapFocus,\n withArrow,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
3
- import { useFluent } from '@fluentui/react-shared-contexts';
4
- import { usePopper, resolvePositioningShorthand, mergeArrowOffset, usePopperMouseTarget } from '@fluentui/react-positioning';
3
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
4
+ import { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget } from '@fluentui/react-positioning';
5
5
  import { elementContains } from '@fluentui/react-portal';
6
6
  import { useFocusFinders } from '@fluentui/react-tabster';
7
7
  import { arrowHeights } from '../PopoverSurface/index';
8
+ import { popoverSurfaceBorderRadius } from './constants';
8
9
  /**
9
10
  * Create the state required to render Popover.
10
11
  *
@@ -15,7 +16,9 @@ import { arrowHeights } from '../PopoverSurface/index';
15
16
  */
16
17
 
17
18
  export const usePopover_unstable = props => {
18
- const [contextTarget, setContextTarget] = usePopperMouseTarget();
19
+ var _a;
20
+
21
+ const [contextTarget, setContextTarget] = usePositioningMouseTarget();
19
22
  const initialState = {
20
23
  size: 'medium',
21
24
  contextTarget,
@@ -46,11 +49,40 @@ export const usePopover_unstable = props => {
46
49
  popoverSurface = children[0];
47
50
  }
48
51
 
49
- const [open, setOpen] = useOpenState(initialState);
52
+ const [open, setOpenState] = useOpenState(initialState);
53
+ const setOpenTimeoutRef = React.useRef(0);
54
+ const setOpen = useEventCallback((e, shouldOpen) => {
55
+ var _a;
56
+
57
+ clearTimeout(setOpenTimeoutRef.current);
58
+
59
+ if (!(e instanceof Event) && e.persist) {
60
+ // < React 17 still uses pooled synthetic events
61
+ e.persist();
62
+ }
63
+
64
+ if (e.type === 'mouseleave') {
65
+ // FIXME leaking Node timeout type
66
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
67
+ // @ts-ignore
68
+ setOpenTimeoutRef.current = setTimeout(() => {
69
+ setOpenState(e, shouldOpen);
70
+ }, (_a = props.mouseLeaveDelay) !== null && _a !== void 0 ? _a : 500);
71
+ } else {
72
+ setOpenState(e, shouldOpen);
73
+ }
74
+ }); // Clear timeout on unmount
75
+ // Setting state after a component unmounts can cause memory leaks
76
+
77
+ React.useEffect(() => {
78
+ return () => {
79
+ clearTimeout(setOpenTimeoutRef.current);
80
+ };
81
+ }, []);
50
82
  const toggleOpen = React.useCallback(e => {
51
83
  setOpen(e, !open);
52
84
  }, [setOpen, open]);
53
- const popperRefs = usePopoverRefs(initialState);
85
+ const positioningRefs = usePopoverRefs(initialState);
54
86
  const {
55
87
  targetDocument
56
88
  } = useFluent();
@@ -58,35 +90,37 @@ export const usePopover_unstable = props => {
58
90
  contains: elementContains,
59
91
  element: targetDocument,
60
92
  callback: ev => setOpen(ev, false),
61
- refs: [popperRefs.triggerRef, popperRefs.contentRef],
93
+ refs: [positioningRefs.triggerRef, positioningRefs.contentRef],
62
94
  disabled: !open
63
- });
95
+ }); // only close on scroll for context, or when closeOnScroll is specified
96
+
97
+ const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;
64
98
  useOnScrollOutside({
65
99
  contains: elementContains,
66
100
  element: targetDocument,
67
101
  callback: ev => setOpen(ev, false),
68
- refs: [popperRefs.triggerRef, popperRefs.contentRef],
69
- disabled: !open || !initialState.openOnContext // only close on scroll for context
70
-
102
+ refs: [positioningRefs.triggerRef, positioningRefs.contentRef],
103
+ disabled: !open || !closeOnScroll
71
104
  });
72
105
  const {
73
106
  findFirstFocusable
74
107
  } = useFocusFinders();
75
108
  React.useEffect(() => {
76
- if (open && popperRefs.contentRef.current) {
77
- const firstFocusable = findFirstFocusable(popperRefs.contentRef.current);
109
+ if (open && positioningRefs.contentRef.current) {
110
+ const firstFocusable = findFirstFocusable(positioningRefs.contentRef.current);
78
111
  firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
79
112
  }
80
- }, [findFirstFocusable, open, popperRefs.contentRef]);
113
+ }, [findFirstFocusable, open, positioningRefs.contentRef]);
81
114
  return { ...initialState,
82
- ...popperRefs,
115
+ ...positioningRefs,
83
116
  popoverTrigger,
84
117
  popoverSurface,
85
118
  open,
86
119
  setOpen,
87
120
  toggleOpen,
88
121
  setContextTarget,
89
- contextTarget
122
+ contextTarget,
123
+ inline: (_a = props.inline) !== null && _a !== void 0 ? _a : false
90
124
  };
91
125
  };
92
126
  /**
@@ -135,26 +169,27 @@ function useOpenState(state) {
135
169
 
136
170
 
137
171
  function usePopoverRefs(state) {
138
- const popperOptions = {
172
+ const positioningOptions = {
139
173
  position: 'above',
140
174
  align: 'center',
175
+ arrowPadding: 2 * popoverSurfaceBorderRadius,
141
176
  target: state.openOnContext ? state.contextTarget : undefined,
142
177
  ...resolvePositioningShorthand(state.positioning)
143
178
  }; // no reason to render arrow when covering the target
144
179
 
145
- if (popperOptions.coverTarget) {
146
- state.noArrow = true;
180
+ if (positioningOptions.coverTarget) {
181
+ state.withArrow = false;
147
182
  }
148
183
 
149
- if (!state.noArrow) {
150
- popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
184
+ if (state.withArrow) {
185
+ positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);
151
186
  }
152
187
 
153
188
  const {
154
189
  targetRef: triggerRef,
155
190
  containerRef: contentRef,
156
191
  arrowRef
157
- } = usePopper(popperOptions);
192
+ } = usePositioning(positioningOptions);
158
193
  return {
159
194
  triggerRef,
160
195
  contentRef,