@fluentui/react-popover 9.1.3 → 9.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +91 -1
- package/CHANGELOG.md +30 -2
- package/dist/index.d.ts +7 -1
- package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
- package/lib/components/PopoverTrigger/usePopoverTrigger.js +7 -5
- package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +7 -5
- package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,97 @@
|
|
2
2
|
"name": "@fluentui/react-popover",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "Thu,
|
5
|
+
"date": "Thu, 20 Oct 2022 08:35:16 GMT",
|
6
|
+
"tag": "@fluentui/react-popover_v9.2.1",
|
7
|
+
"version": "9.2.1",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "olfedias@microsoft.com",
|
12
|
+
"package": "@fluentui/react-popover",
|
13
|
+
"commit": "06865dada128321804646582f564ee86d835d174",
|
14
|
+
"comment": "chore: Update Griffel to latest version"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "mgodbolt@microsoft.com",
|
18
|
+
"package": "@fluentui/react-popover",
|
19
|
+
"commit": "17096b3137d9d3e7c7443ddc3ce0738b2910a334",
|
20
|
+
"comment": "chore: Bump peer deps to support React 18"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-popover",
|
25
|
+
"comment": "Bump @fluentui/react-aria to v9.2.3",
|
26
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-popover",
|
31
|
+
"comment": "Bump @fluentui/react-context-selector to v9.0.5",
|
32
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"author": "beachball",
|
36
|
+
"package": "@fluentui/react-popover",
|
37
|
+
"comment": "Bump @fluentui/react-portal to v9.0.8",
|
38
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"author": "beachball",
|
42
|
+
"package": "@fluentui/react-popover",
|
43
|
+
"comment": "Bump @fluentui/react-positioning to v9.2.2",
|
44
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"author": "beachball",
|
48
|
+
"package": "@fluentui/react-popover",
|
49
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.0.2",
|
50
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"author": "beachball",
|
54
|
+
"package": "@fluentui/react-popover",
|
55
|
+
"comment": "Bump @fluentui/react-tabster to v9.2.0",
|
56
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"author": "beachball",
|
60
|
+
"package": "@fluentui/react-popover",
|
61
|
+
"comment": "Bump @fluentui/react-theme to v9.1.1",
|
62
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"author": "beachball",
|
66
|
+
"package": "@fluentui/react-popover",
|
67
|
+
"comment": "Bump @fluentui/react-utilities to v9.1.2",
|
68
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"author": "beachball",
|
72
|
+
"package": "@fluentui/react-popover",
|
73
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16",
|
74
|
+
"commit": "be27026d83b8a019bcb945d0f42635ae76c00385"
|
75
|
+
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"date": "Thu, 13 Oct 2022 12:56:30 GMT",
|
81
|
+
"tag": "@fluentui/react-popover_v9.2.0",
|
82
|
+
"version": "9.2.0",
|
83
|
+
"comments": {
|
84
|
+
"minor": [
|
85
|
+
{
|
86
|
+
"author": "bernardo.sunderhus@gmail.com",
|
87
|
+
"package": "@fluentui/react-popover",
|
88
|
+
"commit": "e563f3daaea9b7cc62f50bc15edd44edf5045107",
|
89
|
+
"comment": "feat: adds disableButtonEnhancement property on PopoverTrigger"
|
90
|
+
}
|
91
|
+
]
|
92
|
+
}
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"date": "Thu, 13 Oct 2022 11:02:56 GMT",
|
6
96
|
"tag": "@fluentui/react-popover_v9.1.3",
|
7
97
|
"version": "9.1.3",
|
8
98
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,40 @@
|
|
1
1
|
# Change Log - @fluentui/react-popover
|
2
2
|
|
3
|
-
This log was last generated on Thu,
|
3
|
+
This log was last generated on Thu, 20 Oct 2022 08:35:16 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.2.1)
|
8
|
+
|
9
|
+
Thu, 20 Oct 2022 08:35:16 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.2.0..@fluentui/react-popover_v9.2.1)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: Update Griffel to latest version ([PR #25212](https://github.com/microsoft/fluentui/pull/25212) by olfedias@microsoft.com)
|
15
|
+
- chore: Bump peer deps to support React 18 ([PR #24972](https://github.com/microsoft/fluentui/pull/24972) by mgodbolt@microsoft.com)
|
16
|
+
- Bump @fluentui/react-aria to v9.2.3 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
17
|
+
- Bump @fluentui/react-context-selector to v9.0.5 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
18
|
+
- Bump @fluentui/react-portal to v9.0.8 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
19
|
+
- Bump @fluentui/react-positioning to v9.2.2 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
20
|
+
- Bump @fluentui/react-shared-contexts to v9.0.2 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
21
|
+
- Bump @fluentui/react-tabster to v9.2.0 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
22
|
+
- Bump @fluentui/react-theme to v9.1.1 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
23
|
+
- Bump @fluentui/react-utilities to v9.1.2 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
24
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16 ([commit](https://github.com/microsoft/fluentui/commit/be27026d83b8a019bcb945d0f42635ae76c00385) by beachball)
|
25
|
+
|
26
|
+
## [9.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.2.0)
|
27
|
+
|
28
|
+
Thu, 13 Oct 2022 12:56:30 GMT
|
29
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.1.3..@fluentui/react-popover_v9.2.0)
|
30
|
+
|
31
|
+
### Minor changes
|
32
|
+
|
33
|
+
- feat: adds disableButtonEnhancement property on PopoverTrigger ([PR #25112](https://github.com/microsoft/fluentui/pull/25112) by bernardo.sunderhus@gmail.com)
|
34
|
+
|
7
35
|
## [9.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-popover_v9.1.3)
|
8
36
|
|
9
|
-
Thu, 13 Oct 2022
|
37
|
+
Thu, 13 Oct 2022 11:02:56 GMT
|
10
38
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-popover_v9.1.2..@fluentui/react-popover_v9.1.3)
|
11
39
|
|
12
40
|
### Patches
|
package/dist/index.d.ts
CHANGED
@@ -229,7 +229,13 @@ export declare type PopoverTriggerChildProps<Type extends ARIAButtonType = ARIAB
|
|
229
229
|
/**
|
230
230
|
* PopoverTrigger Props
|
231
231
|
*/
|
232
|
-
export declare type PopoverTriggerProps = TriggerProps<PopoverTriggerChildProps
|
232
|
+
export declare type PopoverTriggerProps = TriggerProps<PopoverTriggerChildProps> & {
|
233
|
+
/**
|
234
|
+
* Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.
|
235
|
+
* @default false
|
236
|
+
*/
|
237
|
+
disableButtonEnhancement?: boolean;
|
238
|
+
};
|
233
239
|
|
234
240
|
/**
|
235
241
|
* PopoverTrigger State
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\n/**\n * PopoverTrigger Props\n */\nexport type PopoverTriggerProps = TriggerProps<PopoverTriggerChildProps
|
1
|
+
{"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ARIAButtonResultProps, ARIAButtonType } from '@fluentui/react-aria';\nimport type { TriggerProps } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\n/**\n * PopoverTrigger Props\n */\nexport type PopoverTriggerProps = TriggerProps<PopoverTriggerChildProps> & {\n /**\n * Disables internal trigger mechanism that ensures a child provided will be a compliant ARIA button.\n * @default false\n */\n disableButtonEnhancement?: boolean;\n};\n\n/**\n * PopoverTrigger State\n */\nexport type PopoverTriggerState = {\n children: React.ReactElement | null;\n};\n\n/**\n * Props that are passed to the child of the DialogTrigger when cloned to ensure correct behaviour for the Dialog\n */\nexport type PopoverTriggerChildProps<Type extends ARIAButtonType = ARIAButtonType, Props = {}> = ARIAButtonResultProps<\n Type,\n Props & {\n 'aria-expanded'?: 'true' | 'false';\n ref: React.Ref<unknown>;\n onMouseEnter: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onMouseLeave: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n onContextMenu: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement & HTMLDivElement>;\n }\n>;\n"]}
|
@@ -14,7 +14,8 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
14
14
|
|
15
15
|
export const usePopoverTrigger_unstable = props => {
|
16
16
|
const {
|
17
|
-
children
|
17
|
+
children,
|
18
|
+
disableButtonEnhancement = false
|
18
19
|
} = props;
|
19
20
|
const child = getTriggerChild(children);
|
20
21
|
const open = usePopoverContext_unstable(context => context.open);
|
@@ -61,7 +62,7 @@ export const usePopoverTrigger_unstable = props => {
|
|
61
62
|
}
|
62
63
|
};
|
63
64
|
|
64
|
-
const
|
65
|
+
const contextMenuProps = { ...triggerAttributes,
|
65
66
|
'aria-expanded': `${open}`,
|
66
67
|
...(child === null || child === void 0 ? void 0 : child.props),
|
67
68
|
onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),
|
@@ -69,12 +70,13 @@ export const usePopoverTrigger_unstable = props => {
|
|
69
70
|
onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),
|
70
71
|
ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
|
71
72
|
};
|
72
|
-
const
|
73
|
+
const triggerChildProps = { ...contextMenuProps,
|
73
74
|
onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
|
74
75
|
onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
|
75
|
-
}
|
76
|
+
};
|
77
|
+
const ariaButtonTriggerChildProps = useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);
|
76
78
|
return {
|
77
|
-
children: applyTriggerPropsToChildren(props.children, useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ?
|
79
|
+
children: applyTriggerPropsToChildren(props.children, useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))
|
78
80
|
};
|
79
81
|
};
|
80
82
|
//# sourceMappingURL=usePopoverTrigger.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":"AACA,SACE,2BADF,EAEE,eAFF,EAGE,cAHF,EAIE,aAJF,EAKE,gBALF,QAMO,2BANP;AAOA,SAAS,kBAAT,QAAmC,yBAAnC;AACA,SAAS,0BAAT,QAA2C,sBAA3C;AAEA,SAAS,kBAAT,QAAmC,sBAAnC;AACA,SAAS,MAAT,QAAuB,yBAAvB;AAEA;;;;;;;AAOG;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAAoD;EAC5F,MAAM;IAAE;
|
1
|
+
{"version":3,"sources":["packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverT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n applyTriggerPropsToChildren,\n getTriggerChild,\n mergeCallbacks,\n useMergedRefs,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = (props: PopoverTriggerProps): PopoverTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n\n const open = usePopoverContext_unstable(context => context.open);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const toggleOpen = usePopoverContext_unstable(context => context.toggleOpen);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === Escape && open) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Menu\n e.stopPropagation();\n }\n };\n\n const onMouseEnter = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n };\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n\n const contextMenuProps = {\n ...triggerAttributes,\n 'aria-expanded': `${open}`,\n ...child?.props,\n onMouseEnter: useEventCallback(mergeCallbacks(child?.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child?.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child?.props.onContextMenu, onContextMenu)),\n ref: useMergedRefs(triggerRef, child?.ref),\n } as const;\n\n const triggerChildProps = {\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child?.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child?.props.onKeyDown, onKeyDown)),\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n triggerChildProps,\n );\n\n return {\n children: applyTriggerPropsToChildren(\n props.children,\n useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n ),\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -26,7 +26,8 @@ const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
|
26
26
|
|
27
27
|
const usePopoverTrigger_unstable = props => {
|
28
28
|
const {
|
29
|
-
children
|
29
|
+
children,
|
30
|
+
disableButtonEnhancement = false
|
30
31
|
} = props;
|
31
32
|
const child = react_utilities_1.getTriggerChild(children);
|
32
33
|
const open = popoverContext_1.usePopoverContext_unstable(context => context.open);
|
@@ -73,7 +74,7 @@ const usePopoverTrigger_unstable = props => {
|
|
73
74
|
}
|
74
75
|
};
|
75
76
|
|
76
|
-
const
|
77
|
+
const contextMenuProps = { ...triggerAttributes,
|
77
78
|
'aria-expanded': `${open}`,
|
78
79
|
...(child === null || child === void 0 ? void 0 : child.props),
|
79
80
|
onMouseEnter: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),
|
@@ -81,12 +82,13 @@ const usePopoverTrigger_unstable = props => {
|
|
81
82
|
onContextMenu: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),
|
82
83
|
ref: react_utilities_1.useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
|
83
84
|
};
|
84
|
-
const
|
85
|
+
const triggerChildProps = { ...contextMenuProps,
|
85
86
|
onClick: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
|
86
87
|
onKeyDown: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
|
87
|
-
}
|
88
|
+
};
|
89
|
+
const ariaButtonTriggerChildProps = react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', triggerChildProps);
|
88
90
|
return {
|
89
|
-
children: react_utilities_1.applyTriggerPropsToChildren(props.children, react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ?
|
91
|
+
children: react_utilities_1.applyTriggerPropsToChildren(props.children, react_aria_1.useARIAButtonProps((child === null || child === void 0 ? void 0 : child.type) === 'button' || (child === null || child === void 0 ? void 0 : child.type) === 'a' ? child.type : 'div', openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps))
|
90
92
|
};
|
91
93
|
};
|
92
94
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAOA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,gB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KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,GAA5C,GAAkD,KAAK,CAAC,IAAxD,GAA+D,KAD7B,EAElC,iBAFkC,CAApC;EAKA,OAAO;IACL,QAAQ,EAAE,iBAAA,CAAA,2BAAA,CACR,KAAK,CAAC,QADE,EAER,YAAA,CAAA,kBAAA,CACE,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,QAAhB,IAA4B,CAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,IAAP,MAAgB,GAA5C,GAAkD,KAAK,CAAC,IAAxD,GAA+D,KADjE,EAEE,aAAa,GAAG,gBAAH,GAAsB,wBAAwB,GAAG,iBAAH,GAAuB,2BAFpF,CAFQ;EADL,CAAP;AASD,CA5EM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n mergeCallbacks,\n useMergedRefs,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = (props: PopoverTriggerProps): PopoverTriggerState => {\n const { children, disableButtonEnhancement = false } = props;\n const child = getTriggerChild(children);\n\n const open = usePopoverContext_unstable(context => context.open);\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const toggleOpen = usePopoverContext_unstable(context => context.toggleOpen);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n toggleOpen(e);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === Escape && open) {\n setOpen(e, false);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Menu\n e.stopPropagation();\n }\n };\n\n const onMouseEnter = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n };\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n\n const contextMenuProps = {\n ...triggerAttributes,\n 'aria-expanded': `${open}`,\n ...child?.props,\n onMouseEnter: useEventCallback(mergeCallbacks(child?.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child?.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child?.props.onContextMenu, onContextMenu)),\n ref: useMergedRefs(triggerRef, child?.ref),\n } as const;\n\n const triggerChildProps = {\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child?.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child?.props.onKeyDown, onKeyDown)),\n };\n\n const ariaButtonTriggerChildProps = useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n triggerChildProps,\n );\n\n return {\n children: applyTriggerPropsToChildren(\n props.children,\n useARIAButtonProps(\n child?.type === 'button' || child?.type === 'a' ? child.type : 'div',\n openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps,\n ),\n ),\n };\n};\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-popover",
|
3
|
-
"version": "9.1
|
3
|
+
"version": "9.2.1",
|
4
4
|
"description": "Popover component for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -29,27 +29,27 @@
|
|
29
29
|
"devDependencies": {
|
30
30
|
"@fluentui/eslint-plugin": "*",
|
31
31
|
"@fluentui/react-conformance": "*",
|
32
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
32
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.16",
|
33
33
|
"@fluentui/scripts": "^1.0.0"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
36
|
"@fluentui/keyboard-keys": "^9.0.0",
|
37
|
-
"@fluentui/react-aria": "^9.2.
|
38
|
-
"@fluentui/react-context-selector": "^9.0.
|
39
|
-
"@fluentui/react-portal": "^9.0.
|
40
|
-
"@fluentui/react-positioning": "^9.2.
|
41
|
-
"@fluentui/react-shared-contexts": "^9.0.
|
42
|
-
"@fluentui/react-tabster": "^9.
|
43
|
-
"@fluentui/react-theme": "^9.1.
|
44
|
-
"@fluentui/react-utilities": "^9.1.
|
45
|
-
"@griffel/react": "^1.4.
|
37
|
+
"@fluentui/react-aria": "^9.2.3",
|
38
|
+
"@fluentui/react-context-selector": "^9.0.5",
|
39
|
+
"@fluentui/react-portal": "^9.0.8",
|
40
|
+
"@fluentui/react-positioning": "^9.2.2",
|
41
|
+
"@fluentui/react-shared-contexts": "^9.0.2",
|
42
|
+
"@fluentui/react-tabster": "^9.2.0",
|
43
|
+
"@fluentui/react-theme": "^9.1.1",
|
44
|
+
"@fluentui/react-utilities": "^9.1.2",
|
45
|
+
"@griffel/react": "^1.4.1",
|
46
46
|
"tslib": "^2.1.0"
|
47
47
|
},
|
48
48
|
"peerDependencies": {
|
49
|
-
"@types/react": ">=16.8.0 <
|
50
|
-
"@types/react-dom": ">=16.8.0 <
|
51
|
-
"react": ">=16.8.0 <
|
52
|
-
"react-dom": ">=16.8.0 <
|
49
|
+
"@types/react": ">=16.8.0 <19.0.0",
|
50
|
+
"@types/react-dom": ">=16.8.0 <19.0.0",
|
51
|
+
"react": ">=16.8.0 <19.0.0",
|
52
|
+
"react-dom": ">=16.8.0 <19.0.0",
|
53
53
|
"scheduler": "^0.19.0 || ^0.20.0"
|
54
54
|
},
|
55
55
|
"beachball": {
|