var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import React, {} from "react";
import { cn } from "@utils";
import { adpIconVariants, iconSizeProportions } from "./adpIconVariants";
import { iconList, icons } from "./svgObjects";
export { iconList };
/**
 * Astral UI Icon component
 *
 * This component renders an SVG icon from the set of predefined icons or a custom SVG object.
 */
export const ADPIcon = React.forwardRef((_a, ref) => {
    var { icon = "custom-icon", size = "sm", spin = false, padded = false, title, data_icon_name, fixedWidth = false, customSVG, className } = _a, props = __rest(_a, ["icon", "size", "spin", "padded", "title", "data_icon_name", "fixedWidth", "customSVG", "className"]);
    if (!(icons === null || icons === void 0 ? void 0 : icons[icon]) && typeof customSVG === "undefined") {
        console.error(`Please provide a valid icon (${icon}) or a customSVG object.`);
        return null;
    }
    const { xOffset = 0, yOffset = 0, initialHeight = 24, initialWidth = 24, SVGPath } = customSVG !== null && customSVG !== void 0 ? customSVG : icons[icon];
    const requiredHeight = (iconSizeProportions[size] + (padded ? 0.25 : 0)) * initialHeight;
    const requiredWidth = (iconSizeProportions[size] + (padded ? 0.25 : 0)) * (fixedWidth ? 24 : initialWidth);
    return (_jsx("svg", Object.assign({ "data-testid": "icon", className: cn(adpIconVariants({
            spin,
            padded,
            fixedWidth
        }), className), width: requiredWidth, height: requiredHeight, viewBox: `${xOffset} ${yOffset} ${initialWidth} ${initialHeight}`, fill: "none", "data-icon": data_icon_name !== null && data_icon_name !== void 0 ? data_icon_name : icon, xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", ref: ref }, props, { children: _jsxs(_Fragment, { children: [title && _jsx("title", { children: title }), SVGPath] }) })));
});
ADPIcon.displayName = "ADPIcon";
//# sourceMappingURL=adpIcon.js.map