@octopusdeploy/design-system-components
Version:
The design systems component library.
83 lines (82 loc) • 2.35 kB
TypeScript
import type { ReactNode } from "react";
import type { DesignSystemLinkHref, ShowLinkAsActive } from "../../routing/OctopusRoutingContext";
export interface ButtonMenuItem {
type: "button";
label: string;
description?: string;
onClick: () => void;
title?: string;
isSelected?: boolean;
isDestructive?: boolean;
}
export interface IconButtonMenuItem {
type: "icon-button";
label: string;
onClick: () => void;
title?: string;
isSelected?: boolean;
icon?: JSX.Element;
disableClose?: boolean;
}
export interface InternalLinkMenuItem {
type: "internal-link";
label: string;
description?: string;
path: DesignSystemLinkHref;
showAsActive?: ShowLinkAsActive;
onClick?: () => void;
disableImplicitEventTracking?: boolean;
}
export interface ExternalLinkMenuItem {
type: "external-link";
label: string;
description?: string;
href: string;
onClick?: () => void;
}
export interface DownloadLinkMenuItem {
type: "download-link";
label: string;
description?: string;
href: string;
downloadFileName: string;
onClick?: () => void;
}
export interface ToggleMenuItem {
type: "toggle";
label: string;
isEnabled: boolean;
setIsEnabled: (isEnabled: boolean) => void;
}
export interface InformationMenuItem {
type: "information";
key?: string;
content: ReactNode;
}
export interface NestedMenuItems {
type: "nested-menu";
label: string;
children: SimpleMenuItem[];
}
export interface DisabledMenuItem {
type: "disabled";
label: string;
description?: string;
disableReason?: string;
}
export declare const dividerMenuItem: {
readonly type: "divider";
};
export type MenuItemDivider = typeof dividerMenuItem;
export type SimpleMenuItem = {
autoFocus?: boolean;
isVisible?: boolean;
} & (ButtonMenuItem | IconButtonMenuItem | InternalLinkMenuItem | ExternalLinkMenuItem | DownloadLinkMenuItem | NestedMenuItems | ToggleMenuItem | InformationMenuItem | MenuItemDivider | DisabledMenuItem);
interface SimpleMenuItemsProps {
items: SimpleMenuItem[];
compact?: boolean;
onClose?: () => void;
autoFocus?: boolean;
}
export declare const SimpleMenuItems: import("react").ForwardRefExoticComponent<SimpleMenuItemsProps & import("react").RefAttributes<unknown>>;
export {};