import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { cnb } from "cnbuilder";
import { forwardRef } from "react";
import { FormMessage } from "./FormMessage.js";
/**
 * **Server Component**
 * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper
 * and renders the {@link FormMessage} component.
 *
 * @remarks \@since 2.5.0
 */ export const FormMessageContainer = /*#__PURE__*/ forwardRef(function FormMessageContainer(props, ref) {
    const { className, children, messageProps, ...remaining } = props;
    if (!messageProps) {
        return /*#__PURE__*/ _jsx(_Fragment, {
            children: children
        });
    }
    return /*#__PURE__*/ _jsxs("div", {
        ...remaining,
        ref: ref,
        className: cnb("rmd-form-message-container", className),
        children: [
            children,
            /*#__PURE__*/ _jsx(FormMessage, {
                ...messageProps
            })
        ]
    });
});

//# sourceMappingURL=FormMessageContainer.js.map