import Record from '../models/record'; import Field from '../models/field'; /** * Options object for expanding a record picker. */ interface ExpandRecordPickerOpts { /** The fields to include in the record cards. The primary field will always be shown. Duplicate fields will be removed. */ fields?: Array; /** If set to true, the user will be able to create an empty new record from the record picker. */ shouldAllowCreatingRecord?: boolean; } /** * Expands a list of records in the Airtable UI, and prompts the user to pick * one. The selected record is returned to the app, and the modal is * automatically closed. * * If the user dismisses the modal, or another one is opened before this one * has been closed, it will return null. * * Returns a promise that resolves to the record chosen by the user, or null. * * @param records the records the user can pick from. Duplicate records will be removed. * @param opts An optional options object. * @example * ```js * import {expandRecordPickerAsync} from '@airtable/blocks/ui'; * * async function pickRecordsAsync() { * const recordA = await expandRecordPickerAsync([record1, record2, record3]); * if (recordA !== null) { * alert(recordA.name); * } else { * alert('no record picked'); * } * * const recordB = await expandRecordPickerAsync([record1, record2], { * fields: [field1, field2], * }); * } * ``` * @docsPath UI/utils/expandRecordPickerAsync */ declare function expandRecordPickerAsync(records: Array, opts?: ExpandRecordPickerOpts): Promise; export default expandRecordPickerAsync;