| "use strict"; |
| "use client"; |
| |
| |
| |
| |
| |
| |
|
|
| import { forwardRef, createElement } from 'react'; |
| import defaultAttributes from './defaultAttributes.mjs'; |
| import { hasA11yProp } from './shared/src/utils/hasA11yProp.mjs'; |
| import { mergeClasses } from './shared/src/utils/mergeClasses.mjs'; |
| import { useLucideContext } from './context.mjs'; |
|
|
| const Icon = forwardRef( |
| ({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => { |
| const { |
| size: contextSize = 24, |
| strokeWidth: contextStrokeWidth = 2, |
| absoluteStrokeWidth: contextAbsoluteStrokeWidth = false, |
| color: contextColor = "currentColor", |
| className: contextClass = "" |
| } = useLucideContext() ?? {}; |
| const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth; |
| return createElement( |
| "svg", |
| { |
| ref, |
| ...defaultAttributes, |
| width: size ?? contextSize ?? defaultAttributes.width, |
| height: size ?? contextSize ?? defaultAttributes.height, |
| stroke: color ?? contextColor, |
| strokeWidth: calculatedStrokeWidth, |
| className: mergeClasses("lucide", contextClass, className), |
| ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" }, |
| ...rest |
| }, |
| [ |
| ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)), |
| ...Array.isArray(children) ? children : [children] |
| ] |
| ); |
| } |
| ); |
|
|
| export { Icon as default }; |
| |
|
|