feat: migrate ListBox with virtual collection and accessible parts

This commit is contained in:
maoyingjie
2026-10-23 15:02:30 +08:00
parent dea5ded716
commit 65db60a7ac
39 changed files with 2694 additions and 12 deletions
+38
View File
@@ -0,0 +1,38 @@
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,
];