@cerberus-design/react
Version:
The Cerberus Design React component library.
40 lines (38 loc) • 1.38 kB
JavaScript
import {
HelperText
} from "./chunk-TIQO4VNE.js";
import {
Show
} from "./chunk-NUXMADXV.js";
import {
FieldErrorText,
FieldHelperText,
FieldLabel,
FieldRoot
} from "./chunk-5L5PT37R.js";
import {
splitProps
} from "./chunk-BL7G3577.js";
// src/components/field/field.tsx
import { HStack } from "styled-system/jsx";
import { jsx, jsxs } from "react/jsx-runtime";
function Field(props) {
const [statusProps, fieldProps, rootProps] = splitProps(
props,
["disabled", "required", "readOnly", "invalid"],
["label", "helperText", "secondaryHelperText", "errorText", "children"]
);
return /* @__PURE__ */ jsxs(FieldRoot, { ...statusProps, ...rootProps, children: [
/* @__PURE__ */ jsx(Show, { when: fieldProps.label, children: /* @__PURE__ */ jsx(FieldLabel, { children: fieldProps.label }) }),
fieldProps.children,
/* @__PURE__ */ jsxs(HStack, { justifyContent: "space-between", w: "full", children: [
/* @__PURE__ */ jsx(HelperText, { invalid: statusProps.invalid, children: fieldProps.helperText }),
/* @__PURE__ */ jsx(FieldErrorText, { children: fieldProps.errorText }),
/* @__PURE__ */ jsx(Show, { when: fieldProps.secondaryHelperText, children: /* @__PURE__ */ jsx(FieldHelperText, { children: fieldProps.secondaryHelperText }) })
] })
] });
}
export {
Field
};
//# sourceMappingURL=chunk-6LU43Z4K.js.map