dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
43 lines (42 loc) • 1.38 kB
JavaScript
import { F as T, S as N } from "../../FilterWrapper-C6rEmxjr.js";
import { j as t } from "../../jsx-runtime-C5mzlN2N.js";
import { useState as i } from "react";
import { y as m } from "../../radio-group-CqPTye2U-DGs9dBuR.js";
import { u as n } from "../../button-Bp2lHjov-BTlHPcva.js";
import { p as l } from "../../index-KCZvOJVU.js";
import { l as u } from "../../lodash-CYNxjS-I.js";
import { K as f } from "../../Keyboard-CJVAJWdO.js";
import { u as c } from "../../useTranslation-dH-uwymc.js";
const v = ({
placeholder: o,
onSearchChange: e
}) => {
const { t: a } = c(), [s, p] = i("");
return /* @__PURE__ */ t.jsxs("div", { className: "relative my-2 w-full", children: [
/* @__PURE__ */ t.jsx(
m,
{
placeholder: o || a("Type text and press CTRL + Enter"),
onInput: (r) => p(u.get(r, "target.value", "")),
onKeyUp: (r) => {
r.key === f.ENTER && (r.ctrlKey && e(s || void 0), r.stopPropagation(), r.preventDefault());
}
}
),
/* @__PURE__ */ t.jsx(
n,
{
type: "button",
variant: "ghost",
className: "text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",
onClick: () => e(s),
children: /* @__PURE__ */ t.jsx(l, {})
}
)
] });
};
export {
T as FilterWrapper,
N as Search,
v as SearchWithCtrl
};