import type { Atom } from './atom'; import type { StoreSetStateValue, ValueState } from './types'; export { Conditional, ConditionalRender, Render, RenderWithUpdate }; type AtomLike = Pick | ValueState, 'use' | 'set' | 'value'>; type ReadOnlyAtomLike = Pick | ValueState, 'use' | 'useCompute' | 'value'>; type RenderProps> = { state: State; children: (value: State['value']) => React.ReactNode; }; type RenderWithUpdateProps> = { state: State; children: (value: State['value'], update: (value: StoreSetStateValue) => void) => React.ReactNode; }; type ConditionalProps> = { state: State; on: (value: State['value']) => boolean; children: React.ReactNode; }; type ConditionalRenderProps> = { state: State; on: (value: State['value']) => boolean; children: (value: State['value']) => React.ReactNode; }; /** * Renders the provided children function with the current value from the state. * * @template T The type of the state value. * @param props - The props object. * @param props.state - The ValueState whose value will be passed to children. * @param props.children - A render prop that receives the current value. * @returns The result of calling children with the current value. */ declare function Render>({ state, children }: RenderProps): import("react").ReactNode; /** * Renders the provided children function with the current value and an update function. * * The update function can set the value directly or with an updater function. * * @template T The type of the state value. * @template U The type allowed for updating the state (value or updater). * @param props - The props object. * @param props.state - The ValueState whose value will be passed to children. * @param props.children - A render prop that receives the current value and update function. * @returns The result of calling children with the current value and update function. */ declare function RenderWithUpdate>({ state, children }: RenderWithUpdateProps): import("react").ReactNode; /** * Conditionally shows or hides the children based on the result of the `on` predicate. * * It uses the Activity component to keep component states even when hidden. * * @template T The type of the state value. * @param props - The props object. * @param props.state - The ValueState whose value will be used. * @param props.on - A predicate that receives the value and returns whether to show children. * @param props.children - The component to render if the predicate returns true. * @returns The Activity component with the children. */ declare function Conditional>({ state, on, children }: ConditionalProps): import("react/jsx-runtime").JSX.Element; /** * Conditionally renders the children function based on the result of the `on` predicate. * * It returns null if the predicate returns false. * * @template T The type of the state value. * @param props - The props object. * @param props.state - The ValueState whose value will be used. * @param props.on - A predicate that receives the value and returns whether to show children. * @param props.children - The render function that receives the value. * @returns The result of children if the predicate returns true, otherwise null. */ declare function ConditionalRender>({ state, on, children }: ConditionalRenderProps): import("react").ReactNode;