"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _IconPaths = _interopRequireDefault(require("../IconPaths"));

var _colors = _interopRequireDefault(require("./colors"));

var _sizes = _interopRequireWildcard(require("./sizes"));

var _typography = _interopRequireDefault(require("./typography"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var space = _objectSpread(_objectSpread(_objectSpread({}, _sizes.baseSizes), _sizes["default"].spacing), {}, {
  input: _sizes["default"].input,
  canvas: _sizes["default"].canvas,
  header: _sizes["default"].header
});

var shadows = function shadows(providedTheme, mode) {
  var modes = {
    light: {
      topNav: '0 2px 8px 0 rgba(38,38,38,0.08)',
      card: '0 0 1px 0 rgba(38,38,38,0.08), 0 0 2px 0 rgba(89,89,89,0.16)',
      pressed: '0 0 1px 0 rgba(38,38,38,0.08), 0 0.5px 2px 0 rgba(89,89,89,0.16)',
      button: '0 0 1px 0 rgba(38,38,38,0.04), 0 2px 4px 0 rgba(89,89,89,0.16)',
      menu: '0 0 2px 0 rgba(38,38,38,0.04), 0 4px 8px 0 rgba(89,89,89,0.16)',
      raised: '0 2px 4px 0 rgba(38,38,38,0.04), 0 8px 16px 0 rgba(89,89,89,0.16)',
      toast: '0 2px 8px 0 rgba(38,38,38,0.04), 0 16px 24px 0 rgba(89,89,89,0.16)',
      modal: '0 2px 8px 0 rgba(38,38,38,0.08), 0 20px 32px 0 rgba(89,89,89,0.24)',
      outline: '0 0 0 3px rgba(192, 213, 245, 0.6)'
    },
    dark: {
      topNav: '0 2px 8px 0 rgba(0,0,0,0.08)',
      card: '0 0 1px 0 rgba(0,0,0,0.08), 0 0 2px 0 rgba(0,0,0,0.16)',
      pressed: '0 0 1px 0 rgba(0,0,0,0.08), 0 0.5px 2px 0 rgba(0,0,0,0.16)',
      button: '0 0 1px 0 rgba(0,0,0,0.04), 0 2px 4px 0 rgba(0,0,0,0.16)',
      menu: '0 0 2px 0 rgba(0,0,0,0.04), 0 4px 8px 0 rgba(0,0,0,0.16)',
      raised: '0 2px 4px 0 rgba(0,0,0,0.04), 0 8px 16px 0 rgba(0,0,0,0.16)',
      toast: '0 2px 8px 0 rgba(0,0,0,0.04), 0 16px 24px 0 rgba(0,0,0,0.16)',
      modal: '0 2px 8px 0 rgba(0,0,0,0.08), 0 20px 32px 0 rgba(0,0,0,0.24)',
      outline: '0 0 0 3px rgba(142, 163, 195, 0.25)'
    }
  };
  return _objectSpread(_objectSpread({
    sm: '0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04)',
    md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
    lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
    xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
    '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
    inner: 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
    none: 'none'
  }, modes[mode]), (providedTheme === null || providedTheme === void 0 ? void 0 : providedTheme.shadows) && providedTheme.shadows[mode] || {});
};

var basis = ['480px', '768px', '992px', '1280px', '1600px'];
var breakpoints = {
  basis: basis,
  // aliases
  sm: basis[0],
  md: basis[1],
  lg: basis[2],
  xl: basis[3],
  hd: basis[4],
  stripped: {
    sm: parseInt(basis[0], 10),
    md: parseInt(basis[1], 10),
    lg: parseInt(basis[2], 10),
    xl: parseInt(basis[3], 10),
    hd: parseInt(basis[4], 10)
  }
};
var zIndices = {
  hide: -1,
  auto: 'auto',
  base: 0,
  docked: 10,
  dropdown: 900,
  sticky: 1000,
  banner: 1100,
  panel: 1200,
  overlay: 1300,
  modal: 1400,
  popover: 1500,
  skipLink: 1600,
  toast: 1700,
  tooltip: 1800
};
var baseRadii = {
  none: '0',
  sm: '0.125rem',
  md: '0.25rem',
  lg: '0.5rem',
  full: '9999px'
};

var radii = _objectSpread(_objectSpread({}, baseRadii), {}, {
  radius: '0.375rem' // radius var for component consistency

});

var opacity = {
  '0': '0',
  '20%': '0.2',
  '40%': '0.4',
  '60%': '0.6',
  '80%': '0.8',
  '100%': '1'
};
var borders = {
  none: 0,
  '1px': '1px solid',
  '2px': '2px solid',
  '3px': '3px solid',
  '4px': '4px solid'
}; // const borderWidths = {
//   xl: "2rem",
//   lg: "1rem",
//   md: "0.5rem",
//   sm: "0.25rem",
//   xs: "0.125rem",
//   "2xs": "0.0625rem",
//   none: 0
// };

var baseTheme = function baseTheme(_ref) {
  var _ref$providedTheme = _ref.providedTheme,
      providedTheme = _ref$providedTheme === void 0 ? {} : _ref$providedTheme,
      _ref$mode = _ref.mode,
      mode = _ref$mode === void 0 ? 'light' : _ref$mode;
  var colorScheme = (0, _colors["default"])(providedTheme, mode);
  var shadowScheme = shadows(providedTheme, mode);
  return _objectSpread(_objectSpread(_objectSpread({
    breakpoints: breakpoints['basis'],
    // emotion theme needs to be passed an string array of breakpoints
    breakpoint: breakpoints,
    zIndices: zIndices,
    radii: radii,
    opacity: opacity,
    borders: borders
  }, _typography["default"]), {}, {
    sizes: _sizes["default"],
    space: space,
    icons: _IconPaths["default"],
    // component styles
    // add to this in custom theme to override component styling
    styles: {}
  }, providedTheme), {}, {
    // colors and shadows merge in with default theme
    colors: colorScheme,
    shadows: shadowScheme
  });
};

exports.baseTheme = baseTheme;
var theme = baseTheme({});
exports.theme = theme;
//# sourceMappingURL=theme.js.map