/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, createVNode, mergeProps } from 'vue';
import { AddIcon, RemoveIcon, ChevronDownIcon, ChevronUpIcon } from '@ldesign/icons-vue-next';
import { Button } from '../button/index.js';
import { Input } from '../input/index.js';
import { useGlobalIcon } from '../hooks/useGlobalIcon.js';
import props from './props.js';
import useInputNumber from './useInputNumber.js';
import '../utils/withInstall.js';
import '../button/button.js';
import '@babel/runtime/helpers/toConsumableArray';
import '../loading/index.js';
import '../loading/directive.js';
import '../loading/plugin.js';
import '../utils/dom.js';
import '../_chunks/dep-c9c789a8.js';
import 'lodash/isString';
import 'lodash/isFunction';
import 'lodash/isArray';
import '../utils/easing.js';
import '../hooks/useConfig.js';
import '../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import 'dayjs';
import '../loading/loading.js';
import '@babel/runtime/helpers/slicedToArray';
import '../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isObject';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../hooks/useTeleport.js';
import '../loading/props.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '../_common/js/utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import '../hooks/useRipple.js';
import '../utils/set-style.js';
import '../hooks/useKeepAnimation.js';
import '../form/hooks.js';
import '../hooks/tnode.js';
import '../button/props.js';
import '../input/input.js';
import '../input/props.js';
import '../input/useInput.js';
import '../form/const.js';
import '../hooks/useVModel.js';
import '../input/useLengthLimit.js';
import '../_common/js/log/log.js';
import '../input/useInputEventHandler.js';
import '../input/useInputWidth.js';
import '../input/input-group.js';
import '../input/input-group-props.js';
import '../hooks/useCommonClassName.js';
import '../_common/js/input-number/number.js';
import 'lodash/isNil';
import '../_common/js/input-number/large-number.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _InputNumber = defineComponent({
  name: "TInputNumber",
  props: props,
  setup: function setup(props2, context) {
    var _useGlobalIcon = useGlobalIcon({
        AddIcon: AddIcon,
        RemoveIcon: RemoveIcon,
        ChevronDownIcon: ChevronDownIcon,
        ChevronUpIcon: ChevronUpIcon
      }),
      AddIcon$1 = _useGlobalIcon.AddIcon,
      RemoveIcon$1 = _useGlobalIcon.RemoveIcon,
      ChevronDownIcon$1 = _useGlobalIcon.ChevronDownIcon,
      ChevronUpIcon$1 = _useGlobalIcon.ChevronUpIcon;
    var p = useInputNumber(props2);
    var inputRef = p.inputRef;
    context.expose(_objectSpread({}, p));
    return function () {
      var reduceIcon = props2.theme === "column" ? createVNode(ChevronDownIcon$1, {
        "size": props2.size
      }, null) : createVNode(RemoveIcon$1, {
        "size": props2.size
      }, null);
      var addIcon = props2.theme === "column" ? createVNode(ChevronUpIcon$1, {
        "size": props2.size
      }, null) : createVNode(AddIcon$1, {
        "size": props2.size
      }, null);
      var status = p.isError.value ? "error" : props2.status;
      return createVNode("div", {
        "class": p.wrapClasses.value
      }, [props2.theme !== "normal" && createVNode(Button, {
        "class": p.reduceClasses.value,
        "disabled": p.tDisabled.value,
        "onClick": p.handleReduce,
        "variant": "outline",
        "shape": "square",
        "icon": function icon() {
          return reduceIcon;
        }
      }, null), createVNode(Input, mergeProps({
        "ref": inputRef,
        "disabled": p.tDisabled.value,
        "readonly": props2.readonly,
        "autocomplete": "off",
        "placeholder": props2.placeholder,
        "unselectable": props2.readonly ? "on" : "off",
        "autoWidth": props2.autoWidth,
        "align": props2.align || (props2.theme === "row" ? "center" : void 0),
        "status": status,
        "label": props2.label,
        "suffix": props2.suffix
      }, p.listeners, props2.inputProps, {
        "value": p.userInput.value,
        "onChange": p.onInnerInputChange
      }), context.slots), props2.theme !== "normal" && createVNode(Button, {
        "class": p.addClasses.value,
        "disabled": p.tDisabled.value,
        "onClick": p.handleAdd,
        "variant": "outline",
        "shape": "square",
        "icon": function icon() {
          return addIcon;
        }
      }, null), props2.tips && createVNode("div", {
        "class": "".concat(p.classPrefix.value, "-input__tips ").concat(p.classPrefix.value, "-input__tips--").concat(status)
      }, [props2.tips])]);
    };
  }
});

export { _InputNumber as default };
//# sourceMappingURL=input-number.js.map
