'use strict';

var PropTypes = require('prop-types');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);

/** The prop types available for components using the overrides pattern.
 * A subcomponent can be overidden in two ways, by having its input (i.e. the props) overridden
 * or by having the component class or function itseld be overridden. The overrides pattern can be used with
 * nesting, i.e. to override the subcomponent or a subcomponent.
 */
var OverridePropTypes = PropTypes__default.default.shape({
  /** props should be an object with properties (or a function returning an object) that is used to override the original props
   * received by the specified sub component. */
  props: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.func]),
  /** component should be a drop in replacement component for the subcomponent */
  component: PropTypes__default.default.elementType
});
var HotspotIconPropType = PropTypes__default.default.shape({
  id: PropTypes__default.default.string,
  icon: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.func]),
  text: PropTypes__default.default.string
});
var ColorPropType = PropTypes__default.default.shape({
  carbonColor: PropTypes__default.default.string,
  name: PropTypes__default.default.string
});
var HotspotContentPropTypes = {
  title: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.element]),
  description: PropTypes__default.default.string,
  values: PropTypes__default.default.objectOf(PropTypes__default.default.any),
  attributes: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
    dataSourceId: PropTypes__default.default.string,
    label: PropTypes__default.default.string,
    unit: PropTypes__default.default.string,
    precision: PropTypes__default.default.number,
    thresholds: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
      comparison: PropTypes__default.default.oneOf(['<', '>', '=', '<=', '>=']),
      value: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.bool, PropTypes__default.default.number]),
      icon: PropTypes__default.default.string,
      color: PropTypes__default.default.string
    }))
  })),
  /** overall threshold that launched the hotspot */
  hotspotThreshold: PropTypes__default.default.shape({
    dataSourceId: PropTypes__default.default.string,
    comparison: PropTypes__default.default.oneOf(['<', '>', '=', '<=', '>=']),
    value: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.bool, PropTypes__default.default.number]),
    icon: PropTypes__default.default.string,
    color: PropTypes__default.default.string
  }),
  /** the locale to use for formatting numeric values */
  locale: PropTypes__default.default.string,
  /** ability to render icon by name */
  renderIconByName: PropTypes__default.default.func,
  /** when true the title can be edited by the user. */
  isTitleEditable: PropTypes__default.default.bool,
  /** the unique id of this component, used by input elements */
  id: PropTypes__default.default.string,
  /** For text hotspots, callback with current value for when the editable fields are blurred. */
  onChange: PropTypes__default.default.func,
  i18n: PropTypes__default.default.shape({
    /** The placeholder text for editable title */
    titlePlaceholderText: PropTypes__default.default.string,
    /** The html title attribute text for the title label when editable */
    titleEditableHintText: PropTypes__default.default.string
  })
};
var HotspotPropTypes = {
  /** percentage from the left of the image to show this hotspot */
  x: PropTypes__default.default.number.isRequired,
  /** percentage from the top of the image to show this hotspot */
  y: PropTypes__default.default.number.isRequired,
  /** the content of the hotspot, either a react element or an object to use the default hotspot */
  content: PropTypes__default.default.oneOfType([PropTypes__default.default.element, PropTypes__default.default.shape(HotspotContentPropTypes)]).isRequired,
  /** points to one of our enumerated icon names (ex. caretUp, edit, close)
   * TODO: add support for the carbon icon object (svgData, viewBox, width, height)
   */
  icon: PropTypes__default.default.string,
  iconDescription: PropTypes__default.default.string,
  /** color of the hotspot */
  color: PropTypes__default.default.string,
  /** width of the hotspot */
  width: PropTypes__default.default.number,
  /** height of the hotspot */
  height: PropTypes__default.default.number,
  /** optional function to provide icon based on name */
  renderIconByName: PropTypes__default.default.func,
  /**
   * onClick callback for when the hotspot is clicked. Returns the event and an
   * object width the x and y coordinates */
  onClick: PropTypes__default.default.func,
  /** shows a border with padding when set to true */
  isSelected: PropTypes__default.default.bool,
  /** determines the type of hotspot to render. Defaults to 'fixed'. */
  type: PropTypes__default.default.oneOf(['fixed', 'dynamic', 'text']),
  /** For text hotspots, true if title should be bold */
  bold: PropTypes__default.default.bool,
  /** For text hotspots, true if title should be italic */
  italic: PropTypes__default.default.bool,
  /** For text hotspots, true if title should be underline */
  underline: PropTypes__default.default.bool,
  /** For text hotspots, the hexdec color of the title font, e.g. #ff0000  */
  fontColor: PropTypes__default.default.string,
  /** For text hotspots, the size in px of the font, e.g. 12  */
  fontSize: PropTypes__default.default.number,
  /** For text hotspots, the hexdec color of the background, e.g. #ff0000  */
  backgroundColor: PropTypes__default.default.string,
  /** For text hotspots, the opactity of the background in percentage, e.g. 100 */
  backgroundOpacity: PropTypes__default.default.number,
  /** For text hotspots, the hexdec color of the border, e.g. #ff0000  */
  borderColor: PropTypes__default.default.string,
  /** For text hotspots, the border width in px, e.g. 12  */
  borderWidth: PropTypes__default.default.number
};
var SvgPropType = PropTypes__default.default.shape({
  type: PropTypes__default.default.oneOf(['svg'])
});
var ButtonIconPropType = PropTypes__default.default.oneOfType([PropTypes__default.default.shape({
  width: PropTypes__default.default.string,
  height: PropTypes__default.default.string,
  viewBox: PropTypes__default.default.string.isRequired,
  svgData: SvgPropType.isRequired
}), PropTypes__default.default.object,
// Could be a react icon name
PropTypes__default.default.element]);
var CarbonIconPropType = PropTypes__default.default.oneOfType([PropTypes__default.default.func, PropTypes__default.default.object]);
var HtmlElementRefProp = PropTypes__default.default.oneOfType([PropTypes__default.default.func, PropTypes__default.default.shape({
  current: PropTypes__default.default.oneOfType([PropTypes__default.default.object])
})]);
var WrapCellTextPropTypes = PropTypes__default.default.oneOf(['always', 'never', 'auto', 'alwaysTruncate', 'expand']);

exports.ButtonIconPropType = ButtonIconPropType;
exports.CarbonIconPropType = CarbonIconPropType;
exports.ColorPropType = ColorPropType;
exports.HotspotContentPropTypes = HotspotContentPropTypes;
exports.HotspotIconPropType = HotspotIconPropType;
exports.HotspotPropTypes = HotspotPropTypes;
exports.HtmlElementRefProp = HtmlElementRefProp;
exports.OverridePropTypes = OverridePropTypes;
exports.SvgPropType = SvgPropType;
exports.WrapCellTextPropTypes = WrapCellTextPropTypes;
