import * as React from 'react'; import type { IconProps } from '@planview/pv-icons'; type LabelConfig = { text: string; required?: boolean; requiredTooltip?: string; icon?: React.ReactElement; iconTooltip?: string; }; type ReturnProps = { 'aria-errormessage'?: string; 'aria-describedby'?: string; 'aria-labelledby': string; id: string; }; export type FieldProps = { /** * id of field */ id: string; /** * Label associated with the field, can be string or configuration */ label?: string | LabelConfig; /** * Layout of label */ labelPosition?: 'top' | 'left'; /** * Error message placed bottom left */ error?: string | React.ReactNode; /** * Warning message placed bottom left. Will be replaced by error message if both are provided */ warning?: string | React.ReactNode; /** * Function to return children */ children: (props: ReturnProps) => React.ReactNode; /** * If asterisk should be displayed in label. This prop will be overridden if using a label configuration */ withAsterisk?: boolean; /** * Counter placed bottom right. If an object is provided, the color of the counter * text can be controlled by passing a status. */ count?: string | { text: string; status: 'default' | 'warning' | 'error'; }; /** * Determines if the field label is rendered as a `label` or `span` element. When true, an `htmlFor` will be added to * the internal label to properly associate it with a valid form control. Use false when * this relationship would be semantically or technically incorrect. */ useLabelElement?: boolean; /** * For use when emulating native browser behavior when clicking a label focuses the related element. * If useLabelElement is false, you may want to provide this callback and programmatically focus the * related element. */ onLabelClick?: React.MouseEventHandler; }; /** * Implementation of the [Form Field specification](https://design.planview.com/components/forms/form-field) * * Field wrapper to connect form elements with label and error messages. * The components uses a [render-props](https://reactjs.org/docs/render-props.html) function with a single argument, to provide the children with the props to be applied to the form element * * __Note: This is a generic wrapper for use when there is no out-of-the-box solution in this library. Always defer to the regular components in `pv-form` if they handle the use-case.__ * * ### Example usage * ```jsx * import { Field } from '@planview/pv-form' * * 1/20
} > * {(props) => { * return * }} * * ``` * */ declare const Field: React.FC; export { Field }; export default Field; //# sourceMappingURL=index.d.ts.map