@fluentui/react-popover 9.0.0-nightly.46b9ea7036.0 → 9.0.0-rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/CHANGELOG.json +368 -29
  2. package/CHANGELOG.md +89 -21
  3. package/dist/react-popover.d.ts +31 -20
  4. package/lib/components/Popover/Popover.js +5 -5
  5. package/lib/components/Popover/Popover.js.map +1 -1
  6. package/lib/components/Popover/Popover.types.d.ts +2 -1
  7. package/lib/components/Popover/renderPopover.d.ts +1 -1
  8. package/lib/components/Popover/renderPopover.js +27 -25
  9. package/lib/components/Popover/renderPopover.js.map +1 -1
  10. package/lib/components/Popover/usePopover.d.ts +2 -2
  11. package/lib/components/Popover/usePopover.js +42 -53
  12. package/lib/components/Popover/usePopover.js.map +1 -1
  13. package/lib/components/PopoverSurface/PopoverSurface.js +7 -7
  14. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  15. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  16. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  17. package/lib/components/PopoverSurface/renderPopoverSurface.js +7 -8
  18. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  19. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  20. package/lib/components/PopoverSurface/usePopoverSurface.js +44 -58
  21. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  22. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
  23. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +34 -22
  24. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  25. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  26. package/lib/components/PopoverTrigger/PopoverTrigger.js +6 -5
  27. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  28. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  29. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  30. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  31. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  32. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  33. package/lib/components/PopoverTrigger/usePopoverTrigger.js +39 -54
  34. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  35. package/lib/popoverContext.d.ts +1 -1
  36. package/lib/popoverContext.js +3 -7
  37. package/lib/popoverContext.js.map +1 -1
  38. package/lib-commonjs/Popover.js +1 -1
  39. package/lib-commonjs/PopoverSurface.js +1 -1
  40. package/lib-commonjs/PopoverTrigger.js +1 -1
  41. package/lib-commonjs/components/Popover/Popover.js +5 -5
  42. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  43. package/lib-commonjs/components/Popover/Popover.types.d.ts +2 -1
  44. package/lib-commonjs/components/Popover/index.js +1 -1
  45. package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
  46. package/lib-commonjs/components/Popover/renderPopover.js +31 -29
  47. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  48. package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
  49. package/lib-commonjs/components/Popover/usePopover.js +50 -62
  50. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  51. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +8 -8
  52. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  53. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  54. package/lib-commonjs/components/PopoverSurface/index.js +1 -1
  55. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  56. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +12 -15
  57. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  58. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  59. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +50 -65
  60. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  61. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -1
  62. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +38 -24
  63. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  64. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  65. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +6 -5
  66. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  67. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  68. package/lib-commonjs/components/PopoverTrigger/index.js +1 -1
  69. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  70. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
  71. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  72. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  73. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +44 -60
  74. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  75. package/lib-commonjs/index.js +1 -1
  76. package/lib-commonjs/popoverContext.d.ts +1 -1
  77. package/lib-commonjs/popoverContext.js +5 -9
  78. package/lib-commonjs/popoverContext.js.map +1 -1
  79. package/package.json +13 -15
  80. package/lib/common/isConformant.d.ts +0 -4
  81. package/lib/common/isConformant.js +0 -13
  82. package/lib/common/isConformant.js.map +0 -1
  83. package/lib/common/mockUsePopoverContext.d.ts +0 -7
  84. package/lib/common/mockUsePopoverContext.js +0 -38
  85. package/lib/common/mockUsePopoverContext.js.map +0 -1
  86. package/lib-commonjs/common/isConformant.d.ts +0 -4
  87. package/lib-commonjs/common/isConformant.js +0 -24
  88. package/lib-commonjs/common/isConformant.js.map +0 -1
  89. package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
  90. package/lib-commonjs/common/mockUsePopoverContext.js +0 -49
  91. package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -2,12 +2,15 @@ import type { ComponentProps } from '@fluentui/react-utilities';
2
2
  import type { ComponentState } from '@fluentui/react-utilities';
3
3
  import type { Context } from '@fluentui/react-context-selector';
4
4
  import type { ContextSelector } from '@fluentui/react-context-selector';
5
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
5
6
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
6
- import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
7
+ import { JSXElementConstructor } from 'react';
7
8
  import type { PopperVirtualElement } from '@fluentui/react-positioning';
8
9
  import type { PortalProps } from '@fluentui/react-portal';
9
10
  import type { PositioningShorthand } from '@fluentui/react-positioning';
10
11
  import * as React_2 from 'react';
12
+ import { ReactElement } from 'react';
13
+ import type { Slot } from '@fluentui/react-utilities';
11
14
  import type { usePopperMouseTarget } from '@fluentui/react-positioning';
12
15
 
13
16
  export declare const arrowHeights: Record<PopoverSize, number>;
@@ -29,7 +32,7 @@ export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.MouseE
29
32
  */
30
33
  export declare const Popover: React_2.FC<PopoverProps>;
31
34
 
32
- export declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
35
+ declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
33
36
  /**
34
37
  * Controls the opening of the Popover
35
38
  */
@@ -134,6 +137,8 @@ export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children
134
137
  */
135
138
  export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
136
139
 
140
+ export declare const popoverSurfaceClassName = "fui-PopoverSurface";
141
+
137
142
  /**
138
143
  * PopoverSurface Props
139
144
  */
@@ -143,11 +148,9 @@ export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
143
148
  * Names of the slots in PopoverSurfaceProps
144
149
  */
145
150
  export declare type PopoverSurfaceSlots = {
146
- root: IntrinsicShorthandProps<'div'>;
151
+ root: Slot<'div'>;
147
152
  };
148
153
 
149
- export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
150
-
151
154
  /**
152
155
  * PopoverSurface State
153
156
  */
@@ -161,71 +164,79 @@ export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> &
161
164
  /**
162
165
  * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
163
166
  */
164
- export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps>;
167
+ export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps> & FluentTriggerComponent;
168
+
169
+ export declare type PopoverTriggerChildProps = {
170
+ ref?: React_2.Ref<never>;
171
+ } & Pick<React_2.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
165
172
 
166
173
  /**
167
174
  * PopoverTrigger Props
168
175
  */
169
176
  export declare type PopoverTriggerProps = {
170
- children: React_2.ReactElement;
177
+ children: (React_2.ReactElement & {
178
+ ref?: React_2.Ref<unknown>;
179
+ }) | ((props: PopoverTriggerChildProps) => React_2.ReactElement | null);
171
180
  };
172
181
 
173
182
  /**
174
183
  * PopoverTrigger State
175
184
  */
176
- export declare type PopoverTriggerState = PopoverTriggerProps;
185
+ export declare type PopoverTriggerState = {
186
+ children: React_2.ReactElement | null;
187
+ };
177
188
 
178
189
  /**
179
190
  * Render the final JSX of Popover
180
191
  */
181
- export declare const renderPopover: (state: PopoverState) => JSX.Element;
192
+ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Element;
182
193
 
183
194
  /**
184
195
  * Render the final JSX of PopoverSurface
185
196
  */
186
- export declare const renderPopoverSurface: (state: PopoverSurfaceState) => JSX.Element | null;
197
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
187
198
 
188
199
  /**
189
200
  * Render the final JSX of PopoverTrigger
190
201
  */
191
- export declare const renderPopoverTrigger: (state: PopoverTriggerState) => JSX.Element;
202
+ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => ReactElement<any, string | JSXElementConstructor<any>> | null;
192
203
 
193
204
  /**
194
205
  * Create the state required to render Popover.
195
206
  *
196
207
  * The returned state can be modified with hooks such as usePopoverStyles,
197
- * before being passed to renderPopover.
208
+ * before being passed to renderPopover_unstable.
198
209
  *
199
210
  * @param props - props from this instance of Popover
200
211
  */
201
- export declare const usePopover: (props: PopoverProps) => PopoverState;
212
+ export declare const usePopover_unstable: (props: PopoverProps) => PopoverState;
202
213
 
203
- export declare const usePopoverContext: <T>(selector: ContextSelector<Pick<PopoverState, "mountNode" | "open" | "setOpen" | "triggerRef" | "contentRef" | "openOnHover" | "openOnContext" | "noArrow" | "arrowRef" | "size" | "appearance" | "trapFocus">, T>) => T;
214
+ export declare const usePopoverContext_unstable: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
204
215
 
205
216
  /**
206
217
  * Create the state required to render PopoverSurface.
207
218
  *
208
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
209
- * before being passed to renderPopoverSurface.
219
+ * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
220
+ * before being passed to renderPopoverSurface_unstable.
210
221
  *
211
222
  * @param props - props from this instance of PopoverSurface
212
223
  * @param ref - reference to root HTMLDivElement of PopoverSurface
213
224
  */
214
- export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React_2.Ref<HTMLDivElement>) => PopoverSurfaceState;
225
+ export declare const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React_2.Ref<HTMLDivElement>) => PopoverSurfaceState;
215
226
 
216
227
  /**
217
228
  * Apply styling to the PopoverSurface slots based on the state
218
229
  */
219
- export declare const usePopoverSurfaceStyles: (state: PopoverSurfaceState) => PopoverSurfaceState;
230
+ export declare const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState;
220
231
 
221
232
  /**
222
233
  * Create the state required to render PopoverTrigger.
223
234
  *
224
235
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
225
- * before being passed to renderPopoverTrigger.
236
+ * before being passed to renderPopoverTrigger_unstable.
226
237
  *
227
238
  * @param props - props from this instance of PopoverTrigger
228
239
  */
229
- export declare const usePopoverTrigger: (props: PopoverTriggerProps) => PopoverTriggerState;
240
+ export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
230
241
 
231
242
  export { }
@@ -1,12 +1,12 @@
1
- import { usePopover } from './usePopover';
2
- import { renderPopover } from './renderPopover';
1
+ import { usePopover_unstable } from './usePopover';
2
+ import { renderPopover_unstable } from './renderPopover';
3
3
  /**
4
4
  * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
5
5
  */
6
6
 
7
- export var Popover = function (props) {
8
- var state = usePopover(props);
9
- return renderPopover(state);
7
+ export const Popover = props => {
8
+ const state = usePopover_unstable(props);
9
+ return renderPopover_unstable(state);
10
10
  };
11
11
  Popover.displayName = 'Popover';
12
12
  //# sourceMappingURL=Popover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AACA,SAAS,UAAT,QAA2B,cAA3B;AACA,SAAS,aAAT,QAA8B,iBAA9B;AAGA;;AAEG;;AACH,OAAO,IAAM,OAAO,GAA2B,UAAA,KAAA,EAAK;AAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAD,CAAxB;AAEA,SAAO,aAAa,CAAC,KAAD,CAApB;AACD,CAJM;AAMP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourceRoot":""}
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":""}
@@ -5,7 +5,7 @@ import type { PortalProps } from '@fluentui/react-portal';
5
5
  * Determines popover padding and arrow size
6
6
  */
7
7
  export declare type PopoverSize = 'small' | 'medium' | 'large';
8
- export declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
8
+ declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
9
9
  /**
10
10
  * Controls the opening of the Popover
11
11
  */
@@ -100,3 +100,4 @@ export declare type OnOpenChangeData = {
100
100
  * The supported events that will trigger open/close of the menu
101
101
  */
102
102
  export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement> | React.FocusEvent<HTMLElement>;
103
+ export {};
@@ -2,4 +2,4 @@ import type { PopoverState } from './Popover.types';
2
2
  /**
3
3
  * Render the final JSX of Popover
4
4
  */
5
- export declare const renderPopover: (state: PopoverState) => JSX.Element;
5
+ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Element;
@@ -4,33 +4,35 @@ import { PopoverContext } from '../../popoverContext';
4
4
  * Render the final JSX of Popover
5
5
  */
6
6
 
7
- export var renderPopover = function (state) {
8
- var open = state.open,
9
- setOpen = state.setOpen,
10
- triggerRef = state.triggerRef,
11
- contentRef = state.contentRef,
12
- openOnContext = state.openOnContext,
13
- openOnHover = state.openOnHover,
14
- mountNode = state.mountNode,
15
- arrowRef = state.arrowRef,
16
- size = state.size,
17
- noArrow = state.noArrow,
18
- appearance = state.appearance,
19
- trapFocus = state.trapFocus;
7
+ export const renderPopover_unstable = state => {
8
+ const {
9
+ open,
10
+ setOpen,
11
+ triggerRef,
12
+ contentRef,
13
+ openOnContext,
14
+ openOnHover,
15
+ mountNode,
16
+ arrowRef,
17
+ size,
18
+ noArrow,
19
+ appearance,
20
+ trapFocus
21
+ } = state;
20
22
  return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
21
23
  value: {
22
- open: open,
23
- setOpen: setOpen,
24
- triggerRef: triggerRef,
25
- contentRef: contentRef,
26
- openOnHover: openOnHover,
27
- openOnContext: openOnContext,
28
- mountNode: mountNode,
29
- arrowRef: arrowRef,
30
- size: size,
31
- noArrow: noArrow,
32
- appearance: appearance,
33
- trapFocus: trapFocus
24
+ open,
25
+ setOpen,
26
+ triggerRef,
27
+ contentRef,
28
+ openOnHover,
29
+ openOnContext,
30
+ mountNode,
31
+ arrowRef,
32
+ size,
33
+ noArrow,
34
+ appearance,
35
+ trapFocus
34
36
  }
35
37
  }, state.children);
36
38
  };
@@ -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,IAAM,aAAa,GAAG,UAAC,KAAD,EAAoB;AAE7C,MAAA,IAAI,GAYF,KAAK,CAZH,IAAJ;AAAA,MACA,OAAO,GAWL,KAAK,CAXA,OADP;AAAA,MAEA,UAAU,GAUR,KAAK,CAVG,UAFV;AAAA,MAGA,UAAU,GASR,KAAK,CATG,UAHV;AAAA,MAIA,aAAa,GAQX,KAAK,CARM,aAJb;AAAA,MAKA,WAAW,GAOT,KAAK,CAPI,WALX;AAAA,MAMA,SAAS,GAMP,KAAK,CANE,SANT;AAAA,MAOA,QAAQ,GAKN,KAAK,CALC,QAPR;AAAA,MAQA,IAAI,GAIF,KAAK,CAJH,IARJ;AAAA,MASA,OAAO,GAGL,KAAK,CAHA,OATP;AAAA,MAUA,UAAU,GAER,KAAK,CAFG,UAVV;AAAA,MAWA,SAAS,GACP,KAAK,CADE,SAXT;AAcF,sBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;AACtB,IAAA,KAAK,EAAE;AACL,MAAA,IAAI,EAAA,IADC;AAEL,MAAA,OAAO,EAAA,OAFF;AAGL,MAAA,UAAU,EAAA,UAHL;AAIL,MAAA,UAAU,EAAA,UAJL;AAKL,MAAA,WAAW,EAAA,WALN;AAML,MAAA,aAAa,EAAA,aANR;AAOL,MAAA,SAAS,EAAA,SAPJ;AAQL,MAAA,QAAQ,EAAA,QARH;AASL,MAAA,IAAI,EAAA,IATC;AAUL,MAAA,OAAO,EAAA,OAVF;AAWL,MAAA,UAAU,EAAA,UAXL;AAYL,MAAA,SAAS,EAAA;AAZJ;AADe,GAAxB,EAgBG,KAAK,CAAC,QAhBT,CADF;AAoBD,CApCM","sourceRoot":""}
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;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","sourceRoot":""}
@@ -3,8 +3,8 @@ import type { PopoverProps, PopoverState } from './Popover.types';
3
3
  * Create the state required to render Popover.
4
4
  *
5
5
  * The returned state can be modified with hooks such as usePopoverStyles,
6
- * before being passed to renderPopover.
6
+ * before being passed to renderPopover_unstable.
7
7
  *
8
8
  * @param props - props from this instance of Popover
9
9
  */
10
- export declare const usePopover: (props: PopoverProps) => PopoverState;
10
+ export declare const usePopover_unstable: (props: PopoverProps) => PopoverState;
@@ -1,4 +1,3 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
4
3
  import { useFluent } from '@fluentui/react-shared-contexts';
@@ -9,75 +8,65 @@ import { arrowHeights } from '../PopoverSurface/index';
9
8
  * Create the state required to render Popover.
10
9
  *
11
10
  * The returned state can be modified with hooks such as usePopoverStyles,
12
- * before being passed to renderPopover.
11
+ * before being passed to renderPopover_unstable.
13
12
  *
14
13
  * @param props - props from this instance of Popover
15
14
  */
16
15
 
17
- export var usePopover = function (props) {
18
- var _a = usePopperMouseTarget(),
19
- contextTarget = _a[0],
20
- setContextTarget = _a[1];
21
-
22
- var initialState = __assign({
16
+ export const usePopover_unstable = props => {
17
+ const [contextTarget, setContextTarget] = usePopperMouseTarget();
18
+ const initialState = {
23
19
  size: 'medium',
24
- contextTarget: contextTarget,
25
- setContextTarget: setContextTarget
26
- }, props);
27
-
28
- var _b = useOpenState(initialState),
29
- open = _b[0],
30
- setOpen = _b[1];
31
-
32
- var popperRefs = usePopoverRefs(initialState);
33
- var targetDocument = useFluent().targetDocument;
20
+ contextTarget,
21
+ setContextTarget,
22
+ ...props
23
+ };
24
+ const [open, setOpen] = useOpenState(initialState);
25
+ const popperRefs = usePopoverRefs(initialState);
26
+ const {
27
+ targetDocument
28
+ } = useFluent();
34
29
  useOnClickOutside({
35
30
  contains: elementContains,
36
31
  element: targetDocument,
37
- callback: function (ev) {
38
- return setOpen(ev, false);
39
- },
32
+ callback: ev => setOpen(ev, false),
40
33
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
41
34
  disabled: !open
42
35
  });
43
36
  useOnScrollOutside({
44
37
  contains: elementContains,
45
38
  element: targetDocument,
46
- callback: function (ev) {
47
- return setOpen(ev, false);
48
- },
39
+ callback: ev => setOpen(ev, false),
49
40
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
50
- disabled: !open || !initialState.openOnContext
51
- });
52
- return __assign(__assign(__assign({}, initialState), popperRefs), {
53
- open: open,
54
- setOpen: setOpen,
55
- setContextTarget: setContextTarget,
56
- contextTarget: contextTarget
41
+ disabled: !open || !initialState.openOnContext // only close on scroll for context
42
+
57
43
  });
44
+ return { ...initialState,
45
+ ...popperRefs,
46
+ open,
47
+ setOpen,
48
+ setContextTarget,
49
+ contextTarget
50
+ };
58
51
  };
59
52
  /**
60
53
  * Creates and manages the Popover open state
61
54
  */
62
55
 
63
56
  function useOpenState(state) {
64
- var onOpenChange = useEventCallback(function (e, data) {
57
+ const onOpenChange = useEventCallback((e, data) => {
65
58
  var _a;
66
59
 
67
60
  return (_a = state.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(state, e, data);
68
61
  });
69
-
70
- var _a = useControllableState({
62
+ const [open, setOpenState] = useControllableState({
71
63
  state: state.open,
72
64
  defaultState: state.defaultOpen,
73
65
  initialState: false
74
- }),
75
- open = _a[0],
76
- setOpenState = _a[1];
77
-
66
+ });
78
67
  state.open = open !== undefined ? open : state.open;
79
- var setContextTarget = state.setContextTarget;
80
- var setOpen = React.useCallback(function (e, shouldOpen) {
68
+ const setContextTarget = state.setContextTarget;
69
+ const setOpen = React.useCallback((e, shouldOpen) => {
81
70
  if (shouldOpen && e.type === 'contextmenu') {
82
71
  setContextTarget(e);
83
72
  }
@@ -86,7 +75,7 @@ function useOpenState(state) {
86
75
  setContextTarget(undefined);
87
76
  }
88
77
 
89
- setOpenState(function (prevOpen) {
78
+ setOpenState(prevOpen => {
90
79
  // More than one event (mouse, focus, keyboard) can request the Popover to close
91
80
  // We assume the first event is the correct one
92
81
  if (prevOpen !== shouldOpen) {
@@ -106,12 +95,12 @@ function useOpenState(state) {
106
95
 
107
96
 
108
97
  function usePopoverRefs(state) {
109
- var popperOptions = __assign({
98
+ const popperOptions = {
110
99
  position: 'above',
111
100
  align: 'center',
112
- target: state.openOnContext ? state.contextTarget : undefined
113
- }, resolvePositioningShorthand(state.positioning)); // no reason to render arrow when covering the target
114
-
101
+ target: state.openOnContext ? state.contextTarget : undefined,
102
+ ...resolvePositioningShorthand(state.positioning)
103
+ }; // no reason to render arrow when covering the target
115
104
 
116
105
  if (popperOptions.coverTarget) {
117
106
  state.noArrow = true;
@@ -121,15 +110,15 @@ function usePopoverRefs(state) {
121
110
  popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);
122
111
  }
123
112
 
124
- var _a = usePopper(popperOptions),
125
- triggerRef = _a.targetRef,
126
- contentRef = _a.containerRef,
127
- arrowRef = _a.arrowRef;
128
-
113
+ const {
114
+ targetRef: triggerRef,
115
+ containerRef: contentRef,
116
+ arrowRef
117
+ } = usePopper(popperOptions);
129
118
  return {
130
- triggerRef: triggerRef,
131
- contentRef: contentRef,
132
- arrowRef: arrowRef
119
+ triggerRef,
120
+ contentRef,
121
+ arrowRef
133
122
  };
134
123
  }
135
124
  //# sourceMappingURL=usePopover.js.map
@@ -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,IAAM,UAAU,GAAG,UAAC,KAAD,EAAoB;AACtC,MAAA,EAAA,G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1
1
  import * as React from 'react';
2
- import { usePopoverSurface } from './usePopoverSurface';
3
- import { renderPopoverSurface } from './renderPopoverSurface';
4
- import { usePopoverSurfaceStyles } from './usePopoverSurfaceStyles';
2
+ import { usePopoverSurface_unstable } from './usePopoverSurface';
3
+ import { renderPopoverSurface_unstable } from './renderPopoverSurface';
4
+ import { usePopoverSurfaceStyles_unstable } from './usePopoverSurfaceStyles';
5
5
  /**
6
6
  * PopoverSurface component renders react children in a positioned box
7
7
  */
8
8
 
9
- export var PopoverSurface = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var state = usePopoverSurface(props, ref);
11
- usePopoverSurfaceStyles(state);
12
- return renderPopoverSurface(state);
9
+ export const PopoverSurface = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = usePopoverSurface_unstable(props, ref);
11
+ usePopoverSurfaceStyles_unstable(state);
12
+ return renderPopoverSurface_unstable(state);
13
13
  });
14
14
  PopoverSurface.displayName = 'PopoverSurface';
15
15
  //# sourceMappingURL=PopoverSurface.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,uBAAT,QAAwC,2BAAxC;AAIA;;AAEG;;AACH,OAAO,IAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AAClG,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AAEA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AACA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
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,4 +1,4 @@
1
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
1
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
2
  import type { PopoverContextValue } from '../../popoverContext';
3
3
  /**
4
4
  * PopoverSurface Props
@@ -8,7 +8,7 @@ export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
8
8
  * Names of the slots in PopoverSurfaceProps
9
9
  */
10
10
  export declare type PopoverSurfaceSlots = {
11
- root: IntrinsicShorthandProps<'div'>;
11
+ root: Slot<'div'>;
12
12
  };
13
13
  /**
14
14
  * PopoverSurface State
@@ -2,4 +2,4 @@ import type { PopoverSurfaceState } from './PopoverSurface.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverSurface
4
4
  */
5
- export declare const renderPopoverSurface: (state: PopoverSurfaceState) => JSX.Element | null;
5
+ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSX.Element | null;
@@ -1,17 +1,15 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { Portal } from '@fluentui/react-portal';
4
3
  import { getSlots } from '@fluentui/react-utilities';
5
- import { popoverSurfaceSlots } from './usePopoverSurface';
6
4
  /**
7
5
  * Render the final JSX of PopoverSurface
8
6
  */
9
7
 
10
- export var renderPopoverSurface = function (state) {
11
- var _a = getSlots(state, popoverSurfaceSlots),
12
- slots = _a.slots,
13
- slotProps = _a.slotProps; // TODO should hidden Popovers be supported ?
14
-
8
+ export const renderPopoverSurface_unstable = state => {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = getSlots(state); // TODO should hidden Popovers be supported ?
15
13
 
16
14
  if (!state.open) {
17
15
  return null;
@@ -19,7 +17,8 @@ export var renderPopoverSurface = function (state) {
19
17
 
20
18
  return /*#__PURE__*/React.createElement(Portal, {
21
19
  mountNode: state.mountNode
22
- }, /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), !state.noArrow && /*#__PURE__*/React.createElement("div", {
20
+ }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
21
+ }, !state.noArrow && /*#__PURE__*/React.createElement("div", {
23
22
  ref: state.arrowRef,
24
23
  className: state.arrowClassName
25
24
  }), slotProps.root.children));
@@ -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;AAEA,SAAS,mBAAT,QAAoC,qBAApC;AAEA;;AAEG;;AACH,OAAO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAA2B;AACvD,MAAA,EAAA,GAAuB,QAAQ,CAAsB,KAAtB,EAA6B,mBAA7B,CAA/B;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB,CADuD,CAG7D;;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM","sourceRoot":""}
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,GAAI,KAAD,IAA+B;AAC1E,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,CAArC,CAD0E,CAG1E;;AACA,MAAI,CAAC,KAAK,CAAC,IAAX,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,sBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO;AAAC,IAAA,SAAS,EAAE,KAAK,CAAC;AAAlB,GAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,CAAC,KAAK,CAAC,OAAP,iBAAkB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADrB,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF,CADF;AAQD,CAhBM","sourceRoot":""}
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
- import type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './PopoverSurface.types';
3
- export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
2
+ import type { PopoverSurfaceProps, PopoverSurfaceState } from './PopoverSurface.types';
4
3
  /**
5
4
  * Create the state required to render PopoverSurface.
6
5
  *
7
- * The returned state can be modified with hooks such as usePopoverSurfaceStyles,
8
- * before being passed to renderPopoverSurface.
6
+ * The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
7
+ * before being passed to renderPopoverSurface_unstable.
9
8
  *
10
9
  * @param props - props from this instance of PopoverSurface
11
10
  * @param ref - reference to root HTMLDivElement of PopoverSurface
12
11
  */
13
- export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>) => PopoverSurfaceState;
12
+ export declare const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React.Ref<HTMLDivElement>) => PopoverSurfaceState;