@overmap-ai/forms 1.0.9-handle-patchform-errors.0 → 1.0.9
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/fields/index.d.ts +1 -1
- package/dist/forms.js +8 -9
- package/dist/forms.js.map +1 -1
- package/dist/forms.umd.cjs +7 -8
- package/dist/forms.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/fields/index.d.ts
CHANGED
package/dist/forms.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
8
|
-
import { Flex, Text, useSeverityColor, Checkbox, CheckCircledIcon, TextField as TextField$1, FontFamilyIcon, CalendarIcon, InputIcon, TextArea, RowsIcon, Select, Box, IconButton, PlusIcon, Badge, Cross1Icon, ListBulletIcon, DropdownMenuIcon, MultiSelect, CheckboxIcon, Card, Heading, Button, UploadIcon, ButtonList, divButtonProps, StarFilledIcon, StarIcon, QuestionMarkCircledIcon, PersonIcon, Tooltip, Avatar,
|
|
8
|
+
import { Flex, Text, useSeverityColor, Checkbox, CheckCircledIcon, TextField as TextField$1, FontFamilyIcon, CalendarIcon, InputIcon, TextArea, RowsIcon, Select, Box, IconButton, PlusIcon, Badge, Cross1Icon, ListBulletIcon, DropdownMenuIcon, MultiSelect, CheckboxIcon, Card, Heading, Button, UploadIcon, ButtonList, divButtonProps, StarFilledIcon, StarIcon, QuestionMarkCircledIcon, PersonIcon, Tooltip, Avatar, Separator, useDiscardAlertDialog, Dialog, Pencil1Icon, TrashIcon, CopyIcon, DragHandleDots2Icon, DropdownMenu, DotsVerticalIcon, useAlertDialog, Em, Strong, useToast, Tabs } from "@overmap-ai/blocks";
|
|
9
9
|
import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
|
|
10
10
|
import React, { useMemo, memo, useCallback, useState, useEffect, useRef, forwardRef, useReducer } from "react";
|
|
11
11
|
import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
|
|
@@ -1833,7 +1833,6 @@ const PatchField = memo(function PatchField2(props) {
|
|
|
1833
1833
|
const PatchFormProvider = memo(
|
|
1834
1834
|
forwardRef((props, ref) => {
|
|
1835
1835
|
const { children, schema, values, onPatch, onError, ...rest } = props;
|
|
1836
|
-
const { showError } = useToast();
|
|
1837
1836
|
const initialValues2 = useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
|
|
1838
1837
|
const handlePatch = useCallback(
|
|
1839
1838
|
(values2) => {
|
|
@@ -1846,7 +1845,6 @@ const PatchFormProvider = memo(
|
|
|
1846
1845
|
}
|
|
1847
1846
|
if (!hasKeys(diff))
|
|
1848
1847
|
return;
|
|
1849
|
-
console.log("onpatch runs", diff);
|
|
1850
1848
|
onPatch(diff);
|
|
1851
1849
|
},
|
|
1852
1850
|
[initialValues2, onPatch]
|
|
@@ -1872,13 +1870,9 @@ const PatchFormProvider = memo(
|
|
|
1872
1870
|
const { errors, resetForm } = formik;
|
|
1873
1871
|
useEffect(() => {
|
|
1874
1872
|
if (hasKeys(errors)) {
|
|
1875
|
-
|
|
1876
|
-
showError({
|
|
1877
|
-
title: "test title",
|
|
1878
|
-
description: "Sections with conditions must be below the fields they reference."
|
|
1879
|
-
});
|
|
1873
|
+
resetForm({ values: initialValues2, errors: {} });
|
|
1880
1874
|
}
|
|
1881
|
-
}, [
|
|
1875
|
+
}, [errors, initialValues2, resetForm]);
|
|
1882
1876
|
return /* @__PURE__ */ jsx(FormikProvider, { value: formik, children: /* @__PURE__ */ jsx("form", { ...rest, ref, onSubmit: formik.handleSubmit, children }) });
|
|
1883
1877
|
})
|
|
1884
1878
|
);
|
|
@@ -2674,6 +2668,8 @@ const FormBuilder = memo(
|
|
|
2674
2668
|
})
|
|
2675
2669
|
);
|
|
2676
2670
|
export {
|
|
2671
|
+
BaseField,
|
|
2672
|
+
BaseFormElement,
|
|
2677
2673
|
BooleanField,
|
|
2678
2674
|
BooleanInput,
|
|
2679
2675
|
DateField,
|
|
@@ -2684,6 +2680,8 @@ export {
|
|
|
2684
2680
|
FormRenderer,
|
|
2685
2681
|
FormSubmissionBrowser,
|
|
2686
2682
|
FormSubmissionViewer,
|
|
2683
|
+
InputWithLabel,
|
|
2684
|
+
InputWithLabelAndHelpText,
|
|
2687
2685
|
MultiSelectField,
|
|
2688
2686
|
MultiSelectInput,
|
|
2689
2687
|
MultiStringField,
|
|
@@ -2704,6 +2702,7 @@ export {
|
|
|
2704
2702
|
isConditionMet,
|
|
2705
2703
|
useFieldInput,
|
|
2706
2704
|
useFieldInputs,
|
|
2705
|
+
useFormikInput,
|
|
2707
2706
|
valueIsFile
|
|
2708
2707
|
};
|
|
2709
2708
|
//# sourceMappingURL=forms.js.map
|