@primer/react
Version:
An implementation of GitHub's Primer Design System using React
117 lines • 3.98 kB
TypeScript
import React from 'react';
import { type ActionListItemProps } from '../ActionList';
import type { IconButtonProps } from '../Button';
type Size = 'small' | 'medium' | 'large';
type A11yProps = {
/** When provided, a label is added to the action bar */
'aria-label': React.AriaAttributes['aria-label'];
'aria-labelledby'?: undefined;
} | {
'aria-label'?: undefined;
/**
* When provided, uses the element with that ID as the accessible name for the ActionBar
*/
'aria-labelledby': React.AriaAttributes['aria-labelledby'];
};
type GapScale = 'none' | 'condensed';
export type ActionBarProps = {
/**
* Size of the action bar
* @default 'medium'
* */
size?: Size;
/** Buttons in the action bar */
children: React.ReactNode;
/**
* Allows ActionBar to be flush with the container
* @default false
* */
flush?: boolean;
/** Custom className */
className?: string;
/**
* Horizontal gap scale between items (mirrors Stack gap scale)
* @default 'condensed'
*/
gap?: GapScale;
} & A11yProps;
export type ActionBarIconButtonProps = {
disabled?: boolean;
} & IconButtonProps;
export type ActionBarMenuItemProps = ({
/**
* Type of menu item to be rendered in the menu (action | group).
* Defaults to 'action' if not specified.
*/
type?: 'action';
/**
* Whether the menu item is disabled.
* All interactions will be prevented if true.
*/
disabled?: boolean;
/**
* Leading visual rendered for the menu item.
*/
leadingVisual?: ActionBarIconButtonProps['icon'];
/**
* Trailing visual rendered for the menu item.
*/
trailingVisual?: ActionBarIconButtonProps['icon'] | string;
/**
* Label for the menu item.
*/
label: string;
/**
* Callback fired when the menu item is selected.
*/
onClick?: ActionListItemProps['onSelect'];
/**
* Nested menu items to render within a submenu.
* If provided, the menu item will render a submenu.
*/
items?: ActionBarMenuItemProps[];
} & Pick<ActionListItemProps, 'variant'>) | {
type: 'divider';
};
export type ActionBarMenuProps = {
/** Accessible label for the menu button */
'aria-label': string;
/** Icon for the menu button */
icon: ActionBarIconButtonProps['icon'];
items: ActionBarMenuItemProps[];
/**
* Icon displayed when the menu item is overflowing.
* If 'none' is provided, no icon will be shown in the overflow menu.
*/
overflowIcon?: ActionBarIconButtonProps['icon'] | 'none';
} & IconButtonProps;
export declare const ActionBar: React.FC<React.PropsWithChildren<ActionBarProps>>;
export declare const ActionBarIconButton: React.ForwardRefExoticComponent<ActionBarIconButtonProps & React.RefAttributes<unknown>>;
export declare const ActionBarGroup: React.ForwardRefExoticComponent<{
children?: React.ReactNode | undefined;
} & React.RefAttributes<unknown>>;
export declare const ActionBarMenu: React.ForwardRefExoticComponent<{
/** Accessible label for the menu button */
'aria-label': string;
/** Icon for the menu button */
icon: ActionBarIconButtonProps["icon"];
items: ActionBarMenuItemProps[];
/**
* Icon displayed when the menu item is overflowing.
* If 'none' is provided, no icon will be shown in the overflow menu.
*/
overflowIcon?: ActionBarIconButtonProps["icon"] | "none";
} & {
'aria-label': string;
'aria-labelledby'?: undefined;
} & {
icon: React.ElementType;
unsafeDisableTooltip?: boolean;
description?: string;
tooltipDirection?: import("../TooltipV2").TooltipDirection;
keyshortcuts?: string;
keybindingHint?: string;
} & Omit<import("..").ButtonBaseProps, "aria-label" | "aria-labelledby"> & React.RefAttributes<unknown>>;
export declare const VerticalDivider: () => React.JSX.Element | null;
export {};
//# sourceMappingURL=ActionBar.d.ts.map