import { defineComponent, useAttrs, computed, resolveComponent, createBlock, openBlock, normalizeClass, unref, withCtx, createCommentVNode, createVNode, mergeProps } from 'vue';
import '../../../../utils/index.mjs';
import '../config/index.mjs';
import { createNamespace } from '../../../../utils/create-namespace.mjs';
import { iconPickerSearchEmits, iconPickerSearchProps } from '../config/search.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "LlIconPickerSearch"
  },
  __name: "search",
  props: iconPickerSearchProps,
  emits: iconPickerSearchEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const attrs = useAttrs();
    const bem = createNamespace("icon-picker-search");
    const handleModal = () => emits("handleModal", true);
    const newValue = computed({
      get() {
        return props.value;
      },
      set(value) {
        emits("update:value", value);
        emits("change", value);
      }
    });
    const getInputSizeCss = computed(() => {
      if (props.extendSize === "small" || props.size === "small") {
        return "ant-input-affix-wrapper-sm";
      } else if (props.extendSize === "large" || props.size === "large") {
        return "ant-input-affix-wrapper-lg";
      }
      return "";
    });
    const getBtnSizeCss = computed(() => {
      if (props.extendSize === "small" || props.size === "small") {
        return "ant-btn-sm";
      } else if (props.extendSize === "large" || props.size === "large") {
        return "ant-btn-lg";
      }
      return "";
    });
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_ll_input = resolveComponent("ll-input");
      const _component_ll_button = resolveComponent("ll-button");
      const _component_a_space_compact = resolveComponent("a-space-compact");
      return openBlock(), createBlock(_component_a_space_compact, {
        block: !_ctx.showIconOnly,
        class: normalizeClass(unref(bem).b()),
        size: _ctx.extendSize ? _ctx.extendSize : _ctx.size
      }, {
        default: withCtx(() => [
          !_ctx.showIconOnly ? (openBlock(), createBlock(_component_ll_input, mergeProps({ key: 0 }, unref(attrs), {
            value: newValue.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => newValue.value = $event),
            class: [unref(bem).e("input"), getInputSizeCss.value],
            readonly: props.readonly
          }), {
            suffix: withCtx(() => [
              createVNode(_component_ll_icon, {
                "icon-name": "icon-" + _ctx.value
              }, null, 8, ["icon-name"])
            ]),
            _: 1
            /* STABLE */
          }, 16, ["value", "class", "readonly"])) : createCommentVNode("v-if", true),
          createVNode(_component_ll_button, {
            disabled: unref(attrs).disabled,
            class: normalizeClass([unref(bem).e("btn"), getBtnSizeCss.value]),
            onClick: handleModal
          }, {
            icon: withCtx(() => [
              createVNode(_component_ll_icon, {
                "icon-name": _ctx.showIconOnly ? "icon-" + newValue.value : "icon-select-icon"
              }, null, 8, ["icon-name"])
            ]),
            _: 1
            /* STABLE */
          }, 8, ["disabled", "class"])
        ]),
        _: 1
        /* STABLE */
      }, 8, ["block", "class", "size"]);
    };
  }
});

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