'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../utils/index.js');
var textarea = require('./textarea.js');
var createNamespace = require('../../../utils/create-namespace.js');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{ name: "LlTextarea" },
  __name: "textarea",
  props: textarea.textareaProps,
  setup(__props, { expose: __expose }) {
    const attrs = vue.useAttrs();
    const bem = createNamespace.createNamespace("textarea");
    const props = __props;
    const textareaRef = vue.ref();
    const newMaxlength = vue.computed(() => {
      if (typeof props.maxlength === "number") {
        return props.maxlength <= 0 ? null : props.maxlength;
      }
      return props.maxlength;
    });
    const focus = () => {
      textareaRef.value?.focus?.();
    };
    __expose({ focus });
    return (_ctx, _cache) => {
      const _component_a_textarea = vue.resolveComponent("a-textarea");
      return vue.openBlock(), vue.createBlock(_component_a_textarea, vue.mergeProps(vue.unref(attrs), {
        ref_key: "textareaRef",
        ref: textareaRef,
        readonly: _ctx.readonly,
        maxlength: newMaxlength.value,
        class: [
          vue.unref(bem).b(),
          vue.unref(bem).is(_ctx.isGray ? "gray-textarea" : ""),
          props.useResize ? vue.unref(bem).is("use-resize") : "",
          props.readonly ? vue.unref(bem).is("readonly") : ""
        ]
      }), vue.createSlots({
        _: 2
        /* DYNAMIC */
      }, [
        vue.renderList(Object.keys(_ctx.$slots), (item) => {
          return {
            name: item,
            fn: vue.withCtx((data) => [
              vue.renderSlot(_ctx.$slots, item, vue.normalizeProps(vue.guardReactiveProps(data || {})))
            ])
          };
        })
      ]), 1040, ["readonly", "maxlength", "class"]);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=textarea.vue2.js.map
