@workday/canvas-kit-preview-react
Version:
Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.
75 lines • 3.35 kB
TypeScript
import * as React from 'react';
import { CanvasSystemIcon } from '@workday/design-assets-types';
/**
* @deprecated ⚠️ `DeprecatedMenuItemProps` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
*/
export interface DeprecatedMenuItemProps extends React.LiHTMLAttributes<HTMLLIElement> {
/**
* The function called when the DeprecatedMenuItem is clicked. If the item is a child of the DeprecatedMenu component, this callback will be decorated with the onSelect and onClose DeprecatedMenu callbacks. This callback will not fire if the item is disabled (see below).
*/
onClick?: (event: React.MouseEvent) => void;
/**
* The unique id for the DeprecatedMenuItem used for ARIA attributes. If the item is a child of the `DeprecatedMenu` component, this property will be generated and overridden.
*/
id?: string;
/**
* The icon of the DeprecatedMenuItem. This icon is displayed before what you supplied for the children.
*/
icon?: CanvasSystemIcon;
/**
* The secondary icon of the DeprecatedMenuItem. This icon is displayed after what you supplied for the children.
*/
secondaryIcon?: CanvasSystemIcon;
/**
* If true, render a top border on the DeprecatedMenuItem.
* @default false
*/
hasDivider?: boolean;
/**
* If true, render a header to group data, this menu item will not be intractable.
* @default false
*/
isHeader?: boolean;
/**
* If true, set the DeprecatedMenuItem to the disabled state so it is not clickable.
* @default false
*/
isDisabled?: boolean;
/**
* If true, set the DeprecatedMenuItem to be the currently selected item. If the item is a child of the DeprecatedMenu component, this property will be generated and overridden.
* @default false
*/
isFocused?: boolean;
/**
* The role of the DeprecatedMenuItem. Use this to override the role of the item (e.g. you can use this element as an option in a Combobox).
* @default menuItem
*/
role?: string;
/**
* If true, allow the onClose DeprecatedMenu callback to be fired after the DeprecatedMenuItem has been clicked.
* @default true
*/
shouldClose?: boolean;
}
/**
* `DeprecatedMenuItem` renders an `<li>` element with the correct attributes to ensure it is
* accessible. If you choose to implement your own custom menu items, be sure to use semantic `<li>`
* elements with the following attributes:
*
* - `role="menuitem"`
* - `tabindex={-1}`
* - `id`s following this pattern: `${MenuId}-${index}`
*
* Undocumented props are spread to the underlying `<li>` element.
*
* @deprecated ⚠️ `DeprecatedMenuItem` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
*
*/
export declare class DeprecatedMenuItem extends React.Component<DeprecatedMenuItemProps> {
ref: React.RefObject<HTMLLIElement>;
componentDidMount(): void;
componentDidUpdate: (prevProps: DeprecatedMenuItemProps) => void;
render(): React.JSX.Element;
private handleClick;
}
//# sourceMappingURL=MenuItem.d.ts.map