import type { ComputedRef, Ref } from 'vue'; import type { RovingDirection, RovingOrientation } from '../utils/roving-focus'; import { useContextFactory } from '@robonen/vue'; export type ToggleGroupType = 'single' | 'multiple'; export interface ToggleGroupContext { type: Ref; value: Ref; toggle: (v: string) => void; isPressed: (v: string) => boolean; orientation: Ref; direction: Ref; loop: Ref; disabled: Ref; rovingFocus: Ref; /** DOM-ordered items, sourced from the internal Collection. */ items: ComputedRef; onItemKeyDown: (event: KeyboardEvent, el: HTMLElement) => void; } const ctx = useContextFactory('ToggleGroupContext'); export const provideToggleGroupContext = ctx.provide; export const useToggleGroupContext = ctx.inject;