import { _ as _extends } from '../extends-C4cduGrv.js';
import { _ as _objectWithoutProperties } from '../objectWithoutProperties-TXwlfNxG.js';
import React__default from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import library from './assets/icon-map.js';

var _excluded = ["name", "className", "size"];
var SIZES = {
  sm: "w-4 h-4",
  md: "w-6 h-6",
  lg: "w-8 h-8"
};

var lookupIcon = function lookupIcon(iconName) {
  return library.find(function (i) {
    if (i.name === iconName) {
      return i.component;
    }
  });
};

var CKIcon = function CKIcon(_ref) {
  var name = _ref.name,
      className = _ref.className,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? "md" : _ref$size,
      props = _objectWithoutProperties(_ref, _excluded);

  className = cx("fill-current inline-block overflow-visible", SIZES[size], className);

  if (name && typeof name == 'string') {
    var icon = lookupIcon(name);

    if (!icon) {
      return /*#__PURE__*/React__default.createElement("div", null, "Sorry looks like the icon you are looking for does not exist.");
    }

    var Icon = icon.component;
    return /*#__PURE__*/React__default.createElement(Icon, _extends({
      className: className,
      name: name,
      style: {
        fontSize: 'inherit'
      }
    }, props));
  }
};

CKIcon.propTypes = {
  /** Matches name in Figma, using lowercase and hyphens instead of spaces. */
  name: PropTypes.string.isRequired,
  size: PropTypes.oneOf(["sm", "md", "lg"]),

  /** Customize the icon. E.g. text-gray-700 */
  className: PropTypes.string
};

export { CKIcon as default };
