@hitachivantara/uikit-react-core
Version:
UI Kit Core React components.
28 lines (27 loc) • 973 B
JavaScript
import { HvInput } from "../../Input/Input.js";
import HvControlsContext from "../context/ControlsContext.js";
import { useClasses } from "./LeftControl.styles.js";
import { useContext } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/Controls/LeftControl/LeftControl.tsx
var HvLeftControl = ({ id, classes: classesProp, className, children, placeholder = "Search", onSearch, hideSearch = false, searchProps, ...others }) => {
const { classes, cx } = useClasses(classesProp);
const { onSearch: onSearchHandler } = useContext(HvControlsContext);
const onChangeFilter = (e, value) => {
onSearch?.(e, value);
onSearchHandler?.(value);
};
return /* @__PURE__ */ jsxs("div", {
id,
className: cx(classes.root, className),
...others,
children: [!hideSearch && /* @__PURE__ */ jsx(HvInput, {
type: "search",
placeholder,
onChange: onChangeFilter,
...searchProps
}), children]
});
};
//#endregion
export { HvLeftControl };