import { CommonProps } from '../../types';

/** Props that should be supported by most of Formik components */
export interface CommonFormikProps<Value> extends CommonProps {
  /** Label that will be shown above control in {@link FormField} */
  label: string;
  /** Text that should describe control */
  description?: string;
  /** Show required mark, if given true. Show optional - if false. Show nothing, if not given. */
  requirement?: boolean;
  /** Show help icon after label with this text in tooltip */
  hintText?: string;
  /** Show help icon after label with this behavior */
  onHintClick?: () => void;
  /** Name of control that used for linking with Formik values */
  name: string;
  /** If `true` than control should be disabled */
  disabled?: boolean;
  /**
   * If `true` then label will not be displayed and `aria-label` will be appended to field.
   *
   * Try to do not use this prop because it's not ok for UX.
   */
  noVisualLabel?: boolean;
  /** Function will be called before setValue */
  onChange?: (value: Value) => void;
}
