@fefade/react
Version:
Reusable React UI components powered by the fefade core system.
61 lines (60 loc) • 1.57 kB
JavaScript
import { jsxs as r, jsx as e } from "react/jsx-runtime";
import { b as j } from "../../index-DdnSr7Dp.js";
import { forwardRef as m, useRef as x, useEffect as u } from "react";
import '../../assets/TextField.css';const f = "_textField_1ljwj_1", a = "_required_1ljwj_1", p = "_labelEmpty_1ljwj_1", w = "_outlined_1ljwj_1", h = "_contained_1ljwj_1", y = "_text_1ljwj_1", F = "_xs_1ljwj_1", E = "_sm_1ljwj_1", g = "_md_1ljwj_1", b = "_lg_1ljwj_1", q = "_xl_1ljwj_1", t = {
textField: f,
required: a,
labelEmpty: p,
outlined: w,
contained: h,
text: y,
xs: F,
sm: E,
md: g,
lg: b,
xl: q
}, k = m(
({
className: o = "",
label: l,
variant: _ = "outlined",
focused: s = !1,
size: i = "md",
...n
}, c) => {
const d = x(null);
return u(() => {
s && d.current?.focus();
}, []), /* @__PURE__ */ r(
"div",
{
className: j(
o,
[o, t],
[_, t],
[i, t],
t.textField,
{
[t.labelEmpty]: !l
}
),
children: [
/* @__PURE__ */ e(
"input",
{
...n,
ref: c ?? d,
placeholder: n.placeholder ?? " ",
style: void 0
}
),
l && /* @__PURE__ */ e("label", { htmlFor: n.id ?? n.name, children: l }),
/* @__PURE__ */ e("fieldset", { children: /* @__PURE__ */ e("legend", { children: /* @__PURE__ */ e("span", { children: l }) }) })
]
}
);
}
);
export {
k as default
};