@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
118 lines (117 loc) • 5.66 kB
TypeScript
import { Direction, ThemeProps, WithoutThemeProps } from "../../core/system/index.types.js";
import { Component, GenericsComponent, HTMLProps, HTMLStyledProps } from "../../core/components/index.types.js";
import "../../core/index.js";
import { PopoverAnchorProps, PopoverContentProps, PopoverRootProps, PopoverTriggerProps } from "../popover/popover.js";
import { MenuStyle } from "./menu.style.js";
import { MenuOptionGroupType, MenuOptionGroupValue, UseMenuGroupProps, UseMenuItemProps, UseMenuOptionGroupProps, UseMenuOptionItemProps, UseMenuProps } from "./use-menu.js";
import "../../index.js";
import * as react817 from "react";
import { FC, ReactElement, ReactNode } from "react";
//#region src/components/menu/menu.d.ts
interface MenuSharedItem {
label?: ReactNode;
}
interface MenuItemWithValue extends MenuSharedItem, MenuItemProps {}
interface MenuOptionItem extends MenuSharedItem, MenuOptionItemProps {}
interface MenuItemWithSeparator extends MenuSeparatorProps {
type: "separator";
}
interface MenuItemWithRadioGroup<Y extends string = string> extends Omit<MenuItemWithItems, "defaultValue" | "items" | "onChange">, MenuOptionGroupProps<"radio", Y> {
type: "radio";
items?: MenuOptionItem[];
}
interface MenuItemWithCheckboxGroup<Y extends string[] = string[]> extends Omit<MenuItemWithItems, "defaultValue" | "items" | "onChange">, MenuOptionGroupProps<"checkbox", Y> {
type: "checkbox";
items?: MenuOptionItem[];
}
interface MenuItemWithItems extends MenuSharedItem, MenuGroupProps {
hasEndSeparator?: boolean;
hasSeparator?: boolean;
hasStartSeparator?: boolean;
items?: MenuItemWithValue[];
labelProps?: MenuLabelProps;
}
type MenuItem = MenuItemWithCheckboxGroup | MenuItemWithItems | MenuItemWithRadioGroup | MenuItemWithSeparator | MenuItemWithValue;
interface MenuRootProps extends UseMenuProps, Omit<WithoutThemeProps<PopoverRootProps, MenuStyle>, "autoFocus" | "modal" | "updateRef" | "withCloseButton">, ThemeProps<MenuStyle> {
/**
* The placement of the popper relative to its reference.
*
* @default 'end-start'
*/
placement?: Direction;
}
declare const MenuPropsContext: react817.Context<Partial<MenuRootProps> | undefined>, useMenuPropsContext: () => Partial<MenuRootProps> | undefined;
/**
* `Menu` is a component that displays a common dropdown menu.
*
* @see https://yamada-ui.com/docs/components/menu
*/
declare const MenuRoot: FC<MenuRootProps>;
interface MenuTriggerProps extends PopoverTriggerProps {}
declare const MenuTrigger: Component<"button", MenuTriggerProps>;
interface MenuContextTriggerProps extends HTMLProps {}
declare const MenuContextTrigger: Component<"div", MenuContextTriggerProps>;
interface MenuAnchorProps extends PopoverAnchorProps {}
declare const MenuAnchor: Component<"div", MenuAnchorProps>;
interface MenuContentProps extends PopoverContentProps {
/**
* The footer of the menu.
*/
footer?: ReactNode;
/**
* The header of the menu.
*/
header?: ReactNode;
/**
* If provided, generate elements based on items.
*/
items?: MenuItem[];
/**
* Props for the footer component.
*/
footerProps?: MenuFooterProps;
/**
* Props for the header component.
*/
headerProps?: MenuHeaderProps;
}
declare const MenuContent: Component<"div", MenuContentProps>;
interface MenuHeaderProps extends HTMLStyledProps {}
declare const MenuHeader: Component<"div", MenuHeaderProps>;
interface MenuFooterProps extends HTMLStyledProps {}
declare const MenuFooter: Component<"div", MenuFooterProps>;
interface MenuLabelProps extends HTMLStyledProps<"span"> {}
declare const MenuLabel: Component<"span", MenuLabelProps>;
interface MenuGroupProps extends UseMenuGroupProps, HTMLStyledProps {
/**
* The label of the group.
*/
label?: ReactNode;
/**
* Props for the label component.
*/
labelProps?: MenuLabelProps;
}
declare const MenuGroup: Component<"div", MenuGroupProps>;
interface MenuOptionGroupProps<Y extends MenuOptionGroupType = "checkbox", M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>> extends UseMenuOptionGroupProps<Y, M>, Omit<MenuGroupProps, "defaultValue" | "onChange"> {}
declare const MenuOptionGroup: GenericsComponent<{
<Y extends MenuOptionGroupType = "checkbox", M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>>(props: MenuOptionGroupProps<Y, M>): ReactElement;
}>;
interface MenuItemProps extends HTMLStyledProps, UseMenuItemProps {}
declare const MenuItem: Component<"div", MenuItemProps>;
interface MenuOptionItemProps extends HTMLStyledProps, UseMenuOptionItemProps {
/**
* The icon to be used in the menu option item.
*/
icon?: ReactNode;
}
declare const MenuOptionItem: Component<"div", MenuOptionItemProps>;
interface MenuIndicatorProps extends HTMLStyledProps {}
declare const MenuIndicator: Component<"div", MenuIndicatorProps>;
interface MenuCommandProps extends HTMLStyledProps<"kbd"> {}
declare const MenuCommand: Component<"kbd", MenuCommandProps>;
interface MenuSeparatorProps extends HTMLStyledProps<"hr"> {}
declare const MenuSeparator: Component<"hr", MenuSeparatorProps>;
//#endregion
export { MenuAnchor, MenuAnchorProps, MenuCommand, MenuCommandProps, MenuContent, MenuContentProps, MenuContextTrigger, MenuContextTriggerProps, MenuFooter, MenuFooterProps, MenuGroup, MenuGroupProps, MenuHeader, MenuHeaderProps, MenuIndicator, MenuIndicatorProps, MenuItem, MenuItemProps, MenuLabel, MenuLabelProps, MenuOptionGroup, MenuOptionGroupProps, MenuOptionItem, MenuOptionItemProps, MenuPropsContext, MenuRoot, MenuRootProps, MenuSeparator, MenuSeparatorProps, MenuTrigger, MenuTriggerProps, useMenuPropsContext };
//# sourceMappingURL=menu.d.ts.map