@fluentui/react-popover 9.0.0-alpha.8 → 9.0.0-nightly.f81b28ceb3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +1800 -1
- package/CHANGELOG.md +566 -2
- package/Spec.md +6 -6
- package/dist/react-popover.d.ts +59 -77
- package/lib/Popover.js.map +1 -1
- package/lib/PopoverSurface.js.map +1 -1
- package/lib/PopoverTrigger.js.map +1 -1
- package/lib/common/isConformant.d.ts +1 -1
- package/lib/common/isConformant.js +9 -5
- package/lib/common/isConformant.js.map +1 -1
- package/lib/common/mockUsePopoverContext.d.ts +1 -1
- package/lib/common/mockUsePopoverContext.js +28 -6
- package/lib/common/mockUsePopoverContext.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +2 -2
- package/lib/components/Popover/Popover.js +4 -3
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +24 -33
- package/lib/components/Popover/Popover.types.js.map +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/renderPopover.d.ts +1 -1
- package/lib/components/Popover/renderPopover.js +29 -17
- package/lib/components/Popover/renderPopover.js.map +1 -1
- package/lib/components/Popover/usePopover.d.ts +2 -3
- package/lib/components/Popover/usePopover.js +110 -88
- package/lib/components/Popover/usePopover.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.d.ts +3 -3
- package/lib/components/PopoverSurface/PopoverSurface.js +5 -4
- package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +9 -18
- package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib/components/PopoverSurface/index.js.map +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
- package/lib/components/PopoverSurface/renderPopoverSurface.js +18 -10
- package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -4
- package/lib/components/PopoverSurface/usePopoverSurface.js +94 -54
- package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -2
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +88 -64
- package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -2
- package/lib/components/PopoverTrigger/PopoverTrigger.js +4 -3
- package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/index.js.map +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
- package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -3
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +83 -60
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/popoverContext.d.ts +4 -5
- package/lib/popoverContext.js +19 -12
- package/lib/popoverContext.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Popover.js +7 -2
- package/lib-commonjs/Popover.js.map +1 -1
- package/lib-commonjs/PopoverSurface.js +7 -2
- package/lib-commonjs/PopoverSurface.js.map +1 -1
- package/lib-commonjs/PopoverTrigger.js +7 -2
- package/lib-commonjs/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/common/isConformant.d.ts +1 -1
- package/lib-commonjs/common/isConformant.js +18 -7
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/common/mockUsePopoverContext.d.ts +1 -1
- package/lib-commonjs/common/mockUsePopoverContext.js +38 -9
- package/lib-commonjs/common/mockUsePopoverContext.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.d.ts +2 -2
- package/lib-commonjs/components/Popover/Popover.js +14 -6
- package/lib-commonjs/components/Popover/Popover.js.map +1 -1
- package/lib-commonjs/components/Popover/Popover.types.d.ts +24 -33
- package/lib-commonjs/components/Popover/Popover.types.js +4 -1
- package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
- package/lib-commonjs/components/Popover/index.js +10 -2
- package/lib-commonjs/components/Popover/index.js.map +1 -1
- package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
- package/lib-commonjs/components/Popover/renderPopover.js +39 -20
- package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
- package/lib-commonjs/components/Popover/usePopover.d.ts +2 -3
- package/lib-commonjs/components/Popover/usePopover.js +127 -93
- package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.d.ts +3 -3
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +18 -9
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +9 -18
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js +4 -1
- package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/index.js +11 -2
- package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +32 -14
- package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -4
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +110 -60
- package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +2 -2
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +95 -65
- package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -2
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +14 -6
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +3 -4
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js +4 -1
- package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/index.js +10 -2
- package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +7 -2
- package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -3
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +98 -65
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/index.js +10 -2
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/popoverContext.d.ts +4 -5
- package/lib-commonjs/popoverContext.js +28 -14
- package/lib-commonjs/popoverContext.js.map +1 -1
- package/package.json +18 -15
- package/.storybook/main.js +0 -11
- package/.storybook/preview.js +0 -4
- package/bundle-size/Popover.fixture.js +0 -7
- package/config/api-extractor.json +0 -3
- package/config/tests.js +0 -7
- package/e2e/Popover.e2e.ts +0 -139
- package/etc/react-popover.api.md +0 -135
- package/just.config.ts +0 -3
- package/lib/Popover.stories.d.ts +0 -62
- package/lib/Popover.stories.js +0 -114
- package/lib/Popover.stories.js.map +0 -1
- package/lib/components/Popover/getOffsetWithArrow.d.ts +0 -7
- package/lib/components/Popover/getOffsetWithArrow.js +0 -34
- package/lib/components/Popover/getOffsetWithArrow.js.map +0 -1
- package/lib-amd/Popover.d.ts +0 -1
- package/lib-amd/Popover.js +0 -6
- package/lib-amd/Popover.js.map +0 -1
- package/lib-amd/Popover.stories.d.ts +0 -62
- package/lib-amd/Popover.stories.js +0 -121
- package/lib-amd/Popover.stories.js.map +0 -1
- package/lib-amd/PopoverSurface.d.ts +0 -1
- package/lib-amd/PopoverSurface.js +0 -6
- package/lib-amd/PopoverSurface.js.map +0 -1
- package/lib-amd/PopoverTrigger.d.ts +0 -1
- package/lib-amd/PopoverTrigger.js +0 -6
- package/lib-amd/PopoverTrigger.js.map +0 -1
- package/lib-amd/common/isConformant.d.ts +0 -4
- package/lib-amd/common/isConformant.js +0 -14
- package/lib-amd/common/isConformant.js.map +0 -1
- package/lib-amd/common/mockUsePopoverContext.d.ts +0 -7
- package/lib-amd/common/mockUsePopoverContext.js +0 -20
- package/lib-amd/common/mockUsePopoverContext.js.map +0 -1
- package/lib-amd/components/Popover/Popover.d.ts +0 -6
- package/lib-amd/components/Popover/Popover.js +0 -15
- package/lib-amd/components/Popover/Popover.js.map +0 -1
- package/lib-amd/components/Popover/Popover.types.d.ts +0 -109
- package/lib-amd/components/Popover/Popover.types.js +0 -5
- package/lib-amd/components/Popover/Popover.types.js.map +0 -1
- package/lib-amd/components/Popover/getOffsetWithArrow.d.ts +0 -7
- package/lib-amd/components/Popover/getOffsetWithArrow.js +0 -40
- package/lib-amd/components/Popover/getOffsetWithArrow.js.map +0 -1
- package/lib-amd/components/Popover/index.d.ts +0 -4
- package/lib-amd/components/Popover/index.js +0 -9
- package/lib-amd/components/Popover/index.js.map +0 -1
- package/lib-amd/components/Popover/renderPopover.d.ts +0 -5
- package/lib-amd/components/Popover/renderPopover.js +0 -29
- package/lib-amd/components/Popover/renderPopover.js.map +0 -1
- package/lib-amd/components/Popover/usePopover.d.ts +0 -11
- package/lib-amd/components/Popover/usePopover.js +0 -112
- package/lib-amd/components/Popover/usePopover.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.d.ts +0 -6
- package/lib-amd/components/PopoverSurface/PopoverSurface.js +0 -15
- package/lib-amd/components/PopoverSurface/PopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.d.ts +0 -30
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.js +0 -5
- package/lib-amd/components/PopoverSurface/PopoverSurface.types.js.map +0 -1
- package/lib-amd/components/PopoverSurface/index.d.ts +0 -5
- package/lib-amd/components/PopoverSurface/index.js +0 -10
- package/lib-amd/components/PopoverSurface/index.js.map +0 -1
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.d.ts +0 -5
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js +0 -21
- package/lib-amd/components/PopoverSurface/renderPopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurface.d.ts +0 -13
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js +0 -69
- package/lib-amd/components/PopoverSurface/usePopoverSurface.js.map +0 -1
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +0 -7
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js +0 -81
- package/lib-amd/components/PopoverSurface/usePopoverSurfaceStyles.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.d.ts +0 -6
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js +0 -15
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.d.ts +0 -12
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js +0 -5
- package/lib-amd/components/PopoverTrigger/PopoverTrigger.types.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/index.d.ts +0 -4
- package/lib-amd/components/PopoverTrigger/index.js +0 -9
- package/lib-amd/components/PopoverTrigger/index.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.d.ts +0 -5
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js +0 -13
- package/lib-amd/components/PopoverTrigger/renderPopoverTrigger.js.map +0 -1
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.d.ts +0 -11
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js +0 -75
- package/lib-amd/components/PopoverTrigger/usePopoverTrigger.js.map +0 -1
- package/lib-amd/index.d.ts +0 -4
- package/lib-amd/index.js +0 -9
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/popoverContext.d.ts +0 -9
- package/lib-amd/popoverContext.js +0 -22
- package/lib-amd/popoverContext.js.map +0 -1
- package/lib-commonjs/Popover.stories.d.ts +0 -62
- package/lib-commonjs/Popover.stories.js +0 -122
- package/lib-commonjs/Popover.stories.js.map +0 -1
- package/lib-commonjs/components/Popover/getOffsetWithArrow.d.ts +0 -7
- package/lib-commonjs/components/Popover/getOffsetWithArrow.js +0 -38
- package/lib-commonjs/components/Popover/getOffsetWithArrow.js.map +0 -1
- package/src/components/Popover/Popover.types.ts +0 -124
- package/src/components/PopoverSurface/PopoverSurface.types.ts +0 -36
- package/src/components/PopoverTrigger/PopoverTrigger.types.ts +0 -13
package/dist/react-popover.d.ts
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
-
import { ComponentProps } from '@fluentui/react-utilities';
|
2
|
-
import { ComponentState } from '@fluentui/react-utilities';
|
3
|
-
import { Context } from '@fluentui/react-context-selector';
|
4
|
-
import { ContextSelector } from '@fluentui/react-context-selector';
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
1
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
2
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
3
|
+
import type { Context } from '@fluentui/react-context-selector';
|
4
|
+
import type { ContextSelector } from '@fluentui/react-context-selector';
|
5
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
6
|
+
import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
7
|
+
import type { PopperVirtualElement } from '@fluentui/react-positioning';
|
8
|
+
import type { PortalProps } from '@fluentui/react-portal';
|
9
|
+
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
8
10
|
import * as React_2 from 'react';
|
11
|
+
import type { usePopperMouseTarget } from '@fluentui/react-positioning';
|
9
12
|
|
10
13
|
export declare const arrowHeights: Record<PopoverSize, number>;
|
11
14
|
|
12
15
|
/**
|
13
16
|
* Data attached to open/close events
|
14
17
|
*/
|
15
|
-
export declare
|
16
|
-
}
|
18
|
+
export declare type OnOpenChangeData = Pick<PopoverState, 'open'>;
|
17
19
|
|
18
20
|
/**
|
19
21
|
* The supported events that will trigger open/close of the menu
|
@@ -21,32 +23,15 @@ export declare interface OnOpenChangeData extends Pick<PopoverState, 'open'> {
|
|
21
23
|
export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.FocusEvent<HTMLElement>;
|
22
24
|
|
23
25
|
/**
|
24
|
-
*
|
26
|
+
* Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
|
25
27
|
*/
|
26
28
|
export declare const Popover: React_2.FC<PopoverProps>;
|
27
29
|
|
28
|
-
export declare
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Context shared between Popover and its children components
|
32
|
-
*/
|
33
|
-
export declare interface PopoverContextValue extends Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'target' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'brand' | 'inverted' | 'trapFocus'> {
|
34
|
-
}
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Names of PopoverProps that have a default value in usePopover
|
38
|
-
*/
|
39
|
-
export declare type PopoverDefaultedProps = never;
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Popover Props
|
43
|
-
*/
|
44
|
-
export declare interface PopoverProps extends Pick<PopperOptions, 'position' | 'align' | 'offset' | 'coverTarget' | 'target'>, Pick<PortalProps, 'mountNode'> {
|
45
|
-
children: React_2.ReactNode;
|
30
|
+
export declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
|
46
31
|
/**
|
47
32
|
* Controls the opening of the Popover
|
48
33
|
*/
|
49
|
-
open
|
34
|
+
open: boolean;
|
50
35
|
/**
|
51
36
|
* Used to set the initial open state of the Popover in uncontrolled mode
|
52
37
|
*/
|
@@ -74,25 +59,37 @@ export declare interface PopoverProps extends Pick<PopperOptions, 'position' | '
|
|
74
59
|
*/
|
75
60
|
size?: PopoverSize;
|
76
61
|
/**
|
77
|
-
*
|
78
|
-
*
|
62
|
+
* A popover can appear styled with brand or inverted.
|
63
|
+
* When not specified, the default style is used.
|
79
64
|
*/
|
80
|
-
|
81
|
-
/**
|
82
|
-
* Inverts the foreground/background colour of the popover
|
83
|
-
* Mutually exclusive with `brand`
|
84
|
-
*/
|
85
|
-
inverted?: boolean;
|
65
|
+
appearance?: 'brand' | 'inverted';
|
86
66
|
/**
|
87
67
|
* Should trap focus
|
88
68
|
*/
|
89
69
|
trapFocus?: boolean;
|
90
|
-
|
70
|
+
/**
|
71
|
+
* Configures the position of the Popover
|
72
|
+
*/
|
73
|
+
positioning?: PositioningShorthand;
|
74
|
+
};
|
75
|
+
|
76
|
+
export declare const PopoverContext: Context<PopoverContextValue>;
|
91
77
|
|
92
78
|
/**
|
93
|
-
*
|
79
|
+
* Context shared between Popover and its children components
|
94
80
|
*/
|
95
|
-
export declare type
|
81
|
+
export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Popover Props
|
85
|
+
*/
|
86
|
+
export declare type PopoverProps = Partial<PopoverCommons> & {
|
87
|
+
/**
|
88
|
+
* Can contain two children including {@link PopoverTrigger} and {@link PopoverPopover}.
|
89
|
+
* Alternatively can only contain {@link PopoverPopover} if using a custom `target`.
|
90
|
+
*/
|
91
|
+
children: [JSX.Element, JSX.Element] | JSX.Element;
|
92
|
+
};
|
96
93
|
|
97
94
|
/**
|
98
95
|
* Determines popover padding and arrow size
|
@@ -102,11 +99,7 @@ export declare type PopoverSize = 'small' | 'medium' | 'large';
|
|
102
99
|
/**
|
103
100
|
* Popover State
|
104
101
|
*/
|
105
|
-
export declare
|
106
|
-
/**
|
107
|
-
* Open state of the Popover
|
108
|
-
*/
|
109
|
-
open: boolean;
|
102
|
+
export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children'> & {
|
110
103
|
/**
|
111
104
|
* Callback to open/close the Popover
|
112
105
|
*/
|
@@ -130,63 +123,55 @@ export declare interface PopoverState extends ComponentState<PopoverProps, Popov
|
|
130
123
|
/**
|
131
124
|
* A callback to set the target of the popper to the mouse click for context events
|
132
125
|
*/
|
133
|
-
setContextTarget:
|
126
|
+
setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
|
134
127
|
size: NonNullable<PopoverProps['size']>;
|
135
|
-
}
|
128
|
+
};
|
136
129
|
|
137
130
|
/**
|
138
131
|
* PopoverSurface component renders react children in a positioned box
|
139
132
|
*/
|
140
|
-
export declare const PopoverSurface:
|
141
|
-
|
142
|
-
/**
|
143
|
-
* Names of PopoverSurfaceProps that have a default value in usePopoverSurface
|
144
|
-
*/
|
145
|
-
export declare type PopoverSurfaceDefaultedProps = never;
|
133
|
+
export declare const PopoverSurface: ForwardRefComponent<PopoverSurfaceProps>;
|
146
134
|
|
147
135
|
/**
|
148
136
|
* PopoverSurface Props
|
149
137
|
*/
|
150
|
-
export declare
|
151
|
-
}
|
138
|
+
export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
|
152
139
|
|
153
140
|
/**
|
154
|
-
* Names of the
|
141
|
+
* Names of the slots in PopoverSurfaceProps
|
155
142
|
*/
|
156
|
-
export declare type
|
143
|
+
export declare type PopoverSurfaceSlots = {
|
144
|
+
root: IntrinsicShorthandProps<'div'>;
|
145
|
+
};
|
146
|
+
|
147
|
+
export declare const popoverSurfaceSlots: Array<keyof PopoverSurfaceSlots>;
|
157
148
|
|
158
149
|
/**
|
159
150
|
* PopoverSurface State
|
160
151
|
*/
|
161
|
-
export declare
|
162
|
-
ref: React_2.Ref<HTMLElement>;
|
163
|
-
/**
|
164
|
-
* Ref to the arrow element
|
165
|
-
*/
|
166
|
-
arrowRef?: React_2.Ref<HTMLDivElement>;
|
152
|
+
export declare type PopoverSurfaceState = ComponentState<PopoverSurfaceSlots> & Pick<PopoverContextValue, 'open' | 'mountNode' | 'noArrow' | 'size' | 'appearance' | 'arrowRef'> & {
|
167
153
|
/**
|
168
154
|
* CSS class for the arrow element
|
169
155
|
*/
|
170
156
|
arrowClassName?: string;
|
171
|
-
}
|
157
|
+
};
|
172
158
|
|
173
159
|
/**
|
174
|
-
*
|
160
|
+
* Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
|
175
161
|
*/
|
176
162
|
export declare const PopoverTrigger: React_2.FC<PopoverTriggerProps>;
|
177
163
|
|
178
164
|
/**
|
179
165
|
* PopoverTrigger Props
|
180
166
|
*/
|
181
|
-
export declare
|
167
|
+
export declare type PopoverTriggerProps = {
|
182
168
|
children: React_2.ReactElement;
|
183
|
-
}
|
169
|
+
};
|
184
170
|
|
185
171
|
/**
|
186
172
|
* PopoverTrigger State
|
187
173
|
*/
|
188
|
-
export declare
|
189
|
-
}
|
174
|
+
export declare type PopoverTriggerState = PopoverTriggerProps;
|
190
175
|
|
191
176
|
/**
|
192
177
|
* Render the final JSX of Popover
|
@@ -210,11 +195,10 @@ export declare const renderPopoverTrigger: (state: PopoverTriggerState) => JSX.E
|
|
210
195
|
* before being passed to renderPopover.
|
211
196
|
*
|
212
197
|
* @param props - props from this instance of Popover
|
213
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
214
198
|
*/
|
215
|
-
export declare const usePopover: (props: PopoverProps
|
199
|
+
export declare const usePopover: (props: PopoverProps) => PopoverState;
|
216
200
|
|
217
|
-
export declare const usePopoverContext: <T>(selector: ContextSelector<
|
201
|
+
export declare const usePopoverContext: <T>(selector: ContextSelector<Pick<PopoverState, "mountNode" | "open" | "setOpen" | "triggerRef" | "contentRef" | "openOnHover" | "openOnContext" | "noArrow" | "arrowRef" | "size" | "appearance" | "trapFocus">, T>) => T;
|
218
202
|
|
219
203
|
/**
|
220
204
|
* Create the state required to render PopoverSurface.
|
@@ -223,10 +207,9 @@ export declare const usePopoverContext: <T>(selector: ContextSelector<PopoverCon
|
|
223
207
|
* before being passed to renderPopoverSurface.
|
224
208
|
*
|
225
209
|
* @param props - props from this instance of PopoverSurface
|
226
|
-
* @param ref - reference to root
|
227
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
210
|
+
* @param ref - reference to root HTMLDivElement of PopoverSurface
|
228
211
|
*/
|
229
|
-
export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React_2.Ref<
|
212
|
+
export declare const usePopoverSurface: (props: PopoverSurfaceProps, ref: React_2.Ref<HTMLDivElement>) => PopoverSurfaceState;
|
230
213
|
|
231
214
|
/**
|
232
215
|
* Apply styling to the PopoverSurface slots based on the state
|
@@ -240,8 +223,7 @@ export declare const usePopoverSurfaceStyles: (state: PopoverSurfaceState) => Po
|
|
240
223
|
* before being passed to renderPopoverTrigger.
|
241
224
|
*
|
242
225
|
* @param props - props from this instance of PopoverTrigger
|
243
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
244
226
|
*/
|
245
|
-
export declare const usePopoverTrigger: (props: PopoverTriggerProps
|
227
|
+
export declare const usePopoverTrigger: (props: PopoverTriggerProps) => PopoverTriggerState;
|
246
228
|
|
247
229
|
export { }
|
package/lib/Popover.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../src/Popover.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopoverSurface.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"PopoverSurface.js","sourceRoot":"","sources":["../src/PopoverSurface.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"PopoverTrigger.js","sourceRoot":"","sources":["../src/PopoverTrigger.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IsConformantOptions } from '@fluentui/react-conformance';
|
1
|
+
import type { IsConformantOptions } from '@fluentui/react-conformance';
|
2
2
|
export declare function isConformant<TProps = {}>(testInfo: Omit<IsConformantOptions<TProps>, 'componentPath'> & {
|
3
3
|
componentPath?: string;
|
4
4
|
}): void;
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import { isConformant as baseIsConformant } from '@fluentui/react-conformance';
|
2
|
+
import makeStylesTests from '@fluentui/react-conformance-make-styles';
|
2
3
|
export function isConformant(testInfo) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
var defaultOptions = {
|
5
|
+
asPropHandlesRef: true,
|
6
|
+
componentPath: module.parent.filename.replace('.test', ''),
|
7
|
+
// TODO // https://github.com/microsoft/fluentui/issues/19522
|
8
|
+
skipAsPropTests: true,
|
9
|
+
extraTests: makeStylesTests
|
10
|
+
};
|
11
|
+
baseIsConformant(defaultOptions, testInfo);
|
8
12
|
}
|
9
13
|
//# sourceMappingURL=isConformant.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/common/isConformant.ts"],"names":[],"mappings":"AAAA,SAAS,YAAY,IAAI,gBAAzB,QAAiD,6BAAjD;AAEA,OAAO,eAAP,MAA4B,yCAA5B;AAEA,OAAM,SAAU,YAAV,CACJ,QADI,EACqF;AAEzF,MAAM,cAAc,GAAyC;AAC3D,IAAA,gBAAgB,EAAE,IADyC;AAE3D,IAAA,aAAa,EAAE,MAAO,CAAC,MAAR,CAAgB,QAAhB,CAAyB,OAAzB,CAAiC,OAAjC,EAA0C,EAA1C,CAF4C;AAG3D;AACA,IAAA,eAAe,EAAE,IAJ0C;AAK3D,IAAA,UAAU,EAAE;AAL+C,GAA7D;AAQA,EAAA,gBAAgB,CAAC,cAAD,EAAiB,QAAjB,CAAhB;AACD","sourceRoot":""}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PopoverContextValue } from '../popoverContext';
|
1
|
+
import type { PopoverContextValue } from '../popoverContext';
|
2
2
|
/**
|
3
3
|
* A test utility to mock the usePopoverContext hook that relies on context selector
|
4
4
|
* Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
|
@@ -5,12 +5,34 @@ import { usePopoverContext } from '../popoverContext';
|
|
5
5
|
* Don't forget to call `jest.mock(**\/popupContext.ts)` while using this
|
6
6
|
* @param options Popover context values to set for testing
|
7
7
|
*/
|
8
|
+
|
8
9
|
export var mockPopoverContext = function (options) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
if (options === void 0) {
|
11
|
+
options = {};
|
12
|
+
}
|
13
|
+
|
14
|
+
var mockContext = __assign({
|
15
|
+
open: false,
|
16
|
+
setOpen: function () {
|
17
|
+
return null;
|
18
|
+
},
|
19
|
+
triggerRef: {
|
20
|
+
current: null
|
21
|
+
},
|
22
|
+
contentRef: {
|
23
|
+
current: null
|
24
|
+
},
|
25
|
+
arrowRef: {
|
26
|
+
current: null
|
27
|
+
},
|
28
|
+
openOnContext: false,
|
29
|
+
openOnHover: false,
|
30
|
+
size: 'medium'
|
31
|
+
}, options); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
32
|
+
|
33
|
+
|
34
|
+
usePopoverContext.mockImplementation(function (selector) {
|
35
|
+
return selector(mockContext);
|
36
|
+
});
|
15
37
|
};
|
16
38
|
//# sourceMappingURL=mockUsePopoverContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/common/mockUsePopoverContext.ts"],"names":[],"mappings":";AAAA,SAAS,iBAAT,QAAkC,mBAAlC;AAGA;;;;AAIG;;AACH,OAAO,IAAM,kBAAkB,GAAG,UAAC,OAAD,EAA2C;AAA1C,MAAA,OAAA,KAAA,KAAA,CAAA,EAAA;AAAA,IAAA,OAAA,GAAA,EAAA;AAA0C;;AAC3E,MAAM,WAAW,GAAA,QAAA,CAAA;AACf,IAAA,IAAI,EAAE,KADS;AAEf,IAAA,OAAO,EAAE,YAAA;AAAM,aAAA,IAAA;AAAI,KAFJ;AAGf,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAHG;AAIf,IAAA,UAAU,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KAJG;AAKf,IAAA,QAAQ,EAAE;AAAE,MAAA,OAAO,EAAE;AAAX,KALK;AAMf,IAAA,aAAa,EAAE,KANA;AAOf,IAAA,WAAW,EAAE,KAPE;AAQf,IAAA,IAAI,EAAE;AARS,GAAA,EASZ,OATY,CAAjB,CAD2E,CAY3E;;;AACC,EAAA,iBAA+B,CAAC,kBAAhC,CAAmD,UAAC,QAAD,EAAgD;AAClG,WAAO,QAAQ,CAAC,WAAD,CAAf;AACD,GAFA;AAGF,CAhBM","sourceRoot":""}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { PopoverProps } from './Popover.types';
|
2
|
+
import type { PopoverProps } from './Popover.types';
|
3
3
|
/**
|
4
|
-
*
|
4
|
+
* Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.
|
5
5
|
*/
|
6
6
|
export declare const Popover: React.FC<PopoverProps>;
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { usePopover } from './usePopover';
|
2
2
|
import { renderPopover } 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) {
|
7
|
-
|
8
|
-
|
8
|
+
var state = usePopover(props);
|
9
|
+
return renderPopover(state);
|
9
10
|
};
|
10
11
|
Popover.displayName = 'Popover';
|
11
12
|
//# sourceMappingURL=Popover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,20 +1,15 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import {
|
3
|
-
import { PortalProps } from '@fluentui/react-portal';
|
4
|
-
import { ComponentState } from '@fluentui/react-utilities';
|
2
|
+
import type { PopperVirtualElement, PositioningShorthand, usePopperMouseTarget } from '@fluentui/react-positioning';
|
3
|
+
import type { PortalProps } from '@fluentui/react-portal';
|
5
4
|
/**
|
6
5
|
* Determines popover padding and arrow size
|
7
6
|
*/
|
8
7
|
export declare type PopoverSize = 'small' | 'medium' | 'large';
|
9
|
-
|
10
|
-
* Popover Props
|
11
|
-
*/
|
12
|
-
export interface PopoverProps extends Pick<PopperOptions, 'position' | 'align' | 'offset' | 'coverTarget' | 'target'>, Pick<PortalProps, 'mountNode'> {
|
13
|
-
children: React.ReactNode;
|
8
|
+
export declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
|
14
9
|
/**
|
15
10
|
* Controls the opening of the Popover
|
16
11
|
*/
|
17
|
-
open
|
12
|
+
open: boolean;
|
18
13
|
/**
|
19
14
|
* Used to set the initial open state of the Popover in uncontrolled mode
|
20
15
|
*/
|
@@ -42,36 +37,33 @@ export interface PopoverProps extends Pick<PopperOptions, 'position' | 'align' |
|
|
42
37
|
*/
|
43
38
|
size?: PopoverSize;
|
44
39
|
/**
|
45
|
-
*
|
46
|
-
*
|
40
|
+
* A popover can appear styled with brand or inverted.
|
41
|
+
* When not specified, the default style is used.
|
47
42
|
*/
|
48
|
-
|
49
|
-
/**
|
50
|
-
* Inverts the foreground/background colour of the popover
|
51
|
-
* Mutually exclusive with `brand`
|
52
|
-
*/
|
53
|
-
inverted?: boolean;
|
43
|
+
appearance?: 'brand' | 'inverted';
|
54
44
|
/**
|
55
45
|
* Should trap focus
|
56
46
|
*/
|
57
47
|
trapFocus?: boolean;
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
48
|
+
/**
|
49
|
+
* Configures the position of the Popover
|
50
|
+
*/
|
51
|
+
positioning?: PositioningShorthand;
|
52
|
+
};
|
63
53
|
/**
|
64
|
-
*
|
54
|
+
* Popover Props
|
65
55
|
*/
|
66
|
-
export declare type
|
56
|
+
export declare type PopoverProps = Partial<PopoverCommons> & {
|
57
|
+
/**
|
58
|
+
* Can contain two children including {@link PopoverTrigger} and {@link PopoverPopover}.
|
59
|
+
* Alternatively can only contain {@link PopoverPopover} if using a custom `target`.
|
60
|
+
*/
|
61
|
+
children: [JSX.Element, JSX.Element] | JSX.Element;
|
62
|
+
};
|
67
63
|
/**
|
68
64
|
* Popover State
|
69
65
|
*/
|
70
|
-
export
|
71
|
-
/**
|
72
|
-
* Open state of the Popover
|
73
|
-
*/
|
74
|
-
open: boolean;
|
66
|
+
export declare type PopoverState = PopoverCommons & Pick<PopoverProps, 'children'> & {
|
75
67
|
/**
|
76
68
|
* Callback to open/close the Popover
|
77
69
|
*/
|
@@ -95,14 +87,13 @@ export interface PopoverState extends ComponentState<PopoverProps, PopoverShorth
|
|
95
87
|
/**
|
96
88
|
* A callback to set the target of the popper to the mouse click for context events
|
97
89
|
*/
|
98
|
-
setContextTarget:
|
90
|
+
setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
|
99
91
|
size: NonNullable<PopoverProps['size']>;
|
100
|
-
}
|
92
|
+
};
|
101
93
|
/**
|
102
94
|
* Data attached to open/close events
|
103
95
|
*/
|
104
|
-
export
|
105
|
-
}
|
96
|
+
export declare type OnOpenChangeData = Pick<PopoverState, 'open'>;
|
106
97
|
/**
|
107
98
|
* The supported events that will trigger open/close of the menu
|
108
99
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.types.js","sourceRoot":"
|
1
|
+
{"version":3,"file":"Popover.types.js","sourceRoot":"","sources":["../../../src/components/Popover/Popover.types.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
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"}
|
@@ -3,23 +3,35 @@ import { PopoverContext } from '../../popoverContext';
|
|
3
3
|
/**
|
4
4
|
* Render the final JSX of Popover
|
5
5
|
*/
|
6
|
+
|
6
7
|
export var renderPopover = function (state) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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;
|
20
|
+
return /*#__PURE__*/React.createElement(PopoverContext.Provider, {
|
21
|
+
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
|
34
|
+
}
|
35
|
+
}, state.children);
|
24
36
|
};
|
25
37
|
//# sourceMappingURL=renderPopover.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
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,4 +1,4 @@
|
|
1
|
-
import { PopoverProps, PopoverState } from './Popover.types';
|
1
|
+
import type { PopoverProps, PopoverState } from './Popover.types';
|
2
2
|
/**
|
3
3
|
* Create the state required to render Popover.
|
4
4
|
*
|
@@ -6,6 +6,5 @@ import { PopoverProps, PopoverState } from './Popover.types';
|
|
6
6
|
* before being passed to renderPopover.
|
7
7
|
*
|
8
8
|
* @param props - props from this instance of Popover
|
9
|
-
* @param defaultProps - (optional) default prop values provided by the implementing type
|
10
9
|
*/
|
11
|
-
export declare const usePopover: (props: PopoverProps
|
10
|
+
export declare const usePopover: (props: PopoverProps) => PopoverState;
|