import { jsx as _jsx } from "react/jsx-runtime";
import { cnb } from "cnbuilder";
import { Children, cloneElement, forwardRef, isValidElement } from "react";
import { iconRotator } from "./styles.js";
/**
 * The `IconRotator` is a simple component that is used to rotate an icon from a
 * one degrees to another.
 *
 * @see {@link https://react-md.dev/components/icon-rotator | IconRotator Demos}
 */ export const IconRotator = /*#__PURE__*/ forwardRef(function IconRotator(props, ref) {
    const { className: propClassName, rotated, children, forceIconWrap = false, disableTransition = false, ...remaining } = props;
    const className = iconRotator({
        rotated,
        className: propClassName,
        disableTransition
    });
    if (!forceIconWrap && /*#__PURE__*/ isValidElement(children)) {
        const child = Children.only(children);
        return /*#__PURE__*/ cloneElement(child, {
            className: cnb(className, child.props.className)
        });
    }
    return /*#__PURE__*/ _jsx("span", {
        ...remaining,
        ref: ref,
        className: className,
        children: children
    });
});

//# sourceMappingURL=IconRotator.js.map