@saas-ui/forms 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/base-field.tsx +3 -1
- package/src/create-field.tsx +1 -0
- package/src/layout.tsx +11 -2
- package/src/number-input/number-input.test.tsx +3 -1
- package/src/select/select.test.tsx +4 -2
package/dist/index.mjs
CHANGED
@@ -530,7 +530,8 @@ var useBaseField = (props) => {
|
|
530
530
|
};
|
531
531
|
var BaseField = (props) => {
|
532
532
|
const { controlProps, label, help, hideLabel, error } = useBaseField(props);
|
533
|
-
|
533
|
+
const isInvalid = !!error || controlProps.isInvalid;
|
534
|
+
return /* @__PURE__ */ jsxs5(FormControl2, { ...controlProps, isInvalid, children: [
|
534
535
|
label && !hideLabel ? /* @__PURE__ */ jsx10(FormLabel2, { children: label }) : null,
|
535
536
|
/* @__PURE__ */ jsxs5(Box, { children: [
|
536
537
|
props.children,
|
@@ -564,7 +565,8 @@ var _createField = (InputComponent, { displayName, hideLabel, getBaseField: getB
|
|
564
565
|
"isDisabled",
|
565
566
|
"isInvalid",
|
566
567
|
"isReadOnly",
|
567
|
-
"help"
|
568
|
+
"help",
|
569
|
+
"hideLabel"
|
568
570
|
].concat(extraProps)
|
569
571
|
);
|
570
572
|
return /* @__PURE__ */ jsx11(BaseField2, { ...props, children: /* @__PURE__ */ jsx11(
|
@@ -758,6 +760,7 @@ import {
|
|
758
760
|
chakra as chakra2,
|
759
761
|
omitThemingProps as omitThemingProps2,
|
760
762
|
SimpleGrid,
|
763
|
+
useStyleConfig,
|
761
764
|
useTheme
|
762
765
|
} from "@chakra-ui/react";
|
763
766
|
import { cx as cx2 } from "@chakra-ui/utils";
|
@@ -772,6 +775,7 @@ var FormLayout = ({ children, ...props }) => {
|
|
772
775
|
const defaultProps = (_c = (_b = (_a = theme.components) == null ? void 0 : _a.SuiFormLayout) == null ? void 0 : _b.defaultProps) != null ? _c : {
|
773
776
|
spacing: 4
|
774
777
|
};
|
778
|
+
const styles = useStyleConfig("SuiFormLayout", props);
|
775
779
|
const gridProps = omitThemingProps2({
|
776
780
|
...defaultProps,
|
777
781
|
...props
|
@@ -781,6 +785,10 @@ var FormLayout = ({ children, ...props }) => {
|
|
781
785
|
{
|
782
786
|
...gridProps,
|
783
787
|
className: cx2("sui-form__layout", props.className),
|
788
|
+
sx: {
|
789
|
+
...styles,
|
790
|
+
...props.sx
|
791
|
+
},
|
784
792
|
children
|
785
793
|
}
|
786
794
|
);
|
@@ -967,11 +975,11 @@ ArrayFieldContainer.displayName = "ArrayFieldContainer";
|
|
967
975
|
import {
|
968
976
|
FormControl as FormControl3,
|
969
977
|
FormLabel as FormLabel3,
|
970
|
-
useStyleConfig
|
978
|
+
useStyleConfig as useStyleConfig2
|
971
979
|
} from "@chakra-ui/react";
|
972
980
|
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
973
981
|
var FormLegend = (props) => {
|
974
|
-
const styles =
|
982
|
+
const styles = useStyleConfig2("SuiFormLegend");
|
975
983
|
return /* @__PURE__ */ jsx16(FormLabel3, { as: "legend", sx: styles, ...props });
|
976
984
|
};
|
977
985
|
var ObjectField = (props) => {
|