@lunalytics/ui
Version:
React based component library created to be used in Lunalytics
52 lines (51 loc) • 1.42 kB
JavaScript
import { jsxs as s, jsx as a } from "react/jsx-runtime";
import { c } from "../../index-2w0W-O47.js";
import '../../assets/input.css';const f = ({
id: e,
title: l,
error: n,
subtitle: i,
type: r = "text",
iconLeft: t,
iconRight: u,
isRequired: p,
tabIndex: m = 0,
className: d,
containerClassName: o = "",
...N
}) => {
const h = c("luna-input-wrapper", d), x = c(
"luna-input-container",
o,
{
"luna-input-error": n
}
);
return /* @__PURE__ */ s("div", { className: h, children: [
l && /* @__PURE__ */ s("label", { className: "luna-input-title", children: [
l,
" ",
p && /* @__PURE__ */ a("span", { className: "luna-input-required", children: "*" })
] }),
i && /* @__PURE__ */ a("p", { className: "luna-input-subtitle", children: i }),
/* @__PURE__ */ s("div", { className: x, children: [
t && /* @__PURE__ */ a("span", { className: "luna-input-icon-left", children: t }),
/* @__PURE__ */ a(
"input",
{
type: r,
id: e,
className: "luna-input",
tabIndex: m,
...N
}
),
u && /* @__PURE__ */ a("span", { className: "luna-input-icon-right", children: u })
] }),
n && /* @__PURE__ */ a("p", { className: "luna-input-error-message", id: `error-${e}`, children: n })
] });
};
f.displayName = "TextInput";
export {
f as default
};