import { StudioComponent, StudioComponentChild, StudioForm, FieldConfigMetadata } from '@aws-amplify/codegen-ui'; import { BindingElement, IfStatement, Identifier, JsxAttribute } from 'typescript'; import { DataApiKind } from '../../react-render-config'; export declare const buildMutationBindings: (form: StudioForm, primaryKeys?: string[]) => BindingElement[]; export declare function buildOnBlurStatement(fieldName: string, fieldConfig: FieldConfigMetadata): JsxAttribute; /** * e.g. * onClear={() => { * setCurrentTeamDisplayValue(''); * }} */ export declare function buildOnClearStatement(fieldName: string, fieldConfig: FieldConfigMetadata): JsxAttribute; /** * if the onChange variable is defined it will send the current state of the fields into the function * the function expects all fields in return * the value for that fields onChange will be used from the return object for validation and updating the new state * * if a valueName override is provided it will use the provided name * this the name of the variable to update if onChange override function is provided * * * ex. if the field is email * const returnObject = onChange({ email, ...otherFieldsForForm }); * const value = returnObject.email; * * this value is now used in email validation and setting the state */ export declare const buildOverrideOnChangeStatement: (fieldName: string, fieldConfigs: Record, valueNameOverride?: Identifier | undefined) => IfStatement; export declare const buildOnChangeStatement: (component: StudioComponent | StudioComponentChild, fieldConfigs: Record, dataApi?: DataApiKind | undefined) => JsxAttribute; /** examples: scalar: onSelect={({ id, label }) => { setCurrentPrimaryAuthorValue(id); setCurrentPrimaryAuthorDisplayValue(label); }} model: onSelect={({ id, label }) => { setCurrentPrimaryAuthorValue( primaryAuthorRecords.find((r) => Object.entries(JSON.parse(id)).every(([key, value]) => r[key] === value))); ); setCurrentPrimaryAuthorDisplayValue(label); }} // For autocomplete field only */ export declare function buildOnSelect({ sanitizedFieldName, fieldName, fieldConfig, dataApi, }: { sanitizedFieldName: string; fieldName: string; fieldConfig: FieldConfigMetadata; dataApi?: DataApiKind; }): JsxAttribute; export declare const buildStorageManagerOnChangeStatement: (component: StudioComponent | StudioComponentChild, fieldConfigs: Record, handlerName: 'onUploadSuccess' | 'onFileRemove') => JsxAttribute;