71 lines
2.0 KiB
JavaScript
71 lines
2.0 KiB
JavaScript
"use strict";
|
|
"use client";
|
|
/**
|
|
* @license lucide-react v1.45.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import { forwardRef, createElement } from 'react';
|
|
import { mergeClasses } from './shared/src/utils/mergeClasses.mjs';
|
|
import buildLucideIconForReact from './shared/src/build/buildLucideIconForReact.mjs';
|
|
import { hasA11yProp } from './shared/src/utils/hasA11yProp.mjs';
|
|
import { useLucideContext } from './context.mjs';
|
|
|
|
const Icon = forwardRef(
|
|
({
|
|
color,
|
|
size,
|
|
width,
|
|
height,
|
|
strokeWidth,
|
|
absoluteStrokeWidth,
|
|
nonScalingStroke,
|
|
className = "",
|
|
children,
|
|
iconNode = [],
|
|
icon = {
|
|
node: iconNode,
|
|
aliases: [],
|
|
size: 24
|
|
},
|
|
...rest
|
|
}, ref) => {
|
|
const {
|
|
size: contextSize = 24,
|
|
strokeWidth: contextStrokeWidth = 2,
|
|
absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
|
|
nonScalingStroke: contextNonScalingStroke = false,
|
|
color: contextColor = "currentColor",
|
|
className: contextClass = ""
|
|
} = useLucideContext() ?? {};
|
|
const hasAccessibleProp = Boolean(children) || hasA11yProp(rest);
|
|
const [name, svgAttributes, builtIconNode = []] = buildLucideIconForReact(icon, {
|
|
color: color ?? contextColor,
|
|
width: width ?? size ?? contextSize,
|
|
height: height ?? size ?? contextSize,
|
|
strokeWidth: strokeWidth ?? contextStrokeWidth,
|
|
absoluteStrokeWidth: absoluteStrokeWidth ?? contextAbsoluteStrokeWidth,
|
|
nonScalingStroke: nonScalingStroke ?? contextNonScalingStroke,
|
|
className: mergeClasses(contextClass, className),
|
|
hasA11yProp: hasAccessibleProp,
|
|
attributes: rest
|
|
});
|
|
return createElement(
|
|
name,
|
|
{
|
|
ref,
|
|
...svgAttributes
|
|
},
|
|
[
|
|
...builtIconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
...Array.isArray(children) ? children : [children]
|
|
]
|
|
);
|
|
}
|
|
);
|
|
|
|
export { Icon as default };
|
|
//# sourceMappingURL=Icon.mjs.map
|