Files
heroui-vue/tests/package/list-box-contract.ts
T

39 lines
1.1 KiB
TypeScript

import {
ListBox,
ListBoxItem,
ListBoxItemIndicator,
ListBoxSection,
type ListBoxProps,
type ListBoxItemProps,
} from "@heroui-vue/components";
const props: ListBoxProps = {
modelValue: [0, "0"],
selectionMode: "multiple",
variant: "danger",
onSelectionChange: (keys) => keys.forEach((key) => String(key)),
};
const item: ListBoxItemProps = { id: 0, textValue: "Zero" };
// @ts-expect-error Vue collection models are key arrays, not scalars
const scalar: ListBoxProps = { modelValue: 0 };
// @ts-expect-error Keys cannot be objects
const badKey: ListBoxProps = { modelValue: [{}] };
// @ts-expect-error Selection mode is constrained
const badMode: ListBoxProps = { selectionMode: "radio" };
// @ts-expect-error Variant is constrained
const badVariant: ListBoxItemProps = { id: "a", variant: "solid" };
// @ts-expect-error Item identity is required
const missing: ListBoxItemProps = { textValue: "Missing" };
void [
ListBox,
ListBoxItem,
ListBoxItemIndicator,
ListBoxSection,
props,
item,
scalar,
badKey,
badMode,
badVariant,
missing,
];