@fluentui/react-popover 9.14.4 → 9.14.6
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.
- package/CHANGELOG.md +33 -2
- package/dist/index.d.cts +338 -0
- package/lib/Popover.js +1 -1
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/components/Popover/Popover.js +3 -3
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/PopoverSurfaceMotion.js +3 -3
- package/lib/components/Popover/index.js +4 -4
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.js +4 -4
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.js +22 -13
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/Popover/usePopoverContextValues.js +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.js +5 -5
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/index.js +4 -4
- package/lib/components/PopoverSurface/index.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js +2 -2
- package/lib/components/PopoverSurface/usePopoverSurface.js +4 -4
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.styles.js +3 -3
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.styles.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.styles.raw.js +3 -3
- package/lib/components/PopoverTrigger/PopoverTrigger.js +2 -2
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js +3 -3
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +5 -5
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.js +1 -1
- package/lib-commonjs/{Popover.js → Popover.cjs} +1 -1
- package/lib-commonjs/{Popover.js.map → Popover.cjs.map} +1 -1
- package/lib-commonjs/{PopoverSurface.js → PopoverSurface.cjs} +1 -1
- package/lib-commonjs/{PopoverSurface.js.map → PopoverSurface.cjs.map} +1 -1
- package/lib-commonjs/{PopoverTrigger.js → PopoverTrigger.cjs} +1 -1
- package/lib-commonjs/{PopoverTrigger.js.map → PopoverTrigger.cjs.map} +1 -1
- package/lib-commonjs/components/Popover/{Popover.js → Popover.cjs} +3 -3
- package/lib-commonjs/components/Popover/{Popover.js.map → Popover.cjs.map} +1 -1
- package/lib-commonjs/components/Popover/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/Popover/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Popover/{renderPopover.js → renderPopover.cjs} +1 -1
- package/lib-commonjs/components/Popover/{renderPopover.js.map → renderPopover.cjs.map} +1 -1
- package/lib-commonjs/components/Popover/{usePopover.js → usePopover.cjs} +16 -7
- package/lib-commonjs/components/Popover/usePopover.cjs.map +1 -0
- package/lib-commonjs/components/PopoverSurface/{PopoverSurface.js → PopoverSurface.cjs} +3 -3
- package/lib-commonjs/components/PopoverSurface/{PopoverSurface.js.map → PopoverSurface.cjs.map} +1 -1
- package/lib-commonjs/components/PopoverSurface/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/PopoverSurface/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/PopoverSurface/{usePopoverSurface.js → usePopoverSurface.cjs} +1 -1
- package/lib-commonjs/components/PopoverSurface/{usePopoverSurface.js.map → usePopoverSurface.cjs.map} +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/PopoverTrigger/{PopoverTrigger.js → PopoverTrigger.cjs} +2 -2
- package/lib-commonjs/components/PopoverTrigger/{PopoverTrigger.js.map → PopoverTrigger.cjs.map} +1 -1
- package/lib-commonjs/components/PopoverTrigger/{index.js → index.cjs} +3 -3
- package/lib-commonjs/components/PopoverTrigger/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/PopoverTrigger/{usePopoverTrigger.js → usePopoverTrigger.cjs} +1 -1
- package/lib-commonjs/components/PopoverTrigger/{usePopoverTrigger.js.map → usePopoverTrigger.cjs.map} +1 -1
- package/lib-commonjs/{index.js → index.cjs} +4 -4
- package/lib-commonjs/{index.js.map → index.cjs.map} +1 -1
- package/package.json +25 -19
- package/lib-commonjs/components/Popover/usePopover.js.map +0 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.styles.js.map +0 -1
- /package/lib-commonjs/components/Popover/{Popover.types.js → Popover.types.cjs} +0 -0
- /package/lib-commonjs/components/Popover/{Popover.types.js.map → Popover.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Popover/{PopoverSurfaceMotion.js → PopoverSurfaceMotion.cjs} +0 -0
- /package/lib-commonjs/components/Popover/{PopoverSurfaceMotion.js.map → PopoverSurfaceMotion.cjs.map} +0 -0
- /package/lib-commonjs/components/Popover/{constants.js → constants.cjs} +0 -0
- /package/lib-commonjs/components/Popover/{constants.js.map → constants.cjs.map} +0 -0
- /package/lib-commonjs/components/Popover/{usePopoverContextValues.js → usePopoverContextValues.cjs} +0 -0
- /package/lib-commonjs/components/Popover/{usePopoverContextValues.js.map → usePopoverContextValues.cjs.map} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{PopoverSurface.types.js → PopoverSurface.types.cjs} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{PopoverSurface.types.js.map → PopoverSurface.types.cjs.map} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{renderPopoverSurface.js → renderPopoverSurface.cjs} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{renderPopoverSurface.js.map → renderPopoverSurface.cjs.map} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{usePopoverSurfaceStyles.styles.js → usePopoverSurfaceStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{usePopoverSurfaceStyles.styles.raw.js → usePopoverSurfaceStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/PopoverSurface/{usePopoverSurfaceStyles.styles.raw.js.map → usePopoverSurfaceStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/PopoverTrigger/{PopoverTrigger.types.js → PopoverTrigger.types.cjs} +0 -0
- /package/lib-commonjs/components/PopoverTrigger/{PopoverTrigger.types.js.map → PopoverTrigger.types.cjs.map} +0 -0
- /package/lib-commonjs/components/PopoverTrigger/{renderPopoverTrigger.js → renderPopoverTrigger.cjs} +0 -0
- /package/lib-commonjs/components/PopoverTrigger/{renderPopoverTrigger.js.map → renderPopoverTrigger.cjs.map} +0 -0
- /package/lib-commonjs/{popoverContext.js → popoverContext.cjs} +0 -0
- /package/lib-commonjs/{popoverContext.js.map → popoverContext.cjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,43 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-popover
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Tue, 11 Aug 2026 17:16:02 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.14.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.14.6)
|
|
8
|
+
|
|
9
|
+
Tue, 11 Aug 2026 17:16:02 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.14.5..@fluentui/react-popover_v9.14.6)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Ship ESM-first (type:module): valid ESM under lib/, CommonJS under lib-commonjs/*.cjs, and drop the `node` export condition - bare-Node `import` resolves ESM, `require` resolves CJS; node-targeted bundlers tree-shake. ([PR #36327](https://github.com/microsoft/fluentui/pull/36327) by martinhochel@microsoft.com)
|
|
15
|
+
- Bump @fluentui/keyboard-keys to v9.0.9 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-aria to v9.17.14 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-context-selector to v9.2.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.5 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-motion to v9.16.2 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
- Bump @fluentui/react-motion-components-preview to v0.15.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
|
+
- Bump @fluentui/react-portal to v9.8.15 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
22
|
+
- Bump @fluentui/react-positioning to v9.23.1 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
23
|
+
- Bump @fluentui/react-shared-contexts to v9.26.3 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
24
|
+
- Bump @fluentui/react-tabster to v9.26.17 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
25
|
+
- Bump @fluentui/react-theme to v9.2.2 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
26
|
+
- Bump @fluentui/react-utilities to v9.26.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
27
|
+
|
|
28
|
+
## [9.14.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.14.5)
|
|
29
|
+
|
|
30
|
+
Tue, 04 Aug 2026 10:12:24 GMT
|
|
31
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.14.4..@fluentui/react-popover_v9.14.5)
|
|
32
|
+
|
|
33
|
+
### Patches
|
|
34
|
+
|
|
35
|
+
- fix: close Popover on focus escape only when focus was inside the surface, so a popover whose focus never entered (e.g. an external input stays focused) is not dismissed when focus moves programmatically ([PR #36440](https://github.com/microsoft/fluentui/pull/36440) by petrduda@microsoft.com)
|
|
36
|
+
- Bump @fluentui/react-positioning to v9.23.0 ([PR #36453](https://github.com/microsoft/fluentui/pull/36453) by beachball)
|
|
37
|
+
|
|
7
38
|
## [9.14.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.14.4)
|
|
8
39
|
|
|
9
|
-
Wed, 24 Jun 2026 11:
|
|
40
|
+
Wed, 24 Jun 2026 11:09:52 GMT
|
|
10
41
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.14.3..@fluentui/react-popover_v9.14.4)
|
|
11
42
|
|
|
12
43
|
### Patches
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import type { ARIAButtonResultProps } from '@fluentui/react-aria';
|
|
2
|
+
import type { ARIAButtonType } from '@fluentui/react-aria';
|
|
3
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
4
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
5
|
+
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
6
|
+
import { FC } from 'react';
|
|
7
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
8
|
+
import { JSXElement } from '@fluentui/react-utilities';
|
|
9
|
+
import type { PortalProps } from '@fluentui/react-portal';
|
|
10
|
+
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
|
11
|
+
import type { PositioningVirtualElement } from '@fluentui/react-positioning';
|
|
12
|
+
import type { PresenceMotionSlotProps } from '@fluentui/react-motion';
|
|
13
|
+
import { Provider } from 'react';
|
|
14
|
+
import { ProviderProps } from 'react';
|
|
15
|
+
import type * as React_2 from 'react';
|
|
16
|
+
import type { SetVirtualMouseTarget } from '@fluentui/react-positioning';
|
|
17
|
+
import type { Slot } from '@fluentui/react-utilities';
|
|
18
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
19
|
+
import type { TriggerProps } from '@fluentui/react-utilities';
|
|
20
|
+
|
|
21
|
+
export declare const arrowHeights: Record<PopoverSize, number>;
|
|
22
|
+
|
|
23
|
+
declare type InternalPopoverSlots = {
|
|
24
|
+
surfaceMotion: NonNullable<Slot<PresenceMotionSlotProps>>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Data attached to open/close events
|
|
29
|
+
*/
|
|
30
|
+
export declare type OnOpenChangeData = {
|
|
31
|
+
open: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The supported events that will trigger open/close of the menu
|
|
36
|
+
*/
|
|
37
|
+
export declare type OpenPopoverEvents = MouseEvent | TouchEvent | FocusEvent | React_2.FocusEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
|
|
41
|
+
*/
|
|
42
|
+
export declare const Popover: React_2.FC<PopoverProps>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Context shared between Popover and its children components
|
|
46
|
+
*/
|
|
47
|
+
export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'toggleOpen' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'withArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus' | 'inertTrapFocus' | 'inline'>;
|
|
48
|
+
|
|
49
|
+
export declare type PopoverContextValues = {
|
|
50
|
+
popover: PopoverContextValue;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Popover Props
|
|
55
|
+
*/
|
|
56
|
+
export declare type PopoverProps = ComponentProps<Partial<PopoverSlots>> & Pick<PortalProps, 'mountNode'> & {
|
|
57
|
+
/**
|
|
58
|
+
* A popover can appear styled with brand or inverted.
|
|
59
|
+
* When not specified, the default style is used.
|
|
60
|
+
*/
|
|
61
|
+
appearance?: 'brand' | 'inverted';
|
|
62
|
+
/**
|
|
63
|
+
* Can contain two children including `PopoverTrigger` and `PopoverSurface`.
|
|
64
|
+
* Alternatively can only contain `PopoverSurface` if using a custom `target`.
|
|
65
|
+
*/
|
|
66
|
+
children: [JSXElement, JSXElement] | JSXElement;
|
|
67
|
+
/**
|
|
68
|
+
* Close when scroll outside of it
|
|
69
|
+
*
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
closeOnScroll?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Used to set the initial open state of the Popover in uncontrolled mode
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
defaultOpen?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Popovers are rendered out of DOM order on `document.body` by default, use this to render the popover in DOM order
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
inline?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Sets the delay for closing popover on mouse leave
|
|
87
|
+
*/
|
|
88
|
+
mouseLeaveDelay?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Display an arrow pointing to the target.
|
|
91
|
+
*
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
withArrow?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Call back when the component requests to change value
|
|
97
|
+
* The `open` value is used as a hint when directly controlling the component
|
|
98
|
+
*/
|
|
99
|
+
onOpenChange?: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
|
|
100
|
+
/**
|
|
101
|
+
* Controls the opening of the Popover
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
open?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Flag to open the Popover as a context menu. Disables all other interactions
|
|
108
|
+
*
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
openOnContext?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Flag to open the Popover by hovering the trigger
|
|
114
|
+
*
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
openOnHover?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Flag to close the Popover when an iframe outside a PopoverSurface is focused
|
|
120
|
+
*
|
|
121
|
+
* @default true
|
|
122
|
+
*/
|
|
123
|
+
closeOnIframeFocus?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Configures the position of the Popover.
|
|
126
|
+
* Explore [Positioning docs](https://react.fluentui.dev/?path=/docs/concepts-developer-positioning-components--docs) for more options.
|
|
127
|
+
*/
|
|
128
|
+
positioning?: PositioningShorthand;
|
|
129
|
+
/**
|
|
130
|
+
* Determines popover padding and arrow size
|
|
131
|
+
*
|
|
132
|
+
* @default medium
|
|
133
|
+
*/
|
|
134
|
+
size?: PopoverSize;
|
|
135
|
+
/**
|
|
136
|
+
* Should trap focus
|
|
137
|
+
*
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
trapFocus?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Must be used with the `trapFocus` prop
|
|
143
|
+
* Enables older Fluent UI focus trap behavior where the user
|
|
144
|
+
* cannot tab into the window outside of the document. This is now
|
|
145
|
+
* non-standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)
|
|
146
|
+
* where the focus trap involves setting outside elements inert.
|
|
147
|
+
*
|
|
148
|
+
* @deprecated this behavior is default provided now, to opt-out of it in favor of standard behavior use the `inertTrapFocus` property
|
|
149
|
+
*/
|
|
150
|
+
legacyTrapFocus?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Enables standard behavior according to the [HTML dialog spec](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)
|
|
153
|
+
* where the focus trap involves setting outside elements inert,
|
|
154
|
+
* making navigation leak from the trapped area back to the browser toolbar and vice-versa.
|
|
155
|
+
*
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
inertTrapFocus?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* By default Popover focuses the first focusable element in PopoverSurface on open.
|
|
161
|
+
* Specify `disableAutoFocus` to prevent this behavior.
|
|
162
|
+
*
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
unstable_disableAutoFocus?: boolean;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export declare const PopoverProvider: Provider<PopoverContextValue> & FC<ProviderProps<PopoverContextValue>>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Determines popover padding and arrow size
|
|
172
|
+
*/
|
|
173
|
+
export declare type PopoverSize = 'small' | 'medium' | 'large';
|
|
174
|
+
|
|
175
|
+
declare type PopoverSlots = {
|
|
176
|
+
/**
|
|
177
|
+
* Slot for the surface motion animation.
|
|
178
|
+
* For more information refer to the [Motion docs page](https://react.fluentui.dev/?path=/docs/motion-motion-slot--docs).
|
|
179
|
+
*/
|
|
180
|
+
surfaceMotion: Slot<PresenceMotionSlotProps>;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Popover State
|
|
185
|
+
*/
|
|
186
|
+
export declare type PopoverState = ComponentState<InternalPopoverSlots> & Pick<PopoverProps, 'appearance' | 'mountNode' | 'onOpenChange' | 'openOnContext' | 'openOnHover' | 'trapFocus' | 'withArrow' | 'inertTrapFocus'> & Required<Pick<PopoverProps, 'inline' | 'open'>> & Pick<PopoverProps, 'children'> & {
|
|
187
|
+
/**
|
|
188
|
+
* Ref of the pointing arrow
|
|
189
|
+
*/
|
|
190
|
+
arrowRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
191
|
+
/**
|
|
192
|
+
* Ref of the PopoverSurface
|
|
193
|
+
*/
|
|
194
|
+
contentRef: React_2.MutableRefObject<HTMLElement | null>;
|
|
195
|
+
/**
|
|
196
|
+
* Anchors the popper to the mouse click for context events
|
|
197
|
+
*/
|
|
198
|
+
contextTarget: PositioningVirtualElement | undefined;
|
|
199
|
+
popoverSurface: React_2.ReactElement | undefined;
|
|
200
|
+
popoverTrigger: React_2.ReactElement | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* A callback to set the target of the popper to the mouse click for context events
|
|
203
|
+
*/
|
|
204
|
+
setContextTarget: SetVirtualMouseTarget;
|
|
205
|
+
/**
|
|
206
|
+
* Callback to open/close the Popover
|
|
207
|
+
*/
|
|
208
|
+
setOpen: (e: OpenPopoverEvents, open: boolean) => void;
|
|
209
|
+
size: NonNullable<PopoverProps['size']>;
|
|
210
|
+
/**
|
|
211
|
+
* Callback to toggle the open state of the Popover
|
|
212
|
+
*/
|
|
213
|
+
toggleOpen: (e: OpenPopoverEvents) => void;
|
|
214
|
+
/**
|
|
215
|
+
* Ref of the PopoverTrigger
|
|
216
|
+
*/
|
|
217
|
+
triggerRef: React_2.MutableRefObject<HTMLElement | null>;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* PopoverSurface component renders react children in a positioned box
|
|
222
|
+
*/
|
|
223
|
+
export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
|
|
224
|
+
|
|
225
|
+
export declare const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots>;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* PopoverSurface Props
|
|
229
|
+
*/
|
|
230
|
+
export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Names of the slots in PopoverSurfaceProps
|
|
234
|
+
*/
|
|
235
|
+
export declare type PopoverSurfaceSlots = {
|
|
236
|
+
root: Slot<'div'>;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* PopoverSurface State
|
|
241
|
+
*/
|
|
242
|
+
export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'appearance' | 'arrowRef' | 'inline' | 'mountNode' | 'size' | 'withArrow'> & {
|
|
243
|
+
/**
|
|
244
|
+
* CSS class for the arrow element
|
|
245
|
+
*/
|
|
246
|
+
arrowClassName?: string;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
|
251
|
+
*/
|
|
252
|
+
export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Props that are passed to the child of the DialogTrigger when cloned to ensure correct behaviour for the Dialog
|
|
256
|
+
*/
|
|
257
|
+
export declare type PopoverTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<Type, Props & {
|
|
258
|
+
'aria-expanded'?: 'true' | 'false';
|
|
259
|
+
ref: React_2.Ref<unknown>;
|
|
260
|
+
onMouseEnter: React_2.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
|
|
261
|
+
onMouseLeave: React_2.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
|
|
262
|
+
onContextMenu: React_2.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;
|
|
263
|
+
}>;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* PopoverTrigger Props
|
|
267
|
+
*/
|
|
268
|
+
export declare type PopoverTriggerProps = TriggerProps<PopoverTriggerChildProps> & {
|
|
269
|
+
/**
|
|
270
|
+
* Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.
|
|
271
|
+
* @default false
|
|
272
|
+
*/
|
|
273
|
+
disableButtonEnhancement?: boolean;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* PopoverTrigger State
|
|
278
|
+
*/
|
|
279
|
+
export declare type PopoverTriggerState = {
|
|
280
|
+
children: React_2.ReactElement | null;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Render the final JSX of Popover
|
|
285
|
+
*/
|
|
286
|
+
export declare const renderPopover_unstable: (state: PopoverState, contextValues?: PopoverContextValues) => JSXElement;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Render the final JSX of PopoverSurface
|
|
290
|
+
*/
|
|
291
|
+
export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState) => JSXElement;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Render the final JSX of PopoverTrigger
|
|
295
|
+
*/
|
|
296
|
+
export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => JSXElement | null;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Create the state required to render Popover.
|
|
300
|
+
*
|
|
301
|
+
* The returned state can be modified with hooks such as usePopoverStyles,
|
|
302
|
+
* before being passed to renderPopover_unstable.
|
|
303
|
+
*
|
|
304
|
+
* @param props - props from this instance of Popover
|
|
305
|
+
*/
|
|
306
|
+
export declare const usePopover_unstable: (props: PopoverProps) => PopoverState;
|
|
307
|
+
|
|
308
|
+
export declare const usePopoverContext_unstable: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
|
|
309
|
+
|
|
310
|
+
export declare function usePopoverContextValues_unstable(state: PopoverState): PopoverContextValues;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Create the state required to render PopoverSurface.
|
|
314
|
+
*
|
|
315
|
+
* The returned state can be modified with hooks such as usePopoverSurfaceStyles_unstable,
|
|
316
|
+
* before being passed to renderPopoverSurface_unstable.
|
|
317
|
+
*
|
|
318
|
+
* @param props - props from this instance of PopoverSurface
|
|
319
|
+
* @param ref - reference to root HTMLDivElement of PopoverSurface
|
|
320
|
+
*/
|
|
321
|
+
export declare const usePopoverSurface_unstable: (props: PopoverSurfaceProps, ref: React_2.Ref<HTMLDivElement>) => PopoverSurfaceState;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Apply styling to the PopoverSurface slots based on the state
|
|
325
|
+
*/
|
|
326
|
+
export declare const usePopoverSurfaceStyles_unstable: (state: PopoverSurfaceState) => PopoverSurfaceState;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Create the state required to render PopoverTrigger.
|
|
330
|
+
*
|
|
331
|
+
* The returned state can be modified with hooks such as usePopoverTriggerStyles,
|
|
332
|
+
* before being passed to renderPopoverTrigger_unstable.
|
|
333
|
+
*
|
|
334
|
+
* @param props - props from this instance of PopoverTrigger
|
|
335
|
+
*/
|
|
336
|
+
export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
|
|
337
|
+
|
|
338
|
+
export { }
|
package/lib/Popover.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Popover, renderPopover_unstable, usePopover_unstable, usePopoverContextValues_unstable } from
|
|
1
|
+
export { Popover, renderPopover_unstable, usePopover_unstable, usePopoverContextValues_unstable } from "./components/Popover/index.js";
|
package/lib/Popover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Popover.ts"],"sourcesContent":["export type {\n OnOpenChangeData,\n OpenPopoverEvents,\n PopoverContextValues,\n PopoverProps,\n PopoverSize,\n PopoverState,\n} from './components/Popover/index';\nexport {\n Popover,\n renderPopover_unstable,\n usePopover_unstable,\n usePopoverContextValues_unstable,\n} from './components/Popover/index';\n"],"names":["Popover","renderPopover_unstable","usePopover_unstable","usePopoverContextValues_unstable"],"mappings":"AAQA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,mBAAmB,EACnBC,gCAAgC,QAC3B,
|
|
1
|
+
{"version":3,"sources":["../src/Popover.ts"],"sourcesContent":["export type {\n OnOpenChangeData,\n OpenPopoverEvents,\n PopoverContextValues,\n PopoverProps,\n PopoverSize,\n PopoverState,\n} from './components/Popover/index';\nexport {\n Popover,\n renderPopover_unstable,\n usePopover_unstable,\n usePopoverContextValues_unstable,\n} from './components/Popover/index';\n"],"names":["Popover","renderPopover_unstable","usePopover_unstable","usePopoverContextValues_unstable"],"mappings":"AAQA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,mBAAmB,EACnBC,gCAAgC,QAC3B,gCAA6B"}
|
package/lib/PopoverSurface.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PopoverSurface, arrowHeights, popoverSurfaceClassNames, renderPopoverSurface_unstable, usePopoverSurfaceStyles_unstable, usePopoverSurface_unstable } from
|
|
1
|
+
export { PopoverSurface, arrowHeights, popoverSurfaceClassNames, renderPopoverSurface_unstable, usePopoverSurfaceStyles_unstable, usePopoverSurface_unstable } from "./components/PopoverSurface/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/PopoverSurface.ts"],"sourcesContent":["export type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './components/PopoverSurface/index';\nexport {\n PopoverSurface,\n arrowHeights,\n popoverSurfaceClassNames,\n renderPopoverSurface_unstable,\n usePopoverSurfaceStyles_unstable,\n usePopoverSurface_unstable,\n} from './components/PopoverSurface/index';\n"],"names":["PopoverSurface","arrowHeights","popoverSurfaceClassNames","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","usePopoverSurface_unstable"],"mappings":"AACA,SACEA,cAAc,EACdC,YAAY,EACZC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,
|
|
1
|
+
{"version":3,"sources":["../src/PopoverSurface.ts"],"sourcesContent":["export type { PopoverSurfaceProps, PopoverSurfaceSlots, PopoverSurfaceState } from './components/PopoverSurface/index';\nexport {\n PopoverSurface,\n arrowHeights,\n popoverSurfaceClassNames,\n renderPopoverSurface_unstable,\n usePopoverSurfaceStyles_unstable,\n usePopoverSurface_unstable,\n} from './components/PopoverSurface/index';\n"],"names":["PopoverSurface","arrowHeights","popoverSurfaceClassNames","renderPopoverSurface_unstable","usePopoverSurfaceStyles_unstable","usePopoverSurface_unstable"],"mappings":"AACA,SACEA,cAAc,EACdC,YAAY,EACZC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,uCAAoC"}
|
package/lib/PopoverTrigger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PopoverTrigger, renderPopoverTrigger_unstable, usePopoverTrigger_unstable } from
|
|
1
|
+
export { PopoverTrigger, renderPopoverTrigger_unstable, usePopoverTrigger_unstable } from "./components/PopoverTrigger/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/PopoverTrigger.ts"],"sourcesContent":["export type {\n PopoverTriggerChildProps,\n PopoverTriggerProps,\n PopoverTriggerState,\n} from './components/PopoverTrigger/index';\nexport {\n PopoverTrigger,\n renderPopoverTrigger_unstable,\n usePopoverTrigger_unstable,\n} from './components/PopoverTrigger/index';\n"],"names":["PopoverTrigger","renderPopoverTrigger_unstable","usePopoverTrigger_unstable"],"mappings":"AAKA,SACEA,cAAc,EACdC,6BAA6B,EAC7BC,0BAA0B,QACrB,
|
|
1
|
+
{"version":3,"sources":["../src/PopoverTrigger.ts"],"sourcesContent":["export type {\n PopoverTriggerChildProps,\n PopoverTriggerProps,\n PopoverTriggerState,\n} from './components/PopoverTrigger/index';\nexport {\n PopoverTrigger,\n renderPopoverTrigger_unstable,\n usePopoverTrigger_unstable,\n} from './components/PopoverTrigger/index';\n"],"names":["PopoverTrigger","renderPopoverTrigger_unstable","usePopoverTrigger_unstable"],"mappings":"AAKA,SACEA,cAAc,EACdC,6BAA6B,EAC7BC,0BAA0B,QACrB,uCAAoC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { usePopover_unstable } from
|
|
3
|
-
import { usePopoverContextValues_unstable } from
|
|
4
|
-
import { renderPopover_unstable } from
|
|
2
|
+
import { usePopover_unstable } from "./usePopover.js";
|
|
3
|
+
import { usePopoverContextValues_unstable } from "./usePopoverContextValues.js";
|
|
4
|
+
import { renderPopover_unstable } from "./renderPopover.js";
|
|
5
5
|
/**
|
|
6
6
|
* Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
|
|
7
7
|
*/ export const Popover = (props)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Popover/Popover.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { usePopoverContextValues_unstable } from './usePopoverContextValues';\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 const contextValues = usePopoverContextValues_unstable(state);\n\n return renderPopover_unstable(state, contextValues);\n};\n\nPopover.displayName = 'Popover';\n"],"names":["usePopover_unstable","usePopoverContextValues_unstable","renderPopover_unstable","Popover","props","state","contextValues","displayName"],"mappings":"AAAA;AAGA,SAASA,mBAAmB,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/Popover/Popover.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { usePopoverContextValues_unstable } from './usePopoverContextValues';\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 const contextValues = usePopoverContextValues_unstable(state);\n\n return renderPopover_unstable(state, contextValues);\n};\n\nPopover.displayName = 'Popover';\n"],"names":["usePopover_unstable","usePopoverContextValues_unstable","renderPopover_unstable","Popover","props","state","contextValues","displayName"],"mappings":"AAAA;AAGA,SAASA,mBAAmB,QAAQ,kBAAe;AACnD,SAASC,gCAAgC,QAAQ,+BAA4B;AAC7E,SAASC,sBAAsB,QAAQ,qBAAkB;AAGzD;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA;IAC7C,MAAMC,QAAQL,oBAAoBI;IAClC,MAAME,gBAAgBL,iCAAiCI;IAEvD,OAAOH,uBAAuBG,OAAOC;AACvC,EAAE;AAEFH,QAAQI,WAAW,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createPresenceComponent, motionTokens } from
|
|
2
|
-
import { fadeAtom, slideAtom } from
|
|
3
|
-
import { POSITIONING_SLIDE_DIRECTION_VAR_X as slideDirectionVarX, POSITIONING_SLIDE_DIRECTION_VAR_Y as slideDirectionVarY } from
|
|
1
|
+
import { createPresenceComponent, motionTokens } from "@fluentui/react-motion";
|
|
2
|
+
import { fadeAtom, slideAtom } from "@fluentui/react-motion-components-preview";
|
|
3
|
+
import { POSITIONING_SLIDE_DIRECTION_VAR_X as slideDirectionVarX, POSITIONING_SLIDE_DIRECTION_VAR_Y as slideDirectionVarY } from "@fluentui/react-positioning";
|
|
4
4
|
// Shared timing constants for the enter animation.
|
|
5
5
|
const duration = motionTokens.durationSlower;
|
|
6
6
|
const easing = motionTokens.curveDecelerateMid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Popover } from
|
|
2
|
-
export { renderPopover_unstable } from
|
|
3
|
-
export { usePopover_unstable } from
|
|
4
|
-
export { usePopoverContextValues_unstable } from
|
|
1
|
+
export { Popover } from "./Popover.js";
|
|
2
|
+
export { renderPopover_unstable } from "./renderPopover.js";
|
|
3
|
+
export { usePopover_unstable } from "./usePopover.js";
|
|
4
|
+
export { usePopoverContextValues_unstable } from "./usePopoverContextValues.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Popover/index.ts"],"sourcesContent":["export { Popover } from './Popover';\nexport type { OnOpenChangeData, OpenPopoverEvents, PopoverProps, PopoverSize, PopoverState } from './Popover.types';\nexport { renderPopover_unstable } from './renderPopover';\nexport { usePopover_unstable } from './usePopover';\nexport { usePopoverContextValues_unstable } from './usePopoverContextValues';\nexport type { PopoverContextValues } from './usePopoverContextValues';\n"],"names":["Popover","renderPopover_unstable","usePopover_unstable","usePopoverContextValues_unstable"],"mappings":"AAAA,SAASA,OAAO,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/Popover/index.ts"],"sourcesContent":["export { Popover } from './Popover';\nexport type { OnOpenChangeData, OpenPopoverEvents, PopoverProps, PopoverSize, PopoverState } from './Popover.types';\nexport { renderPopover_unstable } from './renderPopover';\nexport { usePopover_unstable } from './usePopover';\nexport { usePopoverContextValues_unstable } from './usePopoverContextValues';\nexport type { PopoverContextValues } from './usePopoverContextValues';\n"],"names":["Popover","renderPopover_unstable","usePopover_unstable","usePopoverContextValues_unstable"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAY;AAEpC,SAASC,sBAAsB,QAAQ,qBAAkB;AACzD,SAASC,mBAAmB,QAAQ,kBAAe;AACnD,SAASC,gCAAgC,QAAQ,+BAA4B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
-
import * as React from
|
|
3
|
-
import { assertSlots } from
|
|
4
|
-
import { MotionRefForwarder } from
|
|
5
|
-
import { PopoverContext, popoverContextDefaultValue } from
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
4
|
+
import { MotionRefForwarder } from "@fluentui/react-motion";
|
|
5
|
+
import { PopoverContext, popoverContextDefaultValue } from "../../popoverContext.js";
|
|
6
6
|
/**
|
|
7
7
|
* Render the final JSX of Popover
|
|
8
8
|
*/ export const renderPopover_unstable = (state, contextValues)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Popover/renderPopover.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport { assertSlots, type JSXElement } from '@fluentui/react-utilities';\nimport { MotionRefForwarder } from '@fluentui/react-motion';\nimport { PopoverContext, popoverContextDefaultValue } from '../../popoverContext';\nimport type { InternalPopoverSlots, PopoverState } from './Popover.types';\nimport type { PopoverContextValues } from './usePopoverContextValues';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState, contextValues?: PopoverContextValues): JSXElement => {\n assertSlots<InternalPopoverSlots>(state);\n\n return (\n <PopoverContext.Provider value={contextValues?.popover ?? popoverContextDefaultValue}>\n {state.popoverTrigger}\n {state.popoverSurface && (\n <state.surfaceMotion>\n <MotionRefForwarder>\n {/* Casting here as content should be equivalent to <PopoverSurface /> */}\n {/* FIXME: content should not be ReactNode it should be ReactElement instead. */}\n {state.popoverSurface as React.ReactElement}\n </MotionRefForwarder>\n </state.surfaceMotion>\n )}\n </PopoverContext.Provider>\n );\n};\n"],"names":["React","assertSlots","MotionRefForwarder","PopoverContext","popoverContextDefaultValue","renderPopover_unstable","state","contextValues","Provider","value","popover","popoverTrigger","popoverSurface","surfaceMotion"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAyB,4BAA4B;AACzE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,cAAc,EAAEC,0BAA0B,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/components/Popover/renderPopover.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport { assertSlots, type JSXElement } from '@fluentui/react-utilities';\nimport { MotionRefForwarder } from '@fluentui/react-motion';\nimport { PopoverContext, popoverContextDefaultValue } from '../../popoverContext';\nimport type { InternalPopoverSlots, PopoverState } from './Popover.types';\nimport type { PopoverContextValues } from './usePopoverContextValues';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState, contextValues?: PopoverContextValues): JSXElement => {\n assertSlots<InternalPopoverSlots>(state);\n\n return (\n <PopoverContext.Provider value={contextValues?.popover ?? popoverContextDefaultValue}>\n {state.popoverTrigger}\n {state.popoverSurface && (\n <state.surfaceMotion>\n <MotionRefForwarder>\n {/* Casting here as content should be equivalent to <PopoverSurface /> */}\n {/* FIXME: content should not be ReactNode it should be ReactElement instead. */}\n {state.popoverSurface as React.ReactElement}\n </MotionRefForwarder>\n </state.surfaceMotion>\n )}\n </PopoverContext.Provider>\n );\n};\n"],"names":["React","assertSlots","MotionRefForwarder","PopoverContext","popoverContextDefaultValue","renderPopover_unstable","state","contextValues","Provider","value","popover","popoverTrigger","popoverSurface","surfaceMotion"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAyB,4BAA4B;AACzE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,cAAc,EAAEC,0BAA0B,QAAQ,0BAAuB;AAIlF;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAqBC;IAC1DN,YAAkCK;QAGAC;IADlC,qBACE,MAACJ,eAAeK,QAAQ;QAACC,OAAOF,CAAAA,yBAAAA,0BAAAA,oCAAAA,cAAeG,OAAO,cAAtBH,oCAAAA,yBAA0BH;;YACvDE,MAAMK,cAAc;YACpBL,MAAMM,cAAc,kBACnB,KAACN,MAAMO,aAAa;0BAClB,cAAA,KAACX;8BAGEI,MAAMM,cAAc;;;;;AAMjC,EAAE"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as React from
|
|
3
|
-
import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside, elementContains, useTimeout } from
|
|
4
|
-
import { useFluent_unstable as useFluent } from
|
|
5
|
-
import { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget, usePositioningSlideDirection } from
|
|
6
|
-
import { useFocusFinders, useActivateModal } from
|
|
7
|
-
import { arrowHeights } from
|
|
8
|
-
import { popoverSurfaceBorderRadius } from
|
|
9
|
-
import { presenceMotionSlot } from
|
|
10
|
-
import { PopoverSurfaceMotion } from
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useControllableState, useEventCallback, useOnClickOutside, useOnScrollOutside, elementContains, useTimeout } from "@fluentui/react-utilities";
|
|
4
|
+
import { useFluent_unstable as useFluent } from "@fluentui/react-shared-contexts";
|
|
5
|
+
import { usePositioning, resolvePositioningShorthand, mergeArrowOffset, usePositioningMouseTarget, usePositioningSlideDirection } from "@fluentui/react-positioning";
|
|
6
|
+
import { useFocusFinders, useActivateModal } from "@fluentui/react-tabster";
|
|
7
|
+
import { arrowHeights } from "../PopoverSurface/index.js";
|
|
8
|
+
import { popoverSurfaceBorderRadius } from "./constants.js";
|
|
9
|
+
import { presenceMotionSlot } from "@fluentui/react-motion";
|
|
10
|
+
import { PopoverSurfaceMotion } from "./PopoverSurfaceMotion.js";
|
|
11
11
|
/**
|
|
12
12
|
* Create the state required to render Popover.
|
|
13
13
|
*
|
|
@@ -104,10 +104,12 @@ import { PopoverSurfaceMotion } from './PopoverSurfaceMotion';
|
|
|
104
104
|
disabled: !open || !closeOnScroll
|
|
105
105
|
});
|
|
106
106
|
var _props_closeOnFocusOutside;
|
|
107
|
-
// When trapFocus is enabled,
|
|
108
|
-
//
|
|
107
|
+
// When trapFocus is enabled, dismiss the popover only on a genuine inside -> outside focus
|
|
108
|
+
// transition. Focus that was never inside - e.g. a consumer keeping focus on an external element
|
|
109
|
+
// via `unstable_disableAutoFocus` - must not dismiss it on an outside -> outside focus change.
|
|
109
110
|
// Internal `closeOnFocusOutside` prop allows consumers to opt out during gradual rollout.
|
|
110
111
|
const closeOnFocusOutside = (_props_closeOnFocusOutside = props.closeOnFocusOutside) !== null && _props_closeOnFocusOutside !== void 0 ? _props_closeOnFocusOutside : true;
|
|
112
|
+
const focusWasInsideRef = React.useRef(false);
|
|
111
113
|
const closeOnFocusOutCallback = useEventCallback((ev)=>{
|
|
112
114
|
var _ev_composedPath_;
|
|
113
115
|
const target = (_ev_composedPath_ = ev.composedPath()[0]) !== null && _ev_composedPath_ !== void 0 ? _ev_composedPath_ : ev.target;
|
|
@@ -117,8 +119,14 @@ import { PopoverSurfaceMotion } from './PopoverSurfaceMotion';
|
|
|
117
119
|
if (!contentElement) {
|
|
118
120
|
return;
|
|
119
121
|
}
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
122
|
+
const isInside = elementContains(contentElement, target) || elementContains(triggerElement, target);
|
|
123
|
+
if (isInside) {
|
|
124
|
+
focusWasInsideRef.current = true;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// Only dismiss if focus previously lived inside the popover.
|
|
128
|
+
if (focusWasInsideRef.current) {
|
|
129
|
+
focusWasInsideRef.current = false;
|
|
122
130
|
setOpen(ev, false);
|
|
123
131
|
}
|
|
124
132
|
});
|
|
@@ -126,6 +134,7 @@ import { PopoverSurfaceMotion } from './PopoverSurfaceMotion';
|
|
|
126
134
|
if (!open || !props.trapFocus || !closeOnFocusOutside) {
|
|
127
135
|
return;
|
|
128
136
|
}
|
|
137
|
+
focusWasInsideRef.current = false;
|
|
129
138
|
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('focusin', closeOnFocusOutCallback, true);
|
|
130
139
|
return ()=>{
|
|
131
140
|
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('focusin', closeOnFocusOutCallback, true);
|