@base-ui/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
276 lines • 12.7 kB
TypeScript
import * as React from 'react';
import { ReactStore } from '@base-ui/utils/store';
import { PopupStoreContext, PopupStoreState } from "../../utils/popups/index.js";
import { type PreviewCardRoot } from "../root/PreviewCardRoot.js";
export type State<Payload> = PopupStoreState<Payload> & {
instantType: 'dismiss' | 'focus' | undefined;
hasViewport: boolean;
};
export type Context = PopupStoreContext<PreviewCardRoot.ChangeEventDetails> & {
closeDelayRef: React.RefObject<number>;
};
declare const selectors: {
instantType: (state: State<unknown>) => "focus" | "dismiss" | undefined;
hasViewport: (state: State<unknown>) => boolean;
open: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => boolean;
mounted: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => boolean;
transitionStatus: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => import("../../floating-ui-react/components/FloatingRootStore.js").FloatingRootStore;
preventUnmountingOnClose: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => boolean;
payload: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => unknown;
activeTriggerId: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => string | null;
activeTriggerElement: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => Element | null;
isTriggerActive: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}, triggerId: string | undefined) => boolean;
isOpenedByTrigger: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}, triggerId: string | undefined) => boolean;
isMountedByTrigger: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}, triggerId: string | undefined) => boolean;
triggerProps: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}, isActive: boolean) => import("../../index.js").HTMLProps;
popupProps: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => import("../../index.js").HTMLProps;
popupElement: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => HTMLElement | null;
positionerElement: (state: {
open: boolean;
readonly openProp: boolean | undefined;
mounted: boolean;
transitionStatus: import("../../utils/useTransitionStatus.js").TransitionStatus;
floatingRootContext: import("../../floating-ui-react/index.js").FloatingRootContext;
preventUnmountingOnClose: boolean;
payload: unknown;
activeTriggerId: string | null;
activeTriggerElement: Element | null;
readonly triggerIdProp: string | null | undefined;
popupElement: HTMLElement | null;
positionerElement: HTMLElement | null;
activeTriggerProps: import("../../index.js").HTMLProps;
inactiveTriggerProps: import("../../index.js").HTMLProps;
popupProps: import("../../index.js").HTMLProps;
}) => HTMLElement | null;
};
export declare class PreviewCardStore<Payload> extends ReactStore<Readonly<State<Payload>>, Context, typeof selectors> {
constructor(initialState?: Partial<State<Payload>>);
setOpen: (nextOpen: boolean, eventDetails: Omit<PreviewCardRoot.ChangeEventDetails, "preventUnmountOnClose">) => void;
static useStore<Payload>(externalStore: PreviewCardStore<Payload> | undefined, initialState?: Partial<State<Payload>>): PreviewCardStore<Payload>;
}
export {};