umwd-components 0.1.747 → 0.1.749
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/cjs/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
- package/dist/cjs/src/components/public-information/PublicInformationForm.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/categories/EditCategoryForm.js +2 -2
- package/dist/esm/src/components/public-information/PublicInformationForm.js +2 -2
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/types/e-commerce/category/types.d.ts +1 -3
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ const INITIAL_STATE = {
|
|
|
28
28
|
};
|
|
29
29
|
function EditCategoryForm({ data, revalidateCallback, handleClose, productNamesArray, sx, }) {
|
|
30
30
|
const { documentId, title, description, slug, is_archive, products } = data;
|
|
31
|
-
const initialProducts = products
|
|
31
|
+
const initialProducts = products || [];
|
|
32
32
|
const [formState, formAction] = useActionState(updateCategoryAction.bind(null, documentId), INITIAL_STATE);
|
|
33
33
|
const { handleAddMessage } = useSnackbar();
|
|
34
34
|
useEffect(() => {
|
|
@@ -51,7 +51,7 @@ function EditCategoryForm({ data, revalidateCallback, handleClose, productNamesA
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}, [formState?.strapiErrors]);
|
|
54
|
-
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Edit Category" }), jsx(Typography, { variant: "body2", children: "Edit the category for your products. You can add products to this category later." })] }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "title", name: "title", label: "Title", defaultValue: title }), jsx(MarkdownEditor, { name: "description", label: "Description", defaultValue: description })] }) }), jsxs(Grid, { size: 12, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ProductSelector, { productNames: productNamesArray, currentValue: [...initialProducts.map((prod) => prod.documentId)] })] }),
|
|
54
|
+
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Edit Category" }), jsx(Typography, { variant: "body2", children: "Edit the category for your products. You can add products to this category later." })] }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "title", name: "title", label: "Title", defaultValue: title }), jsx(MarkdownEditor, { name: "description", label: "Description", defaultValue: description })] }) }), jsxs(Grid, { size: 12, children: [jsx(Typography, { variant: "h6", children: "Products" }), jsx(ProductSelector, { productNames: productNamesArray, currentValue: [...initialProducts.map((prod) => prod.documentId)] })] }), jsx(Grid, { size: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: 2 }, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Update category", loadingText: "Loading...", variant: "contained" })] }) })] }) }) }));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export { EditCategoryForm };
|
|
@@ -58,7 +58,7 @@ function PublicInformationForm({ publicInformation, sx, }) {
|
|
|
58
58
|
// You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
|
|
59
59
|
{ p: 2 },
|
|
60
60
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
61
|
-
], component: Paper, children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h5", children: "Edit Public Information" }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "title", name: "title", label: "Title", defaultValue: title }), jsx(TextField, { id: "description", name: "description", label: "Description", defaultValue: description }), jsx(TextField, { id: "email", name: "email", label: "email", defaultValue: email }), jsx(TextField, { id: "phone_number", name: "phone_number", label: "phone_number", defaultValue: phone_number })] }) }), jsx(Grid, { size: {
|
|
61
|
+
], component: Paper, children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { size: 12, children: jsx(Typography, { variant: "h5", children: "Edit Public Information" }) }), jsx(Grid, { size: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(TextField, { id: "title", name: "title", label: "Title", defaultValue: title || "" }), jsx(TextField, { id: "description", name: "description", label: "Description", defaultValue: description || "" }), jsx(TextField, { id: "email", name: "email", label: "email", defaultValue: email || "" }), jsx(TextField, { id: "phone_number", name: "phone_number", label: "phone_number", defaultValue: phone_number || "" })] }) }), jsx(Grid, { size: {
|
|
62
62
|
xs: 12,
|
|
63
63
|
lg: 6,
|
|
64
64
|
}, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Company Address" }), jsx(Divider, {}), jsx(AddressFields, { componentName: "address", componentReference: "common.address", data: address })] }) }), jsx(Grid, { size: {
|
|
@@ -83,7 +83,7 @@ function PublicInformationForm({ publicInformation, sx, }) {
|
|
|
83
83
|
xs: 12,
|
|
84
84
|
md: 6,
|
|
85
85
|
lg: 4,
|
|
86
|
-
}, children: [jsx("input", { type: "hidden", name: `socials[${index}].documentId`, value: social.data.documentId }), jsx("input", { type: "hidden", name: `socials[${index}].name`, value: social.data.name }), jsx("input", { type: "hidden", name: `socials[${index}].url`, value: social.data.url }), jsx("input", { type: "hidden", name: `socials[${index}].icon`, value: social.data.icon }), jsx(SocialsDisplay, { data: { ...social.data, onClick: onClickHandler } })] }, index));
|
|
86
|
+
}, children: [jsx("input", { type: "hidden", name: `socials[${index}].documentId`, value: social.data.documentId || "" }), jsx("input", { type: "hidden", name: `socials[${index}].name`, value: social.data.name || "" }), jsx("input", { type: "hidden", name: `socials[${index}].url`, value: social.data.url || "" }), jsx("input", { type: "hidden", name: `socials[${index}].icon`, value: social.data.icon || "" }), jsx(SocialsDisplay, { data: { ...social.data, onClick: onClickHandler } })] }, index));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
return null;
|