@react-spectrum/menu 3.22.11 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +6 -8
- package/dist/main.js +12 -14
- package/dist/main.js.map +1 -1
- package/dist/module.js +6 -8
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +8 -0
- package/package.json +14 -46
- package/src/index.ts +9 -9
- package/dist/ActionMenu.main.js +0 -67
- package/dist/ActionMenu.main.js.map +0 -1
- package/dist/ActionMenu.mjs +0 -62
- package/dist/ActionMenu.module.js +0 -62
- package/dist/ActionMenu.module.js.map +0 -1
- package/dist/ContextualHelpTrigger.main.js +0 -192
- package/dist/ContextualHelpTrigger.main.js.map +0 -1
- package/dist/ContextualHelpTrigger.mjs +0 -187
- package/dist/ContextualHelpTrigger.module.js +0 -187
- package/dist/ContextualHelpTrigger.module.js.map +0 -1
- package/dist/Menu.main.js +0 -235
- package/dist/Menu.main.js.map +0 -1
- package/dist/Menu.mjs +0 -229
- package/dist/Menu.module.js +0 -229
- package/dist/Menu.module.js.map +0 -1
- package/dist/MenuItem.main.js +0 -149
- package/dist/MenuItem.main.js.map +0 -1
- package/dist/MenuItem.mjs +0 -144
- package/dist/MenuItem.module.js +0 -144
- package/dist/MenuItem.module.js.map +0 -1
- package/dist/MenuSection.main.js +0 -81
- package/dist/MenuSection.main.js.map +0 -1
- package/dist/MenuSection.mjs +0 -76
- package/dist/MenuSection.module.js +0 -76
- package/dist/MenuSection.module.js.map +0 -1
- package/dist/MenuTrigger.main.js +0 -128
- package/dist/MenuTrigger.main.js.map +0 -1
- package/dist/MenuTrigger.mjs +0 -123
- package/dist/MenuTrigger.module.js +0 -123
- package/dist/MenuTrigger.module.js.map +0 -1
- package/dist/SubmenuTrigger.main.js +0 -154
- package/dist/SubmenuTrigger.main.js.map +0 -1
- package/dist/SubmenuTrigger.mjs +0 -149
- package/dist/SubmenuTrigger.module.js +0 -149
- package/dist/SubmenuTrigger.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -8
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -10
- package/dist/ar-AE.module.js +0 -10
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -8
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -10
- package/dist/bg-BG.module.js +0 -10
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/context.main.js +0 -43
- package/dist/context.main.js.map +0 -1
- package/dist/context.mjs +0 -29
- package/dist/context.module.js +0 -29
- package/dist/context.module.js.map +0 -1
- package/dist/contextualhelp_vars_css.main.js +0 -23
- package/dist/contextualhelp_vars_css.main.js.map +0 -1
- package/dist/contextualhelp_vars_css.mjs +0 -25
- package/dist/contextualhelp_vars_css.module.js +0 -25
- package/dist/contextualhelp_vars_css.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -8
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -10
- package/dist/cs-CZ.module.js +0 -10
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -8
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -10
- package/dist/da-DK.module.js +0 -10
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -8
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -10
- package/dist/de-DE.module.js +0 -10
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -8
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -10
- package/dist/el-GR.module.js +0 -10
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -8
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -10
- package/dist/en-US.module.js +0 -10
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -8
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -10
- package/dist/es-ES.module.js +0 -10
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -8
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -10
- package/dist/et-EE.module.js +0 -10
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -8
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -10
- package/dist/fi-FI.module.js +0 -10
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -8
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -10
- package/dist/fr-FR.module.js +0 -10
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -8
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -10
- package/dist/he-IL.module.js +0 -10
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -8
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -10
- package/dist/hr-HR.module.js +0 -10
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -8
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -10
- package/dist/hu-HU.module.js +0 -10
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -8
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -10
- package/dist/it-IT.module.js +0 -10
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -8
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -10
- package/dist/ja-JP.module.js +0 -10
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -8
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -10
- package/dist/ko-KR.module.js +0 -10
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -8
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -10
- package/dist/lt-LT.module.js +0 -10
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -8
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -10
- package/dist/lv-LV.module.js +0 -10
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/menu.2ec1fdaf.css +0 -570
- package/dist/menu.2ec1fdaf.css.map +0 -1
- package/dist/menu.5b49954a.css +0 -30
- package/dist/menu.5b49954a.css.map +0 -1
- package/dist/menu_vars_css.main.js +0 -177
- package/dist/menu_vars_css.main.js.map +0 -1
- package/dist/menu_vars_css.mjs +0 -179
- package/dist/menu_vars_css.module.js +0 -179
- package/dist/menu_vars_css.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -8
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -10
- package/dist/nb-NO.module.js +0 -10
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -8
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -10
- package/dist/nl-NL.module.js +0 -10
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -8
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -10
- package/dist/pl-PL.module.js +0 -10
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -8
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -10
- package/dist/pt-BR.module.js +0 -10
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -8
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -10
- package/dist/pt-PT.module.js +0 -10
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -8
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -10
- package/dist/ro-RO.module.js +0 -10
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -8
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -10
- package/dist/ru-RU.module.js +0 -10
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -8
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -10
- package/dist/sk-SK.module.js +0 -10
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -8
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -10
- package/dist/sl-SI.module.js +0 -10
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -8
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -10
- package/dist/sr-SP.module.js +0 -10
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -8
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -10
- package/dist/sv-SE.module.js +0 -10
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -8
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -10
- package/dist/tr-TR.module.js +0 -10
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -43
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -8
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -10
- package/dist/uk-UA.module.js +0 -10
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -8
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -10
- package/dist/zh-CN.module.js +0 -10
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -8
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -10
- package/dist/zh-TW.module.js +0 -10
- package/dist/zh-TW.module.js.map +0 -1
- package/src/ActionMenu.tsx +0 -58
- package/src/ContextualHelpTrigger.tsx +0 -194
- package/src/Menu.tsx +0 -228
- package/src/MenuItem.tsx +0 -159
- package/src/MenuSection.tsx +0 -100
- package/src/MenuTrigger.tsx +0 -125
- package/src/SubmenuTrigger.tsx +0 -154
- package/src/context.ts +0 -63
- package/src/overlays.css +0 -32
- package/src/useCloseOnScroll.ts +0 -65
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
require("./menu.5b49954a.css");
|
|
2
|
-
var $a10e565ec42bcf96$exports = require("./contextualhelp_vars_css.main.js");
|
|
3
|
-
require("./menu.2ec1fdaf.css");
|
|
4
|
-
var $3deee0fd2b46e64f$exports = require("./menu_vars_css.main.js");
|
|
5
|
-
var $cac834c4bc0a51d3$exports = require("./context.main.js");
|
|
6
|
-
var $63a7dff9cbe2d046$exports = require("./Menu.main.js");
|
|
7
|
-
var $hdb2e$reactspectrumutils = require("@react-spectrum/utils");
|
|
8
|
-
var $hdb2e$reactariafocus = require("@react-aria/focus");
|
|
9
|
-
var $hdb2e$reactariainteractions = require("@react-aria/interactions");
|
|
10
|
-
var $hdb2e$reactariautils = require("@react-aria/utils");
|
|
11
|
-
var $hdb2e$reactspectrumoverlays = require("@react-spectrum/overlays");
|
|
12
|
-
var $hdb2e$react = require("react");
|
|
13
|
-
var $hdb2e$reactdom = require("react-dom");
|
|
14
|
-
var $hdb2e$reactariamenu = require("@react-aria/menu");
|
|
15
|
-
var $hdb2e$reactstatelymenu = require("@react-stately/menu");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $parcel$interopDefault(a) {
|
|
19
|
-
return a && a.__esModule ? a.default : a;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function $parcel$export(e, n, v, s) {
|
|
23
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
$parcel$export(module.exports, "ContextualHelpTrigger", () => $db380858d398b658$export$5413b169fff83e61);
|
|
27
|
-
/*
|
|
28
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
29
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
30
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
31
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
32
|
-
*
|
|
33
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
34
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
35
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
36
|
-
* governing permissions and limitations under the License.
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function $db380858d398b658$var$ContextualHelpTrigger(props) {
|
|
51
|
-
let { isUnavailable: isUnavailable = false, targetKey: targetKey } = props;
|
|
52
|
-
let triggerRef = (0, $hdb2e$react.useRef)(null);
|
|
53
|
-
let popoverRef = (0, $hdb2e$react.useRef)(null);
|
|
54
|
-
let { popoverContainer: popoverContainer, trayContainerRef: trayContainerRef, rootMenuTriggerState: rootMenuTriggerState, menu: parentMenuRef, state: state } = (0, $cac834c4bc0a51d3$exports.useMenuStateContext)();
|
|
55
|
-
let submenuTriggerState = (0, $hdb2e$reactstatelymenu.useSubmenuTriggerState)({
|
|
56
|
-
triggerKey: targetKey
|
|
57
|
-
}, {
|
|
58
|
-
...rootMenuTriggerState,
|
|
59
|
-
...state
|
|
60
|
-
});
|
|
61
|
-
let submenuRef = (0, $hdb2e$reactspectrumutils.unwrapDOMRef)(popoverRef);
|
|
62
|
-
let { submenuTriggerProps: submenuTriggerProps, popoverProps: popoverProps } = (0, $hdb2e$reactariamenu.useSubmenuTrigger)({
|
|
63
|
-
parentMenuRef: parentMenuRef,
|
|
64
|
-
submenuRef: submenuRef,
|
|
65
|
-
type: 'dialog',
|
|
66
|
-
isDisabled: !isUnavailable
|
|
67
|
-
}, submenuTriggerState, triggerRef);
|
|
68
|
-
let isMobile = (0, $hdb2e$reactspectrumutils.useIsMobileDevice)();
|
|
69
|
-
let [traySubmenuAnimation, setTraySubmenuAnimation] = (0, $hdb2e$react.useState)('');
|
|
70
|
-
(0, $hdb2e$react.useEffect)(()=>{
|
|
71
|
-
if (submenuTriggerState.isOpen) setTraySubmenuAnimation('spectrum-TraySubmenu-enter');
|
|
72
|
-
}, [
|
|
73
|
-
submenuTriggerState.isOpen
|
|
74
|
-
]);
|
|
75
|
-
let slots = {};
|
|
76
|
-
if (isUnavailable) slots = {
|
|
77
|
-
dialog: {
|
|
78
|
-
UNSAFE_className: (0, $hdb2e$reactspectrumutils.classNames)((0, ($parcel$interopDefault($a10e565ec42bcf96$exports))), 'react-spectrum-ContextualHelp-dialog', {
|
|
79
|
-
'react-spectrum-ContextualHelp-dialog--isMobile': isMobile
|
|
80
|
-
}, (0, $hdb2e$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), {
|
|
81
|
-
'spectrum-Menu-subdialog': !isMobile,
|
|
82
|
-
[traySubmenuAnimation]: isMobile
|
|
83
|
-
}))
|
|
84
|
-
},
|
|
85
|
-
content: {
|
|
86
|
-
UNSAFE_className: (0, ($parcel$interopDefault($a10e565ec42bcf96$exports)))['react-spectrum-ContextualHelp-content']
|
|
87
|
-
},
|
|
88
|
-
footer: {
|
|
89
|
-
UNSAFE_className: (0, ($parcel$interopDefault($a10e565ec42bcf96$exports)))['react-spectrum-ContextualHelp-footer']
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
let [trigger] = (0, ($parcel$interopDefault($hdb2e$react))).Children.toArray(props.children);
|
|
93
|
-
let [, content] = props.children;
|
|
94
|
-
let onBlurWithin = (e)=>{
|
|
95
|
-
if (e.relatedTarget && popoverRef.current && !(0, $hdb2e$reactariautils.nodeContains)(popoverRef.current.UNSAFE_getDOMNode(), e.relatedTarget) && !(e.relatedTarget === triggerRef.current && (0, $hdb2e$reactariainteractions.getInteractionModality)() === 'pointer')) {
|
|
96
|
-
if (submenuTriggerState.isOpen) submenuTriggerState.close();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
let overlay;
|
|
100
|
-
let tray;
|
|
101
|
-
let onBackButtonPress = ()=>{
|
|
102
|
-
setTraySubmenuAnimation('spectrum-TraySubmenu-exit');
|
|
103
|
-
setTimeout(()=>{
|
|
104
|
-
submenuTriggerState.close();
|
|
105
|
-
if (parentMenuRef.current && !(0, $hdb2e$reactariautils.isFocusWithin)(parentMenuRef.current)) parentMenuRef.current.focus();
|
|
106
|
-
}, 220); // Matches transition duration
|
|
107
|
-
};
|
|
108
|
-
if (isMobile) {
|
|
109
|
-
delete submenuTriggerProps.onBlur;
|
|
110
|
-
delete submenuTriggerProps.onHoverChange;
|
|
111
|
-
if (trayContainerRef.current && submenuTriggerState.isOpen) {
|
|
112
|
-
let subDialogKeyDown = (e)=>{
|
|
113
|
-
switch(e.key){
|
|
114
|
-
case 'Escape':
|
|
115
|
-
e.stopPropagation();
|
|
116
|
-
onBackButtonPress();
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
tray = /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement((0, $63a7dff9cbe2d046$exports.TrayHeaderWrapper), {
|
|
121
|
-
isSubmenu: true,
|
|
122
|
-
parentMenuTreeState: state,
|
|
123
|
-
rootMenuTriggerState: rootMenuTriggerState,
|
|
124
|
-
wrapperKeyDown: subDialogKeyDown,
|
|
125
|
-
onBackButtonPress: onBackButtonPress
|
|
126
|
-
}, content);
|
|
127
|
-
overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$reactdom))).createPortal(tray, trayContainerRef.current);
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
let onDismissButtonPress = ()=>{
|
|
131
|
-
var _parentMenuRef_current;
|
|
132
|
-
submenuTriggerState.close();
|
|
133
|
-
(_parentMenuRef_current = parentMenuRef.current) === null || _parentMenuRef_current === void 0 ? void 0 : _parentMenuRef_current.focus();
|
|
134
|
-
};
|
|
135
|
-
overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement((0, $hdb2e$reactspectrumoverlays.Popover), {
|
|
136
|
-
...popoverProps,
|
|
137
|
-
UNSAFE_style: {
|
|
138
|
-
clipPath: 'unset',
|
|
139
|
-
overflow: 'visible',
|
|
140
|
-
filter: 'unset',
|
|
141
|
-
borderWidth: '0px'
|
|
142
|
-
},
|
|
143
|
-
UNSAFE_className: (0, $hdb2e$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Submenu-popover'),
|
|
144
|
-
onDismissButtonPress: onDismissButtonPress,
|
|
145
|
-
onBlurWithin: onBlurWithin,
|
|
146
|
-
container: popoverContainer,
|
|
147
|
-
state: submenuTriggerState,
|
|
148
|
-
ref: popoverRef,
|
|
149
|
-
triggerRef: triggerRef,
|
|
150
|
-
placement: "end top",
|
|
151
|
-
containerPadding: 0,
|
|
152
|
-
hideArrow: true,
|
|
153
|
-
enableBothDismissButtons: true
|
|
154
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement((0, $hdb2e$reactariafocus.FocusScope), {
|
|
155
|
-
restoreFocus: true,
|
|
156
|
-
contain: true
|
|
157
|
-
}, content));
|
|
158
|
-
}
|
|
159
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement((0, ($parcel$interopDefault($hdb2e$react))).Fragment, null, /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement((0, $cac834c4bc0a51d3$exports.SubmenuTriggerContext).Provider, {
|
|
160
|
-
value: {
|
|
161
|
-
isUnavailable: isUnavailable,
|
|
162
|
-
triggerRef: triggerRef,
|
|
163
|
-
...submenuTriggerProps
|
|
164
|
-
}
|
|
165
|
-
}, trigger), /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement((0, $hdb2e$reactspectrumutils.SlotProvider), {
|
|
166
|
-
slots: slots
|
|
167
|
-
}, submenuTriggerState.isOpen && overlay));
|
|
168
|
-
}
|
|
169
|
-
$db380858d398b658$var$ContextualHelpTrigger.getCollectionNode = function* getCollectionNode(props) {
|
|
170
|
-
let childArray = [];
|
|
171
|
-
(0, ($parcel$interopDefault($hdb2e$react))).Children.forEach(props.children, (child)=>{
|
|
172
|
-
if (/*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).isValidElement(child)) childArray.push(child);
|
|
173
|
-
});
|
|
174
|
-
let [trigger] = childArray;
|
|
175
|
-
let [, content] = props.children;
|
|
176
|
-
yield {
|
|
177
|
-
element: /*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).cloneElement(trigger, {
|
|
178
|
-
...trigger.props,
|
|
179
|
-
hasChildItems: true,
|
|
180
|
-
isTrigger: true
|
|
181
|
-
}),
|
|
182
|
-
wrapper: (element)=>/*#__PURE__*/ (0, ($parcel$interopDefault($hdb2e$react))).createElement($db380858d398b658$var$ContextualHelpTrigger, {
|
|
183
|
-
key: element.key,
|
|
184
|
-
targetKey: element.key,
|
|
185
|
-
...props
|
|
186
|
-
}, element, content)
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
let $db380858d398b658$export$5413b169fff83e61 = $db380858d398b658$var$ContextualHelpTrigger;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
//# sourceMappingURL=ContextualHelpTrigger.main.js.map
|
|
@@ -1 +0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AGP;AACF;AAEA,IAAI,4CAAQ","sources":["packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, unwrapDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {DOMRefValue, ItemProps, Key} from '@react-types/shared';\nimport {FocusScope} from '@react-aria/focus';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport helpStyles from '@adobe/spectrum-css-temp/components/contextualhelp/vars.css';\nimport {isFocusWithin, nodeContains} from '@react-aria/utils';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {JSX, KeyboardEventHandler, ReactElement, useEffect, useRef, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {TrayHeaderWrapper} from './Menu';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface MenuDialogTriggerProps {\n /** Whether the menu item is currently unavailable. */\n isUnavailable?: boolean,\n /** The triggering Item and the Dialog, respectively. */\n children: [ReactElement, ReactElement]\n}\n\ninterface InternalMenuDialogTriggerProps extends MenuDialogTriggerProps {\n targetKey: Key\n}\n\nexport interface SpectrumMenuDialogTriggerProps extends MenuDialogTriggerProps {}\n\nfunction ContextualHelpTrigger(props: InternalMenuDialogTriggerProps): ReactElement {\n let {isUnavailable = false, targetKey} = props;\n\n let triggerRef = useRef<HTMLLIElement>(null);\n let popoverRef = useRef<DOMRefValue<HTMLDivElement> | null>(null);\n let {popoverContainer, trayContainerRef, rootMenuTriggerState, menu: parentMenuRef, state} = useMenuStateContext()!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, {...rootMenuTriggerState!, ...state});\n let submenuRef = unwrapDOMRef(popoverRef);\n let {submenuTriggerProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n type: 'dialog',\n isDisabled: !isUnavailable\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let [traySubmenuAnimation, setTraySubmenuAnimation] = useState('');\n useEffect(() => {\n if (submenuTriggerState.isOpen) {\n setTraySubmenuAnimation('spectrum-TraySubmenu-enter');\n }\n }, [submenuTriggerState.isOpen]);\n let slots = {};\n if (isUnavailable) {\n slots = {\n dialog: {\n UNSAFE_className: classNames(\n helpStyles,\n 'react-spectrum-ContextualHelp-dialog',\n {\n 'react-spectrum-ContextualHelp-dialog--isMobile': isMobile\n },\n classNames(\n styles,\n {\n 'spectrum-Menu-subdialog': !isMobile,\n [traySubmenuAnimation]: isMobile\n }\n )\n )\n },\n content: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-content']},\n footer: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-footer']}\n };\n }\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, ReactElement];\n\n let onBlurWithin = (e) => {\n if (e.relatedTarget && popoverRef.current && (!nodeContains(popoverRef.current.UNSAFE_getDOMNode(), e.relatedTarget) && !(e.relatedTarget === triggerRef.current && getInteractionModality() === 'pointer'))) {\n if (submenuTriggerState.isOpen) {\n submenuTriggerState.close();\n }\n }\n };\n\n let overlay;\n let tray;\n let onBackButtonPress = () => {\n setTraySubmenuAnimation('spectrum-TraySubmenu-exit');\n setTimeout(() => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !isFocusWithin(parentMenuRef.current)) {\n parentMenuRef.current.focus();\n }\n }, 220); // Matches transition duration\n };\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n let subDialogKeyDown: KeyboardEventHandler = (e) => {\n switch (e.key) {\n case 'Escape':\n e.stopPropagation();\n onBackButtonPress();\n break;\n }\n };\n\n tray = (\n <TrayHeaderWrapper\n isSubmenu\n parentMenuTreeState={state}\n rootMenuTriggerState={rootMenuTriggerState}\n wrapperKeyDown={subDialogKeyDown}\n onBackButtonPress={onBackButtonPress}>\n {content}\n </TrayHeaderWrapper>\n );\n\n overlay = ReactDOM.createPortal(tray, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n onDismissButtonPress={onDismissButtonPress}\n onBlurWithin={onBlurWithin}\n container={popoverContainer!}\n state={submenuTriggerState}\n ref={popoverRef}\n triggerRef={triggerRef}\n placement=\"end top\"\n containerPadding={0}\n hideArrow\n enableBothDismissButtons>\n <FocusScope restoreFocus contain>\n {content}\n </FocusScope>\n </Popover>\n );\n }\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{isUnavailable, triggerRef, ...submenuTriggerProps}}>{trigger}</SubmenuTriggerContext.Provider>\n <SlotProvider slots={slots}>\n {submenuTriggerState.isOpen && overlay}\n </SlotProvider>\n </>\n );\n}\n\nContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </ContextualHelpTrigger>\n )\n };\n};\n\nlet _Item = ContextualHelpTrigger as unknown as (props: SpectrumMenuDialogTriggerProps) => JSX.Element;\nexport {_Item as ContextualHelpTrigger};\n"],"names":[],"version":3,"file":"ContextualHelpTrigger.main.js.map"}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import "./menu.5b49954a.css";
|
|
2
|
-
import $7Y1uy$contextualhelp_vars_cssmodulejs from "./contextualhelp_vars_css.mjs";
|
|
3
|
-
import "./menu.2ec1fdaf.css";
|
|
4
|
-
import $7Y1uy$menu_vars_cssmodulejs from "./menu_vars_css.mjs";
|
|
5
|
-
import {SubmenuTriggerContext as $d94604d52c3e3feb$export$8d97fe02339fc0e3, useMenuStateContext as $d94604d52c3e3feb$export$efa3856fc0e85e7f} from "./context.mjs";
|
|
6
|
-
import {TrayHeaderWrapper as $49b26f4b606348f6$export$3dfe97b5c32d8d8c} from "./Menu.mjs";
|
|
7
|
-
import {unwrapDOMRef as $7Y1uy$unwrapDOMRef, useIsMobileDevice as $7Y1uy$useIsMobileDevice, classNames as $7Y1uy$classNames, SlotProvider as $7Y1uy$SlotProvider} from "@react-spectrum/utils";
|
|
8
|
-
import {FocusScope as $7Y1uy$FocusScope} from "@react-aria/focus";
|
|
9
|
-
import {getInteractionModality as $7Y1uy$getInteractionModality} from "@react-aria/interactions";
|
|
10
|
-
import {nodeContains as $7Y1uy$nodeContains, isFocusWithin as $7Y1uy$isFocusWithin} from "@react-aria/utils";
|
|
11
|
-
import {Popover as $7Y1uy$Popover} from "@react-spectrum/overlays";
|
|
12
|
-
import $7Y1uy$react, {useRef as $7Y1uy$useRef, useState as $7Y1uy$useState, useEffect as $7Y1uy$useEffect} from "react";
|
|
13
|
-
import $7Y1uy$reactdom from "react-dom";
|
|
14
|
-
import {useSubmenuTrigger as $7Y1uy$useSubmenuTrigger} from "@react-aria/menu";
|
|
15
|
-
import {useSubmenuTriggerState as $7Y1uy$useSubmenuTriggerState} from "@react-stately/menu";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $parcel$interopDefault(a) {
|
|
19
|
-
return a && a.__esModule ? a.default : a;
|
|
20
|
-
}
|
|
21
|
-
/*
|
|
22
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
23
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
-
* governing permissions and limitations under the License.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function $726fb1b478e356bf$var$ContextualHelpTrigger(props) {
|
|
45
|
-
let { isUnavailable: isUnavailable = false, targetKey: targetKey } = props;
|
|
46
|
-
let triggerRef = (0, $7Y1uy$useRef)(null);
|
|
47
|
-
let popoverRef = (0, $7Y1uy$useRef)(null);
|
|
48
|
-
let { popoverContainer: popoverContainer, trayContainerRef: trayContainerRef, rootMenuTriggerState: rootMenuTriggerState, menu: parentMenuRef, state: state } = (0, $d94604d52c3e3feb$export$efa3856fc0e85e7f)();
|
|
49
|
-
let submenuTriggerState = (0, $7Y1uy$useSubmenuTriggerState)({
|
|
50
|
-
triggerKey: targetKey
|
|
51
|
-
}, {
|
|
52
|
-
...rootMenuTriggerState,
|
|
53
|
-
...state
|
|
54
|
-
});
|
|
55
|
-
let submenuRef = (0, $7Y1uy$unwrapDOMRef)(popoverRef);
|
|
56
|
-
let { submenuTriggerProps: submenuTriggerProps, popoverProps: popoverProps } = (0, $7Y1uy$useSubmenuTrigger)({
|
|
57
|
-
parentMenuRef: parentMenuRef,
|
|
58
|
-
submenuRef: submenuRef,
|
|
59
|
-
type: 'dialog',
|
|
60
|
-
isDisabled: !isUnavailable
|
|
61
|
-
}, submenuTriggerState, triggerRef);
|
|
62
|
-
let isMobile = (0, $7Y1uy$useIsMobileDevice)();
|
|
63
|
-
let [traySubmenuAnimation, setTraySubmenuAnimation] = (0, $7Y1uy$useState)('');
|
|
64
|
-
(0, $7Y1uy$useEffect)(()=>{
|
|
65
|
-
if (submenuTriggerState.isOpen) setTraySubmenuAnimation('spectrum-TraySubmenu-enter');
|
|
66
|
-
}, [
|
|
67
|
-
submenuTriggerState.isOpen
|
|
68
|
-
]);
|
|
69
|
-
let slots = {};
|
|
70
|
-
if (isUnavailable) slots = {
|
|
71
|
-
dialog: {
|
|
72
|
-
UNSAFE_className: (0, $7Y1uy$classNames)((0, ($parcel$interopDefault($7Y1uy$contextualhelp_vars_cssmodulejs))), 'react-spectrum-ContextualHelp-dialog', {
|
|
73
|
-
'react-spectrum-ContextualHelp-dialog--isMobile': isMobile
|
|
74
|
-
}, (0, $7Y1uy$classNames)((0, ($parcel$interopDefault($7Y1uy$menu_vars_cssmodulejs))), {
|
|
75
|
-
'spectrum-Menu-subdialog': !isMobile,
|
|
76
|
-
[traySubmenuAnimation]: isMobile
|
|
77
|
-
}))
|
|
78
|
-
},
|
|
79
|
-
content: {
|
|
80
|
-
UNSAFE_className: (0, ($parcel$interopDefault($7Y1uy$contextualhelp_vars_cssmodulejs)))['react-spectrum-ContextualHelp-content']
|
|
81
|
-
},
|
|
82
|
-
footer: {
|
|
83
|
-
UNSAFE_className: (0, ($parcel$interopDefault($7Y1uy$contextualhelp_vars_cssmodulejs)))['react-spectrum-ContextualHelp-footer']
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
let [trigger] = (0, $7Y1uy$react).Children.toArray(props.children);
|
|
87
|
-
let [, content] = props.children;
|
|
88
|
-
let onBlurWithin = (e)=>{
|
|
89
|
-
if (e.relatedTarget && popoverRef.current && !(0, $7Y1uy$nodeContains)(popoverRef.current.UNSAFE_getDOMNode(), e.relatedTarget) && !(e.relatedTarget === triggerRef.current && (0, $7Y1uy$getInteractionModality)() === 'pointer')) {
|
|
90
|
-
if (submenuTriggerState.isOpen) submenuTriggerState.close();
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
let overlay;
|
|
94
|
-
let tray;
|
|
95
|
-
let onBackButtonPress = ()=>{
|
|
96
|
-
setTraySubmenuAnimation('spectrum-TraySubmenu-exit');
|
|
97
|
-
setTimeout(()=>{
|
|
98
|
-
submenuTriggerState.close();
|
|
99
|
-
if (parentMenuRef.current && !(0, $7Y1uy$isFocusWithin)(parentMenuRef.current)) parentMenuRef.current.focus();
|
|
100
|
-
}, 220); // Matches transition duration
|
|
101
|
-
};
|
|
102
|
-
if (isMobile) {
|
|
103
|
-
delete submenuTriggerProps.onBlur;
|
|
104
|
-
delete submenuTriggerProps.onHoverChange;
|
|
105
|
-
if (trayContainerRef.current && submenuTriggerState.isOpen) {
|
|
106
|
-
let subDialogKeyDown = (e)=>{
|
|
107
|
-
switch(e.key){
|
|
108
|
-
case 'Escape':
|
|
109
|
-
e.stopPropagation();
|
|
110
|
-
onBackButtonPress();
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
tray = /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $49b26f4b606348f6$export$3dfe97b5c32d8d8c), {
|
|
115
|
-
isSubmenu: true,
|
|
116
|
-
parentMenuTreeState: state,
|
|
117
|
-
rootMenuTriggerState: rootMenuTriggerState,
|
|
118
|
-
wrapperKeyDown: subDialogKeyDown,
|
|
119
|
-
onBackButtonPress: onBackButtonPress
|
|
120
|
-
}, content);
|
|
121
|
-
overlay = /*#__PURE__*/ (0, $7Y1uy$reactdom).createPortal(tray, trayContainerRef.current);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
let onDismissButtonPress = ()=>{
|
|
125
|
-
var _parentMenuRef_current;
|
|
126
|
-
submenuTriggerState.close();
|
|
127
|
-
(_parentMenuRef_current = parentMenuRef.current) === null || _parentMenuRef_current === void 0 ? void 0 : _parentMenuRef_current.focus();
|
|
128
|
-
};
|
|
129
|
-
overlay = /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$Popover), {
|
|
130
|
-
...popoverProps,
|
|
131
|
-
UNSAFE_style: {
|
|
132
|
-
clipPath: 'unset',
|
|
133
|
-
overflow: 'visible',
|
|
134
|
-
filter: 'unset',
|
|
135
|
-
borderWidth: '0px'
|
|
136
|
-
},
|
|
137
|
-
UNSAFE_className: (0, $7Y1uy$classNames)((0, ($parcel$interopDefault($7Y1uy$menu_vars_cssmodulejs))), 'spectrum-Submenu-popover'),
|
|
138
|
-
onDismissButtonPress: onDismissButtonPress,
|
|
139
|
-
onBlurWithin: onBlurWithin,
|
|
140
|
-
container: popoverContainer,
|
|
141
|
-
state: submenuTriggerState,
|
|
142
|
-
ref: popoverRef,
|
|
143
|
-
triggerRef: triggerRef,
|
|
144
|
-
placement: "end top",
|
|
145
|
-
containerPadding: 0,
|
|
146
|
-
hideArrow: true,
|
|
147
|
-
enableBothDismissButtons: true
|
|
148
|
-
}, /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$FocusScope), {
|
|
149
|
-
restoreFocus: true,
|
|
150
|
-
contain: true
|
|
151
|
-
}, content));
|
|
152
|
-
}
|
|
153
|
-
return /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$react).Fragment, null, /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $d94604d52c3e3feb$export$8d97fe02339fc0e3).Provider, {
|
|
154
|
-
value: {
|
|
155
|
-
isUnavailable: isUnavailable,
|
|
156
|
-
triggerRef: triggerRef,
|
|
157
|
-
...submenuTriggerProps
|
|
158
|
-
}
|
|
159
|
-
}, trigger), /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$SlotProvider), {
|
|
160
|
-
slots: slots
|
|
161
|
-
}, submenuTriggerState.isOpen && overlay));
|
|
162
|
-
}
|
|
163
|
-
$726fb1b478e356bf$var$ContextualHelpTrigger.getCollectionNode = function* getCollectionNode(props) {
|
|
164
|
-
let childArray = [];
|
|
165
|
-
(0, $7Y1uy$react).Children.forEach(props.children, (child)=>{
|
|
166
|
-
if (/*#__PURE__*/ (0, $7Y1uy$react).isValidElement(child)) childArray.push(child);
|
|
167
|
-
});
|
|
168
|
-
let [trigger] = childArray;
|
|
169
|
-
let [, content] = props.children;
|
|
170
|
-
yield {
|
|
171
|
-
element: /*#__PURE__*/ (0, $7Y1uy$react).cloneElement(trigger, {
|
|
172
|
-
...trigger.props,
|
|
173
|
-
hasChildItems: true,
|
|
174
|
-
isTrigger: true
|
|
175
|
-
}),
|
|
176
|
-
wrapper: (element)=>/*#__PURE__*/ (0, $7Y1uy$react).createElement($726fb1b478e356bf$var$ContextualHelpTrigger, {
|
|
177
|
-
key: element.key,
|
|
178
|
-
targetKey: element.key,
|
|
179
|
-
...props
|
|
180
|
-
}, element, content)
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
let $726fb1b478e356bf$export$5413b169fff83e61 = $726fb1b478e356bf$var$ContextualHelpTrigger;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
export {$726fb1b478e356bf$export$5413b169fff83e61 as ContextualHelpTrigger};
|
|
187
|
-
//# sourceMappingURL=ContextualHelpTrigger.module.js.map
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import "./menu.5b49954a.css";
|
|
2
|
-
import $7Y1uy$contextualhelp_vars_cssmodulejs from "./contextualhelp_vars_css.module.js";
|
|
3
|
-
import "./menu.2ec1fdaf.css";
|
|
4
|
-
import $7Y1uy$menu_vars_cssmodulejs from "./menu_vars_css.module.js";
|
|
5
|
-
import {SubmenuTriggerContext as $d94604d52c3e3feb$export$8d97fe02339fc0e3, useMenuStateContext as $d94604d52c3e3feb$export$efa3856fc0e85e7f} from "./context.module.js";
|
|
6
|
-
import {TrayHeaderWrapper as $49b26f4b606348f6$export$3dfe97b5c32d8d8c} from "./Menu.module.js";
|
|
7
|
-
import {unwrapDOMRef as $7Y1uy$unwrapDOMRef, useIsMobileDevice as $7Y1uy$useIsMobileDevice, classNames as $7Y1uy$classNames, SlotProvider as $7Y1uy$SlotProvider} from "@react-spectrum/utils";
|
|
8
|
-
import {FocusScope as $7Y1uy$FocusScope} from "@react-aria/focus";
|
|
9
|
-
import {getInteractionModality as $7Y1uy$getInteractionModality} from "@react-aria/interactions";
|
|
10
|
-
import {nodeContains as $7Y1uy$nodeContains, isFocusWithin as $7Y1uy$isFocusWithin} from "@react-aria/utils";
|
|
11
|
-
import {Popover as $7Y1uy$Popover} from "@react-spectrum/overlays";
|
|
12
|
-
import $7Y1uy$react, {useRef as $7Y1uy$useRef, useState as $7Y1uy$useState, useEffect as $7Y1uy$useEffect} from "react";
|
|
13
|
-
import $7Y1uy$reactdom from "react-dom";
|
|
14
|
-
import {useSubmenuTrigger as $7Y1uy$useSubmenuTrigger} from "@react-aria/menu";
|
|
15
|
-
import {useSubmenuTriggerState as $7Y1uy$useSubmenuTriggerState} from "@react-stately/menu";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $parcel$interopDefault(a) {
|
|
19
|
-
return a && a.__esModule ? a.default : a;
|
|
20
|
-
}
|
|
21
|
-
/*
|
|
22
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
23
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
-
* governing permissions and limitations under the License.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function $726fb1b478e356bf$var$ContextualHelpTrigger(props) {
|
|
45
|
-
let { isUnavailable: isUnavailable = false, targetKey: targetKey } = props;
|
|
46
|
-
let triggerRef = (0, $7Y1uy$useRef)(null);
|
|
47
|
-
let popoverRef = (0, $7Y1uy$useRef)(null);
|
|
48
|
-
let { popoverContainer: popoverContainer, trayContainerRef: trayContainerRef, rootMenuTriggerState: rootMenuTriggerState, menu: parentMenuRef, state: state } = (0, $d94604d52c3e3feb$export$efa3856fc0e85e7f)();
|
|
49
|
-
let submenuTriggerState = (0, $7Y1uy$useSubmenuTriggerState)({
|
|
50
|
-
triggerKey: targetKey
|
|
51
|
-
}, {
|
|
52
|
-
...rootMenuTriggerState,
|
|
53
|
-
...state
|
|
54
|
-
});
|
|
55
|
-
let submenuRef = (0, $7Y1uy$unwrapDOMRef)(popoverRef);
|
|
56
|
-
let { submenuTriggerProps: submenuTriggerProps, popoverProps: popoverProps } = (0, $7Y1uy$useSubmenuTrigger)({
|
|
57
|
-
parentMenuRef: parentMenuRef,
|
|
58
|
-
submenuRef: submenuRef,
|
|
59
|
-
type: 'dialog',
|
|
60
|
-
isDisabled: !isUnavailable
|
|
61
|
-
}, submenuTriggerState, triggerRef);
|
|
62
|
-
let isMobile = (0, $7Y1uy$useIsMobileDevice)();
|
|
63
|
-
let [traySubmenuAnimation, setTraySubmenuAnimation] = (0, $7Y1uy$useState)('');
|
|
64
|
-
(0, $7Y1uy$useEffect)(()=>{
|
|
65
|
-
if (submenuTriggerState.isOpen) setTraySubmenuAnimation('spectrum-TraySubmenu-enter');
|
|
66
|
-
}, [
|
|
67
|
-
submenuTriggerState.isOpen
|
|
68
|
-
]);
|
|
69
|
-
let slots = {};
|
|
70
|
-
if (isUnavailable) slots = {
|
|
71
|
-
dialog: {
|
|
72
|
-
UNSAFE_className: (0, $7Y1uy$classNames)((0, ($parcel$interopDefault($7Y1uy$contextualhelp_vars_cssmodulejs))), 'react-spectrum-ContextualHelp-dialog', {
|
|
73
|
-
'react-spectrum-ContextualHelp-dialog--isMobile': isMobile
|
|
74
|
-
}, (0, $7Y1uy$classNames)((0, ($parcel$interopDefault($7Y1uy$menu_vars_cssmodulejs))), {
|
|
75
|
-
'spectrum-Menu-subdialog': !isMobile,
|
|
76
|
-
[traySubmenuAnimation]: isMobile
|
|
77
|
-
}))
|
|
78
|
-
},
|
|
79
|
-
content: {
|
|
80
|
-
UNSAFE_className: (0, ($parcel$interopDefault($7Y1uy$contextualhelp_vars_cssmodulejs)))['react-spectrum-ContextualHelp-content']
|
|
81
|
-
},
|
|
82
|
-
footer: {
|
|
83
|
-
UNSAFE_className: (0, ($parcel$interopDefault($7Y1uy$contextualhelp_vars_cssmodulejs)))['react-spectrum-ContextualHelp-footer']
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
let [trigger] = (0, $7Y1uy$react).Children.toArray(props.children);
|
|
87
|
-
let [, content] = props.children;
|
|
88
|
-
let onBlurWithin = (e)=>{
|
|
89
|
-
if (e.relatedTarget && popoverRef.current && !(0, $7Y1uy$nodeContains)(popoverRef.current.UNSAFE_getDOMNode(), e.relatedTarget) && !(e.relatedTarget === triggerRef.current && (0, $7Y1uy$getInteractionModality)() === 'pointer')) {
|
|
90
|
-
if (submenuTriggerState.isOpen) submenuTriggerState.close();
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
let overlay;
|
|
94
|
-
let tray;
|
|
95
|
-
let onBackButtonPress = ()=>{
|
|
96
|
-
setTraySubmenuAnimation('spectrum-TraySubmenu-exit');
|
|
97
|
-
setTimeout(()=>{
|
|
98
|
-
submenuTriggerState.close();
|
|
99
|
-
if (parentMenuRef.current && !(0, $7Y1uy$isFocusWithin)(parentMenuRef.current)) parentMenuRef.current.focus();
|
|
100
|
-
}, 220); // Matches transition duration
|
|
101
|
-
};
|
|
102
|
-
if (isMobile) {
|
|
103
|
-
delete submenuTriggerProps.onBlur;
|
|
104
|
-
delete submenuTriggerProps.onHoverChange;
|
|
105
|
-
if (trayContainerRef.current && submenuTriggerState.isOpen) {
|
|
106
|
-
let subDialogKeyDown = (e)=>{
|
|
107
|
-
switch(e.key){
|
|
108
|
-
case 'Escape':
|
|
109
|
-
e.stopPropagation();
|
|
110
|
-
onBackButtonPress();
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
tray = /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $49b26f4b606348f6$export$3dfe97b5c32d8d8c), {
|
|
115
|
-
isSubmenu: true,
|
|
116
|
-
parentMenuTreeState: state,
|
|
117
|
-
rootMenuTriggerState: rootMenuTriggerState,
|
|
118
|
-
wrapperKeyDown: subDialogKeyDown,
|
|
119
|
-
onBackButtonPress: onBackButtonPress
|
|
120
|
-
}, content);
|
|
121
|
-
overlay = /*#__PURE__*/ (0, $7Y1uy$reactdom).createPortal(tray, trayContainerRef.current);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
let onDismissButtonPress = ()=>{
|
|
125
|
-
var _parentMenuRef_current;
|
|
126
|
-
submenuTriggerState.close();
|
|
127
|
-
(_parentMenuRef_current = parentMenuRef.current) === null || _parentMenuRef_current === void 0 ? void 0 : _parentMenuRef_current.focus();
|
|
128
|
-
};
|
|
129
|
-
overlay = /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$Popover), {
|
|
130
|
-
...popoverProps,
|
|
131
|
-
UNSAFE_style: {
|
|
132
|
-
clipPath: 'unset',
|
|
133
|
-
overflow: 'visible',
|
|
134
|
-
filter: 'unset',
|
|
135
|
-
borderWidth: '0px'
|
|
136
|
-
},
|
|
137
|
-
UNSAFE_className: (0, $7Y1uy$classNames)((0, ($parcel$interopDefault($7Y1uy$menu_vars_cssmodulejs))), 'spectrum-Submenu-popover'),
|
|
138
|
-
onDismissButtonPress: onDismissButtonPress,
|
|
139
|
-
onBlurWithin: onBlurWithin,
|
|
140
|
-
container: popoverContainer,
|
|
141
|
-
state: submenuTriggerState,
|
|
142
|
-
ref: popoverRef,
|
|
143
|
-
triggerRef: triggerRef,
|
|
144
|
-
placement: "end top",
|
|
145
|
-
containerPadding: 0,
|
|
146
|
-
hideArrow: true,
|
|
147
|
-
enableBothDismissButtons: true
|
|
148
|
-
}, /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$FocusScope), {
|
|
149
|
-
restoreFocus: true,
|
|
150
|
-
contain: true
|
|
151
|
-
}, content));
|
|
152
|
-
}
|
|
153
|
-
return /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$react).Fragment, null, /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $d94604d52c3e3feb$export$8d97fe02339fc0e3).Provider, {
|
|
154
|
-
value: {
|
|
155
|
-
isUnavailable: isUnavailable,
|
|
156
|
-
triggerRef: triggerRef,
|
|
157
|
-
...submenuTriggerProps
|
|
158
|
-
}
|
|
159
|
-
}, trigger), /*#__PURE__*/ (0, $7Y1uy$react).createElement((0, $7Y1uy$SlotProvider), {
|
|
160
|
-
slots: slots
|
|
161
|
-
}, submenuTriggerState.isOpen && overlay));
|
|
162
|
-
}
|
|
163
|
-
$726fb1b478e356bf$var$ContextualHelpTrigger.getCollectionNode = function* getCollectionNode(props) {
|
|
164
|
-
let childArray = [];
|
|
165
|
-
(0, $7Y1uy$react).Children.forEach(props.children, (child)=>{
|
|
166
|
-
if (/*#__PURE__*/ (0, $7Y1uy$react).isValidElement(child)) childArray.push(child);
|
|
167
|
-
});
|
|
168
|
-
let [trigger] = childArray;
|
|
169
|
-
let [, content] = props.children;
|
|
170
|
-
yield {
|
|
171
|
-
element: /*#__PURE__*/ (0, $7Y1uy$react).cloneElement(trigger, {
|
|
172
|
-
...trigger.props,
|
|
173
|
-
hasChildItems: true,
|
|
174
|
-
isTrigger: true
|
|
175
|
-
}),
|
|
176
|
-
wrapper: (element)=>/*#__PURE__*/ (0, $7Y1uy$react).createElement($726fb1b478e356bf$var$ContextualHelpTrigger, {
|
|
177
|
-
key: element.key,
|
|
178
|
-
targetKey: element.key,
|
|
179
|
-
...props
|
|
180
|
-
}, element, content)
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
let $726fb1b478e356bf$export$5413b169fff83e61 = $726fb1b478e356bf$var$ContextualHelpTrigger;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
export {$726fb1b478e356bf$export$5413b169fff83e61 as ContextualHelpTrigger};
|
|
187
|
-
//# sourceMappingURL=ContextualHelpTrigger.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AA8BD,SAAS,4CAAsB,KAAqC;IAClE,IAAI,iBAAC,gBAAgB,kBAAO,SAAS,EAAC,GAAG;IAEzC,IAAI,aAAa,CAAA,GAAA,aAAK,EAAiB;IACvC,IAAI,aAAa,CAAA,GAAA,aAAK,EAAsC;IAC5D,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,wBAAE,oBAAoB,EAAE,MAAM,aAAa,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAkB;IAC/G,IAAI,sBAAsB,CAAA,GAAA,6BAAqB,EAAE;QAAC,YAAY;IAAS,GAAG;QAAC,GAAG,oBAAoB;QAAG,GAAG,KAAK;IAAA;IAC7G,IAAI,aAAa,CAAA,GAAA,mBAAW,EAAE;IAC9B,IAAI,uBAAC,mBAAmB,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;uBAC1D;oBACA;QACA,MAAM;QACN,YAAY,CAAC;IACf,GAAG,qBAAqB;IACxB,IAAI,WAAW,CAAA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B;IAC1F,IAAI,aAA6B,EAAE;IACnC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,CAAA;QACrC,kBAAI,CAAA,GAAA,YAAI,EAAE,cAAc,CAAC,QACvB,WAAW,IAAI,CAAC;IAEpB;IACA,IAAI,CAAC,QAAQ,GAAG;IAChB,IAAI,GAAG,QAAQ,GAAG,MAAM,QAAQ;IAEhC,MAAM;QACJ,uBAAS,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,SAAS;YAAC,GAAG,QAAQ,KAAK;YAAS,eAAe;YAAM,WAAW;QAAI;QACnG,SAAS,CAAC,wBACR,gCAAC;gBAAsB,KAAK,QAAQ,GAAG;gBAAE,WAAW,QAAQ,GAAG;gBAAG,GAAG,KAAK;eACvE,SACA;IAGP;AACF;AAEA,IAAI,4CAAQ","sources":["packages/@react-spectrum/menu/src/ContextualHelpTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {classNames, SlotProvider, unwrapDOMRef, useIsMobileDevice} from '@react-spectrum/utils';\nimport {DOMRefValue, ItemProps, Key} from '@react-types/shared';\nimport {FocusScope} from '@react-aria/focus';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport helpStyles from '@adobe/spectrum-css-temp/components/contextualhelp/vars.css';\nimport {isFocusWithin, nodeContains} from '@react-aria/utils';\nimport {Popover} from '@react-spectrum/overlays';\nimport React, {JSX, KeyboardEventHandler, ReactElement, useEffect, useRef, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {SubmenuTriggerContext, useMenuStateContext} from './context';\nimport {TrayHeaderWrapper} from './Menu';\nimport {useSubmenuTrigger} from '@react-aria/menu';\nimport {useSubmenuTriggerState} from '@react-stately/menu';\n\ninterface MenuDialogTriggerProps {\n /** Whether the menu item is currently unavailable. */\n isUnavailable?: boolean,\n /** The triggering Item and the Dialog, respectively. */\n children: [ReactElement, ReactElement]\n}\n\ninterface InternalMenuDialogTriggerProps extends MenuDialogTriggerProps {\n targetKey: Key\n}\n\nexport interface SpectrumMenuDialogTriggerProps extends MenuDialogTriggerProps {}\n\nfunction ContextualHelpTrigger(props: InternalMenuDialogTriggerProps): ReactElement {\n let {isUnavailable = false, targetKey} = props;\n\n let triggerRef = useRef<HTMLLIElement>(null);\n let popoverRef = useRef<DOMRefValue<HTMLDivElement> | null>(null);\n let {popoverContainer, trayContainerRef, rootMenuTriggerState, menu: parentMenuRef, state} = useMenuStateContext()!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: targetKey}, {...rootMenuTriggerState!, ...state});\n let submenuRef = unwrapDOMRef(popoverRef);\n let {submenuTriggerProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n type: 'dialog',\n isDisabled: !isUnavailable\n }, submenuTriggerState, triggerRef);\n let isMobile = useIsMobileDevice();\n let [traySubmenuAnimation, setTraySubmenuAnimation] = useState('');\n useEffect(() => {\n if (submenuTriggerState.isOpen) {\n setTraySubmenuAnimation('spectrum-TraySubmenu-enter');\n }\n }, [submenuTriggerState.isOpen]);\n let slots = {};\n if (isUnavailable) {\n slots = {\n dialog: {\n UNSAFE_className: classNames(\n helpStyles,\n 'react-spectrum-ContextualHelp-dialog',\n {\n 'react-spectrum-ContextualHelp-dialog--isMobile': isMobile\n },\n classNames(\n styles,\n {\n 'spectrum-Menu-subdialog': !isMobile,\n [traySubmenuAnimation]: isMobile\n }\n )\n )\n },\n content: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-content']},\n footer: {UNSAFE_className: helpStyles['react-spectrum-ContextualHelp-footer']}\n };\n }\n let [trigger] = React.Children.toArray(props.children);\n let [, content] = props.children as [ReactElement, ReactElement];\n\n let onBlurWithin = (e) => {\n if (e.relatedTarget && popoverRef.current && (!nodeContains(popoverRef.current.UNSAFE_getDOMNode(), e.relatedTarget) && !(e.relatedTarget === triggerRef.current && getInteractionModality() === 'pointer'))) {\n if (submenuTriggerState.isOpen) {\n submenuTriggerState.close();\n }\n }\n };\n\n let overlay;\n let tray;\n let onBackButtonPress = () => {\n setTraySubmenuAnimation('spectrum-TraySubmenu-exit');\n setTimeout(() => {\n submenuTriggerState.close();\n if (parentMenuRef.current && !isFocusWithin(parentMenuRef.current)) {\n parentMenuRef.current.focus();\n }\n }, 220); // Matches transition duration\n };\n\n if (isMobile) {\n delete submenuTriggerProps.onBlur;\n delete submenuTriggerProps.onHoverChange;\n if (trayContainerRef.current && submenuTriggerState.isOpen) {\n let subDialogKeyDown: KeyboardEventHandler = (e) => {\n switch (e.key) {\n case 'Escape':\n e.stopPropagation();\n onBackButtonPress();\n break;\n }\n };\n\n tray = (\n <TrayHeaderWrapper\n isSubmenu\n parentMenuTreeState={state}\n rootMenuTriggerState={rootMenuTriggerState}\n wrapperKeyDown={subDialogKeyDown}\n onBackButtonPress={onBackButtonPress}>\n {content}\n </TrayHeaderWrapper>\n );\n\n overlay = ReactDOM.createPortal(tray, trayContainerRef.current);\n }\n } else {\n let onDismissButtonPress = () => {\n submenuTriggerState.close();\n parentMenuRef.current?.focus();\n };\n\n overlay = (\n <Popover\n {...popoverProps}\n UNSAFE_style={{clipPath: 'unset', overflow: 'visible', filter: 'unset', borderWidth: '0px'}}\n UNSAFE_className={classNames(styles, 'spectrum-Submenu-popover')}\n onDismissButtonPress={onDismissButtonPress}\n onBlurWithin={onBlurWithin}\n container={popoverContainer!}\n state={submenuTriggerState}\n ref={popoverRef}\n triggerRef={triggerRef}\n placement=\"end top\"\n containerPadding={0}\n hideArrow\n enableBothDismissButtons>\n <FocusScope restoreFocus contain>\n {content}\n </FocusScope>\n </Popover>\n );\n }\n\n return (\n <>\n <SubmenuTriggerContext.Provider value={{isUnavailable, triggerRef, ...submenuTriggerProps}}>{trigger}</SubmenuTriggerContext.Provider>\n <SlotProvider slots={slots}>\n {submenuTriggerState.isOpen && overlay}\n </SlotProvider>\n </>\n );\n}\n\nContextualHelpTrigger.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>) {\n let childArray: ReactElement[] = [];\n React.Children.forEach(props.children, child => {\n if (React.isValidElement(child)) {\n childArray.push(child);\n }\n });\n let [trigger] = childArray;\n let [, content] = props.children as [ReactElement, ReactElement];\n\n yield {\n element: React.cloneElement(trigger, {...trigger.props as any, hasChildItems: true, isTrigger: true}),\n wrapper: (element) => (\n <ContextualHelpTrigger key={element.key} targetKey={element.key} {...props}>\n {element}\n {content}\n </ContextualHelpTrigger>\n )\n };\n};\n\nlet _Item = ContextualHelpTrigger as unknown as (props: SpectrumMenuDialogTriggerProps) => JSX.Element;\nexport {_Item as ContextualHelpTrigger};\n"],"names":[],"version":3,"file":"ContextualHelpTrigger.module.js.map"}
|