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.2 kB
JavaScript
import * as e from "react";
import { cn as p } from "./index.es85.js";
import { InputVariants as g } from "./index.es100.js";
import { Typography as E } from "./index.es19.js";
import { XCircle as h } from "lucide-react";
const v = e.forwardRef(
({ className: i, type: u, isError: l, message: o, prefix: c, suffix: s, id: m, ...t }, f) => {
const d = e.useRef(null), r = f || d, [n, a] = e.useState(!1);
return e.useEffect(() => {
n && r.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: m
},
c && /* @__PURE__ */ e.createElement(
"div",
{
onClick: () => {
a(!0);
}
},
c
),
/* @__PURE__ */ e.createElement(
"input",
{
type: u,
className: "outline-0 w-full h-full disabled:bg-transparent disabled:cursor-not-allowed outline-none",
onFocus: () => a(!0),
onBlur: () => a(!1),
ref: r,
...t
}
),
/* @__PURE__ */ e.createElement(
"div",
{
className: "flex items-center cursor-pointer",
onClick: () => {
if (s) {
a(!0);
return;
}
}
},
s ?? /* @__PURE__ */ e.createElement(
"div",
{
className: `${n ? "" : "opacity-0"} hover:opacity-100`,
onClick: () => {
t.onChange && t.onChange({
target: { value: "" }
}), r.current?.focus();
}
},
/* @__PURE__ */ e.createElement(h, { size: 16, className: "stroke-light-2" })
)
)
), o && /* @__PURE__ */ e.createElement(
E,
{
variant: "body2",
className: `${l ? "text-danger-1" : "text-light-3"} mt-1.5`
},
o
));
}
);
v.displayName = "Input";
export {
v as Input
};
//# sourceMappingURL=index.es11.js.map