'use strict';

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

var vue = require('vue');
var iconfont = require('../../../theme-chalk/src/fonts/iconfont.json.js');
require('../../../utils/index.js');
require('./components/modal.vue.js');
require('./components/search.vue.js');
var iconPicker = require('./config/icon-picker.js');
var createNamespace = require('../../../utils/create-namespace.js');
var search_vue_vue_type_script_setup_true_lang = require('./components/search.vue2.js');
var modal_vue_vue_type_script_setup_true_lang = require('./components/modal.vue2.js');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: "LlIconPicker"
  },
  __name: "icon-picker",
  props: iconPicker.iconPickerProps,
  emits: ["update:value"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const attrs = vue.useAttrs();
    const iconValue = vue.ref("");
    const open = vue.ref(false);
    const bem = createNamespace.createNamespace("icon-picker");
    const handleModalVisible = (bool) => open.value = bool;
    const handleChangeValue = (value) => {
      emits("update:value", value);
      iconValue.value = value;
    };
    vue.watch(
      () => props.value,
      (newValue) => {
        iconValue.value = newValue || "";
      },
      { immediate: true }
    );
    __expose({
      handleModalVisible
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock(
        "div",
        {
          class: vue.normalizeClass(vue.unref(bem).b())
        },
        [
          vue.createCommentVNode(" input\u7EC4\u5408 "),
          vue.createVNode(search_vue_vue_type_script_setup_true_lang.default, vue.mergeProps(vue.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"]),
          vue.createCommentVNode(" icon\u5F39\u7A97 "),
          vue.createVNode(modal_vue_vue_type_script_setup_true_lang.default, {
            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 || vue.unref(iconfont.default).glyphs,
            onChangeIconValue: handleChangeValue
          }, null, 8, ["open", "value", "data"])
        ],
        2
        /* CLASS */
      );
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=icon-picker.vue2.js.map
