import { jsx as o } from "react/jsx-runtime";
import { useState as s, useEffect as I, useCallback as b } from "react";
import h from "../../../box/Box.js";
import v from "../../../input/Input.js";
import S from "../../../icon/Icon.js";
const k = ({
  placeholder: l,
  onChange: t,
  value: a,
  searchIcon: c = "Search",
  isSearching: i
}) => {
  const e = a !== void 0, [n, m] = s(""), u = e ? a || "" : n, [f, d] = s(!1);
  I(() => {
    d(!0);
  }, []);
  const p = b(
    (r) => {
      e || m(r), t == null || t(r);
    },
    [t, e]
  );
  return /* @__PURE__ */ o(h, { className: "w-[var(--width-w-72)]", children: /* @__PURE__ */ o(
    v,
    {
      value: u,
      placeholder: l,
      onChange: f ? p : void 0,
      leftIcon: i ? /* @__PURE__ */ o(S, { name: "Loader", animation: "spin" }) : c,
      size: "sm"
    }
  ) });
};
export {
  k as default
};
//# sourceMappingURL=DataTableGlobalSearch.js.map
