bits-ui
Version:
The headless components for Svelte.
94 lines (93 loc) • 3.56 kB
TypeScript
import { type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
import type { BitsKeyboardEvent, BitsMouseEvent, BitsPointerEvent, OnChangeFn, RefAttachment, WithRefOpts } from "../../internal/types.js";
import type { Measurable } from "../../internal/floating-svelte/types.js";
interface PopoverRootStateOpts extends WritableBoxedValues<{
open: boolean;
}>, ReadableBoxedValues<{
onOpenChangeComplete: OnChangeFn<boolean>;
}> {
}
export declare class PopoverRootState {
static create(opts: PopoverRootStateOpts): PopoverRootState;
readonly opts: PopoverRootStateOpts;
contentNode: HTMLElement | null;
triggerNode: HTMLElement | null;
constructor(opts: PopoverRootStateOpts);
toggleOpen(): void;
handleClose(): void;
}
interface PopoverTriggerStateOpts extends WithRefOpts, ReadableBoxedValues<{
disabled: boolean;
}> {
}
export declare class PopoverTriggerState {
#private;
static create(opts: PopoverTriggerStateOpts): PopoverTriggerState;
readonly opts: PopoverTriggerStateOpts;
readonly root: PopoverRootState;
readonly attachment: RefAttachment;
constructor(opts: PopoverTriggerStateOpts, root: PopoverRootState);
onclick(e: BitsMouseEvent): void;
onkeydown(e: BitsKeyboardEvent): void;
readonly props: {
readonly id: string;
readonly "aria-haspopup": "dialog";
readonly "aria-expanded": "true" | "false";
readonly "data-state": "open" | "closed";
readonly "aria-controls": string | undefined;
readonly disabled: boolean;
readonly onkeydown: (e: BitsKeyboardEvent) => void;
readonly onclick: (e: BitsMouseEvent) => void;
};
}
interface PopoverContentStateOpts extends WithRefOpts, ReadableBoxedValues<{
onInteractOutside: (e: PointerEvent) => void;
onEscapeKeydown: (e: KeyboardEvent) => void;
onCloseAutoFocus: (e: Event) => void;
customAnchor: string | HTMLElement | null | Measurable;
}> {
}
export declare class PopoverContentState {
static create(opts: PopoverContentStateOpts): PopoverContentState;
readonly opts: PopoverContentStateOpts;
readonly root: PopoverRootState;
readonly attachment: RefAttachment;
constructor(opts: PopoverContentStateOpts, root: PopoverRootState);
onInteractOutside: (e: PointerEvent) => void;
onEscapeKeydown: (e: KeyboardEvent) => void;
onCloseAutoFocus: (e: Event) => void;
readonly snippetProps: {
open: boolean;
};
readonly props: {
readonly id: string;
readonly tabindex: -1;
readonly "data-state": "open" | "closed";
readonly style: {
readonly pointerEvents: "auto";
};
};
readonly popperProps: {
onInteractOutside: (e: PointerEvent) => void;
onEscapeKeydown: (e: KeyboardEvent) => void;
onCloseAutoFocus: (e: Event) => void;
};
}
interface PopoverCloseStateOpts extends WithRefOpts {
}
export declare class PopoverCloseState {
static create(opts: PopoverCloseStateOpts): PopoverCloseState;
readonly opts: PopoverCloseStateOpts;
readonly root: PopoverRootState;
readonly attachment: RefAttachment;
constructor(opts: PopoverCloseStateOpts, root: PopoverRootState);
onclick(_: BitsPointerEvent): void;
onkeydown(e: BitsKeyboardEvent): void;
readonly props: {
readonly id: string;
readonly onclick: (_: BitsPointerEvent) => void;
readonly onkeydown: (e: BitsKeyboardEvent) => void;
readonly type: "button";
};
}
export {};