"use strict";

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

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

var _reactNative = require("react-native");

var _index = require("./index");

var _primitives = require("../../primitives");

var _theme = require("../../../theme");

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

const SliderThumb = ({
  children,
  ...props
}) => {
  const { ...newProps
  } = (0, _theme.usePropsConfig)('SliderThumb', props);

  const {
    sliderOffset,
    panResponder,
    colorScheme,
    thumbSize
  } = _react.default.useContext(_index.SliderContext);

  const customStyle = _reactNative.StyleSheet.create({
    SliderThumb: {
      position: 'absolute',
      display: 'flex',
      left: sliderOffset,
      justifyContent: 'center',
      alignItems: 'center'
    }
  });

  const sizedIcon = () => /*#__PURE__*/_react.default.cloneElement(children, {
    size: thumbSize,
    color: children.props.color ? children.props.color : colorScheme
  }, children.props.children);

  return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, _extends({
    style: customStyle.SliderThumb
  }, panResponder.panHandlers), /*#__PURE__*/_react.default.createElement(_primitives.Box, _extends({
    position: "relative",
    borderRadius: 999,
    backgroundColor: "light.50",
    p: 1,
    display: "flex",
    justifyContent: "center",
    alignItems: "center"
  }, newProps), children ? sizedIcon() : /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
    name: "circle-medium",
    type: "MaterialCommunityIcons",
    color: colorScheme,
    size: thumbSize,
    opacity: 0
  })));
};

var _default = SliderThumb;
exports.default = _default;
//# sourceMappingURL=SliderThumb.js.map