|
|
import { privateApis } from '@wordpress/components'; |
|
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; |
|
|
import { |
|
|
ForwardRefExoticComponent, |
|
|
Context, |
|
|
RefAttributes, |
|
|
HTMLAttributes, |
|
|
ReactNode, |
|
|
} from 'react'; |
|
|
import type { |
|
|
Props as MenuProps, |
|
|
ItemProps, |
|
|
TriggerButtonProps, |
|
|
PopoverProps, |
|
|
GroupProps, |
|
|
GroupLabelProps, |
|
|
RadioItemProps, |
|
|
CheckboxItemProps, |
|
|
SeparatorProps, |
|
|
ContextProps, |
|
|
} from '@wordpress/components/src/menu/types'; |
|
|
|
|
|
|
|
|
|
|
|
const { unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules( |
|
|
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', |
|
|
'@wordpress/components' |
|
|
); |
|
|
const { Menu: CoreMenu } = unlock( privateApis ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const Menu = Object.assign( CoreMenu as ( props: MenuProps ) => JSX.Element, { |
|
|
Context: Object.assign( CoreMenu.Context, { |
|
|
displayName: 'Menu.Context', |
|
|
} ) as Context< ContextProps | undefined >, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Item: Object.assign( CoreMenu.Item, { |
|
|
displayName: 'Menu.Item', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
ItemProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RadioItem: Object.assign( CoreMenu.RadioItem, { |
|
|
displayName: 'Menu.RadioItem', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
RadioItemProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CheckboxItem: Object.assign( CoreMenu.CheckboxItem, { |
|
|
displayName: 'Menu.CheckboxItem', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
CheckboxItemProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Group: Object.assign( CoreMenu.Group, { |
|
|
displayName: 'Menu.Group', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
GroupProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GroupLabel: Object.assign( CoreMenu.GroupLabel, { |
|
|
displayName: 'Menu.GroupLabel', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
GroupLabelProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
Separator: Object.assign( CoreMenu.Separator, { |
|
|
displayName: 'Menu.Separator', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
SeparatorProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemLabel: Object.assign( CoreMenu.ItemLabel, { |
|
|
displayName: 'Menu.ItemLabel', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
{ |
|
|
children: ReactNode; |
|
|
} & HTMLAttributes< HTMLSpanElement > & |
|
|
RefAttributes< HTMLSpanElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ItemHelpText: Object.assign( CoreMenu.ItemHelpText, { |
|
|
displayName: 'Menu.ItemHelpText', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
{ |
|
|
children: ReactNode; |
|
|
} & HTMLAttributes< HTMLSpanElement > & |
|
|
RefAttributes< HTMLSpanElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Popover: Object.assign( CoreMenu.Popover, { |
|
|
displayName: 'Menu.Popover', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
PopoverProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TriggerButton: Object.assign( CoreMenu.TriggerButton, { |
|
|
displayName: 'Menu.TriggerButton', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
TriggerButtonProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SubmenuTriggerItem: Object.assign( CoreMenu.SubmenuTriggerItem, { |
|
|
displayName: 'Menu.SubmenuTriggerItem', |
|
|
} ) as ForwardRefExoticComponent< |
|
|
ItemProps & HTMLAttributes< HTMLDivElement > & RefAttributes< HTMLDivElement > |
|
|
>, |
|
|
} ); |
|
|
|
|
|
export default Menu; |
|
|
|