import { JsonFormsCore } from '@jsonforms/core'; import { IfElseSchema } from './types'; /** * Evaluates an "if-then-else" schema and returns the properties for the matching branch. * * `core.data` is the entire JsonForms form-root data (not the sub-slice the control sits in), so * the `if` clause always evaluates against the root. Skips evaluation when `data` is `undefined` * or `null`. JSON Schema's `properties` and `required` keywords are object-scoped per spec and * pass trivially against non-object instances, so a naive `ifProps` like: * * { * if: { properties: { x: { const: "Y" } }, required: ["x"] }, * then: { props: { required: true } }, * } * * would otherwise match on `null` root data (both keywords pass trivially) and fire its * `then.props.required: true` on what is effectively empty data. `ifProps` is a UX hook deciding * conditional UI props from form data — when the root is `null` there are no values to inspect, * so firing `then` is not semantically useful. * * Note: this guards against the *root* form data being `null`. Matching a *property* value of * `null` still works as expected (e.g. `if: { properties: { x: { const: null } }, required: ["x"] }`) * because the root is still an object in that case. If a use case ever needs to react to the root * being `null`, do it at the React level instead — `useIfProps` deliberately ignores it. * * `schema` is the if-then-else schema to evaluate, `core` is the JsonForms core instance holding the * data and AJV validator, and `key` is the key to extract properties from the then/else branches * (defaults to 'props'). Returns the matched branch's properties, or undefined if no schema is given. */ export declare const useIfProps: (schema: IfElseSchema | undefined, core: Pick | undefined, key?: string) => { [key: string]: any; } | undefined;