import { A as GetKeys, B as Value, C as Selector, F as PathAsString, G as MaybePromise, H as WildcardPathAsString, I as SettablePath, K as Constrain, N as Path$1, T as Update, U as WildcardValue, W as Object_, b as Duration, j as Join, r as Store } from "../store-21GsOOLS.cjs"; import { a as useScope, c as UseCacheValue, d as useStore, i as ScopeProvider, l as useCache, n as scopeMethods, o as cacheMethods, r as ScopeProps, s as UseCacheArray, t as storeMethods, u as UseStoreOptions } from "../storeMethods-BjuI0joo.cjs"; import { Draft } from "mutative"; import { Component, ComponentPropsWithoutRef, Context, FormEvent, FunctionComponent, HTMLProps, ReactNode } from "react"; //#region src/react/form/customInput.d.ts interface CustomInputProps extends React.HTMLAttributes { name: string; children?: ReactNode; } declare function CustomInput({ name, children, ...props }: CustomInputProps): React.JSX.Element; //#endregion //#region src/react/form/formField.d.ts interface FormFieldComponentProps { name: TPath$1; value: TValue; onChange: (event: { target: { value: TValue; }; } | TValue | undefined, ...args: any[]) => void; onBlur: (...args: any[]) => void; "data-invalid"?: boolean; } type FormFieldInfos = Field & { hasTriggeredValidations: boolean; }; type NativeInputType = "input" | "select" | "textarea"; type PartialComponentType

= (new (props: P, context?: any) => Component) | ((props: P, context?: any) => ReactNode); type FormFieldComponent = NativeInputType | PartialComponentType; interface FormFieldProps extends FieldOptions { name: TPath$1 extends PathAsString ? TPath$1 : PathAsString; commitOnBlur?: boolean; commitDebounce?: Duration; } interface FormFieldPropsWithRender extends FormFieldProps { render: NoInfer<(props: FormFieldComponentProps, TPath$1>, info: FormFieldInfos, form: FormContext) => ReactNode>; children?: undefined; } interface FormFieldPropsWithChildren extends FormFieldProps { render?: undefined; children: NoInfer<(props: FormFieldComponentProps, TPath$1>, info: FormFieldInfos, form: FormContext) => ReactNode>; } //#endregion //#region src/react/form/legacyFormField.d.ts type FieldValue = ComponentPropsWithoutRef["value"]; type FieldChangeValue = ComponentPropsWithoutRef extends { onChange?: (update: infer U) => void; } ? U extends { target: { value: infer V; }; } ? V : U : never; type MakeOptional = Omit & Partial>; type Serialize = (value: Value, formState: FormInstance) => FieldValue; type Deserialize = (value: FieldChangeValue, formState: FormInstance) => Value; type FormFieldPropsWithComponent = FormFieldProps & { component: TComponent; render?: undefined; } & NoInfer<{ inputFilter?: (value: FieldChangeValue) => boolean; } & MakeOptional, "id" | "name" | "value" | "defaultValue">, "onChange" | "onBlur"> & (Value extends Exclude, undefined> ? { defaultValue?: FieldValue; serialize?: Serialize; } : Value extends FieldValue ? { defaultValue: FieldValue; serialize?: Serialize; } | { defaultValue?: FieldValue; serialize: Serialize; } : { serialize: Serialize; }) & (FieldChangeValue extends Value ? { deserialize?: Deserialize; } : { deserialize: Deserialize; })>; //#endregion //#region src/react/form/formForEach.d.ts type ElementName = keyof { [Path in TPath$1 as Join>> & (string | number)>]: 1 }; type ItemValue = T$1 extends readonly (infer U)[] ? U : T$1[keyof T$1]; interface FormForEachProps { name: TPath$1 extends PathAsString ? TPath$1 : PathAsString; renderElement?: (props: { name: ElementName; key: `${GetKeys>> & (string | number)}`; index: number; remove: () => void; count: number; }) => ReactNode; renderAdditionalElement?: NonNullable> extends readonly any[] ? boolean : never; filter?: (item: ItemValue>>, key: GetKeys>>, parent: NonNullable>) => boolean; children?: (props: { setValue: (value: Value | ((value: Value) => Value)) => void; } & FieldHelperMethods) => ReactNode; } //#endregion //#region src/react/form/formOnOriginalChange.d.ts interface OnOriginalChangeHandler { (oldOriginal: TOriginal | undefined, newOriginal: TOriginal | undefined, draft: TDraft, form: FormContext): TDraft | void; } type OnOriginalChangeBuiltin = "default" | "merge" | "overwrite"; type OnOriginalChange = OnOriginalChangeHandler | OnOriginalChangeBuiltin; //#endregion //#region src/react/form/useFormAutosave.d.ts interface FormAutosaveOptions { enabled?: boolean; validateBeforeSave?: boolean; save?: (draft: TDraft, prev: TDraft, form: FormContext) => MaybePromise; debounce?: Duration; resetAfterSave?: boolean; equals?: (a: any, b: any) => boolean; } //#endregion //#region src/react/form/form.d.ts interface Transform { (value: Draft, context: TransformContext): void | TDraft; } interface TransformContext extends FormContext { previousValue: TDraft; } interface FormOptions { id?: string; defaultValue: TDraft; validations?: Validations; initiallyTriggerValidations?: boolean; localizeError?: (error: string, field: string) => string | undefined; autoSave?: FormAutosaveOptions; transform?: Transform; validatedClass?: string; original?: TOriginal; onSubmit?: (event: FormEvent, form: FormInstance) => void; reportValidity?: boolean | "browser" | "scrollTo"; transformFieldProps?: (props: FormFieldComponentProps, TPath$1>, info: FormFieldInfos, form: FormContext) => FormFieldComponentProps, TPath$1>; onOriginalChange?: OnOriginalChange; } type Validations = ((context: { draft: TDraft; original: TOriginal | undefined; }) => Iterable<{ name: string; error: string; }>) | ({ [TPath in WildcardPathAsString]?: Record> } & Record>>); type Validation = (value: WildcardValue, context: { draft: TDraft; original: TOriginal; field: PathAsString | ""; }) => boolean; type Field = { originalValue: Value | undefined; value: Value; setValue: (value: Update>) => void; removeValue: () => void; hasChange: boolean; errors: string[]; } & (Value extends Object_ ? FieldHelperMethods : {}); type FieldHelperMethods = { names: ElementName[]; add: NonNullable> extends readonly (infer T)[] ? (element: T) => void : NonNullable> extends Record ? (key: K, value: V) => void : never; remove: NonNullable> extends readonly any[] ? (index: number) => void : (key: string) => void; }; interface FormState { draft: TDraft | undefined; hasTriggeredValidations: boolean; saveInProgress: boolean; } interface FormDerivedState { draft: TDraft; hasTriggeredValidations: boolean; saveInProgress: boolean; hasChanges: boolean; errors: Map; isValid: boolean; } interface FormContext { formState: Store>; options: FormOptions; original: TOriginal | undefined; getField: (name: TPath$1 extends PathAsString ? TPath$1 : PathAsString, options?: FieldOptions) => Field; getDraft: () => TDraft; hasTriggeredValidations: () => boolean; saveInProgress: () => boolean; flushAutosave: () => Promise; cancelAutosave: () => void; hasChanges: () => boolean; getErrors: () => Map; isValid: () => boolean; validate: (options?: ValidateOptions) => boolean; reset: () => void; } interface FieldOptions { includeNestedErrors?: boolean; } interface ValidateOptions { reportValidity?: boolean | "browser" | "scrollTo"; button?: HTMLButtonElement; } interface FormInstance extends FormDerivedState, Pick, "options" | "original" | "getField" | "validate" | "reset"> {} declare class Form { readonly options: FormOptions; context: Context | null>; constructor(options: FormOptions); useForm(): FormContext; useFormState(selector: (state: FormInstance) => S, useStoreOptions?: UseStoreOptions): S; useField(name: TPath$1 extends PathAsString ? TPath$1 : PathAsString, { includeNestedErrors, ...useStoreOptions }?: FieldOptions & UseStoreOptions): Field; useFieldProps(name: TPath$1 extends PathAsString ? TPath$1 : PathAsString, options?: Omit, "name">): FormFieldComponentProps, TPath$1>; Form({ defaultValue, validations, initiallyTriggerValidations, localizeError, autoSave, transform, validatedClass, original, onSubmit, reportValidity, transformFieldProps, onOriginalChange, ...formProps }: Partial> & Omit, "defaultValue" | "autoSave" | "onSubmit">): React.JSX.Element; FormState({ selector, children }: { selector: (form: FormInstance) => S; children: (selectedState: S) => ReactNode; }): React.JSX.Element; Field(props: FormFieldPropsWithRender): React.JSX.Element; Field(props: FormFieldPropsWithChildren): React.JSX.Element; /** @deprecated */ Field(props: FormFieldPropsWithComponent): React.JSX.Element; ForEach(props: FormForEachProps): React.JSX.Element; withForm>(Component: React.ComponentType, formProps?: Parameters[0]): FunctionComponent; } declare function createForm(options: FormOptions): Form; //#endregion //#region src/react/form/closestFormContext.d.ts declare function useClosestForm(): Form | null; //#endregion //#region src/react/loadingBoundary.d.ts interface LoadingBoundaryEntry { label?: ReactNode; } interface LoadingBoundaryProps { /** * Fallback node to render when there are loading components within the boundary. */ fallback?: ReactNode | ((entries: LoadingBoundaryEntry[]) => ReactNode); /** * Child node to render when there are no loading components within the boundary. */ children?: ReactNode; /** * Add a loading state from outside the boundary. Useful for when you want to * show a loading state for a component that is not a child of the boundary. */ isLoading?: boolean; } declare function LoadingBoundary({ fallback, children, isLoading: isLoadingExternal }: LoadingBoundaryProps): React.JSX.Element; declare function useLoadingBoundary(isLoading: boolean | undefined, label?: ReactNode): void; //#endregion //#region src/react/url/urlOptions.d.ts interface UrlOptions { key: string; type?: "search" | "hash"; serialize?: (value: T$1) => string; deserialize?: (value: string) => T$1; defaultValue: T$1; writeDefaultValue?: boolean; onCommit?: (value: T$1) => void; persist?: { id: string; } | null; path?: string | RegExp | (string | RegExp)[] | null; } interface UrlOptionsWithoutDefaults extends Omit, "defaultValue"> { defaultValue?: T$1 | undefined; } declare function createUrlOptions(options: UrlOptions): Required>; declare function createUrlOptions(options: UrlOptionsWithoutDefaults): Required>; //#endregion //#region src/react/url/urlParamStore.d.ts declare const urlStore: Store; declare class UrlParamStore extends Store { readonly urlOptions: Required>; readonly storageKey: string | null; private lastHref?; private lastStorageValue?; private lastValue?; constructor(urlOptions: Required>); private watch; private getUrlValue; private getStorageValue; private isPathActive; private calc; private updateUrl; private updateStorage; set(update: Update): void; set(path: Constrain>, update: Update>): void; parse(path: string): T$1; } declare function createUrlParam(options: UrlOptions): UrlParamStore; declare function createUrlParam(options: UrlOptionsWithoutDefaults): UrlParamStore; //#endregion //#region src/react/useDecoupledState.d.ts interface UseDecoupledStateOptions { debounce?: Duration; throttle?: Duration; onCommit?: (value: T$1) => void; } declare function useDecoupledState(value: T$1, onChange: (value: T$1) => MaybePromise, options?: UseDecoupledStateOptions): [state: T$1, setState: (value: T$1) => void]; //#endregion //#region src/react/useProp.d.ts declare function useProp(store: Store, selector: Selector, updater: (value: S) => Update, options?: UseStoreOptions): [value: S, setValue: Store["set"]]; declare function useProp(store: Store, selector: Constrain>, options?: UseStoreOptions>): [value: Value, setValue: Store>["set"]]; declare function useProp(store: Store, options?: UseStoreOptions): [value: T$1, setValue: Store["set"]]; //#endregion export { CustomInput, CustomInputProps, Field, Form, FormContext, FormDerivedState, FormFieldComponent, FormFieldComponentProps, FormFieldInfos, FormFieldProps, FormFieldPropsWithChildren, FormFieldPropsWithRender, FormInstance, FormOptions, FormState, LoadingBoundary, type LoadingBoundaryEntry, type LoadingBoundaryProps, type ScopeProps, ScopeProvider, Transform, type UrlOptions, type UrlOptionsWithoutDefaults, type UrlParamStore, type UseCacheArray, type UseCacheValue, type UseDecoupledStateOptions, type UseStoreOptions, Validation, Validations, cacheMethods, createForm, createUrlOptions, createUrlParam, scopeMethods, storeMethods, urlStore, useCache, useClosestForm, useDecoupledState, useLoadingBoundary, useProp, useScope, useStore }; //# sourceMappingURL=index.d.cts.map