import { forwardRef } from 'react';
import { jsx } from 'react/jsx-runtime';

function withIcon(Icon, desc) {
  const {
    name,
    theme
  } = desc;
  const viewBox = theme === 'twotone' ? '64 64 896 896' : '0 0 1024 1024';
  function IconWrap(props, ref) {
    const {
      className,
      style
    } = props;
    return /*#__PURE__*/jsx("span", {
      ...props,
      ref: ref,
      className: `mink-icon icon-${name}${className ? ` ${className}` : ''}`,
      style: style,
      "aria-label": name,
      role: "img",
      children: /*#__PURE__*/jsx(Icon, {
        "aria-hidden": "true",
        "data-icon": name,
        fill: "currentColor",
        focusable: "false",
        height: "1em",
        viewBox: viewBox,
        width: "1em"
      })
    });
  }
  return /*#__PURE__*/forwardRef(IconWrap);
}

export { withIcon as default };
