@fluentui/react-popover 0.0.0-nightlyff78d1e27a20220217.1 → 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/CHANGELOG.json +780 -20
  2. package/CHANGELOG.md +281 -82
  3. package/Spec.md +25 -5
  4. package/dist/{react-popover.d.ts → index.d.ts} +99 -53
  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 +23 -17
  11. package/lib/components/Popover/renderPopover.js.map +1 -1
  12. package/lib/components/Popover/usePopover.js +93 -18
  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 +9 -8
  17. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  18. package/lib/components/PopoverSurface/usePopoverSurface.js +8 -16
  19. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  20. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +24 -22
  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 +4 -4
  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 +23 -17
  35. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  36. package/lib-commonjs/components/Popover/usePopover.js +94 -17
  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 +9 -8
  40. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  41. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +7 -16
  42. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  43. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +25 -23
  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 +4 -4
  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 +26 -28
  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 -103
  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 -8
  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 -103
  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 -8
  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,17 +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
- import type { usePopperMouseTarget } from '@fluentui/react-positioning';
16
+ import type { SlotClassNames } from '@fluentui/react-utilities';
17
+ import type { UseModalAttributesOptions } from '@fluentui/react-tabster';
18
+ import type { usePositioningMouseTarget } from '@fluentui/react-positioning';
15
19
 
16
20
  export declare const arrowHeights: Record<PopoverSize, number>;
17
21
 
@@ -25,76 +29,112 @@ export declare type OnOpenChangeData = {
25
29
  /**
26
30
  * The supported events that will trigger open/close of the menu
27
31
  */
28
- 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>;
29
33
 
30
34
  /**
31
35
  * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
32
36
  */
33
37
  export declare const Popover: React_2.FC<PopoverProps>;
34
38
 
35
- 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'> & {
36
48
  /**
37
- * 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.
38
51
  */
39
- 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;
40
64
  /**
41
65
  * Used to set the initial open state of the Popover in uncontrolled mode
66
+ *
67
+ * @default false
42
68
  */
43
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;
44
86
  /**
45
87
  * Call back when the component requests to change value
46
88
  * The `open` value is used as a hint when directly controlling the component
47
89
  */
48
90
  onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
49
91
  /**
50
- * Flag to open the Popover by hovering the trigger
92
+ * Controls the opening of the Popover
93
+ *
94
+ * @default false
51
95
  */
52
- openOnHover?: boolean;
96
+ open?: boolean;
53
97
  /**
54
98
  * Flag to open the Popover as a context menu. Disables all other interactions
99
+ *
100
+ * @default false
55
101
  */
56
102
  openOnContext?: boolean;
57
103
  /**
58
- * Do not display the arrow
104
+ * Flag to open the Popover by hovering the trigger
105
+ *
106
+ * @default false
59
107
  */
60
- noArrow?: boolean;
108
+ openOnHover?: boolean;
109
+ /**
110
+ * Configures the position of the Popover
111
+ */
112
+ positioning?: PositioningShorthand;
61
113
  /**
62
114
  * Determines popover padding and arrow size
115
+ *
63
116
  * @default medium
64
117
  */
65
118
  size?: PopoverSize;
66
- /**
67
- * A popover can appear styled with brand or inverted.
68
- * When not specified, the default style is used.
69
- */
70
- appearance?: 'brand' | 'inverted';
71
119
  /**
72
120
  * Should trap focus
121
+ *
122
+ * @default false
73
123
  */
74
- trapFocus?: boolean;
124
+ trapFocus?: UseModalAttributesOptions['trapFocus'];
75
125
  /**
76
- * 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
77
133
  */
78
- positioning?: PositioningShorthand;
134
+ legacyTrapFocus?: UseModalAttributesOptions['legacyTrapFocus'];
79
135
  };
80
136
 
81
- export declare const PopoverContext: Context<PopoverContextValue>;
82
-
83
- /**
84
- * Context shared between Popover and its children components
85
- */
86
- export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
87
-
88
- /**
89
- * Popover Props
90
- */
91
- export declare type PopoverProps = Partial<PopoverCommons> & {
92
- /**
93
- * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.
94
- * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.
95
- */
96
- children: [JSX.Element, JSX.Element] | JSX.Element;
97
- };
137
+ export declare const PopoverProvider: Provider<PopoverContextValue> & FC<ProviderProps<PopoverContextValue>>;
98
138
 
99
139
  /**
100
140
  * Determines popover padding and arrow size
@@ -104,32 +144,38 @@ export declare type PopoverSize = 'small' | 'medium' | 'large';
104
144
  /**
105
145
  * Popover State
106
146
  */
107
- export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children'> & {
108
- /**
109
- * Callback to open/close the Popover
110
- */
111
- setOpen: (e: OpenPopoverEvents, open: boolean) => void;
147
+ export declare type PopoverState = Pick<PopoverProps, 'appearance' | 'mountNode' | 'onOpenChange' | 'openOnContext' | 'openOnHover' | 'trapFocus' | 'withArrow' | 'legacyTrapFocus'> & Required<Pick<PopoverProps, 'inline' | 'open'>> & Pick<PopoverProps, 'children'> & {
112
148
  /**
113
- * Ref of the PopoverTrigger
149
+ * Ref of the pointing arrow
114
150
  */
115
- triggerRef: React_2.MutableRefObject<HTMLElement | null>;
151
+ arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
116
152
  /**
117
153
  * Ref of the PopoverSurface
118
154
  */
119
155
  contentRef: React_2.MutableRefObject<HTMLElement | null>;
120
- /**
121
- * Ref of the pointing arrow
122
- */
123
- arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
124
156
  /**
125
157
  * Anchors the popper to the mouse click for context events
126
158
  */
127
- contextTarget: PopperVirtualElement | undefined;
159
+ contextTarget: PositioningVirtualElement | undefined;
160
+ popoverSurface: React_2.ReactElement | undefined;
161
+ popoverTrigger: React_2.ReactElement | undefined;
128
162
  /**
129
163
  * A callback to set the target of the popper to the mouse click for context events
130
164
  */
131
- setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
165
+ setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];
166
+ /**
167
+ * Callback to open/close the Popover
168
+ */
169
+ setOpen: (e: OpenPopoverEvents, open: boolean) => void;
132
170
  size: NonNullable<PopoverProps['size']>;
171
+ /**
172
+ * Callback to toggle the open state of the Popover
173
+ */
174
+ toggleOpen: (e: OpenPopoverEvents) => void;
175
+ /**
176
+ * Ref of the PopoverTrigger
177
+ */
178
+ triggerRef: React_2.MutableRefObject<HTMLElement | null>;
133
179
  };
134
180
 
135
181
  /**
@@ -137,7 +183,7 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
137
183
  */
138
184
  export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
139
185
 
140
- export declare const popoverSurfaceClassName = "fui-PopoverSurface";
186
+ export declare const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots>;
141
187
 
142
188
  /**
143
189
  * PopoverSurface Props
@@ -154,7 +200,7 @@ export declare type PopoverSurfaceSlots = {
154
200
  /**
155
201
  * PopoverSurface State
156
202
  */
157
- export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
203
+ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'size' | 'withArrow'> & {
158
204
  /**
159
205
  * CSS class for the arrow element
160
206
  */
@@ -168,7 +214,7 @@ export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps> & FluentTri
168
214
 
169
215
  export declare type PopoverTriggerChildProps = {
170
216
  ref?: React_2.Ref<never>;
171
- } & 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'>;
172
218
 
173
219
  /**
174
220
  * PopoverTrigger Props
@@ -194,7 +240,7 @@ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Elemen
194
240
  /**
195
241
  * Render the final JSX of PopoverSurface
196
242
  */
197
- export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
243
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element;
198
244
 
199
245
  /**
200
246
  * Render the final JSX of PopoverTrigger
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 * 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\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,34 +6,40 @@ import { PopoverContext } from '../../popoverContext';
6
6
 
7
7
  export const renderPopover_unstable = state => {
8
8
  const {
9
- open,
10
- setOpen,
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,
24
32
  open,
33
+ openOnContext,
34
+ openOnHover,
25
35
  setOpen,
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
- }, state.children);
43
+ }, state.popoverTrigger, state.open && state.popoverSurface);
38
44
  };
39
45
  //# sourceMappingURL=renderPopover.js.map
@@ -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,IADI;AAEJ,IAAA,OAFI;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,IADK;AAEL,MAAA,OAFK;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,QAhBT,CADF;AAoBD,CApCM","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 open,\n setOpen,\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 open,\n setOpen,\n triggerRef,\n contentRef,\n openOnHover,\n openOnContext,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n }}\n >\n {state.children}\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,9 +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
+ import { useFocusFinders } from '@fluentui/react-tabster';
6
7
  import { arrowHeights } from '../PopoverSurface/index';
8
+ import { popoverSurfaceBorderRadius } from './constants';
7
9
  /**
8
10
  * Create the state required to render Popover.
9
11
  *
@@ -14,15 +16,73 @@ import { arrowHeights } from '../PopoverSurface/index';
14
16
  */
15
17
 
16
18
  export const usePopover_unstable = props => {
17
- const [contextTarget, setContextTarget] = usePopperMouseTarget();
19
+ var _a;
20
+
21
+ const [contextTarget, setContextTarget] = usePositioningMouseTarget();
18
22
  const initialState = {
19
23
  size: 'medium',
20
24
  contextTarget,
21
25
  setContextTarget,
22
26
  ...props
23
27
  };
24
- const [open, setOpen] = useOpenState(initialState);
25
- const popperRefs = usePopoverRefs(initialState);
28
+ const children = React.Children.toArray(props.children);
29
+
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ if (children.length === 0) {
32
+ // eslint-disable-next-line no-console
33
+ console.warn('Popover must contain at least one child');
34
+ }
35
+
36
+ if (children.length > 2) {
37
+ // eslint-disable-next-line no-console
38
+ console.warn('Popover must contain at most two children');
39
+ }
40
+ }
41
+
42
+ let popoverTrigger = undefined;
43
+ let popoverSurface = undefined;
44
+
45
+ if (children.length === 2) {
46
+ popoverTrigger = children[0];
47
+ popoverSurface = children[1];
48
+ } else if (children.length === 1) {
49
+ popoverSurface = children[0];
50
+ }
51
+
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
+ }, []);
82
+ const toggleOpen = React.useCallback(e => {
83
+ setOpen(e, !open);
84
+ }, [setOpen, open]);
85
+ const positioningRefs = usePopoverRefs(initialState);
26
86
  const {
27
87
  targetDocument
28
88
  } = useFluent();
@@ -30,23 +90,37 @@ export const usePopover_unstable = props => {
30
90
  contains: elementContains,
31
91
  element: targetDocument,
32
92
  callback: ev => setOpen(ev, false),
33
- refs: [popperRefs.triggerRef, popperRefs.contentRef],
93
+ refs: [positioningRefs.triggerRef, positioningRefs.contentRef],
34
94
  disabled: !open
35
- });
95
+ }); // only close on scroll for context, or when closeOnScroll is specified
96
+
97
+ const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;
36
98
  useOnScrollOutside({
37
99
  contains: elementContains,
38
100
  element: targetDocument,
39
101
  callback: ev => setOpen(ev, false),
40
- refs: [popperRefs.triggerRef, popperRefs.contentRef],
41
- disabled: !open || !initialState.openOnContext // only close on scroll for context
42
-
102
+ refs: [positioningRefs.triggerRef, positioningRefs.contentRef],
103
+ disabled: !open || !closeOnScroll
43
104
  });
105
+ const {
106
+ findFirstFocusable
107
+ } = useFocusFinders();
108
+ React.useEffect(() => {
109
+ if (open && positioningRefs.contentRef.current) {
110
+ const firstFocusable = findFirstFocusable(positioningRefs.contentRef.current);
111
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
112
+ }
113
+ }, [findFirstFocusable, open, positioningRefs.contentRef]);
44
114
  return { ...initialState,
45
- ...popperRefs,
115
+ ...positioningRefs,
116
+ popoverTrigger,
117
+ popoverSurface,
46
118
  open,
47
119
  setOpen,
120
+ toggleOpen,
48
121
  setContextTarget,
49
- contextTarget
122
+ contextTarget,
123
+ inline: (_a = props.inline) !== null && _a !== void 0 ? _a : false
50
124
  };
51
125
  };
52
126
  /**
@@ -95,26 +169,27 @@ function useOpenState(state) {
95
169
 
96
170
 
97
171
  function usePopoverRefs(state) {
98
- const popperOptions = {
172
+ const positioningOptions = {
99
173
  position: 'above',
100
174
  align: 'center',
175
+ arrowPadding: 2 * popoverSurfaceBorderRadius,
101
176
  target: state.openOnContext ? state.contextTarget : undefined,
102
177
  ...resolvePositioningShorthand(state.positioning)
103
178
  }; // no reason to render arrow when covering the target
104
179
 
105
- if (popperOptions.coverTarget) {
106
- state.noArrow = true;
180
+ if (positioningOptions.coverTarget) {
181
+ state.withArrow = false;
107
182
  }
108
183
 
109
- if (!state.noArrow) {
110
- popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
184
+ if (state.withArrow) {
185
+ positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeights[state.size]);
111
186
  }
112
187
 
113
188
  const {
114
189
  targetRef: triggerRef,
115
190
  containerRef: contentRef,
116
191
  arrowRef
117
- } = usePopper(popperOptions);
192
+ } = usePositioning(positioningOptions);
118
193
  return {
119
194
  triggerRef,
120
195
  contentRef,