File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -5,18 +5,20 @@ import React, {
55 useMemo ,
66 createContext ,
77} from 'react' ;
8- import type { ContextMenuContext , ContextMenuState } from './types' ;
8+ import type { ContextMenuContextType , ContextMenuState } from './types' ;
99import type { EnhancedMouseEvent } from './context-menu-content' ;
1010import { getContextMenuContent } from './context-menu-content' ;
1111
12- export const Context = createContext < ContextMenuContext | null > ( null ) ;
12+ export const ContextMenuContext = createContext < ContextMenuContextType | null > (
13+ null
14+ ) ;
1315
1416export function ContextMenuProvider ( {
1517 children,
16- wrapper ,
18+ menuWrapper ,
1719} : {
1820 children : React . ReactNode ;
19- wrapper : React . ComponentType < {
21+ menuWrapper : React . ComponentType < {
2022 menu : ContextMenuState & { close : ( ) => void } ;
2123 } > ;
2224} ) {
@@ -73,12 +75,12 @@ export function ContextMenuProvider({
7375 [ close ]
7476 ) ;
7577
76- const Wrapper = wrapper ?? React . Fragment ;
78+ const Wrapper = menuWrapper ?? React . Fragment ;
7779
7880 return (
79- < Context . Provider value = { value } >
81+ < ContextMenuContext . Provider value = { value } >
8082 { children }
8183 < Wrapper menu = { { ...menu , close } } />
82- </ Context . Provider >
84+ </ ContextMenuContext . Provider >
8385 ) ;
8486}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export type ContextMenuWrapperProps = {
1616 menu : ContextMenuState & { close : ( ) => void } ;
1717} ;
1818
19- export type ContextMenuContext = {
19+ export type ContextMenuContextType = {
2020 close ( ) : void ;
2121} ;
2222
Original file line number Diff line number Diff line change 11import type { RefCallback } from 'react' ;
22import { useContext , useMemo , useRef } from 'react' ;
3- import { Context } from './context-menu-provider' ;
3+ import { ContextMenuContext } from './context-menu-provider' ;
44import { appendContextMenuContent } from './context-menu-content' ;
55import type { ContextMenuItem } from './types' ;
66
@@ -19,7 +19,7 @@ export type ContextMenuMethods<T extends ContextMenuItem> = {
1919export function useContextMenu <
2020 T extends ContextMenuItem = ContextMenuItem
2121> ( ) : ContextMenuMethods < T > {
22- const context = useContext ( Context ) ;
22+ const context = useContext ( ContextMenuContext ) ;
2323 const previous = useRef < null | [ HTMLElement , ( event : MouseEvent ) => void ] > (
2424 null
2525 ) ;
You can’t perform that action at this time.
0 commit comments