UNPKG

@revenuecat/purchases-ui-js

Version:

Web components for Paywalls. Powered by RevenueCat

23 lines (22 loc) 1.02 kB
import { type Readable } from "svelte/store"; type SelectionMode = "single" | "multiple"; export interface SelectionRange { min: number; max: number; } interface InputChoiceContext { fieldId: string; mode: SelectionMode; required: boolean; selectionRange: SelectionRange | null; selectedOptionIds: Readable<Set<string>>; selectOption: (optionId: string) => void; /** True when selection count has reached the max (unselected options should be disabled) */ isAtMax: Readable<boolean>; /** True when the current selection satisfies the validation requirements */ isSatisfied: Readable<boolean>; } export declare function createInputChoiceContext(fieldId: string, mode: SelectionMode, required?: boolean, selectionRange?: SelectionRange | null, initialSelectedIds?: string[]): InputChoiceContext; export declare function setInputChoiceContext(context: InputChoiceContext): void; export declare function getInputChoiceContext(): InputChoiceContext | undefined; export {};