"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _color = _interopRequireDefault(require("color"));
var _utils = require("../utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var HoverArea = _styledComponents.default.div.withConfig({
  displayName: "SliderTrack__HoverArea",
  componentId: "sc-jh56np-0"
})(["position:relative;width:100%;height:", ";cursor:", ";padding:", ";&:hover{& > div > div:nth-last-child(1){border:", ";background:", ";}}"], function (p) {
  return "".concat(p.theme.spacing.unit(1), "px");
}, function (p) {
  return p.$disabled ? 'not-allowed' : 'pointer';
}, function (p) {
  return "".concat(p.theme.spacing.unit(1), "px;");
}, function (p) {
  var knobColor = p.$sliderColor ? p.$sliderColor(p.theme) : p.theme.color.sliderColor;
  return !p.$disabled && "".concat(knobColor ? "".concat(p.theme.spacing.unit(1), "px solid ").concat((0, _color.default)(knobColor).darken(0.1)) : '');
}, function (p) {
  var knobColor = p.$sliderColor ? p.$sliderColor(p.theme) : p.theme.color.sliderColor;
  return !p.$disabled && "".concat(knobColor ? (0, _color.default)(knobColor).darken(0.1) : '');
});
var Track = _styledComponents.default.div.withConfig({
  displayName: "SliderTrack__Track",
  componentId: "sc-jh56np-1"
})(["position:relative;width:100%;height:", ";background:", ";border-radius:", ";cursor:", ";"], function (p) {
  return "".concat((0, _utils.getHeight)(p.$variant), "px");
}, function (p) {
  return p.$disabled ? p.theme.color.sliderDisabled : p.theme.color.sliderBackgroundColor;
}, function (p) {
  return "".concat((0, _utils.getKnobSize)(p.$variant), "px");
}, function (p) {
  return p.$disabled ? 'not-allowed' : 'pointer';
});
var SliderTrack = function SliderTrack(_ref) {
  var children = _ref.children,
    disabled = _ref.disabled,
    variant = _ref.variant,
    readOnly = _ref.readOnly,
    sliderColor = _ref.sliderColor,
    onMouseDown = _ref.onMouseDown,
    onMouseLeave = _ref.onMouseLeave,
    onMouseMove = _ref.onMouseMove,
    onMouseUp = _ref.onMouseUp,
    onTouchStart = _ref.onTouchStart;
  return _react.default.createElement(HoverArea, {
    onMouseDown: onMouseDown,
    onMouseLeave: onMouseLeave,
    onMouseMove: onMouseMove,
    onMouseUp: onMouseUp,
    onTouchStart: onTouchStart,
    $sliderColor: sliderColor
  }, _react.default.createElement(Track, {
    $disabled: disabled || readOnly,
    $variant: variant
  }, children));
};
var _default = exports.default = SliderTrack;