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 React, { forwardRef } from "react";
import { useThemeInternal } from "../../theme/Theme.js";
import { BodyLong } from "../../typography/index.js";
import { cl } from "../../utils/helpers/index.js";
import { useI18n } from "../../utils/i18n/i18n.hooks.js";
import { InlineMessageIcon } from "../icon/InlineMessageIcon.js";
/**
 * InlineMessage is used to highlight short messages next to other content.
 * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/inline-message)
 * @see 🏷️ {@link InlineMessageProps}
 * @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
 * @example
 * ```jsx
 *  <InlineMessage status="error">
 *    Inline Errormessage
 *  </InlineMessage>
 * ```
 *
 * @example
 * As a link
 * ```jsx
 *  <InlineMessage status="error" as={Link} href="#">
 *    Inline Errormessage
 *  </InlineMessage>
 * ```
 */
export const InlineMessage = forwardRef((_a, forwardedRef) => {
    var { as: Component = "div", children, className, status, size = "medium" } = _a, restProps = __rest(_a, ["as", "children", "className", "status", "size"]);
    const themeContext = useThemeInternal();
    const translate = useI18n("global");
    return (React.createElement(BodyLong, Object.assign({ ref: forwardedRef, className: cl("aksel-inline-message", className), "data-color": status === "error" ? "danger" : status }, restProps, { size: size, as: Component, "data-size": size }),
        React.createElement(InlineMessageIcon, { status: status }),
        status && (React.createElement(BodyLong, { as: "span", visuallyHidden: true }, `${translate(status)}: `)),
        React.createElement("span", { "data-color": themeContext === null || themeContext === void 0 ? void 0 : themeContext.color }, children)));
});
export default InlineMessage;
//# sourceMappingURL=InlineMessage.js.map