var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/workSpaceList/components/AppearanceEdit/IconPanel.tsx
var IconPanel_exports = {};
__export(IconPanel_exports, {
  default: () => IconPanel_default
});
module.exports = __toCommonJS(IconPanel_exports);
var import_constants = require("./../AppearanceEdit/constants");
var import_icon = require("@pisell/icon");
var import_materials = require("@pisell/materials");
var import_ahooks = require("ahooks");
var import_antd = require("antd");
var import_classnames = __toESM(require("classnames"));
var import_react = require("react");
var import_IconPanel = require("./IconPanel.less");
var IconPanel = (props) => {
  const { color, name, value } = props;
  const [state, setState] = (0, import_ahooks.useControllableValue)(props);
  const [showIcons, setShowIcons] = (0, import_react.useState)(import_constants.icons);
  const onSearch = (val) => {
    setShowIcons(import_constants.icons.filter((item) => item.name.includes(val)));
  };
  return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
    import_materials.Input,
    {
      bordered: false,
      prefix: /* @__PURE__ */ React.createElement(import_icon.SearchLg, { className: "search-icon" }),
      placeholder: "Search icons",
      className: "search",
      onPressEnter: (e) => {
        var _a;
        return onSearch == null ? void 0 : onSearch((_a = e.target) == null ? void 0 : _a.value);
      }
    }
  ), /* @__PURE__ */ React.createElement(import_antd.Space, { size: 20, wrap: true }, /* @__PURE__ */ React.createElement(
    "div",
    {
      className: (0, import_classnames.default)("icon-item-wrap", "icon-item-text", {
        ["icon-item-wrap-active"]: !import_constants.iconMap[value]
      }),
      style: !import_constants.iconMap[value] ? { background: color } : {},
      onClick: () => setState("")
    },
    name.slice(0, 2)
  ), showIcons.map((item) => {
    const isActive = state === item.name;
    const Icon = item.icon;
    return /* @__PURE__ */ React.createElement(
      "div",
      {
        className: (0, import_classnames.default)("icon-item-wrap", {
          ["icon-item-wrap-active"]: isActive
        }),
        style: isActive ? { background: color } : {},
        onClick: () => setState(item.name),
        key: item.name
      },
      /* @__PURE__ */ React.createElement(Icon, { style: { fontSize: 20 } })
    );
  })));
};
var IconPanel_default = IconPanel;
