bits-ui
Version:
The headless components for Svelte.
75 lines (74 loc) • 2.84 kB
TypeScript
import { type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt";
import type { BitsKeyboardEvent, BitsMouseEvent, OnChangeFn, RefAttachment, WithRefOpts } from "../../internal/types.js";
interface CollapsibleRootStateOpts extends WithRefOpts, WritableBoxedValues<{
open: boolean;
}>, ReadableBoxedValues<{
disabled: boolean;
onOpenChangeComplete: OnChangeFn<boolean>;
}> {
}
export declare class CollapsibleRootState {
static create(opts: CollapsibleRootStateOpts): CollapsibleRootState;
readonly opts: CollapsibleRootStateOpts;
readonly attachment: RefAttachment;
contentNode: HTMLElement | null;
contentId: string | undefined;
constructor(opts: CollapsibleRootStateOpts);
toggleOpen(): void;
readonly props: {
readonly id: string;
readonly "data-state": "open" | "closed";
readonly "data-disabled": "" | undefined;
};
}
interface CollapsibleContentStateOpts extends WithRefOpts, ReadableBoxedValues<{
forceMount: boolean;
}> {
}
export declare class CollapsibleContentState {
#private;
static create(opts: CollapsibleContentStateOpts): CollapsibleContentState;
readonly opts: CollapsibleContentStateOpts;
readonly root: CollapsibleRootState;
readonly attachment: RefAttachment;
readonly present: boolean;
constructor(opts: CollapsibleContentStateOpts, root: CollapsibleRootState);
readonly snippetProps: {
open: boolean;
};
readonly props: {
readonly id: string;
readonly style: {
readonly "--bits-collapsible-content-height": string | undefined;
readonly "--bits-collapsible-content-width": string | undefined;
};
readonly "data-state": "open" | "closed";
readonly "data-disabled": "" | undefined;
};
}
interface CollapsibleTriggerStateOpts extends WithRefOpts, ReadableBoxedValues<{
disabled: boolean | null | undefined;
}> {
}
export declare class CollapsibleTriggerState {
#private;
static create(opts: CollapsibleTriggerStateOpts): CollapsibleTriggerState;
readonly opts: CollapsibleTriggerStateOpts;
readonly root: CollapsibleRootState;
readonly attachment: RefAttachment;
constructor(opts: CollapsibleTriggerStateOpts, root: CollapsibleRootState);
onclick(e: BitsMouseEvent): void;
onkeydown(e: BitsKeyboardEvent): void;
readonly props: {
readonly id: string;
readonly type: "button";
readonly disabled: boolean;
readonly "aria-controls": string | undefined;
readonly "aria-expanded": "true" | "false";
readonly "data-state": "open" | "closed";
readonly "data-disabled": "" | undefined;
readonly onclick: (e: BitsMouseEvent) => void;
readonly onkeydown: (e: BitsKeyboardEvent) => void;
};
}
export {};