113 lines
2.5 KiB
TypeScript
113 lines
2.5 KiB
TypeScript
import {
|
|
DropdownRoot,
|
|
DropdownTrigger,
|
|
DropdownPopover,
|
|
DropdownMenu,
|
|
DropdownSection,
|
|
DropdownItem,
|
|
DropdownItemIndicator,
|
|
DropdownSubmenuIndicator,
|
|
DropdownSubmenuTrigger,
|
|
Menu,
|
|
MenuItem,
|
|
MenuItemIndicator,
|
|
MenuItemSubmenuIndicator,
|
|
MenuSection,
|
|
type DropdownSubmenuTriggerProps,
|
|
type DropdownRootProps,
|
|
type DropdownMenuProps,
|
|
type DropdownItemProps,
|
|
type DropdownItemIndicatorProps,
|
|
type MenuRootProps,
|
|
type MenuItemProps,
|
|
type MenuItemIndicatorProps,
|
|
type MenuSectionProps,
|
|
type MenuKey,
|
|
type MenuSelectionMode,
|
|
} from "@heroui-vue/components";
|
|
|
|
const mode: MenuSelectionMode = "multiple";
|
|
const keys: MenuKey[] = ["a", 0, ""];
|
|
|
|
const root: DropdownRootProps = {
|
|
trigger: "longPress",
|
|
longPressDuration: 400,
|
|
modal: true,
|
|
dir: "rtl",
|
|
};
|
|
// @ts-expect-error unknown trigger mode
|
|
const badTrigger: DropdownRootProps = { trigger: "hover" };
|
|
|
|
const menu: MenuRootProps = {
|
|
selectionMode: mode,
|
|
selectedKeys: keys,
|
|
disabledKeys: ["b"],
|
|
};
|
|
// @ts-expect-error selectionMode must be none|single|multiple
|
|
const badMode: MenuRootProps = { selectionMode: "multiple2" };
|
|
|
|
const item: MenuItemProps = {
|
|
id: "a",
|
|
textValue: "A",
|
|
variant: "danger",
|
|
isDisabled: true,
|
|
closeOnSelect: false,
|
|
};
|
|
// @ts-expect-error variant is default|danger only
|
|
const badVariant: MenuItemProps = { variant: "primary" };
|
|
|
|
const indicator: MenuItemIndicatorProps = { type: "dot" };
|
|
// @ts-expect-error type is checkmark|dot
|
|
const badIndicator: MenuItemIndicatorProps = { type: "cross" };
|
|
|
|
const section: MenuSectionProps = {
|
|
selectionMode: "single",
|
|
selectedKeys: ["x"],
|
|
};
|
|
|
|
const dItem: DropdownItemProps = {
|
|
id: "x",
|
|
textValue: "X",
|
|
variant: "default",
|
|
};
|
|
const dInd: DropdownItemIndicatorProps = { type: "checkmark" };
|
|
const dMenu: DropdownMenuProps = { selectionMode: "none" };
|
|
|
|
export const parts = [
|
|
DropdownRoot,
|
|
DropdownTrigger,
|
|
DropdownPopover,
|
|
DropdownMenu,
|
|
DropdownSection,
|
|
DropdownItem,
|
|
DropdownItemIndicator,
|
|
DropdownSubmenuIndicator,
|
|
DropdownSubmenuTrigger,
|
|
Menu,
|
|
MenuItem,
|
|
MenuItemIndicator,
|
|
MenuItemSubmenuIndicator,
|
|
MenuSection,
|
|
] as const;
|
|
|
|
export const values = {
|
|
root,
|
|
menu,
|
|
item,
|
|
indicator,
|
|
section,
|
|
dItem,
|
|
dInd,
|
|
dMenu,
|
|
badTrigger,
|
|
badMode,
|
|
badVariant,
|
|
badIndicator,
|
|
};
|
|
|
|
const submenuDelay: DropdownSubmenuTriggerProps = { delay: 600 };
|
|
// @ts-expect-error submenu hover delay is a number of milliseconds
|
|
const badSubmenuDelay: DropdownSubmenuTriggerProps = { delay: "slow" };
|
|
void submenuDelay;
|
|
void badSubmenuDelay;
|