import type { ComputedRef, InjectionKey, Ref } from "vue"; import type { checkboxVariants, radioVariants } from "@heroui-vue/styles"; import type { FieldContext } from "../field/context"; export interface ChoiceState { isSelected: boolean; isIndeterminate: boolean; isDisabled: boolean; isReadOnly: boolean; isRequired: boolean; isInvalid: boolean; isHovered: boolean; isPressed: boolean; isFocused: boolean; isFocusVisible: boolean; } export interface ChoiceMember { value: () => string; disabled: ComputedRef; readOnly: ComputedRef; input: Ref; } export interface ChoiceGroupContext { kind: "checkbox" | "radio"; field: FieldContext; behavior: ComputedRef; name: () => string | undefined; form: () => string | undefined; variant: ComputedRef<"primary" | "secondary" | undefined>; selected: (value: string) => boolean; select: (value: string) => void; register: (member: ChoiceMember) => () => void; tabIndex: (member: ChoiceMember) => number; keydown: (event: KeyboardEvent, member: ChoiceMember) => void; describedBy: () => string | undefined; restore: () => void; } export const choiceGroupKey: InjectionKey = Symbol( "HeroUIVue.ChoiceGroup", ); export interface ChoiceContext { kind: "checkbox" | "radio"; field: FieldContext; slots: ComputedRef< ReturnType | ReturnType >; state: () => ChoiceState; input: Ref; rootAttrs: () => Record; inputAttrs: () => Record; onChange: (event: Event) => void; onInvalid: (event: Event) => void; guard: (event: Event) => void; keydown: (event: KeyboardEvent) => void; hover: Ref; pressed: Ref; focused: Ref; focusVisible: Ref; } export const choiceKey: InjectionKey = Symbol("HeroUIVue.Choice");