@douglasneuroinformatics/libui 3.7.2 → 3.7.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/dist/components.d.ts +1 -1
- package/dist/components.js +5 -0
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.7.3.tgz +0 -0
- package/package.json +2 -2
- package/src/components/Form/Form.stories.tsx +28 -0
- package/src/components/Form/Form.tsx +6 -0
- package/dist/douglasneuroinformatics-libui-3.7.2.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 | null;
|
|
1253
1253
|
|
|
1254
1254
|
type HeadingProps = {
|
|
1255
1255
|
children: string;
|
package/dist/components.js
CHANGED
|
@@ -3434,6 +3434,7 @@ var Form = ({
|
|
|
3434
3434
|
const [rootErrors, setRootErrors] = useState8([]);
|
|
3435
3435
|
const [errors, setErrors] = useState8({});
|
|
3436
3436
|
const [values, setValues] = useState8({});
|
|
3437
|
+
const [isInitialSetValuesComplete, setIsInitialSetValuesComplete] = useState8(false);
|
|
3437
3438
|
const handleError = (error) => {
|
|
3438
3439
|
const fieldErrors = {};
|
|
3439
3440
|
for (const issue of error.issues) {
|
|
@@ -3489,7 +3490,11 @@ var Form = ({
|
|
|
3489
3490
|
if (initialValues) {
|
|
3490
3491
|
setValues(getInitialValues(initialValues));
|
|
3491
3492
|
}
|
|
3493
|
+
setIsInitialSetValuesComplete(true);
|
|
3492
3494
|
}, [initialValues]);
|
|
3495
|
+
if (!isInitialSetValuesComplete) {
|
|
3496
|
+
return null;
|
|
3497
|
+
}
|
|
3493
3498
|
return /* @__PURE__ */ jsxs47(
|
|
3494
3499
|
"form",
|
|
3495
3500
|
{
|