import { defineComponent, useAttrs, ref, computed, resolveComponent, createBlock, openBlock, mergeProps, unref, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
import '../../../utils/index.mjs';
import { textareaProps } from './textarea.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

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

export { _sfc_main as default };
//# sourceMappingURL=textarea.vue2.mjs.map
