import { a as IconSize, n as AnalyticsId } from "./constants2.js";
import React, { useId } from "react";
import classNames from "classnames";
import { jsx, jsxs } from "react/jsx-runtime";
const getIcon = ({ size, isHovered, normal, normalHover, xSmall, xSmallHover, xxSmall, xxSmallHover }) => {
	if (size <= IconSize.XXSmall && xxSmall && xxSmallHover) return isHovered ? xxSmallHover : xxSmall;
	if (size <= IconSize.XSmall && xSmall && xSmallHover) return isHovered ? xSmallHover : xSmall;
	return isHovered ? normalHover : normal;
};
const Icon = React.forwardRef((props, ref) => {
	const { svgIcon, ariaLabel, className = "", size = IconSize.Small, color = "black", hoverColor = color || "black", isHovered = false, onColor, testId, ...other } = props;
	const svgRaw = React.createElement(svgIcon, {
		size,
		isHovered,
		onColor
	});
	const titleId = useId();
	const svgColor = isHovered ? hoverColor : color;
	return /* @__PURE__ */ jsxs("svg", {
		"data-testid": testId,
		"data-analyticsid": AnalyticsId.Icon,
		ref,
		className: classNames(`hnds-style-icon`, className),
		role: ariaLabel ? "img" : "presentation",
		"aria-labelledby": ariaLabel ? titleId : void 0,
		focusable: false,
		"aria-hidden": ariaLabel ? void 0 : true,
		viewBox: "0 0 48 48",
		style: {
			minWidth: size,
			minHeight: size
		},
		width: size,
		height: size,
		fill: svgColor,
		color: svgColor,
		...other,
		children: [ariaLabel && /* @__PURE__ */ jsx("title", {
			id: titleId,
			children: ariaLabel
		}), svgRaw]
	});
});
Icon.displayName = "Icon";
var Icon_default = Icon;
export { Icon as n, getIcon as r, Icon_default as t };

//# sourceMappingURL=Icon.js.map