'use strict';

var React = require('react');
var PropTypes = require('prop-types');
var react = require('@carbon/react');
var iconsReact = require('@carbon/icons-react');
var Settings = require('../../../../constants/Settings.js');

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

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

var iotPrefix = Settings.settings.iotPrefix;
var propTypes = {
  title: PropTypes__default.default.string,
  tooltip: PropTypes__default.default.shape({
    tooltipText: PropTypes__default.default.string,
    href: PropTypes__default.default.string,
    linkText: PropTypes__default.default.string
  })
};
var defaultProps = {
  title: 'Data',
  tooltip: null
};
var ContentFormItemTitle = function ContentFormItemTitle(_ref) {
  var title = _ref.title,
    tooltip = _ref.tooltip;
  var _ref2 = tooltip || {},
    tooltipText = _ref2.tooltipText,
    linkText = _ref2.linkText,
    href = _ref2.href;
  return /*#__PURE__*/React__default.default.createElement("div", {
    className: "".concat(iotPrefix, "--card-edit-form--form-section")
  }, title ? /*#__PURE__*/React__default.default.createElement("div", null, title) : null, /*#__PURE__*/React__default.default.createElement("div", null, tooltip ? /*#__PURE__*/React__default.default.createElement(react.unstable_FeatureFlags, {
    enableV12DynamicFloatingStyles: true
  }, /*#__PURE__*/React__default.default.createElement(react.Tooltip, {
    align: "left",
    triggerId: "card-edit-form-".concat(title),
    tooltipId: "card-edit-form-".concat(title),
    label: /*#__PURE__*/React__default.default.createElement("p", null, tooltipText, ' ', href && linkText ? /*#__PURE__*/React__default.default.createElement(react.Link, {
      href: href,
      target: "_blank",
      rel: "noopener noreferrer"
    }, linkText) : null)
  }, /*#__PURE__*/React__default.default.createElement(iconsReact.Information, null))) : null));
};
ContentFormItemTitle.propTypes = propTypes;
ContentFormItemTitle.defaultProps = defaultProps;
ContentFormItemTitle.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "ContentFormItemTitle",
  "props": {
    "title": {
      "defaultValue": {
        "value": "'Data'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "tooltip": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "tooltipText": {
            "name": "string",
            "required": false
          },
          "href": {
            "name": "string",
            "required": false
          },
          "linkText": {
            "name": "string",
            "required": false
          }
        }
      },
      "required": false
    }
  }
};
var ContentFormItemTitle$1 = ContentFormItemTitle;

module.exports = ContentFormItemTitle$1;
