// @flow
import type { Node } from 'react';
import PropTypes from 'prop-types';
import type { SpaceProps } from '../../../mixins/spacing';
import { spacePropTypes } from '../../../mixins/spacing';

export type ModalBreakpoints = 'sm' | 'md' | 'lg' | 'xl';

export type ModalProps = {
  show: boolean,
  persistent?: boolean,
  onClose: () => void,
  size?: ModalBreakpoints,
  children: Node,
  className?: string,
  hideHeader?: boolean,
  refToRestoreFocus?: { current: HTMLElement | null },
} & SpaceProps;

export const modalPropTypes = {
  ...spacePropTypes,
  show: PropTypes.bool.isRequired,
  persistent: PropTypes.bool,
  onClose: PropTypes.func.isRequired,
  size: PropTypes.string,
  children:
    PropTypes.node.isRequired || PropTypes.arrayOf(PropTypes.node).isRequired,
  hideHeader: PropTypes.bool,
  disableAutoFocus: PropTypes.bool,
  disableRestoreFocus: PropTypes.bool,
};
