@fluentui/react-popover 0.0.0-nightlya21bfaceec20220202.1 → 0.0.0-nightlyb2b3ec1da320220209.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.json CHANGED
@@ -2,15 +2,15 @@
2
2
  "name": "@fluentui/react-popover",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 02 Feb 2022 04:13:27 GMT",
6
- "tag": "@fluentui/react-popover_v0.0.0-nightlya21bfaceec20220202.1",
7
- "version": "0.0.0-nightlya21bfaceec20220202.1",
5
+ "date": "Wed, 09 Feb 2022 04:13:01 GMT",
6
+ "tag": "@fluentui/react-popover_v0.0.0-nightlyb2b3ec1da320220209.1",
7
+ "version": "0.0.0-nightlyb2b3ec1da320220209.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
11
11
  "author": "email not defined",
12
12
  "package": "@fluentui/react-popover",
13
- "commit": "e975312642c322c9f393ec8345ead680d9df154a",
13
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480",
14
14
  "comment": "Release nightly v9"
15
15
  },
16
16
  {
@@ -31,6 +31,12 @@
31
31
  "commit": "09804275c7f346db54c33d4ff347bffc33676014",
32
32
  "comment": "Fix Popover arrow border in high contrast"
33
33
  },
34
+ {
35
+ "author": "behowell@microsoft.com",
36
+ "package": "@fluentui/react-popover",
37
+ "commit": "53b01d71e335715fda91b33e3d7bbd9d471d5ed3",
38
+ "comment": "Refactor component Slot typings"
39
+ },
34
40
  {
35
41
  "author": "lingfangao@hotmail.com",
36
42
  "package": "@fluentui/react-popover",
@@ -49,6 +55,12 @@
49
55
  "commit": "b1446dead62e61c9a0f6101d6dfc5a2f780403b8",
50
56
  "comment": "use Griffel packages"
51
57
  },
58
+ {
59
+ "author": "olfedias@microsoft.com",
60
+ "package": "@fluentui/react-popover",
61
+ "commit": "aa6cfd8ac825b5a280206808101de549a91094fc",
62
+ "comment": "standardize trigger implementation & cloning"
63
+ },
52
64
  {
53
65
  "author": "olfedias@microsoft.com",
54
66
  "package": "@fluentui/react-popover",
@@ -76,44 +88,44 @@
76
88
  {
77
89
  "author": "beachball",
78
90
  "package": "@fluentui/react-popover",
79
- "comment": "Bump @fluentui/react-context-selector to v0.0.0-nightlya21bfaceec20220202.1",
80
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
91
+ "comment": "Bump @fluentui/react-context-selector to v0.0.0-nightlyb2b3ec1da320220209.1",
92
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
81
93
  },
82
94
  {
83
95
  "author": "beachball",
84
96
  "package": "@fluentui/react-popover",
85
- "comment": "Bump @fluentui/react-portal to v0.0.0-nightlya21bfaceec20220202.1",
86
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
97
+ "comment": "Bump @fluentui/react-portal to v0.0.0-nightlyb2b3ec1da320220209.1",
98
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
87
99
  },
88
100
  {
89
101
  "author": "beachball",
90
102
  "package": "@fluentui/react-popover",
91
- "comment": "Bump @fluentui/react-positioning to v0.0.0-nightlya21bfaceec20220202.1",
92
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
103
+ "comment": "Bump @fluentui/react-positioning to v0.0.0-nightlyb2b3ec1da320220209.1",
104
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
93
105
  },
94
106
  {
95
107
  "author": "beachball",
96
108
  "package": "@fluentui/react-popover",
97
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightlya21bfaceec20220202.1",
98
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
109
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightlyb2b3ec1da320220209.1",
110
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
99
111
  },
100
112
  {
101
113
  "author": "beachball",
102
114
  "package": "@fluentui/react-popover",
103
- "comment": "Bump @fluentui/react-tabster to v0.0.0-nightlya21bfaceec20220202.1",
104
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
115
+ "comment": "Bump @fluentui/react-tabster to v0.0.0-nightlyb2b3ec1da320220209.1",
116
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
105
117
  },
106
118
  {
107
119
  "author": "beachball",
108
120
  "package": "@fluentui/react-popover",
109
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightlya21bfaceec20220202.1",
110
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
121
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightlyb2b3ec1da320220209.1",
122
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
111
123
  },
112
124
  {
113
125
  "author": "beachball",
114
126
  "package": "@fluentui/react-popover",
115
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightlya21bfaceec20220202.1",
116
- "commit": "e975312642c322c9f393ec8345ead680d9df154a"
127
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightlyb2b3ec1da320220209.1",
128
+ "commit": "066f84c7bef7f4df47448557396199d8b7f26480"
117
129
  }
118
130
  ],
119
131
  "none": [
package/CHANGELOG.md CHANGED
@@ -1,34 +1,36 @@
1
1
  # Change Log - @fluentui/react-popover
2
2
 
3
- This log was last generated on Wed, 02 Feb 2022 04:13:27 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 09 Feb 2022 04:13:01 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightlya21bfaceec20220202.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v0.0.0-nightlya21bfaceec20220202.1)
7
+ ## [0.0.0-nightlyb2b3ec1da320220209.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v0.0.0-nightlyb2b3ec1da320220209.1)
8
8
 
9
- Wed, 02 Feb 2022 04:13:27 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.5..@fluentui/react-popover_v0.0.0-nightlya21bfaceec20220202.1)
9
+ Wed, 09 Feb 2022 04:13:01 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.0.0-beta.5..@fluentui/react-popover_v0.0.0-nightlyb2b3ec1da320220209.1)
11
11
 
12
12
  ### Changes
13
13
 
14
- - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by email not defined)
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by email not defined)
15
15
  - Replacing use of functions in makeStyles with direct use of tokens ([PR #21049](https://github.com/microsoft/fluentui/pull/21049) by Humberto.Morimoto@microsoft.com)
16
16
  - Remove component's shorthandProps array ([PR #21134](https://github.com/microsoft/fluentui/pull/21134) by behowell@microsoft.com)
17
17
  - Fix Popover arrow border in high contrast ([PR #21086](https://github.com/microsoft/fluentui/pull/21086) by behowell@microsoft.com)
18
+ - Refactor component Slot typings ([PR #21518](https://github.com/microsoft/fluentui/pull/21518) by behowell@microsoft.com)
18
19
  - fix: Set `aria-modal` on Popover if focus trap is enabled ([PR #21387](https://github.com/microsoft/fluentui/pull/21387) by lingfangao@hotmail.com)
19
20
  - Updating based on removal of functions from makeStyles. ([PR #21239](https://github.com/microsoft/fluentui/pull/21239) by Humberto.Morimoto@microsoft.com)
20
21
  - use Griffel packages ([PR #21392](https://github.com/microsoft/fluentui/pull/21392) by olfedias@microsoft.com)
22
+ - standardize trigger implementation & cloning ([PR #21609](https://github.com/microsoft/fluentui/pull/21609) by olfedias@microsoft.com)
21
23
  - update styles to not use CSS shorthands ([PR #20796](https://github.com/microsoft/fluentui/pull/20796) by olfedias@microsoft.com)
22
24
  - fix: Use role=complementary for Popovers without focus traps ([PR #21416](https://github.com/microsoft/fluentui/pull/21416) by lingfangao@hotmail.com)
23
25
  - BREAKING: Rename component hooks add the suffix _unstable, as their API has not been finalized yet ([PR #21365](https://github.com/microsoft/fluentui/pull/21365) by behowell@microsoft.com)
24
26
  - Updating based on changes to composition types. ([PR #20891](https://github.com/microsoft/fluentui/pull/20891) by Humberto.Morimoto@microsoft.com)
25
- - Bump @fluentui/react-context-selector to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
26
- - Bump @fluentui/react-portal to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
27
- - Bump @fluentui/react-positioning to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
28
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
29
- - Bump @fluentui/react-tabster to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
30
- - Bump @fluentui/react-utilities to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
31
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightlya21bfaceec20220202.1 ([commit](https://github.com/microsoft/fluentui/commit/e975312642c322c9f393ec8345ead680d9df154a) by beachball)
27
+ - Bump @fluentui/react-context-selector to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
28
+ - Bump @fluentui/react-portal to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
29
+ - Bump @fluentui/react-positioning to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
30
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
31
+ - Bump @fluentui/react-tabster to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
32
+ - Bump @fluentui/react-utilities to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
33
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightlyb2b3ec1da320220209.1 ([commit](https://github.com/microsoft/fluentui/commit/066f84c7bef7f4df47448557396199d8b7f26480) by beachball)
32
34
 
33
35
  ## [9.0.0-beta.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.0.0-beta.5)
34
36
 
@@ -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 { IntrinsicSlotProps } 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>;
@@ -145,7 +148,7 @@ export declare type PopoverSurfaceProps = ComponentProps<PopoverSurfaceSlots>;
145
148
  * Names of the slots in PopoverSurfaceProps
146
149
  */
147
150
  export declare type PopoverSurfaceSlots = {
148
- root: IntrinsicSlotProps<'div'>;
151
+ root: Slot<'div'>;
149
152
  };
150
153
 
151
154
  /**
@@ -161,19 +164,27 @@ 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
@@ -188,7 +199,7 @@ export declare const renderPopoverSurface_unstable: (state: PopoverSurfaceState)
188
199
  /**
189
200
  * Render the final JSX of PopoverTrigger
190
201
  */
191
- export declare const renderPopoverTrigger_unstable: (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.
@@ -1,4 +1,4 @@
1
- import type { ComponentProps, ComponentState, IntrinsicSlotProps } 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: IntrinsicSlotProps<'div'>;
11
+ root: Slot<'div'>;
12
12
  };
13
13
  /**
14
14
  * PopoverSurface State
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
2
3
  import type { PopoverTriggerProps } from './PopoverTrigger.types';
3
4
  /**
4
5
  * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
5
6
  */
6
- export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
7
+ export declare const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent;
@@ -9,4 +9,5 @@ export const PopoverTrigger = props => {
9
9
  return renderPopoverTrigger_unstable(state);
10
10
  };
11
11
  PopoverTrigger.displayName = 'PopoverTrigger';
12
+ PopoverTrigger.isFluentTriggerComponent = true;
12
13
  //# sourceMappingURL=PopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AAGA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAAkC,KAAK,IAAG;AACnE,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,CAAxC;AAEA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CAJM;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAA2D,KAAK,IAAG;AAC5F,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,CAAxC;AAEA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CAJM;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B;AACA,cAAc,CAAC,wBAAf,GAA0C,IAA1C","sourceRoot":""}
@@ -3,9 +3,16 @@ import * as React from 'react';
3
3
  * PopoverTrigger Props
4
4
  */
5
5
  export declare type PopoverTriggerProps = {
6
- children: React.ReactElement;
6
+ children: (React.ReactElement & {
7
+ ref?: React.Ref<unknown>;
8
+ }) | ((props: PopoverTriggerChildProps) => React.ReactElement | null);
7
9
  };
8
10
  /**
9
11
  * PopoverTrigger State
10
12
  */
11
- export declare type PopoverTriggerState = PopoverTriggerProps;
13
+ export declare type PopoverTriggerState = {
14
+ children: React.ReactElement | null;
15
+ };
16
+ export declare type PopoverTriggerChildProps = {
17
+ ref?: React.Ref<never>;
18
+ } & Pick<React.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
@@ -2,4 +2,4 @@ import type { PopoverTriggerState } from './PopoverTrigger.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverTrigger
4
4
  */
5
- export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => JSX.Element;
5
+ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA4C;AACvF,SAAO,KAAK,CAAC,QAAb;AACD,CAFM","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM","sourceRoot":""}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useMergedRefs, useEventCallback, shouldPreventDefaultOnKeyDown } from '@fluentui/react-utilities';
2
+ import { applyTriggerPropsToChildren, getTriggerChild, shouldPreventDefaultOnKeyDown, useMergedRefs, useMergedEventCallbacks, useEventCallback } from '@fluentui/react-utilities';
3
3
  import { useModalAttributes } from '@fluentui/react-tabster';
4
4
  import { usePopoverContext_unstable } from '../../popoverContext';
5
5
  /**
@@ -12,6 +12,12 @@ import { usePopoverContext_unstable } from '../../popoverContext';
12
12
  */
13
13
 
14
14
  export const usePopoverTrigger_unstable = props => {
15
+ var _a, _b, _c, _d, _e;
16
+
17
+ const {
18
+ children
19
+ } = props;
20
+ const child = /*#__PURE__*/React.isValidElement(children) ? getTriggerChild(children) : undefined;
15
21
  const setOpen = usePopoverContext_unstable(context => context.setOpen);
16
22
  const open = usePopoverContext_unstable(context => context.open);
17
23
  const triggerRef = usePopoverContext_unstable(context => context.triggerRef);
@@ -21,27 +27,22 @@ export const usePopoverTrigger_unstable = props => {
21
27
  const {
22
28
  triggerAttributes
23
29
  } = useModalAttributes();
24
- const onContextMenu = useEventCallback(e => {
25
- var _a, _b;
26
30
 
31
+ const onContextMenu = e => {
27
32
  if (openOnContext) {
28
33
  e.preventDefault();
29
34
  setOpen(e, true);
30
35
  }
36
+ };
31
37
 
32
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
33
- });
34
- const onClick = useEventCallback(e => {
35
- var _a, _b;
36
-
38
+ const onClick = e => {
37
39
  if (!openOnContext) {
38
40
  setOpen(e, !open);
39
41
  }
42
+ };
40
43
 
41
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
42
- });
43
- const onKeyDown = useEventCallback(e => {
44
- var _a, _b, _c;
44
+ const onKeyDown = e => {
45
+ var _a;
45
46
 
46
47
  if (shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
47
48
  e.preventDefault();
@@ -51,38 +52,30 @@ export const usePopoverTrigger_unstable = props => {
51
52
  if (e.key === 'Escape') {
52
53
  setOpen(e, false);
53
54
  }
55
+ };
54
56
 
55
- (_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
56
- });
57
57
  const onMouseEnter = useEventCallback(e => {
58
- var _a, _b;
59
-
60
58
  if (openOnHover) {
61
59
  setOpen(e, true);
62
60
  }
63
-
64
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
65
61
  });
66
- const onMouseLeave = useEventCallback(e => {
67
- var _a, _b;
68
62
 
63
+ const onMouseLeave = e => {
69
64
  if (openOnHover) {
70
65
  setOpen(e, false);
71
66
  }
67
+ };
72
68
 
73
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
74
- });
75
- const child = React.Children.only(props.children);
76
69
  return {
77
- children: /*#__PURE__*/React.cloneElement(child, { ...triggerAttributes,
70
+ children: applyTriggerPropsToChildren(props.children, { ...triggerAttributes,
78
71
  'aria-haspopup': trapFocus ? 'dialog' : 'true',
79
- ...child.props,
80
- onClick,
81
- onMouseEnter,
82
- onKeyDown,
83
- onMouseLeave,
84
- onContextMenu,
85
- ref: useMergedRefs(child.ref, triggerRef)
72
+ ...(child === null || child === void 0 ? void 0 : child.props),
73
+ onClick: useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
74
+ onMouseEnter: useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
75
+ onKeyDown: useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onKeyDown, onKeyDown),
76
+ onMouseLeave: useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onMouseLeave, onMouseLeave),
77
+ onContextMenu: useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
78
+ ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
86
79
  })
87
80
  };
88
81
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,aAAT,EAAwB,gBAAxB,EAA0C,6BAA1C,QAA+E,2BAA/E;AACA,SAAS,kBAAT,QAAmC,yBAAnC;AACA,SAAS,0BAAT,QAA2C,sBAA3C;AAGA;;;;;;;AAOG;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAAoD;AAC5F,QAAM,OAAO,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,OAApB,CAA1C;AACA,QAAM,IAAI,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,IAApB,CAAvC;AACA,QAAM,UAAU,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,UAApB,CAA7C;AACA,QAAM,WAAW,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,WAApB,CAA9C;AACA,QAAM,aAAa,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,aAApB,CAAhD;AACA,QAAM,SAAS,GAAG,0BAA0B,CAAC,OAAO,IAAI,OAAO,CAAC,SAApB,CAA5C;AACA,QAAM;AAAE,IAAA;AAAF,MAAwB,kBAAkB,EAAhD;AAEA,QAAM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AAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,YAAf,EAA6B,YAA7B,CAPyC;AAQ9E,MAAA,aAAa,EAAE,uBAAuB,CAAC,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,aAAf,EAA8B,aAA9B,CARwC;AAS9E,MAAA,GAAG,EAAE,aAAa,CAAC,UAAD,EAAa,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAApB;AAT4D,KAA3C;AADhC,GAAP;AAaD,CA7DM","sourceRoot":""}
@@ -1,4 +1,4 @@
1
- import type { ComponentProps, ComponentState, IntrinsicSlotProps } 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: IntrinsicSlotProps<'div'>;
11
+ root: Slot<'div'>;
12
12
  };
13
13
  /**
14
14
  * PopoverSurface State
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
2
3
  import type { PopoverTriggerProps } from './PopoverTrigger.types';
3
4
  /**
4
5
  * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
5
6
  */
6
- export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
7
+ export declare const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent;
@@ -20,4 +20,5 @@ const PopoverTrigger = props => {
20
20
 
21
21
  exports.PopoverTrigger = PopoverTrigger;
22
22
  exports.PopoverTrigger.displayName = 'PopoverTrigger';
23
+ exports.PopoverTrigger.isFluentTriggerComponent = true;
23
24
  //# sourceMappingURL=PopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,cAAc,GAAkC,KAAK,IAAG;AACnE,QAAM,KAAK,GAAG,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAd;AAEA,SAAO,sBAAA,CAAA,6BAAA,CAA8B,KAA9B,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd;AAMb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAIA;;AAEG;;;AACI,MAAM,cAAc,GAA2D,KAAK,IAAG;AAC5F,QAAM,KAAK,GAAG,mBAAA,CAAA,0BAAA,CAA2B,KAA3B,CAAd;AAEA,SAAO,sBAAA,CAAA,6BAAA,CAA8B,KAA9B,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd;AAMb,OAAA,CAAA,cAAA,CAAe,WAAf,GAA6B,gBAA7B;AACA,OAAA,CAAA,cAAA,CAAe,wBAAf,GAA0C,IAA1C","sourceRoot":""}
@@ -3,9 +3,16 @@ import * as React from 'react';
3
3
  * PopoverTrigger Props
4
4
  */
5
5
  export declare type PopoverTriggerProps = {
6
- children: React.ReactElement;
6
+ children: (React.ReactElement & {
7
+ ref?: React.Ref<unknown>;
8
+ }) | ((props: PopoverTriggerChildProps) => React.ReactElement | null);
7
9
  };
8
10
  /**
9
11
  * PopoverTrigger State
10
12
  */
11
- export declare type PopoverTriggerState = PopoverTriggerProps;
13
+ export declare type PopoverTriggerState = {
14
+ children: React.ReactElement | null;
15
+ };
16
+ export declare type PopoverTriggerChildProps = {
17
+ ref?: React.Ref<never>;
18
+ } & Pick<React.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
@@ -2,4 +2,4 @@ import type { PopoverTriggerState } from './PopoverTrigger.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverTrigger
4
4
  */
5
- export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => JSX.Element;
5
+ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA4C;AACvF,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":";;;;;;AAEA;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourceRoot":""}
@@ -23,6 +23,12 @@ const popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
23
23
 
24
24
 
25
25
  const usePopoverTrigger_unstable = props => {
26
+ var _a, _b, _c, _d, _e;
27
+
28
+ const {
29
+ children
30
+ } = props;
31
+ const child = React.isValidElement(children) ? react_utilities_1.getTriggerChild(children) : undefined;
26
32
  const setOpen = popoverContext_1.usePopoverContext_unstable(context => context.setOpen);
27
33
  const open = popoverContext_1.usePopoverContext_unstable(context => context.open);
28
34
  const triggerRef = popoverContext_1.usePopoverContext_unstable(context => context.triggerRef);
@@ -32,27 +38,22 @@ const usePopoverTrigger_unstable = props => {
32
38
  const {
33
39
  triggerAttributes
34
40
  } = react_tabster_1.useModalAttributes();
35
- const onContextMenu = react_utilities_1.useEventCallback(e => {
36
- var _a, _b;
37
41
 
42
+ const onContextMenu = e => {
38
43
  if (openOnContext) {
39
44
  e.preventDefault();
40
45
  setOpen(e, true);
41
46
  }
47
+ };
42
48
 
43
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
44
- });
45
- const onClick = react_utilities_1.useEventCallback(e => {
46
- var _a, _b;
47
-
49
+ const onClick = e => {
48
50
  if (!openOnContext) {
49
51
  setOpen(e, !open);
50
52
  }
53
+ };
51
54
 
52
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
53
- });
54
- const onKeyDown = react_utilities_1.useEventCallback(e => {
55
- var _a, _b, _c;
55
+ const onKeyDown = e => {
56
+ var _a;
56
57
 
57
58
  if (react_utilities_1.shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
58
59
  e.preventDefault();
@@ -62,38 +63,30 @@ const usePopoverTrigger_unstable = props => {
62
63
  if (e.key === 'Escape') {
63
64
  setOpen(e, false);
64
65
  }
66
+ };
65
67
 
66
- (_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
67
- });
68
68
  const onMouseEnter = react_utilities_1.useEventCallback(e => {
69
- var _a, _b;
70
-
71
69
  if (openOnHover) {
72
70
  setOpen(e, true);
73
71
  }
74
-
75
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
76
72
  });
77
- const onMouseLeave = react_utilities_1.useEventCallback(e => {
78
- var _a, _b;
79
73
 
74
+ const onMouseLeave = e => {
80
75
  if (openOnHover) {
81
76
  setOpen(e, false);
82
77
  }
78
+ };
83
79
 
84
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
85
- });
86
- const child = React.Children.only(props.children);
87
80
  return {
88
- children: React.cloneElement(child, { ...triggerAttributes,
81
+ children: react_utilities_1.applyTriggerPropsToChildren(props.children, { ...triggerAttributes,
89
82
  'aria-haspopup': trapFocus ? 'dialog' : 'true',
90
- ...child.props,
91
- onClick,
92
- onMouseEnter,
93
- onKeyDown,
94
- onMouseLeave,
95
- onContextMenu,
96
- ref: react_utilities_1.useMergedRefs(child.ref, triggerRef)
83
+ ...(child === null || child === void 0 ? void 0 : child.props),
84
+ onClick: react_utilities_1.useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
85
+ onMouseEnter: react_utilities_1.useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
86
+ onKeyDown: react_utilities_1.useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onKeyDown, onKeyDown),
87
+ onMouseLeave: react_utilities_1.useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onMouseLeave, onMouseLeave),
88
+ onContextMenu: react_utilities_1.useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
89
+ ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ?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,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,YAAtC,EAAoD,YAApD,CAPgE;AAQ9E,MAAA,aAAa,EAAE,iBAAA,CAAA,uBAAA,CAAwB,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,aAAtC,EAAqD,aAArD,CAR+D;AAS9E,MAAA,GAAG,EAAE,iBAAA,CAAA,aAAA,CAAc,UAAd,EAA0B,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,GAAjC;AATyE,KAAtE;AADL,GAAP;AAaD,CA7DM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-popover",
3
- "version": "0.0.0-nightlya21bfaceec20220202.1",
3
+ "version": "0.0.0-nightlyb2b3ec1da320220209.1",
4
4
  "description": "Popover component for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -29,7 +29,7 @@
29
29
  "devDependencies": {
30
30
  "@fluentui/eslint-plugin": "*",
31
31
  "@fluentui/react-conformance": "*",
32
- "@fluentui/react-conformance-griffel": "0.0.0-nightlya21bfaceec20220202.1",
32
+ "@fluentui/react-conformance-griffel": "0.0.0-nightlyb2b3ec1da320220209.1",
33
33
  "@fluentui/scripts": "^1.0.0",
34
34
  "@types/enzyme": "3.10.3",
35
35
  "@types/enzyme-adapter-react-16": "1.0.3",
@@ -43,13 +43,13 @@
43
43
  "react-test-renderer": "^16.3.0"
44
44
  },
45
45
  "dependencies": {
46
- "@fluentui/react-context-selector": "0.0.0-nightlya21bfaceec20220202.1",
46
+ "@fluentui/react-context-selector": "0.0.0-nightlyb2b3ec1da320220209.1",
47
47
  "@griffel/react": "1.0.0",
48
- "@fluentui/react-portal": "0.0.0-nightlya21bfaceec20220202.1",
49
- "@fluentui/react-positioning": "0.0.0-nightlya21bfaceec20220202.1",
50
- "@fluentui/react-shared-contexts": "0.0.0-nightlya21bfaceec20220202.1",
51
- "@fluentui/react-tabster": "0.0.0-nightlya21bfaceec20220202.1",
52
- "@fluentui/react-utilities": "0.0.0-nightlya21bfaceec20220202.1",
48
+ "@fluentui/react-portal": "0.0.0-nightlyb2b3ec1da320220209.1",
49
+ "@fluentui/react-positioning": "0.0.0-nightlyb2b3ec1da320220209.1",
50
+ "@fluentui/react-shared-contexts": "0.0.0-nightlyb2b3ec1da320220209.1",
51
+ "@fluentui/react-tabster": "0.0.0-nightlyb2b3ec1da320220209.1",
52
+ "@fluentui/react-utilities": "0.0.0-nightlyb2b3ec1da320220209.1",
53
53
  "tslib": "^2.1.0"
54
54
  },
55
55
  "peerDependencies": {