import type { JSX } from 'solid-js'; export interface InputStateControlledOptions { value: string | undefined; disabled?: boolean; onChange?: (state?: string) => void; } export interface InputStateUncontrolledOptions { defaultValue: string | undefined; disabled?: boolean; onChange?: (state?: string) => void; } export type InputStateOptions = InputStateControlledOptions | InputStateUncontrolledOptions; export interface InputStateProperties { value: () => string | undefined; setState: (newState?: string) => void; disabled: () => boolean; } /** * Creates a plain string state. Exported for building text-input components. * * Pass `defaultValue` for uncontrolled state or `value` for controlled. * * @see {@link https://github.com/lxsmnsyc/terracotta/blob/main/docs/states.md#input-state} */ export declare function createInputState(options: InputStateOptions): InputStateProperties; export interface InputStateRenderProps { children?: JSX.Element | ((state: InputStateProperties) => JSX.Element); } export interface InputStateProviderProps extends InputStateRenderProps { state: InputStateProperties; } /** * Publishes an input state to its descendants, so `useInputState` and * `InputStateChild` can reach it. No component in the library creates an input * state, so this is the only way to make one available to a subtree. * * @see {@link https://github.com/lxsmnsyc/terracotta/blob/main/docs/states.md#input-state} */ export declare function InputStateProvider(props: InputStateProviderProps): JSX.Element; /** * Reads the nearest input state from context. Throws when there is none. * * @see {@link https://github.com/lxsmnsyc/terracotta/blob/main/docs/states.md#input-state} */ export declare function useInputState(): InputStateProperties; /** * Passes the nearest input state to a render prop. A function child is treated * as a render prop only when it declares exactly one parameter. * * @see {@link https://github.com/lxsmnsyc/terracotta/blob/main/docs/states.md#input-state} */ export declare function InputStateChild(props: InputStateRenderProps): JSX.Element; //# sourceMappingURL=create-input-state.d.ts.map