import { defineComponent, useAttrs, ref, watch, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, createVNode, mergeProps } from 'vue';
import data from '../../../theme-chalk/src/fonts/iconfont.json.mjs';
import '../../../utils/index.mjs';
import './components/modal.vue.mjs';
import './components/search.vue.mjs';
import { iconPickerProps } from './config/icon-picker.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';
import _sfc_main$1 from './components/search.vue2.mjs';
import _sfc_main$2 from './components/modal.vue2.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "LlIconPicker"
  },
  __name: "icon-picker",
  props: iconPickerProps,
  emits: ["update:value"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const attrs = useAttrs();
    const iconValue = ref("");
    const open = ref(false);
    const bem = createNamespace("icon-picker");
    const handleModalVisible = (bool) => open.value = bool;
    const handleChangeValue = (value) => {
      emits("update:value", value);
      iconValue.value = value;
    };
    watch(
      () => props.value,
      (newValue) => {
        iconValue.value = newValue || "";
      },
      { immediate: true }
    );
    __expose({
      handleModalVisible
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(
        "div",
        {
          class: normalizeClass(unref(bem).b())
        },
        [
          createCommentVNode(" input\u7EC4\u5408 "),
          createVNode(_sfc_main$1, mergeProps(unref(attrs), {
            value: iconValue.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => iconValue.value = $event),
            readonly: props.readonly,
            "show-icon-only": _ctx.showIconOnly,
            size: _ctx.size,
            onHandleModal: handleModalVisible,
            onChange: handleChangeValue
          }), null, 16, ["value", "readonly", "show-icon-only", "size"]),
          createCommentVNode(" icon\u5F39\u7A97 "),
          createVNode(_sfc_main$2, {
            open: open.value,
            "onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event),
            value: iconValue.value,
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => iconValue.value = $event),
            data: _ctx.iconList || unref(data).glyphs,
            onChangeIconValue: handleChangeValue
          }, null, 8, ["open", "value", "data"])
        ],
        2
        /* CLASS */
      );
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=icon-picker.vue2.mjs.map
