@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
49 lines (48 loc) • 1.2 kB
JavaScript
import { jsx as o, jsxs as w } from "react/jsx-runtime";
import { forwardRef as h } from "react";
import { cn as r } from "../../utils/index.js";
import { DropdownProvider as v } from "./contexts/dropdown.provider.js";
import { Wrapper as N } from "./components/Wrapper.js";
const W = h(
({
error: t,
errorClassName: e,
helperText: s,
helperTextClassName: i,
highlightSearch: a,
mainWrapperClassName: p,
name: l,
value: d,
options: n,
onChange: c,
onBlur: m,
...f
}, x) => /* @__PURE__ */ o(
v,
{
highlightSearch: a,
name: l,
value: d,
options: n,
onBlur: m,
onChange: c,
children: /* @__PURE__ */ w("div", { className: r("relative w-full", p), children: [
/* @__PURE__ */ o(
N,
{
error: t,
name: l,
ref: x,
onBlur: m,
...f
}
),
t ? /* @__PURE__ */ o("span", { className: r("text-xs text-red-700", e), children: t }) : null,
!t && s ? /* @__PURE__ */ o("span", { className: r("text-xs text-metal-600", i), children: s }) : null
] })
}
)
);
export {
W as Dropdown
};