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); }

import React from 'react';
import { Box, Icon, usePropsConfig } from '@native-base/v3';
import { NumberInputContext } from './index';
import { TouchableOpacity } from 'react-native';

const NumberIncrementStepper = ({
  children,
  isDisabled: pIsDisabled,
  ariaLabel,
  ...props
}) => {
  const {
    style,
    _active,
    _disabled,
    ...newProps
  } = usePropsConfig('NumberInputStepper', props);
  const {
    numberInputValue = 0,
    step = 1,
    max = +Infinity,
    handleChange,
    ...context
  } = React.useContext(NumberInputContext);
  const isDisabled = pIsDisabled || context.isDisabled;

  const pressHandler = () => {
    handleChange && handleChange(numberInputValue + step);
  };

  return /*#__PURE__*/React.createElement(TouchableOpacity, {
    activeOpacity: 1,
    disabled: numberInputValue + step > max || isDisabled,
    onPress: () => pressHandler(),
    accessible: true,
    accessibilityLabel: ariaLabel
  }, /*#__PURE__*/React.createElement(Box, _extends({}, newProps, _active, numberInputValue + step > max || isDisabled ? _disabled : {}, {
    style: style
  }), children || /*#__PURE__*/React.createElement(Icon, {
    name: "arrow-drop-up",
    type: "MaterialIcons"
  })));
};

export default NumberIncrementStepper;
//# sourceMappingURL=NumberIncrementStepper.js.map