'use strict';

var icons = require('@transferwise/icons');
var clsx = require('clsx');
var SentimentSurface = require('../../sentimentSurface/SentimentSurface.js');
var IconButton = require('../../iconButton/IconButton.js');
var reactIntl = require('react-intl');
var CloseButton_messages = require('../../common/closeButton/CloseButton.messages.js');
var React = require('react');
var jsxRuntime = require('react/jsx-runtime');

const PrimitivePrompt = /*#__PURE__*/React.forwardRef(({
  sentiment = 'success',
  emphasis = 'base',
  media,
  actions,
  onDismiss,
  className,
  children,
  ...restProps
}, ref) => {
  const intl = reactIntl.useIntl();
  return /*#__PURE__*/jsxRuntime.jsx(SentimentSurface.default
  // @ts-expect-error - SentimentSurface forwardRef types don't expose ref in props
  , {
    ref: ref,
    sentiment: sentiment,
    emphasis: emphasis,
    className: clsx.clsx('wds-prompt', `wds-prompt--${sentiment}`, className),
    ...restProps,
    children: /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: clsx.clsx('wds-prompt__content-wrapper', {
        'wds-prompt__content-wrapper--with-dismiss': !!onDismiss
      }),
      children: [/*#__PURE__*/jsxRuntime.jsx("div", {
        className: clsx.clsx('wds-prompt__media-wrapper'),
        children: media
      }), children, onDismiss && /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
        size: 24,
        priority: "secondary",
        "aria-label": intl.formatMessage(CloseButton_messages.default.ariaLabel),
        onClick: onDismiss,
        children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
      }), actions && /*#__PURE__*/jsxRuntime.jsx("div", {
        className: "wds-prompt__actions-wrapper",
        children: actions
      })]
    })
  });
});
PrimitivePrompt.displayName = 'PrimitivePrompt';

exports.PrimitivePrompt = PrimitivePrompt;
//# sourceMappingURL=PrimitivePrompt.js.map
