// @flow
import type { TranslatedContent } from '../../../types';

type BaseRangeProps = {|
  value: number,
  /** Minimum value allowed to slide to */
  min: number,
  /** Maximum value allowed to slide to */
  max: number,
  /** Label underneath the min value */
  minLabel?: TranslatedContent,
  /** Label underneath the max value */
  maxLabel?: TranslatedContent,
  onRangeChange: (number) => void,
  /** Current value label. Use this when sliders are represented by text  */
  ariaValuetext?: string,
|};

type InternalLabelProps = {|
  /** Used to give context to what the slider is changing */
  label: TranslatedContent,
  /** Show or hide the field label. Defaults to false */
  hideLabel?: boolean,
|};

type ExternalLabelProps = {|
  /** Use when the label is external to the component */
  ariaLabelledBy: string,
|};

export type RangeWithInternalLabelProps = {|
  ...BaseRangeProps,
  ...InternalLabelProps,
|};

type RangeWithExternalLabelProps = {|
  ...BaseRangeProps,
  ...ExternalLabelProps,
|};

export type RangeProps =
  | RangeWithInternalLabelProps
  | RangeWithExternalLabelProps;
