umwd-components 0.1.652 → 0.1.653

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.
@@ -1,9 +1,11 @@
1
1
  import React from "react";
2
2
  import { CategoryName } from "../../../types/e-commerce/category/types";
3
3
  import { VendorName } from "../../../types/logistics/Vendor";
4
- export declare const AddProductForm: ({ vendorArr, categories, revalidateCallback, handleClose, }: {
4
+ import { SxProps } from "@mui/material/styles";
5
+ export declare const AddProductForm: ({ vendorArr, categories, revalidateCallback, handleClose, sx, }: {
5
6
  vendorArr: VendorName[];
6
7
  categories: CategoryName[];
7
8
  revalidateCallback?: (() => void) | undefined;
8
9
  handleClose?: (() => void) | undefined;
10
+ sx?: SxProps | undefined;
9
11
  }) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.652",
3
+ "version": "0.1.653",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -72,7 +72,7 @@ export function AddCategoryForm({
72
72
  }, [formState?.strapiErrors]);
73
73
 
74
74
  return (
75
- <Box sx={[{ p: 2 }, ...(Array.isArray(sx) ? sx : [sx])]} component={Paper}>
75
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
76
76
  <form action={formAction}>
77
77
  <Grid container spacing={2}>
78
78
  <Grid item xs={12}>
@@ -97,7 +97,7 @@ export function AddCategoryForm({
97
97
  />
98
98
  </Grid>
99
99
  </Grid>
100
- <Grid item xs={12}>
100
+ {/* <Grid item xs={12}>
101
101
  <Stack
102
102
  direction="row-reverse"
103
103
  spacing={2}
@@ -107,11 +107,8 @@ export function AddCategoryForm({
107
107
  }}
108
108
  >
109
109
  <SubmitButton text="create category" loadingText="loading" />
110
- {/* {formState?.strapiErrors && (
111
- <StrapiErrors error={formState?.strapiErrors} />
112
- )} */}
113
110
  </Stack>
114
- </Grid>
111
+ </Grid> */}
115
112
  </form>
116
113
  </Box>
117
114
  );
@@ -70,7 +70,7 @@ export default function CreateCategoryForm({
70
70
  />
71
71
  </Grid>
72
72
  </Grid>
73
- <Grid item xs={12}>
73
+ {/* <Grid item xs={12}>
74
74
  <Stack
75
75
  direction="row-reverse"
76
76
  spacing={2}
@@ -82,7 +82,7 @@ export default function CreateCategoryForm({
82
82
  <StrapiErrors error={formState?.strapiErrors} />
83
83
  )}
84
84
  </Stack>
85
- </Grid>
85
+ </Grid> */}
86
86
  </form>
87
87
  </Box>
88
88
  );
@@ -75,14 +75,7 @@ export function EditCategoryForm({
75
75
  }, [formState?.strapiErrors]);
76
76
 
77
77
  return (
78
- <Box
79
- sx={[
80
- // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
81
- { p: 2 },
82
- ...(Array.isArray(sx) ? sx : [sx]),
83
- ]}
84
- component={Paper}
85
- >
78
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
86
79
  <form action={formAction}>
87
80
  {id && <input id="id" type="hidden" name="id" value={id} />}
88
81
  <Grid container spacing={2}>
@@ -113,7 +106,7 @@ export function EditCategoryForm({
113
106
  />
114
107
  </Grid>
115
108
  </Grid>
116
- <Grid item xs={12}>
109
+ {/* <Grid item xs={12}>
117
110
  <Stack
118
111
  direction="row-reverse"
119
112
  spacing={2}
@@ -131,7 +124,7 @@ export function EditCategoryForm({
131
124
  <Alert severity="error">{formState?.message}</Alert>
132
125
  )}
133
126
  </Stack>
134
- </Grid>
127
+ </Grid> */}
135
128
  </form>
136
129
  </Box>
137
130
  );
@@ -66,7 +66,7 @@ export default function CreateIroForm({
66
66
  }, [formState?.strapiErrors]);
67
67
 
68
68
  return (
69
- <Box sx={[{ p: 2 }, ...(Array.isArray(sx) ? sx : [sx])]}>
69
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
70
70
  <form action={formAction}>
71
71
  <Grid container spacing={2}>
72
72
  <Grid item xs={12}>
@@ -374,7 +374,7 @@ export default function RmaForm({
374
374
  }, [formState?.strapiErrors]);
375
375
 
376
376
  return (
377
- <Box sx={[{ p: 2 }, ...(Array.isArray(sx) ? sx : [sx])]}>
377
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
378
378
  <form action={formAction}>
379
379
  <Grid container spacing={2}>
380
380
  <Grid item xs={12}>
@@ -613,7 +613,7 @@ export default function TextualManageIROForm({
613
613
  }, [data]);
614
614
 
615
615
  return (
616
- <Box sx={[{ p: 2 }, ...(Array.isArray(sx) ? sx : [sx])]} component={Paper}>
616
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
617
617
  <Grid container spacing={2}>
618
618
  <Grid item xs={12}>
619
619
  <Stack spacing={2}>
@@ -876,6 +876,11 @@ export default function TextualManageIROForm({
876
876
  * should be within the form, thats why the form spans two grid items
877
877
  * */}
878
878
  <input name="id" type="hidden" value={data.id} />
879
+ <input
880
+ type="hidden"
881
+ name="items"
882
+ value={JSON.stringify(parseItems(items))}
883
+ />
879
884
  {items &&
880
885
  items.map((item: IroItem, index: number) => {
881
886
  return (
@@ -903,16 +908,16 @@ export default function TextualManageIROForm({
903
908
  </Paper>
904
909
  );
905
910
  })}
906
- <Paper sx={{ p: 2 }}>
907
- <Stack direction="row" spacing={2} justifyContent={"end"}>
908
- <SubmitButton text="Update items" loadingText="Loading..." />
909
- </Stack>
910
- </Paper>
911
- <input
912
- type="hidden"
913
- name="items"
914
- value={JSON.stringify(parseItems(items))}
915
- />
911
+ <Stack direction={"row"} justifyContent={"space-between"}>
912
+ <Button onClick={handleClose} variant="outlined">
913
+ Cancel
914
+ </Button>
915
+ <SubmitButton
916
+ text="Confirm"
917
+ loadingText="Loading..."
918
+ variant="contained"
919
+ />
920
+ </Stack>
916
921
  </form>
917
922
  </Stack>
918
923
  </Grid>
@@ -26,6 +26,7 @@ import VendorSelector from "../../../components/logistics/vendor/VendorSelector"
26
26
  import { VendorName } from "../../../types/logistics/Vendor";
27
27
  import MarkdownEditor from "../../../components/common/markdown/MarkdownEditor";
28
28
  import { useSnackbar } from "../../../context/common/SnackbarContext";
29
+ import { SxProps } from "@mui/material/styles";
29
30
 
30
31
  const INITIAL_STATE = {
31
32
  zodErrors: null,
@@ -40,11 +41,13 @@ export const AddProductForm = ({
40
41
  categories,
41
42
  revalidateCallback,
42
43
  handleClose,
44
+ sx,
43
45
  }: {
44
46
  vendorArr: VendorName[];
45
47
  categories: CategoryName[];
46
48
  revalidateCallback?: () => void;
47
49
  handleClose?: () => void;
50
+ sx?: SxProps;
48
51
  }) => {
49
52
  const { state, dispatch } = useSnackbar();
50
53
  const [formState, formAction] = useFormState(
@@ -104,14 +107,7 @@ export const AddProductForm = ({
104
107
  }
105
108
 
106
109
  return (
107
- <Box
108
- /* sx={[
109
- // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
110
- ...(Array.isArray(sx) ? sx : [sx]),
111
- ]} */
112
- component={Paper}
113
- sx={{ p: 2 }}
114
- >
110
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
115
111
  <form action={formAction}>
116
112
  {/* <input id="id" type="hidden" name="id" value={id} /> */}
117
113
  <Grid container spacing={2}>
@@ -60,7 +60,6 @@ export function EditProductForm({
60
60
  categories,
61
61
  vendors,
62
62
  } = data;
63
- console.log("data", data);
64
63
 
65
64
  const initialGallery = gallery?.data || [];
66
65
  const initialCategories = categories?.data || [];
@@ -126,14 +125,7 @@ export function EditProductForm({
126
125
  }
127
126
 
128
127
  return (
129
- <Box
130
- sx={[
131
- { p: 2 },
132
- // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
133
- ...(Array.isArray(sx) ? sx : [sx]),
134
- ]}
135
- component={Paper}
136
- >
128
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
137
129
  <form action={formAction}>
138
130
  {id && <input id="id" type="hidden" name="id" value={id} />}
139
131
  <Grid container spacing={2}>
@@ -78,14 +78,7 @@ export function EditStockForm({
78
78
  }, [formState?.strapiErrors]);
79
79
 
80
80
  return (
81
- <Box
82
- sx={[
83
- // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
84
- { p: 2 },
85
- ...(Array.isArray(sx) ? sx : [sx]),
86
- ]}
87
- component={Paper}
88
- >
81
+ <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
89
82
  <Grid container spacing={2}>
90
83
  <Grid item xs={12}>
91
84
  <Typography variant="h6">{title}</Typography>