All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.index.d.ts Maven / Gradle / Ivy

The newest version!
import * as _zag_js_anatomy from '@zag-js/anatomy';
import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, NormalizeProps } from '@zag-js/types';
import * as _zag_js_core from '@zag-js/core';
import { Machine, StateMachine } from '@zag-js/core';

declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "trigger" | "content">;

interface OpenChangeDetails {
    open: boolean;
}
type ElementIds = Partial<{
    root: string;
    content: string;
    trigger: string;
}>;
interface PublicContext extends DirectionProperty, CommonProperties {
    /**
     * The ids of the elements in the collapsible. Useful for composition.
     */
    ids?: ElementIds | undefined;
    /**
     * Function called when the animation ends in the closed state.
     */
    onExitComplete?: (() => void) | undefined;
    /**
     * Function called when the popup is opened
     */
    onOpenChange?: ((details: OpenChangeDetails) => void) | undefined;
    /**
     * Whether the collapsible is open
     */
    open?: boolean | undefined;
    /**
     * Whether the collapsible is disabled
     */
    disabled?: boolean | undefined;
    /**
     *  Whether the collapsible open state is controlled by the user
     */
    "open.controlled"?: boolean | undefined;
}
type ComputedContext = Readonly<{}>;
interface PrivateContext {
}
type UserDefinedContext = RequiredBy;
interface MachineContext extends PublicContext, PrivateContext, ComputedContext {
}
type MachineState = {
    value: "open" | "closed" | "closing";
};
type State = StateMachine.State;
type Send = StateMachine.Send;
type Service = Machine;
interface MachineApi {
    /**
     * Whether the collapsible is open.
     */
    open: boolean;
    /**
     * Whether the collapsible is visible (open or closing)
     */
    visible: boolean;
    /**
     * Whether the collapsible is disabled
     */
    disabled: boolean;
    /**
     * Function to open or close the collapsible.
     */
    setOpen(open: boolean): void;
    getRootProps(): T["element"];
    getTriggerProps(): T["button"];
    getContentProps(): T["element"];
}

declare function connect(state: State, send: Send, normalize: NormalizeProps): MachineApi;

declare function machine(userContext: UserDefinedContext): _zag_js_core.Machine;

declare const props: ("dir" | "id" | "getRootNode" | "open" | "disabled" | "ids" | "onExitComplete" | "onOpenChange" | "open.controlled")[];
declare const splitProps: >(props: Props) => [Partial, Omit];

export { type MachineApi as Api, type UserDefinedContext as Context, type ElementIds, type OpenChangeDetails, type Service, anatomy, connect, machine, props, splitProps };




© 2015 - 2025 Weber Informatics LLC | Privacy Policy