UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

215 lines • 9.11 kB
import * as React from 'react'; import { SystemIconProps } from '@workday/canvas-kit-react/icon'; export interface MenuItemProps { /** * Optionally pass index to menu item. This should be done if `Menu.Item` components were created * via a `Array::map` function. This index will ensure keyboard navigation works even if items are * inserted out of order. */ index?: number; /** * The label text of the MenuItem. */ children?: React.ReactNode; /** * The name of the menu item. This name will be used in the `onSelect` callback in the model. If * this property is not provided, it will default to a string representation of the the zero-based * index of the Tab when it was initialized. */ 'data-id'?: string; /** * `aria-disabled` is used for keyboard and screen reader users to discover disabled content with * the keyboard or screen reader caret tool. For more information, see * https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_disabled_controls */ 'aria-disabled'?: boolean; /** * If true, set the StyledMenuItem to the disabled state so it is not clickable. * @default false * @deprecated Use `aria-disabled` instead */ isDisabled?: boolean; } export declare const menuItemStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {}, never>, {}, {}, never, never>; export declare const StyledMenuItem: import("@workday/canvas-kit-react/common").ElementComponent<"button", MenuItemProps>; export declare const useMenuItem: import("@workday/canvas-kit-react/common").BehaviorHook<{ state: { stackRef: React.RefObject<HTMLDivElement>; targetRef: React.RefObject<HTMLButtonElement>; initialFocusRef: React.RefObject<any> | undefined; returnFocusRef: React.RefObject<any> | undefined; placement: import("@popperjs/core").Placement; id: string; visibility: "hidden" | "visible"; selectedIds: string[] | "all"; unselectedIds: string[]; cursorId: string; columnCount: number; pageSizeRef: React.MutableRefObject<number>; cursorIndexRef: { readonly current: number; }; UNSTABLE_virtual: { virtualItems: import("@workday/canvas-kit-react/collection").VirtualItem[]; totalSize: number; scrollToOffset: (index: number, options?: import("@workday/canvas-kit-react/collection").ScrollToOffsetOptions | undefined) => void; scrollToIndex: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToIndexOptions | undefined) => void; measure: () => void; }; UNSTABLE_defaultItemHeight: number; containerRef: React.RefObject<HTMLDivElement>; orientation: "horizontal" | "vertical"; indexRef: React.MutableRefObject<number>; nonInteractiveIds: string[]; isVirtualized: boolean; items: import("@workday/canvas-kit-react/collection").Item<any>[]; mode: "multiple" | "single"; }; events: { updatePlacement(data: { placement: import("@popperjs/core").Placement; }): void; show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void; hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void; select(data: { id: string; }): void; selectAll(): void; unselectAll(): void; setSelectedIds(ids: string[] | "all"): void; remove(data: { id: string; nextId?: string | undefined; event?: Event | React.SyntheticEvent<Element, Event> | undefined; }): void; goTo(data: { id: string; }): void; goToNext(): void; goToPrevious(): void; goToPreviousRow(): void; goToNextRow(): void; goToFirst(): void; goToLast(): void; goToFirstOfRow(): void; goToLastOfRow(): void; goToNextPage(): void; goToPreviousPage(): void; registerItem(data: { id: string; textValue: string; }): void; unregisterItem(data: { id: string; }): void; updateItemHeight(data: { value: number; }): void; }; selection: import("@workday/canvas-kit-react/collection").SelectionManager; navigation: import("@workday/canvas-kit-react/collection").NavigationManager; getId: (item: any) => string; }, import("@workday/canvas-kit-react/common").RemoveNulls<import("@workday/canvas-kit-react/common").MergeProps<{ readonly ref: (instance: HTMLElement | null) => void; readonly role: "menuitem"; readonly onClick: ((event: React.SyntheticEvent) => void) | undefined; }, import("@workday/canvas-kit-react/common").MergeProps<{ readonly onClick: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void; }, import("@workday/canvas-kit-react/common").MergeProps<{ readonly onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void; readonly onClick: () => void; readonly 'data-focus-id': `${string}-${string}` | `${string}-undefined`; readonly tabIndex: 0 | -1; }, import("@workday/canvas-kit-react/common").MergeProps<{ readonly ref: (instance: HTMLElement | null) => void; readonly 'data-id': string; readonly disabled: true | undefined; readonly item: null; readonly virtual: null; readonly 'aria-setsize': number | undefined; readonly 'aria-posinset': number | undefined; readonly style: React.CSSProperties; readonly id: string; }, import("@workday/canvas-kit-react/common").MergeProps<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, {}>>>>>>>>; export declare const MenuItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", MenuItemProps, { state: { stackRef: React.RefObject<HTMLDivElement>; targetRef: React.RefObject<HTMLButtonElement>; initialFocusRef: React.RefObject<any> | undefined; returnFocusRef: React.RefObject<any> | undefined; placement: import("@popperjs/core").Placement; id: string; visibility: "hidden" | "visible"; selectedIds: string[] | "all"; unselectedIds: string[]; cursorId: string; columnCount: number; pageSizeRef: React.MutableRefObject<number>; cursorIndexRef: { readonly current: number; }; UNSTABLE_virtual: { virtualItems: import("@workday/canvas-kit-react/collection").VirtualItem[]; totalSize: number; scrollToOffset: (index: number, options?: import("@workday/canvas-kit-react/collection").ScrollToOffsetOptions | undefined) => void; scrollToIndex: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToIndexOptions | undefined) => void; measure: () => void; }; UNSTABLE_defaultItemHeight: number; containerRef: React.RefObject<HTMLDivElement>; orientation: "horizontal" | "vertical"; indexRef: React.MutableRefObject<number>; nonInteractiveIds: string[]; isVirtualized: boolean; items: import("@workday/canvas-kit-react/collection").Item<any>[]; mode: "multiple" | "single"; }; events: { updatePlacement(data: { placement: import("@popperjs/core").Placement; }): void; show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void; hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void; select(data: { id: string; }): void; selectAll(): void; unselectAll(): void; setSelectedIds(ids: string[] | "all"): void; remove(data: { id: string; nextId?: string | undefined; event?: Event | React.SyntheticEvent<Element, Event> | undefined; }): void; goTo(data: { id: string; }): void; goToNext(): void; goToPrevious(): void; goToPreviousRow(): void; goToNextRow(): void; goToFirst(): void; goToLast(): void; goToFirstOfRow(): void; goToLastOfRow(): void; goToNextPage(): void; goToPreviousPage(): void; registerItem(data: { id: string; textValue: string; }): void; unregisterItem(data: { id: string; }): void; updateItemHeight(data: { value: number; }): void; }; selection: import("@workday/canvas-kit-react/collection").SelectionManager; navigation: import("@workday/canvas-kit-react/collection").NavigationManager; getId: (item: any) => string; }> & { Icon: (elemProps: SystemIconProps) => React.JSX.Element; Text: ({ children }: React.PropsWithChildren) => React.JSX.Element; }; //# sourceMappingURL=MenuItem.d.ts.map