@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
204 lines • 8.78 kB
TypeScript
import * as React from 'react';
import { SystemIconProps } from '@workday/canvas-kit-react/icon';
export interface MenuOptionProps {
/**
* 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 MenuOption.
*/
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;
}
export declare const menuOptionStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {}, never>, {}, {}, import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {}, never>, {}, {}, never, never>, never>;
export declare const StyledMenuOption: import("@workday/canvas-kit-react/common").ElementComponent<"button", MenuOptionProps>;
export declare const useMenuOption: 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 role: "option";
readonly 'aria-selected': boolean;
readonly onMouseDown: (event: React.MouseEvent<HTMLElement>) => void;
}, import("@workday/canvas-kit-react/common").MergeProps<{
readonly className: "" | "focus";
}, 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<{}, import("@workday/canvas-kit-react/common").MergeProps<{}, {}>>>>>>>>;
export declare const MenuOption: import("@workday/canvas-kit-react/common").ElementComponentM<"li", MenuOptionProps, {
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=MenuOption.d.ts.map