mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-27 16:40:57 +00:00
20 lines
815 B
TypeScript
20 lines
815 B
TypeScript
export interface UseUncontrolledOptions<T> {
|
|
/** Value for controlled state */
|
|
value?: T;
|
|
/** Initial value for uncontrolled state */
|
|
defaultValue?: T;
|
|
/** Final value for uncontrolled state when value and defaultValue are not provided */
|
|
finalValue?: T;
|
|
/** Controlled state onChange handler */
|
|
onChange?: (value: T, ...payload: any[]) => void;
|
|
}
|
|
export type UseUncontrolledReturnValue<T> = [
|
|
/** Current value */
|
|
T,
|
|
/** Handler to update the state, passes `value` and `payload` to `onChange` */
|
|
(value: T, ...payload: any[]) => void,
|
|
/** True if the state is controlled, false if uncontrolled */
|
|
boolean
|
|
];
|
|
export declare function useUncontrolled<T>({ value, defaultValue, finalValue, onChange, }: UseUncontrolledOptions<T>): UseUncontrolledReturnValue<T>;
|