@saas-ui/forms 2.6.3 → 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -5
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/base-field.tsx +9 -1
- package/src/types.ts +4 -0
package/dist/index.mjs
CHANGED
@@ -513,6 +513,7 @@ var useBaseField = (props) => {
|
|
513
513
|
const [fieldProps] = splitProps(props, ["name", "label", "help", "hideLabel"]);
|
514
514
|
const [controlProps] = splitProps(props, [
|
515
515
|
"id",
|
516
|
+
"direction",
|
516
517
|
"isDisabled",
|
517
518
|
"isInvalid",
|
518
519
|
"isReadOnly",
|
@@ -531,14 +532,23 @@ var useBaseField = (props) => {
|
|
531
532
|
var BaseField = (props) => {
|
532
533
|
const { controlProps, label, help, hideLabel, error } = useBaseField(props);
|
533
534
|
const isInvalid = !!error || controlProps.isInvalid;
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
535
|
+
const { direction, ...rest } = controlProps;
|
536
|
+
return /* @__PURE__ */ jsxs5(
|
537
|
+
FormControl2,
|
538
|
+
{
|
539
|
+
...rest,
|
540
|
+
isInvalid,
|
541
|
+
variant: direction === "row" ? "horizontal" : void 0,
|
542
|
+
children: [
|
543
|
+
label && !hideLabel ? /* @__PURE__ */ jsx10(FormLabel2, { children: label }) : null,
|
544
|
+
/* @__PURE__ */ jsxs5(Box, { children: [
|
545
|
+
props.children,
|
546
|
+
help && !(error == null ? void 0 : error.message) ? /* @__PURE__ */ jsx10(FormHelperText, { children: help }) : null,
|
547
|
+
(error == null ? void 0 : error.message) && /* @__PURE__ */ jsx10(FormErrorMessage, { children: error == null ? void 0 : error.message })
|
548
|
+
] })
|
549
|
+
]
|
550
|
+
}
|
551
|
+
);
|
542
552
|
};
|
543
553
|
BaseField.displayName = "BaseField";
|
544
554
|
|