import { default as React } from 'react'; /** * filterFields accepts: * - string: `"company"` → watch form field `company`, use `filterKey` prop as API filter key * - object: `{ company: 'company_id' }` → key = form field to watch, value = API filter key */ type FilterFieldsInput = string | Record; export interface DynamicDependentFieldProps { /** Field name registered in React Hook Form (e.g. "department_id") */ name: string; /** * Describes which form field(s) this select depends on. * * **String** – a single form field name. The API filter key is taken from `filterKey`. * @example filterFields="company" * * **Object** – keys are form field names, values are API filter keys. * @example filterFields={{ company: 'company_id', branch: 'branch_id' }} */ filterFields: FilterFieldsInput; /** * The form array/namespace prefix used in the parent form * (same as `fieldArrayName` in DynamicSearchSelect). */ fieldArrayName: string; /** * API filter key used when `filterFields` is a plain string. * Ignored when `filterFields` is an object (the object values are used instead). * @default 'company_id' */ filterKey?: string; /** Label displayed above the select */ label?: string; /** Placeholder text inside the select */ placeholder?: string; /** * API key string forwarded to `DynamicSearchSelect` as `apiType`. */ apiType?: string; /** * Custom fetch function forwarded to `DynamicSearchSelect` as `customFetchApi`. */ customFetchApi?: (...args: any[]) => Promise; /** Disable the field regardless of filter state */ disabled?: boolean; /** React Hook Form validation rules */ rules?: Record; /** Allow multi-select (forwarded as `is_multiselect`) */ isMulti?: boolean; /** Mark field as required */ required?: boolean; /** Form control object from useForm */ control?: any; formControl?: any; /** Watch function from useForm */ watch?: any; /** SetValue function from useForm */ setValue?: any; /** GetFieldState function from useForm */ getFieldState?: any; /** FormState object from useForm */ formState?: any; /** Any additional props forwarded verbatim to DynamicSearchSelect */ [key: string]: any; } /** * `DynamicDependentField` is a fully reusable, typed wrapper around * `DynamicSearchSelect` that: * * - Reads `control`, `watch`, and `setValue` from the nearest `FormProvider`. * - Watches one or more dependent fields (`filterFields`). * - Builds a `customeFilter` object from the watched values. * - Resets its own value and triggers a fresh option load whenever a watched * field changes. * - Disables itself automatically while any required filter is empty. * * @example * // String – single dependency, uses filterKey for the API filter key * * * @example * // Object – multiple dependencies with explicit API filter keys * */ declare const DynamicDependentField: React.FC; export default DynamicDependentField;