import { _ as _objectWithoutProperties } from '../objectWithoutProperties-72d23964.js';
import React__default from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { I as Icon, B as Button } from '../index-99927619.js';
import '../extends-e61fd370.js';
import '../defineProperty-18999f8e.js';
import '../slicedToArray-5b664d46.js';
import '../typeof-6c6d8d7a.js';
import '../toConsumableArray-f2f53597.js';
import '../index-81a9bdac.js';
import 'react-dom';
import '../icon/assets/icon-map/index.js';
import '../social-icon/index.js';
import '@fortawesome/react-fontawesome';
import '../social-icon/icons.js';
import '../social-icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/free-solid-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../tooltip/index.js';
import '../auto-id.esm-2b54f757.js';
import '../utils.esm-514fad91.js';
import '../warning-ed2bf294.js';
import '../portal.esm-613949dc.js';
import '@reach/visually-hidden';
import '../portal/index.js';
import '../use-rerender-once/index.js';
import '../use-force-update/index.js';
import '../button/button-group.js';
import '../inject-css-ccd0a386.js';

var _excluded = ["type", "size", "title", "message", "action", "children", "icon"],
    _excluded2 = ["children"];
var types = {
  success: {
    bg: "bg-green-50",
    iconColor: "text-green-600",
    icon: "check-circle",
    buttonColor: "bg-green-200 text-gray-900 hover:bg-green-300 focus:bg-green-300"
  },
  warning: {
    bg: "bg-yellow-50",
    iconColor: "text-yellow-600",
    icon: "alert-circle",
    buttonColor: "bg-yellow-200 hover:bg-yellow-300"
  },
  info: {
    bg: "bg-blue-50",
    iconColor: "text-blue-600",
    icon: "information-circle",
    buttonColor: "bg-blue-200 hover:bg-blue-300"
  },
  error: {
    bg: "bg-red-50",
    iconColor: "text-red-600",
    icon: "alert-triangle",
    buttonColor: "bg-red-200 hover:bg-red-300"
  }
};
var sizes = {
  sm: "py-2 px-4 items-center",
  lg: "p-4"
};
function Note(_ref) {
  var _ref$type = _ref.type,
      type = _ref$type === void 0 ? "info" : _ref$type,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? "lg" : _ref$size,
      title = _ref.title,
      message = _ref.message,
      action = _ref.action,
      children = _ref.children,
      _ref$icon = _ref.icon,
      icon = _ref$icon === void 0 ? true : _ref$icon,
      props = _objectWithoutProperties(_ref, _excluded);

  var className = cx("rounded-lg text-sm text-gray-800 flex", types[type].bg, sizes[size], props.className);
  var iconName = typeof icon === "string" ? icon : types[type].icon;
  return /*#__PURE__*/React__default.createElement("div", {
    className: className,
    "data-testid": "note",
    style: {
      minHeight: "48px"
    }
  }, icon && /*#__PURE__*/React__default.createElement(Icon, {
    name: iconName,
    className: "".concat(types[type].iconColor, " mr-4")
  }), /*#__PURE__*/React__default.createElement("div", {
    className: cx("w-full", size === "sm" && "flex items-center")
  }, size !== "sm" && title && /*#__PURE__*/React__default.createElement(Title, {
    className: "flex-shrink-0"
  }, title), message && /*#__PURE__*/React__default.createElement("p", {
    className: cx("text-gray-700 leading-6", size === "sm" && "flex-grow")
  }, message), action && /*#__PURE__*/React__default.createElement(Button, {
    size: "sm",
    is: "plain",
    className: cx(types[type].buttonColor, {
      "mt-4": size !== "sm",
      "ml-4": size === "sm"
    }),
    onClick: action.onClick,
    href: action.href,
    target: action.target
  }, action.label), children));
}
Note.propTypes = {
  type: PropTypes.oneOf(["info", "success", "warning", "error"]),
  size: PropTypes.oneOf(["sm", "lg"]),

  /** Only available on `lg` size */
  title: PropTypes.string,
  message: PropTypes.string,
  action: PropTypes.shape({
    label: PropTypes.string,
    onClick: PropTypes.func,
    href: PropTypes.string,
    target: PropTypes.string
  }),

  /** Controls if an icon is displayed or not. */
  icon: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
  className: PropTypes.string,
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
};
function Title(_ref2) {
  var children = _ref2.children,
      props = _objectWithoutProperties(_ref2, _excluded2);

  var className = cx("font-semibold text-sm text-gray-900 leading-6 mb-1", props.className);
  return /*#__PURE__*/React__default.createElement("div", {
    className: className
  }, children);
}

export { Title, Note as default, types };
