"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getPlacement = getPlacement;
exports.CloseIconSvg = exports.Body = exports.Root = void 0;

var _styles = require("../styles");

var _styledComponents = require("../icon/styled-components");

var _constants = require("./constants");

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function getBackgroundColor(kind, theme) {
  var _KIND$info$KIND$posit;

  return (_KIND$info$KIND$posit = {}, _defineProperty(_KIND$info$KIND$posit, _constants.KIND.info, theme.colors.primary500), _defineProperty(_KIND$info$KIND$posit, _constants.KIND.positive, theme.colors.positive500), _defineProperty(_KIND$info$KIND$posit, _constants.KIND.warning, theme.colors.warning500), _defineProperty(_KIND$info$KIND$posit, _constants.KIND.negative, theme.colors.negative500), _KIND$info$KIND$posit)[kind];
}

function getPlacement(placement) {
  var _PLACEMENT$topLeft$PL;

  return (_PLACEMENT$topLeft$PL = {}, _defineProperty(_PLACEMENT$topLeft$PL, _constants.PLACEMENT.topLeft, {
    top: 0,
    alignItems: 'flex-start',
    justifyContent: 'flex-start',
    flexDirection: 'column'
  }), _defineProperty(_PLACEMENT$topLeft$PL, _constants.PLACEMENT.top, {
    top: 0,
    alignItems: 'center',
    justifyContent: 'flex-start',
    flexDirection: 'column'
  }), _defineProperty(_PLACEMENT$topLeft$PL, _constants.PLACEMENT.topRight, {
    top: 0,
    alignItems: 'flex-end',
    justifyContent: 'flex-start',
    flexDirection: 'column'
  }), _defineProperty(_PLACEMENT$topLeft$PL, _constants.PLACEMENT.bottomRight, {
    bottom: 0,
    alignItems: 'flex-end',
    justifyContent: 'flex-end',
    flexDirection: 'column-reverse'
  }), _defineProperty(_PLACEMENT$topLeft$PL, _constants.PLACEMENT.bottom, {
    bottom: 0,
    alignItems: 'center',
    justifyContent: 'flex-end',
    flexDirection: 'column-reverse'
  }), _defineProperty(_PLACEMENT$topLeft$PL, _constants.PLACEMENT.bottomLeft, {
    bottom: 0,
    alignItems: 'flex-start',
    justifyContent: 'flex-end',
    flexDirection: 'column-reverse'
  }), _PLACEMENT$topLeft$PL)[placement];
}
/**
 * Main component container element
 */


var Root = (0, _styles.styled)('div', function (props) {
  var $placement = props.$placement;
  return _objectSpread({
    pointerEvents: 'none',
    position: 'fixed',
    right: 0,
    left: 0,
    display: 'flex'
  }, getPlacement($placement));
});
exports.Root = Root;
var Body = (0, _styles.styled)('div', function (props) {
  var $isVisible = props.$isVisible,
      $kind = props.$kind,
      $theme = props.$theme;
  return _objectSpread({}, $theme.typography.font300, {
    pointerEvents: 'auto',
    color: $theme.colors.white,
    height: 'auto',
    width: '288px',
    paddingTop: $theme.sizing.scale600,
    paddingRight: $theme.sizing.scale600,
    paddingBottom: $theme.sizing.scale600,
    paddingLeft: $theme.sizing.scale600,
    marginTop: $theme.sizing.scale300,
    marginBottom: $theme.sizing.scale300,
    backgroundColor: getBackgroundColor($kind, $theme) || $theme.colors.primary500,
    borderRadius: $theme.borders.useRoundedCorners ? $theme.borders.radius200 : '0px',
    boxShadow: $theme.lighting.shadow600,
    opacity: $isVisible ? 1 : 0,
    transitionProperty: 'all',
    transitionDuration: $theme.animation.timing100,
    transitionTimingFunction: $theme.animation.easeInOutCurve
  });
});
/**
 * DeleteAlt icon overrides
 */

exports.Body = Body;
var CloseIconSvg = (0, _styles.styled)('svg', function (props) {
  return _objectSpread({}, (0, _styledComponents.getSvgStyles)(props), {
    cursor: 'pointer',
    float: 'right'
  });
});
exports.CloseIconSvg = CloseIconSvg;