@douglasneuroinformatics/libui 3.7.3 → 3.7.4
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/dist/components.d.ts +1 -1
- package/dist/components.js +4 -12
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.7.4.tgz +0 -0
- package/package.json +1 -1
- package/src/components/Form/BooleanField/BooleanFieldCheckbox.tsx +1 -1
- package/src/components/Form/Form.stories.tsx +22 -0
- package/src/components/Form/Form.tsx +3 -13
- package/dist/douglasneuroinformatics-libui-3.7.3.tgz +0 -0
package/dist/components.d.ts
CHANGED
|
@@ -1249,7 +1249,7 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
|
|
|
1249
1249
|
submitBtnLabel?: string;
|
|
1250
1250
|
validationSchema: z.ZodType<TData>;
|
|
1251
1251
|
};
|
|
1252
|
-
declare const Form: <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({ additionalButtons, className, content, fieldsFooter, id, initialValues, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element
|
|
1252
|
+
declare const Form: <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({ additionalButtons, className, content, fieldsFooter, id, initialValues, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
|
|
1253
1253
|
|
|
1254
1254
|
type HeadingProps = {
|
|
1255
1255
|
children: string;
|
package/dist/components.js
CHANGED
|
@@ -2686,7 +2686,7 @@ var BooleanFieldCheckbox = ({
|
|
|
2686
2686
|
/* @__PURE__ */ jsx117(
|
|
2687
2687
|
Checkbox,
|
|
2688
2688
|
{
|
|
2689
|
-
checked: value,
|
|
2689
|
+
checked: Boolean(value),
|
|
2690
2690
|
disabled: disabled || readOnly,
|
|
2691
2691
|
id: name,
|
|
2692
2692
|
name,
|
|
@@ -3433,8 +3433,9 @@ var Form = ({
|
|
|
3433
3433
|
const { resolvedLanguage, t } = useTranslation("libui");
|
|
3434
3434
|
const [rootErrors, setRootErrors] = useState8([]);
|
|
3435
3435
|
const [errors, setErrors] = useState8({});
|
|
3436
|
-
const [values, setValues] = useState8(
|
|
3437
|
-
|
|
3436
|
+
const [values, setValues] = useState8(
|
|
3437
|
+
initialValues ? getInitialValues(initialValues) : {}
|
|
3438
|
+
);
|
|
3438
3439
|
const handleError = (error) => {
|
|
3439
3440
|
const fieldErrors = {};
|
|
3440
3441
|
for (const issue of error.issues) {
|
|
@@ -3486,15 +3487,6 @@ var Form = ({
|
|
|
3486
3487
|
useEffect10(() => {
|
|
3487
3488
|
revalidate();
|
|
3488
3489
|
}, [resolvedLanguage]);
|
|
3489
|
-
useEffect10(() => {
|
|
3490
|
-
if (initialValues) {
|
|
3491
|
-
setValues(getInitialValues(initialValues));
|
|
3492
|
-
}
|
|
3493
|
-
setIsInitialSetValuesComplete(true);
|
|
3494
|
-
}, [initialValues]);
|
|
3495
|
-
if (!isInitialSetValuesComplete) {
|
|
3496
|
-
return null;
|
|
3497
|
-
}
|
|
3498
3490
|
return /* @__PURE__ */ jsxs47(
|
|
3499
3491
|
"form",
|
|
3500
3492
|
{
|