@mongodb-js/compass-context-menu 0.3.15 → 0.3.17
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ContextMenuContextType, ContextMenuItemGroup, ContextMenuState } from './types';
|
|
3
3
|
export declare const ContextMenuContext: React.Context<ContextMenuContextType | null>;
|
|
4
|
-
export declare function ContextMenuProvider({
|
|
5
|
-
disabled?: boolean;
|
|
4
|
+
export declare function ContextMenuProvider({ children, menuWrapper: Wrapper, onContextMenuOpen, }: {
|
|
6
5
|
children: React.ReactNode;
|
|
7
6
|
menuWrapper: React.ComponentType<{
|
|
8
7
|
menu: ContextMenuState & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu-provider.d.ts","sourceRoot":"","sources":["../src/context-menu-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"context-menu-provider.d.ts","sourceRoot":"","sources":["../src/context-menu-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,kBAAkB,8CAE9B,CAAC;AAMF,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,WAAW,EAAE,OAAO,EACpB,iBAAiB,GAClB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC;QAC/B,IAAI,EAAE,gBAAgB,GAAG;YAAE,KAAK,EAAE,MAAM,IAAI,CAAA;SAAE,CAAC;KAChD,CAAC,CAAC;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,IAAI,CAAC;CAClE,qBAqGA"}
|
|
@@ -42,7 +42,7 @@ exports.ContextMenuContext = (0, react_1.createContext)(null);
|
|
|
42
42
|
const contextMenuContainerStyles = {
|
|
43
43
|
display: 'contents',
|
|
44
44
|
};
|
|
45
|
-
function ContextMenuProvider({
|
|
45
|
+
function ContextMenuProvider({ children, menuWrapper: Wrapper, onContextMenuOpen, }) {
|
|
46
46
|
// Check if there's already a parent context menu provider
|
|
47
47
|
const parentContext = (0, react_1.useContext)(exports.ContextMenuContext);
|
|
48
48
|
const containerRef = (0, react_1.useRef)(null);
|
|
@@ -66,7 +66,7 @@ function ContextMenuProvider({ disabled = false, children, menuWrapper: Wrapper,
|
|
|
66
66
|
(0, react_1.useEffect)(() => {
|
|
67
67
|
// We skip registering listeners when parentContext is known to avoid registering multiple (nested) listeners
|
|
68
68
|
const { current: container } = containerRef;
|
|
69
|
-
if (parentContext ||
|
|
69
|
+
if (parentContext || !container)
|
|
70
70
|
return;
|
|
71
71
|
function handleContextMenu(event) {
|
|
72
72
|
const itemGroups = (0, context_menu_content_1.getContextMenuContent)(event);
|
|
@@ -99,13 +99,7 @@ function ContextMenuProvider({ disabled = false, children, menuWrapper: Wrapper,
|
|
|
99
99
|
capture: true,
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
-
}, [
|
|
103
|
-
disabled,
|
|
104
|
-
containerRef,
|
|
105
|
-
handleClosingEvent,
|
|
106
|
-
onContextMenuOpenRef,
|
|
107
|
-
parentContext,
|
|
108
|
-
]);
|
|
102
|
+
}, [containerRef, handleClosingEvent, onContextMenuOpenRef, parentContext]);
|
|
109
103
|
const value = (0, react_1.useMemo)(() => ({
|
|
110
104
|
close,
|
|
111
105
|
}), [close]);
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"email": "compass@mongodb.com"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/mongodb-js/compass",
|
|
16
|
-
"version": "0.3.
|
|
16
|
+
"version": "0.3.17",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "https://github.com/mongodb-js/compass.git"
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"react": "^
|
|
53
|
+
"react": "^18.3.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@mongodb-js/eslint-config-compass": "^1.4.
|
|
57
|
-
"@mongodb-js/mocha-config-compass": "^1.8.
|
|
56
|
+
"@mongodb-js/eslint-config-compass": "^1.4.27",
|
|
57
|
+
"@mongodb-js/mocha-config-compass": "^1.8.1",
|
|
58
58
|
"@mongodb-js/prettier-config-compass": "^1.2.9",
|
|
59
|
-
"@mongodb-js/testing-library-compass": "^1.
|
|
59
|
+
"@mongodb-js/testing-library-compass": "^1.7.1",
|
|
60
60
|
"@mongodb-js/tsconfig-compass": "^1.3.1",
|
|
61
61
|
"@types/chai": "^4.2.21",
|
|
62
62
|
"@types/mocha": "^9.0.0",
|
|
63
|
-
"@types/react": "^
|
|
63
|
+
"@types/react": "^18.3.31",
|
|
64
64
|
"@types/sinon-chai": "^3.2.5",
|
|
65
65
|
"chai": "^4.3.6",
|
|
66
66
|
"depcheck": "^1.4.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"sinon": "^9.2.3",
|
|
71
71
|
"typescript": "^6.0.3"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "13069dd486790839d988fbef8ff12c1056fa86c8"
|
|
74
74
|
}
|