@clubmed/trident-ui
Version:
Shared ClubMed React UI components
55 lines (54 loc) • 1.21 kB
JavaScript
import { jsxs as h, jsx as s } from "react/jsx-runtime";
import { useInternalStatus as F } from "../hooks/useInternalStatus.js";
import { FormLabel as S } from "./FormLabel.js";
import { c as j } from "../../chunks/clsx.js";
import { FormControlError as C } from "./FormControlError.js";
const y = ({
id: r,
label: t,
description: a,
disabled: e,
required: l,
className: m,
validationStatus: n = "default",
children: i,
errorMessage: o,
dataTestId: c,
dataName: d,
labelClassName: f,
hideRequiredStar: p,
layout: u
}) => {
const x = F({
isDisabled: !!e,
validationStatus: n
}) === "error" && o;
return /* @__PURE__ */ h(
"div",
{
className: j("flex flex-col gap-4", m),
"data-name": d,
"data-testid": c,
children: [
t && r && /* @__PURE__ */ s(
S,
{
description: a,
id: r,
layout: u,
required: l,
hideRequiredStar: p,
className: f,
children: t
}
),
i,
x && /* @__PURE__ */ s(C, { children: o })
]
}
);
};
export {
y as FormControl
};
//# sourceMappingURL=FormControl.js.map