geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
83 lines (82 loc) • 2.15 kB
JavaScript
import * as e from "react";
import { cn as p } from "./index.es79.js";
import { InputVariants as g } from "./index.es105.js";
import { Typography as E } from "./index.es17.js";
import { XCircle as N } from "lucide-react";
const b = e.forwardRef(
({ className: i, type: m, isError: l, message: r, prefix: o, suffix: c, id: u, ...t }, d) => {
const f = e.useRef(null), s = d || f, [n, a] = e.useState(!1);
return e.useEffect(() => {
n && s.current?.focus();
}, [n]), /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
"div",
{
className: p(
g({
isError: l,
isFocused: n,
disabled: t.disabled,
className: i
})
),
id: u
},
o && /* @__PURE__ */ e.createElement(
"div",
{
onClick: () => {
a(!0);
}
},
o
),
/* @__PURE__ */ e.createElement(
"input",
{
type: m,
className: "outline-0 w-full h-full disabled:bg-transparent disabled:cursor-not-allowed outline-none",
onFocus: () => a(!0),
onBlur: () => a(!1),
ref: s,
...t
}
),
/* @__PURE__ */ e.createElement(
"div",
{
className: "flex items-center cursor-pointer",
onClick: () => {
if (c) {
a(!0);
return;
}
}
},
c ?? /* @__PURE__ */ e.createElement(
"div",
{
className: n ? "" : "opacity-0",
onClick: () => {
t.onChange && t.onChange({
target: { value: "" }
});
}
},
/* @__PURE__ */ e.createElement(N, { size: 16, className: "stroke-light-2" })
)
)
), r && /* @__PURE__ */ e.createElement(
E,
{
variant: "body2",
className: `${l ? "text-danger-1" : "text-light-3"} mt-1.5`
},
r
));
}
);
b.displayName = "Input";
export {
b as Input
};
//# sourceMappingURL=index.es9.js.map