'use strict';

var clsx = require('clsx');
var StatusIcon = require('../statusIcon/StatusIcon.js');
var Body = require('../body/Body.js');
var jsxRuntime = require('react/jsx-runtime');
var sentiment = require('../common/propsValues/sentiment.js');
var size = require('../common/propsValues/size.js');

const iconTypes = new Set([sentiment.Sentiment.NEGATIVE, sentiment.Sentiment.ERROR, sentiment.Sentiment.POSITIVE, sentiment.Sentiment.SUCCESS, sentiment.Sentiment.WARNING]);
/**
 * Avoid using `<InlineAlert>` component directly
 * it's for edge cases when `<Field />` isn't suitable for some reasons.
 *
 * Example:
 * ```
 * <Field sentiment={..} message={..}>..</Field>
 * ```
 */
function InlineAlert({
  id,
  type = 'neutral',
  iconLabel,
  className,
  children
}) {
  return /*#__PURE__*/jsxRuntime.jsxs(Body, {
    role: "alert",
    id: id,
    className: clsx.clsx('alert alert-detach', `alert-${type === sentiment.Sentiment.NEGATIVE || type === sentiment.Sentiment.ERROR ? 'danger' : type}`, 'd-flex', className),
    children: [iconTypes.has(type) && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
      sentiment: type,
      size: size.Size.SMALL,
      iconLabel: iconLabel
    }), /*#__PURE__*/jsxRuntime.jsx("div", {
      children: children
    })]
  });
}

module.exports = InlineAlert;
//# sourceMappingURL=InlineAlert.js.map
