UNPKG

@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.

78 lines 3.56 kB
import * as React from 'react'; import { DeprecatedMenuItemProps } from './MenuItem'; import { GrowthBehavior } from '@workday/canvas-kit-react/common'; /** * @deprecated ⚠️ `DeprecatedMenuProps` 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 DeprecatedMenuProps extends GrowthBehavior, React.HTMLAttributes<HTMLUListElement> { /** * The DeprecatedMenuItem children of the DeprecatedMenu (must be at least one). Also accepts other components which share the same interface as `DeprecatedMenuItem`. */ children?: React.ReactElement<DeprecatedMenuItemProps> | React.ReactElement<DeprecatedMenuItemProps>[]; /** * If true, set the DeprecatedMenu to the open state. Useful for showing and hiding the DeprecatedMenu from a parent component such as a menu button. * @default true */ isOpen?: boolean; /** * The width of the DeprecatedMenu. If no value is provided, the DeprecatedMenu will collapse around its content. */ width?: number | string; /** * The function called when a menu item is selected. */ onSelect?: () => void; /** * The function called when the DeprecatedMenu should close. This is called after a menu item is selected or if the escape shortcut key is used. This will not fire if the menu item sets `shouldClose` to false. */ onClose?: () => void; /** * The zero-based index of the menu item which should initially receive focus. */ initialSelectedItem?: number; /** * The unique id of the DeprecatedMenu used for ARIA and HTML `id` attributes. */ id?: string; /** * The HTML `id` of the element that labels the DeprecatedMenu. Often used with menu buttons. */ 'aria-labelledby'?: string; } /** * * @deprecated ⚠️ `DeprecatedMenuState` 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 DeprecatedMenuState { selectedItemIndex: number; } /** * `DeprecatedMenu` renders a styled `<ul role="menu">` element within a {@link Card} and follows * the [Active Menu * pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html) * using `aria-activedescendant`. * * Undocumented props are spread to the underlying `<ul>` element. * * @deprecated ⚠️ Deprecated Menu 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 DeprecatedMenu extends React.Component<DeprecatedMenuProps, DeprecatedMenuState> { private id; private animateId; private menuRef; private firstCharacters; constructor(props: DeprecatedMenuProps); componentDidUpdate(prevProps: DeprecatedMenuProps): void; componentDidMount(): void; componentWillUnmount(): void; render(): React.JSX.Element; getNormalizedItemIndex: (index: number | undefined) => number; setNormalizedItemIndex: (index: number | undefined) => void; private handleKeyboardShortcuts; private handleClick; private getIndexFirstChars; private setFirstCharacters; private getInitialSelectedItem; private setInitialSelectedItem; } //# sourceMappingURL=Menu.d.ts.map