dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
45 lines (44 loc) • 1.46 kB
JavaScript
import { F as k, S as C } from "../../FilterWrapper-Dk18nVPy.js";
import { j as t } from "../../jsx-runtime-DS1N_tNq.js";
import { useState as i } from "react";
import { y as n } from "../../input-mask-DBLFIvhN-BBxoZxnd.js";
import { u as l } from "../../button-CdZDBhmr-BT_j3ig5.js";
import { p as f } from "../../index-BrQ82Wyu.js";
import { l as u } from "../../lodash-CYNxjS-I.js";
import { K as c } from "../../Keyboard-CJVAJWdO.js";
import { m as d } from "../../utils-B6fNqzRf-B1_jG1K7.js";
import { u as x } from "../../useTranslation-dH-uwymc.js";
const T = ({
placeholder: o,
onSearchChange: s,
className: a
}) => {
const { t: p } = x(), [e, m] = i("");
return /* @__PURE__ */ t.jsxs("div", { className: d("relative my-2 w-full", a), children: [
/* @__PURE__ */ t.jsx(
n,
{
placeholder: o || p("Type text and press CTRL + Enter"),
onInput: (r) => m(u.get(r, "target.value", "")),
onKeyUp: (r) => {
r.key === c.ENTER && (r.ctrlKey && s(e || void 0), r.stopPropagation(), r.preventDefault());
}
}
),
/* @__PURE__ */ t.jsx(
l,
{
type: "button",
variant: "ghost",
className: "text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",
onClick: () => s(e),
children: /* @__PURE__ */ t.jsx(f, {})
}
)
] });
};
export {
k as FilterWrapper,
C as Search,
T as SearchWithCtrl
};