@primer/react
Version:
An implementation of GitHub's Primer Design System using React
56 lines (55 loc) • 1.94 kB
TypeScript
import { ItemProps } from "./ActionList/Item.js";
import { GroupedListProps, ListPropsBase } from "./ActionList/List.js";
import { Divider } from "./ActionList/Divider.js";
import { AnchoredOverlayWrapperAnchorProps } from "../AnchoredOverlay/AnchoredOverlay.js";
import { OverlayProps } from "../Overlay/Overlay.js";
import React, { JSX } from "react";
//#region src/deprecated/ActionMenu.d.ts
interface ActionMenuBaseProps extends Partial<Omit<GroupedListProps, keyof ListPropsBase>>, ListPropsBase {
/**
* Content that is passed into the renderAnchor component, which is a button by default.
*/
anchorContent?: React.ReactNode;
/**
* A callback that triggers both on clicks and keyboard events. This callback will be overridden by item level `onAction` callbacks.
*/
onAction?: (props: ItemProps, event?: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) => void;
/**
* If defined, will control the open/closed state of the overlay. Must be used in conjuction with `setOpen`.
*/
open?: boolean;
/**
* If defined, will control the open/closed state of the overlay. Must be used in conjuction with `open`.
*/
setOpen?: (s: boolean) => void;
/**
* Props to be spread on the internal `Overlay` component.
*/
overlayProps?: Partial<OverlayProps>;
}
type ActionMenuProps = ActionMenuBaseProps & AnchoredOverlayWrapperAnchorProps;
/**
* @deprecated Use ActionMenu with composable API instead. See https://primer.style/react/ActionMenu for more details.
*/
declare const ActionMenu: {
({
anchorContent,
renderAnchor,
anchorRef: externalAnchorRef,
onAction,
open,
setOpen,
overlayProps,
items,
...listProps
}: ActionMenuProps): JSX.Element;
displayName: string;
} & {
Divider: typeof Divider;
Item: {
(props: ItemProps): JSX.Element;
displayName: string;
};
};
//#endregion
export { ActionMenu, ActionMenuProps };