@tabler/icons-react
Version:
A set of free MIT-licensed high-quality SVG icons for you to use in your web projects.
42 lines (38 loc) • 1.26 kB
JavaScript
/**
* @license @tabler/icons-react v3.34.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/
import { forwardRef, createElement } from 'react';
import defaultAttributes from './defaultAttributes.mjs';
const createReactComponent = (type, iconName, iconNamePascal, iconNode) => {
const Component = forwardRef(
({ color = "currentColor", size = 24, stroke = 2, title, className, children, ...rest }, ref) => createElement(
"svg",
{
ref,
...defaultAttributes[type],
width: size,
height: size,
className: [`tabler-icon`, `tabler-icon-${iconName}`, className].join(" "),
...type === "filled" ? {
fill: color
} : {
strokeWidth: stroke,
stroke: color
},
...rest
},
[
title && createElement("title", { key: "svg-title" }, title),
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
...Array.isArray(children) ? children : [children]
]
)
);
Component.displayName = `${iconNamePascal}`;
return Component;
};
export { createReactComponent as default };
//# sourceMappingURL=createReactComponent.mjs.map