function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import React from 'react';
import PropTypes from 'prop-types';
import Icon from '../icon';
import { BUILDER_HEADER_NAV_LINK } from '../../utilities/constants';
var propTypes = {
  /**
   * **Assistive text for accessibility**
   * This object is merged with the default props object on every render.
   * * `icon`: Used for the icon next to the link text.
   * * _Tested with snapshot testing._
   */
  assistiveText: PropTypes.shape({
    icon: PropTypes.string
  }),

  /**
   * Name of the icon category. Visit <a href="http://www.lightningdesignsystem.com/resources/icons">Lightning Design System Icons</a> to reference icon categories.
   */
  iconCategory: PropTypes.oneOf(['action', 'custom', 'doctype', 'standard', 'utility']),

  /**
   * Name of the icon. Visit <a href="http://www.lightningdesignsystem.com/resources/icons">Lightning Design System Icons</a> to reference icon names.
   */
  iconName: PropTypes.string,

  /**
   * Path to the icon. This will override any global icon settings.
   */
  iconPath: PropTypes.string,

  /**
   * Text for the link.
   */
  label: PropTypes.string,

  /**
   * Triggered when the link is clicked.
   */
  onClick: PropTypes.func
};
var defaultProps = {
  assistiveText: {},
  iconCategory: '',
  iconName: '',
  label: ''
};
/**
 * A link within the navigation section of the header.
 */

var BuilderHeaderNavLink = function BuilderHeaderNavLink(props) {
  var assistiveText = _objectSpread(_objectSpread({}, defaultProps.assistiveText), props.assistiveText);

  return /*#__PURE__*/React.createElement("li", {
    className: "slds-builder-header__nav-item"
  }, /*#__PURE__*/React.createElement("a", {
    className: "slds-builder-header__item-action slds-media slds-media_center",
    href: "javascript:void(0)",
    onClick: props.onClick
  }, /*#__PURE__*/React.createElement("span", {
    className: "slds-media__figure"
  }, /*#__PURE__*/React.createElement(Icon, {
    assistiveText: {
      label: assistiveText.icon
    },
    category: props.iconCategory,
    containerClassName: "slds-icon_container slds-icon-utility-settings slds-current-color",
    name: props.iconName,
    path: props.iconPath,
    size: "x-small"
  })), /*#__PURE__*/React.createElement("span", {
    className: "slds-media__body"
  }, /*#__PURE__*/React.createElement("span", {
    className: "slds-truncate",
    title: props.label
  }, props.label))));
};

BuilderHeaderNavLink.displayName = BUILDER_HEADER_NAV_LINK;
BuilderHeaderNavLink.propTypes = propTypes;
export default BuilderHeaderNavLink;
//# sourceMappingURL=nav-link.js.map