@fluentui/react-menu 9.11.0 → 9.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -2
- package/dist/index.d.ts +4 -0
- package/lib/components/Menu/useMenu.js +2 -22
- package/lib/components/Menu/useMenu.js.map +1 -1
- package/lib/components/MenuItem/useMenuItemStyles.styles.js +2 -1
- package/lib/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
- package/lib/components/MenuList/MenuList.types.js.map +1 -1
- package/lib/components/MenuList/useMenuList.js +1 -0
- package/lib/components/MenuList/useMenuList.js.map +1 -1
- package/lib/components/MenuList/useMenuListStyles.styles.js +5 -2
- package/lib/components/MenuList/useMenuListStyles.styles.js.map +1 -1
- package/lib/components/MenuPopover/useMenuPopover.js +8 -0
- package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js +1 -1
- package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib/components/MenuTrigger/index.js +1 -1
- package/lib/components/MenuTrigger/index.js.map +1 -1
- package/lib/components/MenuTrigger/useMenuTrigger.js +164 -0
- package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -0
- package/lib-commonjs/components/Menu/useMenu.js +1 -20
- package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js +2 -0
- package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuList.js +1 -0
- package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
- package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js +6 -2
- package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js.map +1 -1
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js +8 -0
- package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +2 -2
- package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/index.js +1 -1
- package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
- package/lib-commonjs/components/MenuTrigger/{useMenuTrigger.styles.js → useMenuTrigger.js} +3 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -0
- package/package.json +5 -5
- package/lib/components/MenuTrigger/useMenuTrigger.styles.js +0 -168
- package/lib/components/MenuTrigger/useMenuTrigger.styles.js.map +0 -1
- package/lib-commonjs/components/MenuTrigger/useMenuTrigger.styles.js.map +0 -1
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "MenuTrigger", {
|
|
8
8
|
});
|
9
9
|
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
10
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
-
const
|
11
|
+
const _useMenuTrigger = require("./useMenuTrigger");
|
12
12
|
const _renderMenuTrigger = require("./renderMenuTrigger");
|
13
13
|
const MenuTrigger = (props)=>{
|
14
|
-
const state = (0,
|
14
|
+
const state = (0, _useMenuTrigger.useMenuTrigger_unstable)(props);
|
15
15
|
return (0, _renderMenuTrigger.renderMenuTrigger_unstable)(state);
|
16
16
|
};
|
17
17
|
MenuTrigger.displayName = 'MenuTrigger';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["MenuTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuTrigger_unstable } from './useMenuTrigger
|
1
|
+
{"version":3,"sources":["MenuTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuTrigger_unstable } from './useMenuTrigger';\nimport { renderMenuTrigger_unstable } from './renderMenuTrigger';\n/**\n * Wraps a trigger element as an only child\n * and adds the necessary event handling to open a popup menu\n */ export const MenuTrigger = (props)=>{\n const state = useMenuTrigger_unstable(props);\n return renderMenuTrigger_unstable(state);\n};\nMenuTrigger.displayName = 'MenuTrigger';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\nMenuTrigger.isFluentTriggerComponent = true;\n"],"names":["MenuTrigger","props","state","useMenuTrigger_unstable","renderMenuTrigger_unstable","displayName","isFluentTriggerComponent"],"mappings":";;;;+BAMiBA;;aAAAA;;;6DANM;gCACiB;mCACG;AAIhC,MAAMA,cAAc,CAACC,QAAQ;IACpC,MAAMC,QAAQC,IAAAA,uCAAuB,EAACF;IACtC,OAAOG,IAAAA,6CAA0B,EAACF;AACtC;AACAF,YAAYK,WAAW,GAAG;AAC1B,6FAA6F;AAC7FL,YAAYM,wBAAwB,GAAG,IAAI"}
|
@@ -6,4 +6,4 @@ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
|
|
6
6
|
_exportStar(require("./MenuTrigger"), exports);
|
7
7
|
_exportStar(require("./MenuTrigger.types"), exports);
|
8
8
|
_exportStar(require("./renderMenuTrigger"), exports);
|
9
|
-
_exportStar(require("./useMenuTrigger
|
9
|
+
_exportStar(require("./useMenuTrigger"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './MenuTrigger';\nexport * from './MenuTrigger.types';\nexport * from './renderMenuTrigger';\nexport * from './useMenuTrigger
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './MenuTrigger';\nexport * from './MenuTrigger.types';\nexport * from './renderMenuTrigger';\nexport * from './useMenuTrigger';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA"}
|
@@ -24,6 +24,7 @@ const useMenuTrigger_unstable = (props)=>{
|
|
24
24
|
const triggerId = (0, _menuContext.useMenuContext_unstable)((context)=>context.triggerId);
|
25
25
|
const openOnHover = (0, _menuContext.useMenuContext_unstable)((context)=>context.openOnHover);
|
26
26
|
const openOnContext = (0, _menuContext.useMenuContext_unstable)((context)=>context.openOnContext);
|
27
|
+
const restoreFocusTargetAttribute = (0, _reactTabster.useRestoreFocusTarget)();
|
27
28
|
const isSubmenu = (0, _useIsSubmenu.useIsSubmenu)();
|
28
29
|
const { findFirstFocusable } = (0, _reactTabster.useFocusFinders)();
|
29
30
|
const focusFirst = _react.useCallback(()=>{
|
@@ -147,6 +148,7 @@ const useMenuTrigger_unstable = (props)=>{
|
|
147
148
|
const triggerChildProps = {
|
148
149
|
'aria-haspopup': 'menu',
|
149
150
|
'aria-expanded': !open && !isSubmenu ? undefined : open,
|
151
|
+
...restoreFocusTargetAttribute,
|
150
152
|
...contextMenuProps,
|
151
153
|
onClick: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
|
152
154
|
onKeyDown: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
|
@@ -163,4 +165,4 @@ const isTargetDisabled = (event)=>{
|
|
163
165
|
return true;
|
164
166
|
}
|
165
167
|
return (0, _reactUtilities.isHTMLElement)(event.currentTarget) && isDisabled(event.currentTarget);
|
166
|
-
};
|
168
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["useMenuTrigger.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders, useRestoreFocusTarget } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport { applyTriggerPropsToChildren, getTriggerChild, isHTMLElement, mergeCallbacks, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */ export const useMenuTrigger_unstable = (props)=>{\n const { children , disableButtonEnhancement =false } = props;\n const triggerRef = useMenuContext_unstable((context)=>context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable((context)=>context.menuPopoverRef);\n const setOpen = useMenuContext_unstable((context)=>context.setOpen);\n const open = useMenuContext_unstable((context)=>context.open);\n const triggerId = useMenuContext_unstable((context)=>context.triggerId);\n const openOnHover = useMenuContext_unstable((context)=>context.openOnHover);\n const openOnContext = useMenuContext_unstable((context)=>context.openOnContext);\n const restoreFocusTargetAttribute = useRestoreFocusTarget();\n const isSubmenu = useIsSubmenu();\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(()=>{\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }, [\n findFirstFocusable,\n menuPopoverRef\n ]);\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n const { dir } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n const child = getTriggerChild(children);\n const onContextMenu = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnContext) {\n event.preventDefault();\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerContextMenu',\n event\n });\n }\n };\n const onClick = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (!openOnContext) {\n setOpen(event, {\n open: !open,\n keyboard: openedWithKeyboardRef.current,\n type: 'menuTriggerClick',\n event\n });\n openedWithKeyboardRef.current = false;\n }\n };\n const onKeyDown = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n const key = event.key;\n if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {\n setOpen(event, {\n open: true,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n if (key === Escape && !isSubmenu) {\n setOpen(event, {\n open: false,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n const onMouseEnter = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseEnter',\n event\n });\n }\n };\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseMove',\n event\n });\n hasMouseMoved.current = true;\n }\n };\n const onMouseLeave = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover) {\n setOpen(event, {\n open: false,\n keyboard: false,\n type: 'menuTriggerMouseLeave',\n event\n });\n }\n };\n const contextMenuProps = {\n id: triggerId,\n ...child === null || child === void 0 ? void 0 : child.props,\n ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref),\n onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),\n onMouseMove: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseMove, onMouseMove))\n };\n const triggerChildProps = {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n ...restoreFocusTargetAttribute,\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))\n };\n 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);\n return {\n isSubmenu,\n children: applyTriggerPropsToChildren(children, openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\nconst isTargetDisabled = (event)=>{\n const isDisabled = (el)=>el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';\n if (isHTMLElement(event.target) && isDisabled(event.target)) {\n return true;\n }\n return isHTMLElement(event.currentTarget) && isDisabled(event.currentTarget);\n};\n"],"names":["useMenuTrigger_unstable","props","children","disableButtonEnhancement","triggerRef","useMenuContext_unstable","context","menuPopoverRef","setOpen","open","triggerId","openOnHover","openOnContext","restoreFocusTargetAttribute","useRestoreFocusTarget","isSubmenu","useIsSubmenu","findFirstFocusable","useFocusFinders","focusFirst","React","useCallback","firstFocusable","current","focus","openedWithKeyboardRef","useRef","hasMouseMoved","dir","useFluent","OpenArrowKey","ArrowRight","ArrowLeft","child","getTriggerChild","onContextMenu","event","isTargetDisabled","preventDefault","keyboard","type","onClick","onKeyDown","key","ArrowDown","Escape","onMouseEnter","onMouseMove","onMouseLeave","contextMenuProps","id","ref","useMergedRefs","useEventCallback","mergeCallbacks","triggerChildProps","undefined","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToChildren","isDisabled","el","hasAttribute","getAttribute","isHTMLElement","target","currentTarget"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;6BACiB;8BACX;8BAC0B;qCACP;8BACS;gCACoE;2BAC1F;AAMxB,MAAMA,0BAA0B,CAACC,QAAQ;IAChD,MAAM,EAAEC,SAAQ,EAAGC,0BAA0B,KAAK,CAAA,EAAG,GAAGF;IACxD,MAAMG,aAAaC,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,QAAQF,UAAU;IACxE,MAAMG,iBAAiBF,IAAAA,oCAAuB,EAAC,CAACC,UAAUA,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AAgB;QACnBR,SAASY,IAAAA,gCAAgB,EAACC,IAAAA,8BAAc,EAACrB,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMhC,KAAK,CAACwC,OAAO,EAAEA;QAC5GC,WAAWW,IAAAA,gCAAgB,EAACC,IAAAA,8BAAc,EAACrB,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMhC,KAAK,CAACyC,SAAS,EAAEA;IACpH;IACA,MAAMe,8BAA8BC,IAAAA,6BAAkB,EAAC,AAACzB,CAAAA,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMO,IAAI,AAAD,MAAO,YAAY,AAACP,CAAAA,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMO,IAAI,AAAD,MAAO,MAAMP,MAAMO,IAAI,GAAG,KAAK,EAAEe;IAC3N,OAAO;QACHxC;QACAb,UAAUyD,IAAAA,2CAA2B,EAACzD,UAAUU,gBAAgBqC,mBAAmB9C,2BAA2BoD,oBAAoBE,2BAA2B;IACjK;AACJ;AACA,MAAMpB,mBAAmB,CAACD,QAAQ;IAC9B,MAAMwB,aAAa,CAACC,KAAKA,GAAGC,YAAY,CAAC,eAAeD,GAAGC,YAAY,CAAC,oBAAoBD,GAAGE,YAAY,CAAC,qBAAqB;IACjI,IAAIC,IAAAA,6BAAa,EAAC5B,MAAM6B,MAAM,KAAKL,WAAWxB,MAAM6B,MAAM,GAAG;QACzD,OAAO,IAAI;IACf,CAAC;IACD,OAAOD,IAAAA,6BAAa,EAAC5B,MAAM8B,aAAa,KAAKN,WAAWxB,MAAM8B,aAAa;AAC/E"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-menu",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.12.0",
|
4
4
|
"description": "Fluent UI menu component",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -39,11 +39,11 @@
|
|
39
39
|
"@fluentui/keyboard-keys": "^9.0.3",
|
40
40
|
"@fluentui/react-aria": "^9.3.27",
|
41
41
|
"@fluentui/react-context-selector": "^9.1.26",
|
42
|
-
"@fluentui/react-icons": "^2.0.
|
43
|
-
"@fluentui/react-portal": "^9.3.
|
44
|
-
"@fluentui/react-positioning": "^9.
|
42
|
+
"@fluentui/react-icons": "^2.0.207",
|
43
|
+
"@fluentui/react-portal": "^9.3.3",
|
44
|
+
"@fluentui/react-positioning": "^9.9.0",
|
45
45
|
"@fluentui/react-shared-contexts": "^9.6.0",
|
46
|
-
"@fluentui/react-tabster": "^9.
|
46
|
+
"@fluentui/react-tabster": "^9.11.0",
|
47
47
|
"@fluentui/react-theme": "^9.1.9",
|
48
48
|
"@fluentui/react-utilities": "^9.10.1",
|
49
49
|
"@fluentui/react-jsx-runtime": "9.0.0-alpha.12",
|
@@ -1,168 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { useMenuContext_unstable } from '../../contexts/menuContext';
|
3
|
-
import { useIsSubmenu } from '../../utils/useIsSubmenu';
|
4
|
-
import { useFocusFinders } from '@fluentui/react-tabster';
|
5
|
-
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
6
|
-
import { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';
|
7
|
-
import { applyTriggerPropsToChildren, getTriggerChild, isHTMLElement, mergeCallbacks, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
8
|
-
import { useARIAButtonProps } from '@fluentui/react-aria';
|
9
|
-
/**
|
10
|
-
* Create the state required to render MenuTrigger.
|
11
|
-
* Clones the only child component and adds necessary event handling behaviours to open a popup menu
|
12
|
-
*
|
13
|
-
* @param props - props from this instance of MenuTrigger
|
14
|
-
*/
|
15
|
-
export const useMenuTrigger_unstable = props => {
|
16
|
-
const {
|
17
|
-
children,
|
18
|
-
disableButtonEnhancement = false
|
19
|
-
} = props;
|
20
|
-
const triggerRef = useMenuContext_unstable(context => context.triggerRef);
|
21
|
-
const menuPopoverRef = useMenuContext_unstable(context => context.menuPopoverRef);
|
22
|
-
const setOpen = useMenuContext_unstable(context => context.setOpen);
|
23
|
-
const open = useMenuContext_unstable(context => context.open);
|
24
|
-
const triggerId = useMenuContext_unstable(context => context.triggerId);
|
25
|
-
const openOnHover = useMenuContext_unstable(context => context.openOnHover);
|
26
|
-
const openOnContext = useMenuContext_unstable(context => context.openOnContext);
|
27
|
-
const isSubmenu = useIsSubmenu();
|
28
|
-
const {
|
29
|
-
findFirstFocusable
|
30
|
-
} = useFocusFinders();
|
31
|
-
const focusFirst = React.useCallback(() => {
|
32
|
-
const firstFocusable = findFirstFocusable(menuPopoverRef.current);
|
33
|
-
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
34
|
-
}, [findFirstFocusable, menuPopoverRef]);
|
35
|
-
const openedWithKeyboardRef = React.useRef(false);
|
36
|
-
const hasMouseMoved = React.useRef(false);
|
37
|
-
const {
|
38
|
-
dir
|
39
|
-
} = useFluent();
|
40
|
-
const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;
|
41
|
-
const child = getTriggerChild(children);
|
42
|
-
const onContextMenu = event => {
|
43
|
-
if (isTargetDisabled(event)) {
|
44
|
-
return;
|
45
|
-
}
|
46
|
-
if (openOnContext) {
|
47
|
-
event.preventDefault();
|
48
|
-
setOpen(event, {
|
49
|
-
open: true,
|
50
|
-
keyboard: false,
|
51
|
-
type: 'menuTriggerContextMenu',
|
52
|
-
event
|
53
|
-
});
|
54
|
-
}
|
55
|
-
};
|
56
|
-
const onClick = event => {
|
57
|
-
if (isTargetDisabled(event)) {
|
58
|
-
return;
|
59
|
-
}
|
60
|
-
if (!openOnContext) {
|
61
|
-
setOpen(event, {
|
62
|
-
open: !open,
|
63
|
-
keyboard: openedWithKeyboardRef.current,
|
64
|
-
type: 'menuTriggerClick',
|
65
|
-
event
|
66
|
-
});
|
67
|
-
openedWithKeyboardRef.current = false;
|
68
|
-
}
|
69
|
-
};
|
70
|
-
const onKeyDown = event => {
|
71
|
-
if (isTargetDisabled(event)) {
|
72
|
-
return;
|
73
|
-
}
|
74
|
-
const key = event.key;
|
75
|
-
if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {
|
76
|
-
setOpen(event, {
|
77
|
-
open: true,
|
78
|
-
keyboard: true,
|
79
|
-
type: 'menuTriggerKeyDown',
|
80
|
-
event
|
81
|
-
});
|
82
|
-
}
|
83
|
-
if (key === Escape && !isSubmenu) {
|
84
|
-
setOpen(event, {
|
85
|
-
open: false,
|
86
|
-
keyboard: true,
|
87
|
-
type: 'menuTriggerKeyDown',
|
88
|
-
event
|
89
|
-
});
|
90
|
-
}
|
91
|
-
// if menu is already open, can't rely on effects to focus
|
92
|
-
if (open && key === OpenArrowKey && isSubmenu) {
|
93
|
-
focusFirst();
|
94
|
-
}
|
95
|
-
};
|
96
|
-
const onMouseEnter = event => {
|
97
|
-
if (isTargetDisabled(event)) {
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
if (openOnHover && hasMouseMoved.current) {
|
101
|
-
setOpen(event, {
|
102
|
-
open: true,
|
103
|
-
keyboard: false,
|
104
|
-
type: 'menuTriggerMouseEnter',
|
105
|
-
event
|
106
|
-
});
|
107
|
-
}
|
108
|
-
};
|
109
|
-
// Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience
|
110
|
-
// First time open the mouse using mousemove and then continue with mouseenter
|
111
|
-
// Only use once to determine that the user is using the mouse since it is an expensive event to handle
|
112
|
-
const onMouseMove = event => {
|
113
|
-
if (isTargetDisabled(event)) {
|
114
|
-
return;
|
115
|
-
}
|
116
|
-
if (openOnHover && !hasMouseMoved.current) {
|
117
|
-
setOpen(event, {
|
118
|
-
open: true,
|
119
|
-
keyboard: false,
|
120
|
-
type: 'menuTriggerMouseMove',
|
121
|
-
event
|
122
|
-
});
|
123
|
-
hasMouseMoved.current = true;
|
124
|
-
}
|
125
|
-
};
|
126
|
-
const onMouseLeave = event => {
|
127
|
-
if (isTargetDisabled(event)) {
|
128
|
-
return;
|
129
|
-
}
|
130
|
-
if (openOnHover) {
|
131
|
-
setOpen(event, {
|
132
|
-
open: false,
|
133
|
-
keyboard: false,
|
134
|
-
type: 'menuTriggerMouseLeave',
|
135
|
-
event
|
136
|
-
});
|
137
|
-
}
|
138
|
-
};
|
139
|
-
const contextMenuProps = {
|
140
|
-
id: triggerId,
|
141
|
-
...(child === null || child === void 0 ? void 0 : child.props),
|
142
|
-
ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref),
|
143
|
-
onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),
|
144
|
-
onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),
|
145
|
-
onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),
|
146
|
-
onMouseMove: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseMove, onMouseMove))
|
147
|
-
};
|
148
|
-
const triggerChildProps = {
|
149
|
-
'aria-haspopup': 'menu',
|
150
|
-
'aria-expanded': !open && !isSubmenu ? undefined : open,
|
151
|
-
...contextMenuProps,
|
152
|
-
onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),
|
153
|
-
onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))
|
154
|
-
};
|
155
|
-
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);
|
156
|
-
return {
|
157
|
-
isSubmenu,
|
158
|
-
children: applyTriggerPropsToChildren(children, openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)
|
159
|
-
};
|
160
|
-
};
|
161
|
-
const isTargetDisabled = event => {
|
162
|
-
const isDisabled = el => el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';
|
163
|
-
if (isHTMLElement(event.target) && isDisabled(event.target)) {
|
164
|
-
return true;
|
165
|
-
}
|
166
|
-
return isHTMLElement(event.currentTarget) && isDisabled(event.currentTarget);
|
167
|
-
};
|
168
|
-
//# sourceMappingURL=useMenuTrigger.styles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","useMenuContext_unstable","useIsSubmenu","useFocusFinders","useFluent_unstable","useFluent","ArrowRight","ArrowLeft","Escape","ArrowDown","applyTriggerPropsToChildren","getTriggerChild","isHTMLElement","mergeCallbacks","useEventCallback","useMergedRefs","useARIAButtonProps","useMenuTrigger_unstable","props","children","disableButtonEnhancement","triggerRef","context","menuPopoverRef","setOpen","open","triggerId","openOnHover","openOnContext","isSubmenu","findFirstFocusable","focusFirst","useCallback","firstFocusable","current","focus","openedWithKeyboardRef","useRef","hasMouseMoved","dir","OpenArrowKey","child","onContextMenu","event","isTargetDisabled","preventDefault","keyboard","type","onClick","onKeyDown","key","onMouseEnter","onMouseMove","onMouseLeave","contextMenuProps","id","ref","triggerChildProps","undefined","ariaButtonTriggerChildProps","isDisabled","el","hasAttribute","getAttribute","target","currentTarget"],"sources":["useMenuTrigger.styles.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport { applyTriggerPropsToChildren, getTriggerChild, isHTMLElement, mergeCallbacks, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */ export const useMenuTrigger_unstable = (props)=>{\n const { children , disableButtonEnhancement =false } = props;\n const triggerRef = useMenuContext_unstable((context)=>context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable((context)=>context.menuPopoverRef);\n const setOpen = useMenuContext_unstable((context)=>context.setOpen);\n const open = useMenuContext_unstable((context)=>context.open);\n const triggerId = useMenuContext_unstable((context)=>context.triggerId);\n const openOnHover = useMenuContext_unstable((context)=>context.openOnHover);\n const openOnContext = useMenuContext_unstable((context)=>context.openOnContext);\n const isSubmenu = useIsSubmenu();\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(()=>{\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }, [\n findFirstFocusable,\n menuPopoverRef\n ]);\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n const { dir } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n const child = getTriggerChild(children);\n const onContextMenu = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnContext) {\n event.preventDefault();\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerContextMenu',\n event\n });\n }\n };\n const onClick = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (!openOnContext) {\n setOpen(event, {\n open: !open,\n keyboard: openedWithKeyboardRef.current,\n type: 'menuTriggerClick',\n event\n });\n openedWithKeyboardRef.current = false;\n }\n };\n const onKeyDown = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n const key = event.key;\n if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {\n setOpen(event, {\n open: true,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n if (key === Escape && !isSubmenu) {\n setOpen(event, {\n open: false,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n const onMouseEnter = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseEnter',\n event\n });\n }\n };\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseMove',\n event\n });\n hasMouseMoved.current = true;\n }\n };\n const onMouseLeave = (event)=>{\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover) {\n setOpen(event, {\n open: false,\n keyboard: false,\n type: 'menuTriggerMouseLeave',\n event\n });\n }\n };\n const contextMenuProps = {\n id: triggerId,\n ...child === null || child === void 0 ? void 0 : child.props,\n ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref),\n onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),\n onMouseMove: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseMove, onMouseMove))\n };\n const triggerChildProps = {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))\n };\n 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);\n return {\n isSubmenu,\n children: applyTriggerPropsToChildren(children, openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\nconst isTargetDisabled = (event)=>{\n const isDisabled = (el)=>el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';\n if (isHTMLElement(event.target) && isDisabled(event.target)) {\n return true;\n }\n return isHTMLElement(event.currentTarget) && isDisabled(event.currentTarget);\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,uBAAuB,QAAQ,4BAA4B;AACpE,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,kBAAkB,IAAIC,SAAS,QAAQ,iCAAiC;AACjF,SAASC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,SAAS,QAAQ,yBAAyB;AAClF,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,aAAa,EAAEC,cAAc,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,2BAA2B;AACxJ,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD;AACA;AACA;AACA;AACA;AACA;AAAI,OAAO,MAAMC,uBAAuB,GAAIC,KAAK,IAAG;EAChD,MAAM;IAAEC,QAAQ;IAAGC,wBAAwB,GAAE;EAAO,CAAC,GAAGF,KAAK;EAC7D,MAAMG,UAAU,GAAGpB,uBAAuB,CAAEqB,OAAO,IAAGA,OAAO,CAACD,UAAU,CAAC;EACzE,MAAME,cAAc,GAAGt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D,cAAc,CAAC4B,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,KAAK,CAACvB,KAAK,CAAC+B,SAAS,EAAEA,SAAS,CAAC;EAC9H,CAAC;EACD,MAAMU,2BAA2B,GAAG3C,kBAAkB,CAAC,CAACyB,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,KAAK,CAACM,IAAI,MAAM,QAAQ,IAAI,CAACN,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,KAAK,CAACM,IAAI,MAAM,GAAG,GAAGN,KAAK,CAACM,IAAI,GAAG,KAAK,EAAEU,iBAAiB,CAAC;EAC7O,OAAO;IACH5B,SAAS;IACTV,QAAQ,EAAET,2BAA2B,CAACS,QAAQ,EAAES,aAAa,GAAG0B,gBAAgB,GAAGlC,wBAAwB,GAAGqC,iBAAiB,GAAGE,2BAA2B;EACjK,CAAC;AACL,CAAC;AACD,MAAMf,gBAAgB,GAAID,KAAK,IAAG;EAC9B,MAAMiB,UAAU,GAAIC,EAAE,IAAGA,EAAE,CAACC,YAAY,CAAC,UAAU,CAAC,IAAID,EAAE,CAACC,YAAY,CAAC,eAAe,CAAC,IAAID,EAAE,CAACE,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM;EACvI,IAAInD,aAAa,CAAC+B,KAAK,CAACqB,MAAM,CAAC,IAAIJ,UAAU,CAACjB,KAAK,CAACqB,MAAM,CAAC,EAAE;IACzD,OAAO,IAAI;EACf;EACA,OAAOpD,aAAa,CAAC+B,KAAK,CAACsB,aAAa,CAAC,IAAIL,UAAU,CAACjB,KAAK,CAACsB,aAAa,CAAC;AAChF,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["useMenuTrigger.styles.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport { applyTriggerPropsToChildren, getTriggerChild, isHTMLElement, mergeCallbacks, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { useARIAButtonProps } from '@fluentui/react-aria';\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */\nexport const useMenuTrigger_unstable = props => {\n const {\n children,\n disableButtonEnhancement = false\n } = props;\n const triggerRef = useMenuContext_unstable(context => context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const openOnContext = useMenuContext_unstable(context => context.openOnContext);\n const isSubmenu = useIsSubmenu();\n const {\n findFirstFocusable\n } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();\n }, [findFirstFocusable, menuPopoverRef]);\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n const {\n dir\n } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n const child = getTriggerChild(children);\n const onContextMenu = event => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnContext) {\n event.preventDefault();\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerContextMenu',\n event\n });\n }\n };\n const onClick = event => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (!openOnContext) {\n setOpen(event, {\n open: !open,\n keyboard: openedWithKeyboardRef.current,\n type: 'menuTriggerClick',\n event\n });\n openedWithKeyboardRef.current = false;\n }\n };\n const onKeyDown = event => {\n if (isTargetDisabled(event)) {\n return;\n }\n const key = event.key;\n if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {\n setOpen(event, {\n open: true,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n if (key === Escape && !isSubmenu) {\n setOpen(event, {\n open: false,\n keyboard: true,\n type: 'menuTriggerKeyDown',\n event\n });\n }\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n const onMouseEnter = event => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseEnter',\n event\n });\n }\n };\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = event => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(event, {\n open: true,\n keyboard: false,\n type: 'menuTriggerMouseMove',\n event\n });\n hasMouseMoved.current = true;\n }\n };\n const onMouseLeave = event => {\n if (isTargetDisabled(event)) {\n return;\n }\n if (openOnHover) {\n setOpen(event, {\n open: false,\n keyboard: false,\n type: 'menuTriggerMouseLeave',\n event\n });\n }\n };\n const contextMenuProps = {\n id: triggerId,\n ...(child === null || child === void 0 ? void 0 : child.props),\n ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref),\n onMouseEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseEnter, onMouseEnter)),\n onMouseLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseLeave, onMouseLeave)),\n onContextMenu: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onContextMenu, onContextMenu)),\n onMouseMove: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onMouseMove, onMouseMove))\n };\n const triggerChildProps = {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n ...contextMenuProps,\n onClick: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onClick, onClick)),\n onKeyDown: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : child.props.onKeyDown, onKeyDown))\n };\n 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);\n return {\n isSubmenu,\n children: applyTriggerPropsToChildren(children, openOnContext ? contextMenuProps : disableButtonEnhancement ? triggerChildProps : ariaButtonTriggerChildProps)\n };\n};\nconst isTargetDisabled = event => {\n const isDisabled = el => el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';\n if (isHTMLElement(event.target) && isDisabled(event.target)) {\n return true;\n }\n return isHTMLElement(event.currentTarget) && isDisabled(event.currentTarget);\n};\n//# sourceMappingURL=useMenuTrigger.styles.js.map"],"names":["useMenuTrigger_unstable","props","children","disableButtonEnhancement","triggerRef","useMenuContext_unstable","context","menuPopoverRef","setOpen","open","triggerId","openOnHover","openOnContext","isSubmenu","useIsSubmenu","findFirstFocusable","useFocusFinders","focusFirst","React","useCallback","firstFocusable","current","focus","openedWithKeyboardRef","useRef","hasMouseMoved","dir","useFluent","OpenArrowKey","ArrowRight","ArrowLeft","child","getTriggerChild","onContextMenu","event","isTargetDisabled","preventDefault","keyboard","type","onClick","onKeyDown","key","ArrowDown","Escape","onMouseEnter","onMouseMove","onMouseLeave","contextMenuProps","id","ref","useMergedRefs","useEventCallback","mergeCallbacks","triggerChildProps","undefined","ariaButtonTriggerChildProps","useARIAButtonProps","applyTriggerPropsToCh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