@fluentui/react-popover 9.0.0-rc.1 → 9.0.0-rc.10

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 (106) hide show
  1. package/CHANGELOG.json +497 -1
  2. package/CHANGELOG.md +201 -71
  3. package/Spec.md +20 -0
  4. package/dist/{react-popover.d.ts → index.d.ts} +85 -49
  5. package/{lib → dist}/tsdoc-metadata.json +0 -0
  6. package/lib/Popover.js.map +1 -1
  7. package/lib/PopoverSurface.js.map +1 -1
  8. package/lib/PopoverTrigger.js.map +1 -1
  9. package/lib/components/Popover/Popover.js.map +1 -1
  10. package/lib/components/Popover/Popover.types.js.map +1 -1
  11. package/lib/components/Popover/index.js.map +1 -1
  12. package/lib/components/Popover/renderPopover.js +19 -17
  13. package/lib/components/Popover/renderPopover.js.map +1 -1
  14. package/lib/components/Popover/usePopover.js +81 -8
  15. package/lib/components/Popover/usePopover.js.map +1 -1
  16. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  17. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  18. package/lib/components/PopoverSurface/index.js.map +1 -1
  19. package/lib/components/PopoverSurface/renderPopoverSurface.js +9 -8
  20. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  21. package/lib/components/PopoverSurface/usePopoverSurface.js +3 -13
  22. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  23. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +8 -1
  24. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  25. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  26. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  27. package/lib/components/PopoverTrigger/index.js.map +1 -1
  28. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  29. package/lib/components/PopoverTrigger/usePopoverTrigger.js +2 -2
  30. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  31. package/lib/index.js +5 -4
  32. package/lib/index.js.map +1 -1
  33. package/lib/popoverContext.js +3 -2
  34. package/lib/popoverContext.js.map +1 -1
  35. package/lib-commonjs/Popover.js.map +1 -1
  36. package/lib-commonjs/PopoverSurface.js.map +1 -1
  37. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  38. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  39. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  40. package/lib-commonjs/components/Popover/index.js.map +1 -1
  41. package/lib-commonjs/components/Popover/renderPopover.js +19 -17
  42. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  43. package/lib-commonjs/components/Popover/usePopover.js +82 -8
  44. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  45. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  46. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  47. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  48. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +9 -8
  49. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  50. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +2 -13
  51. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  52. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +9 -2
  53. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  54. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  55. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  56. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  57. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  58. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +2 -2
  59. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  60. package/lib-commonjs/index.js +99 -5
  61. package/lib-commonjs/index.js.map +1 -1
  62. package/lib-commonjs/popoverContext.js +3 -2
  63. package/lib-commonjs/popoverContext.js.map +1 -1
  64. package/package.json +21 -23
  65. package/lib/Popover.d.ts +0 -1
  66. package/lib/PopoverSurface.d.ts +0 -1
  67. package/lib/PopoverTrigger.d.ts +0 -1
  68. package/lib/components/Popover/Popover.d.ts +0 -6
  69. package/lib/components/Popover/Popover.types.d.ts +0 -103
  70. package/lib/components/Popover/index.d.ts +0 -4
  71. package/lib/components/Popover/renderPopover.d.ts +0 -5
  72. package/lib/components/Popover/usePopover.d.ts +0 -10
  73. package/lib/components/PopoverSurface/PopoverSurface.d.ts +0 -6
  74. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +0 -21
  75. package/lib/components/PopoverSurface/index.d.ts +0 -5
  76. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
  77. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +0 -12
  78. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -8
  79. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +0 -7
  80. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -18
  81. package/lib/components/PopoverTrigger/index.d.ts +0 -4
  82. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
  83. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -10
  84. package/lib/index.d.ts +0 -4
  85. package/lib/popoverContext.d.ts +0 -8
  86. package/lib-commonjs/Popover.d.ts +0 -1
  87. package/lib-commonjs/PopoverSurface.d.ts +0 -1
  88. package/lib-commonjs/PopoverTrigger.d.ts +0 -1
  89. package/lib-commonjs/components/Popover/Popover.d.ts +0 -6
  90. package/lib-commonjs/components/Popover/Popover.types.d.ts +0 -103
  91. package/lib-commonjs/components/Popover/index.d.ts +0 -4
  92. package/lib-commonjs/components/Popover/renderPopover.d.ts +0 -5
  93. package/lib-commonjs/components/Popover/usePopover.d.ts +0 -10
  94. package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +0 -6
  95. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +0 -21
  96. package/lib-commonjs/components/PopoverSurface/index.d.ts +0 -5
  97. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
  98. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +0 -12
  99. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -8
  100. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +0 -7
  101. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -18
  102. package/lib-commonjs/components/PopoverTrigger/index.d.ts +0 -4
  103. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
  104. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -10
  105. package/lib-commonjs/index.d.ts +0 -4
  106. 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
 
@@ -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.
@@ -11,6 +11,7 @@ import type { PositioningShorthand } from '@fluentui/react-positioning';
11
11
  import * as React_2 from 'react';
12
12
  import { ReactElement } from 'react';
13
13
  import type { Slot } from '@fluentui/react-utilities';
14
+ import type { SlotClassNames } from '@fluentui/react-utilities';
14
15
  import type { usePopperMouseTarget } from '@fluentui/react-positioning';
15
16
 
16
17
  export declare const arrowHeights: Record<PopoverSize, number>;
@@ -25,75 +26,99 @@ export declare type OnOpenChangeData = {
25
26
  /**
26
27
  * The supported events that will trigger open/close of the menu
27
28
  */
28
- export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.FocusEvent<HTMLElement>;
29
+ export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.FocusEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement>;
29
30
 
30
31
  /**
31
32
  * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
32
33
  */
33
34
  export declare const Popover: React_2.FC<PopoverProps>;
34
35
 
35
- declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
36
+ export declare const PopoverContext: Context<PopoverContextValue>;
37
+
38
+ /**
39
+ * Context shared between Popover and its children components
40
+ */
41
+ export declare type PopoverContextValue = Pick<PopoverState, 'toggleOpen' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus' | 'inline'>;
42
+
43
+ /**
44
+ * Popover Props
45
+ */
46
+ export declare type PopoverProps = Pick<PortalProps, 'mountNode'> & {
36
47
  /**
37
- * Controls the opening of the Popover
48
+ * A popover can appear styled with brand or inverted.
49
+ * When not specified, the default style is used.
38
50
  */
39
- open: boolean;
51
+ appearance?: 'brand' | 'inverted';
52
+ /**
53
+ * Can contain two children including {@link PopoverTrigger} and {@link PopoverSurface}.
54
+ * Alternatively can only contain {@link PopoverSurface} if using a custom `target`.
55
+ */
56
+ children: [JSX.Element, JSX.Element] | JSX.Element;
57
+ /**
58
+ * Close when scroll outside of it
59
+ *
60
+ * @default false
61
+ */
62
+ closeOnScroll?: boolean;
40
63
  /**
41
64
  * Used to set the initial open state of the Popover in uncontrolled mode
65
+ *
66
+ * @default false
42
67
  */
43
68
  defaultOpen?: boolean;
69
+ /**
70
+ * Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order
71
+ *
72
+ * @default false
73
+ */
74
+ inline?: boolean;
75
+ /**
76
+ * Sets the delay for closing popover on mouse leave
77
+ */
78
+ mouseLeaveDelay?: number;
79
+ /**
80
+ * Do not display the arrow
81
+ */
82
+ noArrow?: boolean;
44
83
  /**
45
84
  * Call back when the component requests to change value
46
85
  * The `open` value is used as a hint when directly controlling the component
47
86
  */
48
87
  onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
49
88
  /**
50
- * Flag to open the Popover by hovering the trigger
89
+ * Controls the opening of the Popover
90
+ *
91
+ * @default false
51
92
  */
52
- openOnHover?: boolean;
93
+ open?: boolean;
53
94
  /**
54
95
  * Flag to open the Popover as a context menu. Disables all other interactions
96
+ *
97
+ * @default false
55
98
  */
56
99
  openOnContext?: boolean;
57
100
  /**
58
- * Do not display the arrow
101
+ * Flag to open the Popover by hovering the trigger
102
+ *
103
+ * @default false
59
104
  */
60
- noArrow?: boolean;
105
+ openOnHover?: boolean;
106
+ /**
107
+ * Configures the position of the Popover
108
+ */
109
+ positioning?: PositioningShorthand;
61
110
  /**
62
111
  * Determines popover padding and arrow size
112
+ *
63
113
  * @default medium
64
114
  */
65
115
  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
116
  /**
72
117
  * Should trap focus
118
+ *
119
+ * @default false
73
120
  */
74
121
  trapFocus?: boolean;
75
- /**
76
- * Configures the position of the Popover
77
- */
78
- positioning?: PositioningShorthand;
79
- };
80
-
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
122
  };
98
123
 
99
124
  /**
@@ -104,32 +129,38 @@ export declare type PopoverSize = 'small' | 'medium' | 'large';
104
129
  /**
105
130
  * Popover State
106
131
  */
107
- export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children'> & {
132
+ export declare type PopoverState = Pick<PopoverProps, 'appearance' | 'mountNode' | 'noArrow' | 'onOpenChange' | 'openOnContext' | 'openOnHover' | 'trapFocus'> & Required<Pick<PopoverProps, 'inline' | 'open'>> & Pick<PopoverProps, 'children'> & {
108
133
  /**
109
- * Callback to open/close the Popover
110
- */
111
- setOpen: (e: OpenPopoverEvents, open: boolean) => void;
112
- /**
113
- * Ref of the PopoverTrigger
134
+ * Ref of the pointing arrow
114
135
  */
115
- triggerRef: React_2.MutableRefObject<HTMLElement | null>;
136
+ arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
116
137
  /**
117
138
  * Ref of the PopoverSurface
118
139
  */
119
140
  contentRef: React_2.MutableRefObject<HTMLElement | null>;
120
- /**
121
- * Ref of the pointing arrow
122
- */
123
- arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
124
141
  /**
125
142
  * Anchors the popper to the mouse click for context events
126
143
  */
127
144
  contextTarget: PopperVirtualElement | undefined;
145
+ popoverSurface: React_2.ReactElement | undefined;
146
+ popoverTrigger: React_2.ReactElement | undefined;
128
147
  /**
129
148
  * A callback to set the target of the popper to the mouse click for context events
130
149
  */
131
150
  setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
151
+ /**
152
+ * Callback to open/close the Popover
153
+ */
154
+ setOpen: (e: OpenPopoverEvents, open: boolean) => void;
132
155
  size: NonNullable<PopoverProps['size']>;
156
+ /**
157
+ * Callback to toggle the open state of the Popover
158
+ */
159
+ toggleOpen: (e: OpenPopoverEvents) => void;
160
+ /**
161
+ * Ref of the PopoverTrigger
162
+ */
163
+ triggerRef: React_2.MutableRefObject<HTMLElement | null>;
133
164
  };
134
165
 
135
166
  /**
@@ -137,8 +168,13 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
137
168
  */
138
169
  export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
139
170
 
171
+ /**
172
+ * @deprecated Use `popoverSurfaceClassNames.root` instead.
173
+ */
140
174
  export declare const popoverSurfaceClassName = "fui-PopoverSurface";
141
175
 
176
+ export declare const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots>;
177
+
142
178
  /**
143
179
  * PopoverSurface Props
144
180
  */
@@ -154,7 +190,7 @@ export declare type PopoverSurfaceSlots = {
154
190
  /**
155
191
  * PopoverSurface State
156
192
  */
157
- export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
193
+ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'noArrow' | 'size'> & {
158
194
  /**
159
195
  * CSS class for the arrow element
160
196
  */
@@ -168,7 +204,7 @@ export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps> & FluentTri
168
204
 
169
205
  export declare type PopoverTriggerChildProps = {
170
206
  ref?: React_2.Ref<never>;
171
- } & Pick<React_2.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
207
+ } & Pick<React_2.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onContextMenu' | 'onKeyDown' | 'onMouseEnter' | 'onMouseLeave'>;
172
208
 
173
209
  /**
174
210
  * PopoverTrigger Props
@@ -194,7 +230,7 @@ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Elemen
194
230
  /**
195
231
  * Render the final JSX of PopoverSurface
196
232
  */
197
- export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
233
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element;
198
234
 
199
235
  /**
200
236
  * Render the final JSX of PopoverTrigger
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../src/Popover.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"Popover.js","sourceRoot":"../src/","sources":["Popover.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Popover/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverSurface.js","sourceRoot":"","sources":["../src/PopoverSurface.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"PopoverSurface.js","sourceRoot":"../src/","sources":["PopoverSurface.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/PopoverSurface/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverTrigger.js","sourceRoot":"","sources":["../src/PopoverTrigger.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"PopoverTrigger.js","sourceRoot":"../src/","sources":["PopoverTrigger.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/PopoverTrigger/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/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","sourceRoot":""}
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 +1 @@
1
- {"version":3,"file":"Popover.types.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.types.ts"],"names":[],"mappings":""}
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 { PortalProps } from '@fluentui/react-portal';\nimport type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } from '@fluentui/react-positioning';\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 * Do not display the arrow\n */\n noArrow?: 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?: boolean;\n};\n\n/**\n * Popover State\n */\nexport type PopoverState = Pick<\n PopoverProps,\n 'appearance' | 'mountNode' | 'noArrow' | 'onOpenChange' | 'openOnContext' | 'openOnHover' | 'trapFocus'\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: PopperVirtualElement | 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 usePopperMouseTarget>[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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Popover/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC","sourcesContent":["export * from './Popover';\nexport * from './Popover.types';\nexport * from './renderPopover';\nexport * from './usePopover';\n"]}
@@ -6,34 +6,36 @@ 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
+ noArrow,
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
21
22
  } = state;
22
23
  return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
23
24
  value: {
24
- open,
25
- setOpen,
26
- triggerRef,
25
+ appearance,
26
+ arrowRef,
27
27
  contentRef,
28
- openOnHover,
29
- openOnContext,
28
+ inline,
30
29
  mountNode,
31
- arrowRef,
32
- size,
33
30
  noArrow,
34
- appearance,
31
+ openOnContext,
32
+ openOnHover,
33
+ setOpen,
34
+ toggleOpen,
35
+ triggerRef,
36
+ size,
35
37
  trapFocus
36
38
  }
37
- }, state.children);
39
+ }, state.popoverTrigger, state.open && state.popoverSurface);
38
40
  };
39
41
  //# sourceMappingURL=renderPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/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;AAU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EAkBG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,cAlBvB,CADF;AAsBD,CAvCM","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 noArrow,\n openOnContext,\n openOnHover,\n setOpen,\n size,\n toggleOpen,\n trapFocus,\n triggerRef,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n appearance,\n arrowRef,\n contentRef,\n inline,\n mountNode,\n noArrow,\n openOnContext,\n openOnHover,\n setOpen,\n toggleOpen,\n triggerRef,\n size,\n trapFocus,\n }}\n >\n {state.popoverTrigger}\n {state.open && state.popoverSurface}\n </PopoverContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
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';
5
2
  import { elementContains } from '@fluentui/react-portal';
3
+ import { mergeArrowOffset, resolvePositioningShorthand, usePopper, usePopperMouseTarget } from '@fluentui/react-positioning';
4
+ import { useFluent } from '@fluentui/react-shared-contexts';
5
+ import { useFocusFinders } from '@fluentui/react-tabster';
6
+ import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
6
7
  import { arrowHeights } from '../PopoverSurface/index';
7
8
  /**
8
9
  * Create the state required to render Popover.
@@ -14,6 +15,8 @@ import { arrowHeights } from '../PopoverSurface/index';
14
15
  */
15
16
 
16
17
  export const usePopover_unstable = props => {
18
+ var _a;
19
+
17
20
  const [contextTarget, setContextTarget] = usePopperMouseTarget();
18
21
  const initialState = {
19
22
  size: 'medium',
@@ -21,7 +24,63 @@ export const usePopover_unstable = props => {
21
24
  setContextTarget,
22
25
  ...props
23
26
  };
24
- const [open, setOpen] = useOpenState(initialState);
27
+ const children = React.Children.toArray(props.children);
28
+
29
+ if (process.env.NODE_ENV !== 'production') {
30
+ if (children.length === 0) {
31
+ // eslint-disable-next-line no-console
32
+ console.warn('Popover must contain at least one child');
33
+ }
34
+
35
+ if (children.length > 2) {
36
+ // eslint-disable-next-line no-console
37
+ console.warn('Popover must contain at most two children');
38
+ }
39
+ }
40
+
41
+ let popoverTrigger = undefined;
42
+ let popoverSurface = undefined;
43
+
44
+ if (children.length === 2) {
45
+ popoverTrigger = children[0];
46
+ popoverSurface = children[1];
47
+ } else if (children.length === 1) {
48
+ popoverSurface = children[0];
49
+ }
50
+
51
+ const [open, setOpenState] = useOpenState(initialState);
52
+ const setOpenTimeoutRef = React.useRef(0);
53
+ const setOpen = useEventCallback((e, shouldOpen) => {
54
+ var _a;
55
+
56
+ clearTimeout(setOpenTimeoutRef.current);
57
+
58
+ if (!(e instanceof Event) && e.persist) {
59
+ // < React 17 still uses pooled synthetic events
60
+ e.persist();
61
+ }
62
+
63
+ if (e.type === 'mouseleave') {
64
+ // FIXME leaking Node timeout type
65
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
66
+ // @ts-ignore
67
+ setOpenTimeoutRef.current = setTimeout(() => {
68
+ setOpenState(e, shouldOpen);
69
+ }, (_a = props.mouseLeaveDelay) !== null && _a !== void 0 ? _a : 500);
70
+ } else {
71
+ setOpenState(e, shouldOpen);
72
+ }
73
+ }); // Clear timeout on unmount
74
+ // Setting state after a component unmounts can cause memory leaks
75
+
76
+ React.useEffect(() => {
77
+ return () => {
78
+ clearTimeout(setOpenTimeoutRef.current);
79
+ };
80
+ }, []);
81
+ const toggleOpen = React.useCallback(e => {
82
+ setOpen(e, !open);
83
+ }, [setOpen, open]);
25
84
  const popperRefs = usePopoverRefs(initialState);
26
85
  const {
27
86
  targetDocument
@@ -32,21 +91,35 @@ export const usePopover_unstable = props => {
32
91
  callback: ev => setOpen(ev, false),
33
92
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
34
93
  disabled: !open
35
- });
94
+ }); // only close on scroll for context, or when closeOnScroll is specified
95
+
96
+ const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;
36
97
  useOnScrollOutside({
37
98
  contains: elementContains,
38
99
  element: targetDocument,
39
100
  callback: ev => setOpen(ev, false),
40
101
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
41
- disabled: !open || !initialState.openOnContext // only close on scroll for context
42
-
102
+ disabled: !open || !closeOnScroll
43
103
  });
104
+ const {
105
+ findFirstFocusable
106
+ } = useFocusFinders();
107
+ React.useEffect(() => {
108
+ if (open && popperRefs.contentRef.current) {
109
+ const firstFocusable = findFirstFocusable(popperRefs.contentRef.current);
110
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
111
+ }
112
+ }, [findFirstFocusable, open, popperRefs.contentRef]);
44
113
  return { ...initialState,
45
114
  ...popperRefs,
115
+ popoverTrigger,
116
+ popoverSurface,
46
117
  open,
47
118
  setOpen,
119
+ toggleOpen,
48
120
  setContextTarget,
49
- contextTarget
121
+ contextTarget,
122
+ inline: (_a = props.inline) !== null && _a !== void 0 ? _a : false
50
123
  };
51
124
  };
52
125
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/usePopover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,oBADF,EAEE,gBAFF,EAGE,iBAHF,EAIE,kBAJF,QAKO,2BALP;AAMA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SACE,SADF,EAEE,2BAFF,EAGE,gBAHF,EAIE,oBAJF,QAKO,6BALP;AAMA,SAAS,eAAT,QAAgC,wBAAhC;AACA,SAAS,YAAT,QAA6B,yBAA7B;AAGA;;;;;;;AAOG;;AACH,OAAO,MAAM,mBAAmB,GAAI,KAAD,IAAsC;AACvE,QA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pB,IAAA,KAAK,EAAE,QAFa;AAGpB,IAAA,MAAM,EAAE,KAAK,CAAC,aAAN,GAAsB,KAAK,CAAC,aAA5B,GAA4C,SAHhC;AAIpB,OAAG,2BAA2B,CAAC,KAAK,CAAC,WAAP;AAJV,GAAtB,CAFqH,CASrH;;AACA,MAAI,aAAa,CAAC,WAAlB,EAA+B;AAC7B,IAAA,KAAK,CAAC,OAAN,GAAgB,IAAhB;AACD;;AAED,MAAI,CAAC,KAAK,CAAC,OAAX,EAAoB;AAClB,IAAA,aAAa,CAAC,MAAd,GAAuB,gBAAgB,CAAC,aAAa,CAAC,MAAf,EAAuB,YAAY,CAAC,KAAK,CAAC,IAAP,CAAnC,CAAvC;AACD;;AAED,QAAM;AAAE,IAAA,SAAS,EAAE,UAAb;AAAyB,IAAA,YAAY,EAAE,UAAvC;AAAmD,IAAA;AAAnD,MAAgE,SAAS,CAAC,aAAD,CAA/E;AAEA,SAAO;AACL,IAAA,UADK;AAEL,IAAA,UAFK;AAGL,IAAA;AAHK,GAAP;AAKD","sourcesContent":["import * as React from 'react';\nimport { elementContains } from '@fluentui/react-portal';\nimport {\n mergeArrowOffset,\n resolvePositioningShorthand,\n usePopper,\n usePopperMouseTarget,\n} from '@fluentui/react-positioning';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\n\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */\nexport const usePopover_unstable = (props: PopoverProps): PopoverState => {\n const [contextTarget, setContextTarget] = usePopperMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Popover must contain at most two children');\n }\n }\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const [open, setOpenState] = useOpenState(initialState);\n\n const setOpenTimeoutRef = React.useRef(0);\n\n const setOpen = useEventCallback((e: OpenPopoverEvents, shouldOpen: boolean) => {\n clearTimeout(setOpenTimeoutRef.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave') {\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeoutRef.current = setTimeout(() => {\n setOpenState(e, shouldOpen);\n }, props.mouseLeaveDelay ?? 500);\n } else {\n setOpenState(e, shouldOpen);\n }\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeoutRef.current);\n };\n }, []);\n\n const toggleOpen = React.useCallback<PopoverState['toggleOpen']>(\n e => {\n setOpen(e, !open);\n },\n [setOpen, open],\n );\n\n const popperRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open,\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = initialState.openOnContext || initialState.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open || !closeOnScroll,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n\n React.useEffect(() => {\n if (open && popperRefs.contentRef.current) {\n const firstFocusable = findFirstFocusable(popperRefs.contentRef.current);\n firstFocusable?.focus();\n }\n }, [findFirstFocusable, open, popperRefs.contentRef]);\n\n return {\n ...initialState,\n ...popperRefs,\n popoverTrigger,\n popoverSurface,\n open,\n setOpen,\n toggleOpen,\n setContextTarget,\n contextTarget,\n inline: props.inline ?? false,\n };\n};\n\n/**\n * Creates and manages the Popover open state\n */\nfunction useOpenState(\n state: Pick<PopoverState, 'setContextTarget' | 'onOpenChange'> & Pick<PopoverProps, 'open' | 'defaultOpen'>,\n) {\n const onOpenChange: PopoverState['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n\n const setOpen = React.useCallback(\n (e: OpenPopoverEvents, shouldOpen: boolean) => {\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e as React.MouseEvent);\n }\n\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n\n setOpenState(prevOpen => {\n // More than one event (mouse, focus, keyboard) can request the Popover to close\n // We assume the first event is the correct one\n if (prevOpen !== shouldOpen) {\n onOpenChange?.(e, { open: shouldOpen });\n }\n\n return shouldOpen;\n });\n },\n [setOpenState, onOpenChange, setContextTarget],\n );\n\n return [open, setOpen] as const;\n}\n\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */\nfunction usePopoverRefs(\n state: Pick<PopoverState, 'size' | 'contextTarget'> & Pick<PopoverProps, 'positioning' | 'openOnContext' | 'noArrow'>,\n) {\n const popperOptions = {\n position: 'above' as const,\n align: 'center' as const,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n // no reason to render arrow when covering the target\n if (popperOptions.coverTarget) {\n state.noArrow = true;\n }\n\n if (!state.noArrow) {\n popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePopper(popperOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;AAEA,EAAA,gCAAgC,CAAC,KAAD,CAAhC;AACA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;AAEA,EAAA,gCAAgC,CAAC,KAAD,CAAhC;AACA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourcesContent":["import * as React from 'react';\nimport { usePopoverSurface_unstable } from './usePopoverSurface';\nimport { renderPopoverSurface_unstable } from './renderPopoverSurface';\nimport { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';\nimport type { PopoverSurfaceProps } from './PopoverSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * PopoverSurface component renders react children in a positioned box\n */\nexport const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePopoverSurface_unstable(props, ref);\n\n usePopoverSurfaceStyles_unstable(state);\n return renderPopoverSurface_unstable(state);\n});\n\nPopoverSurface.displayName = 'PopoverSurface';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"","sources":["../../../src/components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"PopoverSurface.types.js","sourceRoot":"../src/","sources":["components/PopoverSurface/PopoverSurface.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverContextValue } from '../../popoverContext';\n\n/**\n * PopoverSurface Props\n */\nexport type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;\n\n/**\n * Names of the slots in PopoverSurfaceProps\n */\nexport type PopoverSurfaceSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * PopoverSurface State\n */\nexport type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &\n Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'noArrow' | 'size'> & {\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PopoverSurface/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PopoverSurface/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './PopoverSurface';\nexport * from './PopoverSurface.types';\nexport * from './renderPopoverSurface';\nexport * from './usePopoverSurface';\nexport * from './usePopoverSurfaceStyles';\n"]}
@@ -9,18 +9,19 @@ export const renderPopoverSurface_unstable = state => {
9
9
  const {
10
10
  slots,
11
11
  slotProps
12
- } = getSlots(state); // TODO should hidden Popovers be supported ?
12
+ } = getSlots(state);
13
+ const surface = /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
14
+ }, !state.noArrow && /*#__PURE__*/React.createElement("div", {
15
+ ref: state.arrowRef,
16
+ className: state.arrowClassName
17
+ }), slotProps.root.children);
13
18
 
14
- if (!state.open) {
15
- return null;
19
+ if (state.inline) {
20
+ return surface;
16
21
  }
17
22
 
18
23
  return /*#__PURE__*/React.createElement(Portal, {
19
24
  mountNode: state.mountNode
20
- }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
21
- }, !state.noArrow && /*#__PURE__*/React.createElement("div", {
22
- ref: state.arrowRef,
23
- className: state.arrowClassName
24
- }), slotProps.root.children));
25
+ }, surface);
25
26
  };
26
27
  //# sourceMappingURL=renderPopoverSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/renderPopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,6BAA6B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AAe,QAFlB,CADF;;AAOA,MAAI,KAAK,CAAC,MAAV,EAAkB;AAChB,WAAO,OAAP;AACD;;AAED,sBAAO,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,EAAqC,OAArC,CAAP;AACD,CAfM","sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';\n\n/**\n * Render the final JSX of PopoverSurface\n */\nexport const renderPopoverSurface_unstable = (state: PopoverSurfaceState) => {\n const { slots, slotProps } = getSlots<PopoverSurfaceSlots>(state);\n\n const surface = (\n <slots.root {...slotProps.root}>\n {!state.noArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {slotProps.root.children}\n </slots.root>\n );\n\n if (state.inline) {\n return surface;\n }\n\n return <Portal mountNode={state.mountNode}>{surface}</Portal>;\n};\n"],"sourceRoot":"../src/"}