UNPKG

@hugeicons/react

Version:

HugeIcons Pro React Component Library https://hugeicons.com

48 lines (43 loc) 1.52 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var react = require('react'); const defaultAttributes = { xmlns: 'http://www.w3.org/2000/svg', width: 24, height: 24, viewBox: '0 0 24 24', fill: 'none', }; const HugeiconsIcon = react.forwardRef(({ color = 'currentColor', size = 24, strokeWidth, absoluteStrokeWidth = false, className = '', altIcon, showAlt = false, icon, ...rest }, ref) => { const calculatedStrokeWidth = strokeWidth !== undefined ? (absoluteStrokeWidth ? (Number(strokeWidth) * 24) / Number(size) : strokeWidth) : undefined; const strokeProps = calculatedStrokeWidth !== undefined ? { strokeWidth: calculatedStrokeWidth, stroke: 'currentColor' } : {}; const elementProps = { ref, ...defaultAttributes, width: size, height: size, color, className, ...strokeProps, ...rest, }; const currentIcon = (showAlt && altIcon) ? altIcon : icon; // Create SVG children without adding them as an icon prop const svgChildren = currentIcon.map(([tag, attrs]) => { return react.createElement(tag, { ...attrs, ...strokeProps, key: attrs.key }); }); return react.createElement('svg', elementProps, svgChildren); }); HugeiconsIcon.displayName = 'HugeiconsIcon'; exports.HugeiconsIcon = HugeiconsIcon; exports.default = HugeiconsIcon; //# sourceMappingURL=HugeiconsIcon.js.map