"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getBaseFocusState = exports.transitionFade = exports.transitionInstant = exports.focusedCircleRadius = exports.activeBackgroundColor = exports.hoverBackgroundColor = exports.focusedBorderRadius = exports.focusedBorderColor = exports.focusedBorderShadow = exports.darkModeBoxShadow = exports.focusedBoxShadow = exports.FOCUS_VISIBLE_SELECTOR = void 0;

require("focus-visible/dist/focus-visible");

var _color = require("../../utils/color");

var _branding = require("../branding");

/*
  We use a polyfill for the :focus-visible property to hide focus outlines. We remove the
  outline in the cases where the polyfill is loaded and focus-visible is not applied. The
  data attribute for focus visible is used as our style classes are overwritten. In the
  future this should be removed with just a :focused-visible css selector.
*/
var FOCUS_VISIBLE_SELECTOR = '.js-focus-visible &[data-focus-visible-added]';
exports.FOCUS_VISIBLE_SELECTOR = FOCUS_VISIBLE_SELECTOR;

var focusedBoxShadow = function focusedBoxShadow(_ref) {
  var theme = _ref.theme;
  return "0 1px 5px ".concat((0, _color.fadeColor)((0, _branding.getPaletteColor)('white')({
    theme: theme
  }), 0.9));
};

exports.focusedBoxShadow = focusedBoxShadow;

var darkModeBoxShadow = function darkModeBoxShadow(_ref2) {
  var theme = _ref2.theme;
  return "0 0 0 2px ".concat((0, _branding.getPaletteColor)('white')({
    theme: theme
  }));
};

exports.darkModeBoxShadow = darkModeBoxShadow;

var focusedBorderShadow = function focusedBorderShadow(_ref3) {
  var _ref3$inset = _ref3.inset,
      inset = _ref3$inset === void 0 ? true : _ref3$inset;
  return "".concat(inset ? 'inset' : '', " 0 0 0 2px");
};

exports.focusedBorderShadow = focusedBorderShadow;

var focusedBorderColor = function focusedBorderColor(_ref4) {
  var theme = _ref4.theme;
  return (0, _branding.getPaletteColor)('greyscale-black')({
    theme: theme
  });
};

exports.focusedBorderColor = focusedBorderColor;

var focusedBorderRadius = function focusedBorderRadius(_ref5) {
  var _ref5$borderRadius = _ref5.borderRadius,
      borderRadius = _ref5$borderRadius === void 0 ? 0 : _ref5$borderRadius;
  return "".concat(borderRadius, "px");
};

exports.focusedBorderRadius = focusedBorderRadius;

var hoverBackgroundColor = function hoverBackgroundColor(_ref6) {
  var theme = _ref6.theme;
  return (0, _color.fadeColor)((0, _branding.getPaletteColor)('greyscale-light')({
    theme: theme
  }), 0.75);
};

exports.hoverBackgroundColor = hoverBackgroundColor;

var activeBackgroundColor = function activeBackgroundColor(_ref7) {
  var theme = _ref7.theme;
  return (0, _color.fadeColor)((0, _branding.getPaletteColor)('greyscale-light')({
    theme: theme
  }), 0.5);
};

exports.activeBackgroundColor = activeBackgroundColor;
var focusedCircleRadius = '50%';
exports.focusedCircleRadius = focusedCircleRadius;
var transitionInstant = '0s';
exports.transitionInstant = transitionInstant;
var transitionFade = 'all 100ms linear';
exports.transitionFade = transitionFade;

var getBaseFocusState = function getBaseFocusState(_ref8) {
  var _ref8$baseTransition = _ref8.baseTransition,
      baseTransition = _ref8$baseTransition === void 0 ? true : _ref8$baseTransition,
      _ref8$hoverTransition = _ref8.hoverTransition,
      hoverTransition = _ref8$hoverTransition === void 0 ? true : _ref8$hoverTransition,
      _ref8$activeTransitio = _ref8.activeTransition,
      activeTransition = _ref8$activeTransitio === void 0 ? true : _ref8$activeTransitio,
      _ref8$pointerCursor = _ref8.pointerCursor,
      pointerCursor = _ref8$pointerCursor === void 0 ? true : _ref8$pointerCursor;
  return "\n  outline: none;\n  box-shadow: initial;\n  ".concat(baseTransition ? "transition: ".concat(transitionFade, ";") : '', "\n  &:not([disabled]) {\n    &:hover {\n      ").concat(pointerCursor ? 'cursor: pointer;' : '', "\n      ").concat(hoverTransition ? "transition: ".concat(transitionInstant, ";") : '', "\n    }\n    &:active {\n      ").concat(activeTransition ? "transition: ".concat(transitionInstant, ";") : '', "\n    }\n  }\n  &[disabled] {\n    cursor: default;\n  }\n");
};

exports.getBaseFocusState = getBaseFocusState;