feat: migrate Select with field, collection and SSR contracts
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { ComputedRef, InjectionKey } from "vue";
|
||||
import type { CollectionKey } from "./keys";
|
||||
export interface CollectionRecord {
|
||||
key: CollectionKey;
|
||||
text: string;
|
||||
disabled: boolean;
|
||||
}
|
||||
export interface OwnedCollection {
|
||||
items: () => CollectionRecord[];
|
||||
focus: (edge: "first" | "last" | "selected") => Promise<void>;
|
||||
}
|
||||
/** A field composite may own a ListBox, without adding another value store. */
|
||||
export interface CollectionOwner {
|
||||
keys: ComputedRef<readonly CollectionKey[]>;
|
||||
mode: ComputedRef<"single" | "multiple">;
|
||||
disabled: ComputedRef<boolean>;
|
||||
readOnly: ComputedRef<boolean>;
|
||||
disabledKeys: ComputedRef<readonly CollectionKey[]>;
|
||||
id: string;
|
||||
labelledBy: () => string | undefined;
|
||||
ariaLabel: () => string | undefined;
|
||||
request: (keys: CollectionKey[]) => void;
|
||||
action: (key: CollectionKey) => void;
|
||||
leave: () => void;
|
||||
connect: (collection: OwnedCollection) => () => void;
|
||||
}
|
||||
export const collectionOwnerKey: InjectionKey<CollectionOwner | undefined> =
|
||||
Symbol("hv-collection-owner");
|
||||
Reference in New Issue
Block a user