import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import { jsx } from '@emotion/core';
import { Fragment } from 'react';
import _pt from 'prop-types';
import { TooltipPopup } from '../../../node_modules/@reach/tooltip/dist/tooltip.esm.esm.js';
import TooltipPointer from './TooltipPointer.esm.js';
import { tooltipPosition } from './TooltipContent.helpers.esm.js';

var baseCss = function baseCss(theme) {
  return {
    // defaults from @reach/tooltip
    zIndex: 1,
    pointerEvents: "none",
    position: "absolute",
    boxShadow: "2px 2px 10px hsla(0, 0%, 0%, 0.1)",
    // gatsby-interface styles
    background: theme.colors.black,
    color: theme.colors.whiteFade[80],
    fontSize: theme.fontSizes[1],
    border: "none",
    borderRadius: "2px",
    padding: "".concat(theme.space[2], " ").concat(theme.space[4]),
    transformOrigin: "center",
    whiteSpace: "normal"
  };
};

function TooltipContent(_ref) {
  var _ref$position = _ref.position,
      position = _ref$position === void 0 ? "top" : _ref$position,
      label = _ref.label,
      tooltipParams = _ref.tooltipParams,
      ariaLabel = _ref["aria-label"],
      style = _ref.style,
      rest = _objectWithoutProperties(_ref, ["position", "label", "tooltipParams", "aria-label", "style"]);

  return jsx(TooltipPopup, _extends({}, tooltipParams, rest, {
    label: jsx(Fragment, null, tooltipParams.triggerRect && jsx(TooltipPointer, {
      triggerRect: tooltipParams.triggerRect,
      position: position,
      style: style
    }), label),
    ariaLabel: ariaLabel,
    "aria-label": ariaLabel,
    css: baseCss,
    style: style,
    position: tooltipPosition[position]
  }));
}
TooltipContent.propTypes = {
  label: _pt.node.isRequired
};
TooltipContent.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "TooltipContent",
  "props": {
    "position": {
      "defaultValue": {
        "value": "\"top\"",
        "computed": false
      },
      "required": false,
      "tsType": {
        "name": "TooltipPosition"
      },
      "description": ""
    },
    "label": {
      "required": true,
      "tsType": {
        "name": "ReactReactNode",
        "raw": "React.ReactNode"
      },
      "description": ""
    },
    "tooltipParams": {
      "required": true,
      "tsType": {
        "name": "TooltipParams"
      },
      "description": ""
    }
  }
};

if (typeof STORYBOOK_REACT_CLASSES !== "undefined") {
  STORYBOOK_REACT_CLASSES["src/components/Tooltip/TooltipContent.tsx"] = {
    name: "TooltipContent",
    docgenInfo: TooltipContent.__docgenInfo,
    path: "src/components/Tooltip/TooltipContent.tsx"
  };
}

export default TooltipContent;
//# sourceMappingURL=TooltipContent.esm.js.map
