"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Palette = void 0;

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireWildcard(require("styled-components"));

var _ = require("../../..");

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var BackgroundColor = (0, _styledComponents["default"])(_.Box).withConfig({
  displayName: "BackgroundColor",
  componentId: "sc-19un633-0"
})(["min-height:100px;"]);
var SwatchContainer = (0, _styledComponents["default"])(_.Card).withConfig({
  displayName: "SwatchContainer",
  componentId: "sc-19un633-1"
})(["overflow:hidden;"]);

var Swatch = function Swatch(_ref) {
  var backgroundColorName = _ref.backgroundColorName,
      legalForegroundColorNames = _ref.legalForegroundColorNames;
  var theme = (0, _styledComponents.useTheme)();
  return /*#__PURE__*/_react["default"].createElement(SwatchContainer, {
    spacing: "mv2"
  }, /*#__PURE__*/_react["default"].createElement(_.CardSection, {
    spacing: "p1",
    stacked: "row",
    justify: "center"
  }, /*#__PURE__*/_react["default"].createElement(_.Text, {
    spacing: "m0",
    fontSize: "f0"
  }, /*#__PURE__*/_react["default"].createElement(_.Span, {
    bold: true
  }, backgroundColorName), " (", theme.colorPalette[backgroundColorName], ")")), /*#__PURE__*/_react["default"].createElement(_.CardSection, null, /*#__PURE__*/_react["default"].createElement(BackgroundColor, {
    colorName: backgroundColorName,
    spacing: "pt1",
    stacked: "column",
    align: "end",
    justify: "center"
  }, legalForegroundColorNames.map(function (legalForegroundColorName) {
    return /*#__PURE__*/_react["default"].createElement(_.Text, {
      fontSize: "f0",
      colorName: legalForegroundColorName,
      spacing: "mr1"
    }, /*#__PURE__*/_react["default"].createElement(_.Span, {
      bold: true
    }, legalForegroundColorName), " (", theme.colorPalette[legalForegroundColorName], ")");
  }))));
};

var Basics = function Basics() {
  return /*#__PURE__*/_react["default"].createElement(_.Box, {
    spacing: "mr2",
    basis: 225
  }, /*#__PURE__*/_react["default"].createElement(_.SectionHeader, null, "Basics"), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "greyscale-dark",
    backgroundColorName: "background",
    legalForegroundColorNames: ['greyscale-dark', 'greyscale-black', 'brand-primary-fg', 'brand-secondary-fg']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "greyscale-dark",
    backgroundColorName: "white",
    legalForegroundColorNames: ['greyscale-dark', 'greyscale-black', 'brand-primary-fg', 'brand-secondary-fg']
  }));
};

var Primary = function Primary() {
  return /*#__PURE__*/_react["default"].createElement(_.Box, {
    spacing: "mr2",
    basis: 220
  }, /*#__PURE__*/_react["default"].createElement(_.SectionHeader, null, "Primary"), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "brand-primary-fg",
    backgroundColorName: "brand-primary-bg",
    legalForegroundColorNames: ['brand-primary-fg']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "brand-primary-bg",
    backgroundColorName: "brand-primary-fg",
    legalForegroundColorNames: ['brand-primary-bg', 'white']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "white",
    backgroundColorName: "brand-primary-base",
    legalForegroundColorNames: []
  }));
};

var Secondary = function Secondary() {
  return /*#__PURE__*/_react["default"].createElement(_.Box, {
    spacing: "mr2",
    basis: 240
  }, /*#__PURE__*/_react["default"].createElement(_.SectionHeader, null, "Secondary"), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "brand-secondary-fg",
    backgroundColorName: "brand-secondary-bg",
    legalForegroundColorNames: ['brand-secondary-fg']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "brand-secondary-bg",
    backgroundColorName: "brand-secondary-fg",
    legalForegroundColorNames: ['brand-secondary-bg', 'white']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "white",
    backgroundColorName: "brand-secondary-base",
    legalForegroundColorNames: []
  }));
};

var Alerts = function Alerts() {
  return /*#__PURE__*/_react["default"].createElement(_.Box, {
    basis: 200
  }, /*#__PURE__*/_react["default"].createElement(_.SectionHeader, null, "Alerts"), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "success-fg",
    backgroundColorName: "success-bg",
    legalForegroundColorNames: ['success-fg']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "info-fg",
    backgroundColorName: "info-bg",
    legalForegroundColorNames: ['info-fg']
  }), /*#__PURE__*/_react["default"].createElement(Swatch, {
    infoTextColorName: "error-fg",
    backgroundColorName: "error-bg",
    legalForegroundColorNames: ['error-fg']
  }));
};

var Palette = function Palette() {
  return /*#__PURE__*/_react["default"].createElement(_.Box, {
    stacked: "row",
    spacing: ['mt3', 'pr1'],
    justify: "space-between",
    wrap: true
  }, /*#__PURE__*/_react["default"].createElement(Basics, null), /*#__PURE__*/_react["default"].createElement(Primary, null), /*#__PURE__*/_react["default"].createElement(Secondary, null), /*#__PURE__*/_react["default"].createElement(Alerts, null));
};

exports.Palette = Palette;