@mamrp/components 1.0.21 → 1.0.24

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/index.d.mts CHANGED
@@ -48,8 +48,13 @@ interface ConfirmationDialogProps$1 {
48
48
  callbackParams: any;
49
49
  headerText: string;
50
50
  bodyText: ReactNode;
51
+ isLoading?: boolean;
52
+ maxWidth: "xs" | "sm" | "md" | "lg" | "xl";
53
+ iconColor: string;
54
+ color: "error" | "info" | "primary" | "success" | "warning" | "secondary";
55
+ actionTitle: string;
51
56
  }
52
- declare function ConfirmationDialog$1({ open, handleClose, callback, callbackParams, headerText, bodyText, }: ConfirmationDialogProps$1): React.JSX.Element;
57
+ declare function ConfirmationDialog$1({ open, handleClose, callback, callbackParams, headerText, bodyText, isLoading, maxWidth, iconColor, color, actionTitle, }: ConfirmationDialogProps$1): React.JSX.Element;
53
58
 
54
59
  interface CustomTimePickerProps {
55
60
  name: string;
package/dist/index.d.ts CHANGED
@@ -48,8 +48,13 @@ interface ConfirmationDialogProps$1 {
48
48
  callbackParams: any;
49
49
  headerText: string;
50
50
  bodyText: ReactNode;
51
+ isLoading?: boolean;
52
+ maxWidth: "xs" | "sm" | "md" | "lg" | "xl";
53
+ iconColor: string;
54
+ color: "error" | "info" | "primary" | "success" | "warning" | "secondary";
55
+ actionTitle: string;
51
56
  }
52
- declare function ConfirmationDialog$1({ open, handleClose, callback, callbackParams, headerText, bodyText, }: ConfirmationDialogProps$1): React.JSX.Element;
57
+ declare function ConfirmationDialog$1({ open, handleClose, callback, callbackParams, headerText, bodyText, isLoading, maxWidth, iconColor, color, actionTitle, }: ConfirmationDialogProps$1): React.JSX.Element;
53
58
 
54
59
  interface CustomTimePickerProps {
55
60
  name: string;
package/dist/index.js CHANGED
@@ -173,6 +173,12 @@ function LicensePlate({
173
173
  }
174
174
  }, [data]);
175
175
  const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
176
+ if (inputName !== "input2") {
177
+ const englishInput = (0, import_utils.convertToEnglishDigits)(enteredInput);
178
+ if (!/^\d*$/.test(englishInput)) {
179
+ return;
180
+ }
181
+ }
176
182
  const newInputValues = {
177
183
  ...inputValues,
178
184
  [inputName]: enteredInput
@@ -268,7 +274,13 @@ function LicensePlate({
268
274
  cursor: readOnly || !!data && readOnly ? "" : "text"
269
275
  },
270
276
  value: (0, import_utils.convertToPersianDigits)(inputValues.input1),
271
- onChange: (e) => handleInputChange(e.target.value, "input1", 2)
277
+ onChange: (e) => {
278
+ const value = e.target.value;
279
+ const englishValue = (0, import_utils.convertToEnglishDigits)(value);
280
+ if (/^\d*$/.test(englishValue)) {
281
+ handleInputChange(value, "input1", 2);
282
+ }
283
+ }
272
284
  }
273
285
  ),
274
286
  /* @__PURE__ */ React.createElement(
@@ -415,7 +427,13 @@ function LicensePlate({
415
427
  cursor: readOnly || !!data && readOnly ? "" : "text"
416
428
  },
417
429
  value: (0, import_utils.convertToPersianDigits)(inputValues.input3),
418
- onChange: (e) => handleInputChange(e.target.value, "input3", 3)
430
+ onChange: (e) => {
431
+ const value = e.target.value;
432
+ const englishValue = (0, import_utils.convertToEnglishDigits)(value);
433
+ if (/^\d*$/.test(englishValue)) {
434
+ handleInputChange(value, "input3", 3);
435
+ }
436
+ }
419
437
  }
420
438
  ),
421
439
  /* @__PURE__ */ React.createElement(
@@ -455,7 +473,13 @@ function LicensePlate({
455
473
  cursor: readOnly || !!data && readOnly ? "" : "text"
456
474
  },
457
475
  value: (0, import_utils.convertToPersianDigits)(inputValues.input4),
458
- onChange: (e) => handleInputChange(e.target.value, "input4", 2)
476
+ onChange: (e) => {
477
+ const value = e.target.value;
478
+ const englishValue = (0, import_utils.convertToEnglishDigits)(value);
479
+ if (/^\d*$/.test(englishValue)) {
480
+ handleInputChange(value, "input4", 2);
481
+ }
482
+ }
459
483
  }
460
484
  ),
461
485
  /* @__PURE__ */ React.createElement(
@@ -844,27 +868,38 @@ var import_DialogActions = __toESM(require("@mui/material/DialogActions"));
844
868
  var import_DialogContent2 = __toESM(require("@mui/material/DialogContent"));
845
869
  var import_DialogTitle2 = __toESM(require("@mui/material/DialogTitle"));
846
870
  var import_material7 = require("@mui/material");
847
- var import_ai = require("react-icons/ai");
871
+ var import_fa2 = require("react-icons/fa");
848
872
  var import_md = require("react-icons/md");
849
- var import_link = __toESM(require("next/link"));
850
873
  function ConfirmationDialog({
851
874
  open,
852
875
  handleClose,
853
876
  callback,
854
877
  callbackParams,
855
878
  headerText,
856
- bodyText
879
+ bodyText,
880
+ isLoading,
881
+ maxWidth,
882
+ iconColor,
883
+ color,
884
+ actionTitle
857
885
  }) {
858
- return /* @__PURE__ */ React7.createElement(import_Dialog2.default, { open, onClose: handleClose, fullWidth: true, maxWidth: "sm" }, /* @__PURE__ */ React7.createElement(import_material7.Box, null, /* @__PURE__ */ React7.createElement(
886
+ const isMobile = (0, import_material7.useMediaQuery)("(max-width:785px)");
887
+ return /* @__PURE__ */ React7.createElement(import_Dialog2.default, { open, onClose: handleClose, fullWidth: true, maxWidth }, /* @__PURE__ */ React7.createElement(import_material7.Box, null, /* @__PURE__ */ React7.createElement(
859
888
  import_DialogTitle2.default,
860
889
  {
861
890
  fontWeight: 700,
862
891
  fontSize: "1.2rem",
863
892
  display: "flex",
864
893
  alignItems: "center",
865
- gap: "4px"
894
+ gap: 1
866
895
  },
867
- /* @__PURE__ */ React7.createElement(import_ai.AiOutlineDeliveredProcedure, { style: { color: "inherit" }, size: 22 }),
896
+ /* @__PURE__ */ React7.createElement(
897
+ import_fa2.FaRegTrashAlt,
898
+ {
899
+ style: { color: iconColor },
900
+ size: isMobile ? 18 : 20
901
+ }
902
+ ),
868
903
  headerText
869
904
  ), /* @__PURE__ */ React7.createElement(
870
905
  import_material7.IconButton,
@@ -879,7 +914,25 @@ function ConfirmationDialog({
879
914
  }
880
915
  },
881
916
  /* @__PURE__ */ React7.createElement(import_md.MdClose, null)
882
- ), /* @__PURE__ */ React7.createElement(import_material7.Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React7.createElement(import_DialogContent2.default, null, bodyText), /* @__PURE__ */ React7.createElement(
917
+ ), /* @__PURE__ */ React7.createElement(import_material7.Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React7.createElement(
918
+ import_DialogContent2.default,
919
+ {
920
+ sx: {
921
+ px: isMobile ? 2 : 3,
922
+ py: isMobile ? 1.5 : 2,
923
+ "& .MuiTypography-root": {
924
+ fontSize: isMobile ? "0.875rem" : "1rem",
925
+ lineHeight: isMobile ? 1.5 : 1.6,
926
+ gap: isMobile ? "2px" : "4px",
927
+ flexWrap: "wrap",
928
+ wordBreak: "break-word",
929
+ overflowWrap: "break-word",
930
+ whiteSpace: "normal"
931
+ }
932
+ }
933
+ },
934
+ bodyText
935
+ ), /* @__PURE__ */ React7.createElement(
883
936
  import_DialogActions.default,
884
937
  {
885
938
  sx: {
@@ -891,27 +944,27 @@ function ConfirmationDialog({
891
944
  padding: "2rem"
892
945
  }
893
946
  },
894
- /* @__PURE__ */ React7.createElement(import_link.default, { href: "/module/transportation/workflow/confirm-deliver" }, /* @__PURE__ */ React7.createElement(
947
+ /* @__PURE__ */ React7.createElement(
895
948
  import_material7.Button,
896
949
  {
950
+ disabled: isLoading,
897
951
  onClick: () => {
898
952
  callback(callbackParams);
899
- handleClose();
900
953
  },
901
954
  variant: "contained",
902
- color: "primary",
903
- startIcon: /* @__PURE__ */ React7.createElement(import_ai.AiOutlineDeliveredProcedure, { size: 16 }),
904
- sx: { minWidth: "120px" }
955
+ color,
956
+ sx: { minWidth: "120px" },
957
+ startIcon: isLoading ? /* @__PURE__ */ React7.createElement(import_material7.CircularProgress, { sx: { color: "white" }, size: 20 }) : /* @__PURE__ */ React7.createElement(import_fa2.FaRegTrashAlt, { size: 16 })
905
958
  },
906
- "\u062A\u0623\u06CC\u06CC\u062F"
907
- )),
959
+ actionTitle
960
+ ),
908
961
  /* @__PURE__ */ React7.createElement(
909
962
  import_material7.Button,
910
963
  {
911
964
  onClick: handleClose,
912
965
  variant: "outlined",
913
- color: "inherit",
914
- startIcon: /* @__PURE__ */ React7.createElement(import_md.MdOutlineCancel, null),
966
+ color,
967
+ startIcon: /* @__PURE__ */ React7.createElement(import_md.MdOutlineCancel, { size: 15 }),
915
968
  sx: { minWidth: "120px" }
916
969
  },
917
970
  "\u0627\u0646\u0635\u0631\u0627\u0641"
@@ -1175,7 +1228,7 @@ var import_system = require("@mui/system");
1175
1228
  var import_moment = __toESM(require("moment"));
1176
1229
  var import_react8 = require("react");
1177
1230
  var import_react_hook_form5 = require("react-hook-form");
1178
- var import_fa3 = require("react-icons/fa");
1231
+ var import_fa4 = require("react-icons/fa");
1179
1232
  var yup = __toESM(require("yup"));
1180
1233
 
1181
1234
  // src/date-picker/index.tsx
@@ -1185,7 +1238,7 @@ var import_x_date_pickers = require("@mui/x-date-pickers");
1185
1238
  var import_AdapterMomentJalaali = require("@mui/x-date-pickers/AdapterMomentJalaali");
1186
1239
  var import_dayjs = __toESM(require("dayjs"));
1187
1240
  var import_moment_jalaali = __toESM(require("moment-jalaali"));
1188
- var import_fa2 = require("moment/locale/fa");
1241
+ var import_fa3 = require("moment/locale/fa");
1189
1242
  var import_react7 = __toESM(require("react"));
1190
1243
  var import_react_hook_form4 = require("react-hook-form");
1191
1244
  import_moment_jalaali.default.locale("fa");
@@ -1442,7 +1495,7 @@ function DateFilterRange({ FromDate, ToDate }) {
1442
1495
  onClick: () => handleDate("forward", "time"),
1443
1496
  disabled: isNextDisabled || isNextDisabledTime
1444
1497
  },
1445
- /* @__PURE__ */ React.createElement(import_fa3.FaChevronRight, { size: 30 })
1498
+ /* @__PURE__ */ React.createElement(import_fa4.FaChevronRight, { size: 30 })
1446
1499
  )), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ React.createElement(date_picker_default, { name: "time", control, label: "\u062A\u0627\u0631\u06CC\u062E \u0627\u0632", maxDate: (0, import_moment.default)(watch("time2")), align: "center", persian: true, clear: false, size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React.createElement(
1447
1500
  import_Button2.default,
1448
1501
  {
@@ -1454,7 +1507,7 @@ function DateFilterRange({ FromDate, ToDate }) {
1454
1507
  },
1455
1508
  onClick: () => handleDate("backward", "time")
1456
1509
  },
1457
- /* @__PURE__ */ React.createElement(import_fa3.FaChevronLeft, { size: 30 })
1510
+ /* @__PURE__ */ React.createElement(import_fa4.FaChevronLeft, { size: 30 })
1458
1511
  ))), /* @__PURE__ */ React.createElement(import_Grid2.default, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, justifyContent: "start" }, /* @__PURE__ */ React.createElement(
1459
1512
  import_Button2.default,
1460
1513
  {
@@ -1467,7 +1520,7 @@ function DateFilterRange({ FromDate, ToDate }) {
1467
1520
  onClick: () => handleDate("forward", "time2"),
1468
1521
  disabled: isNextDisabledTime2
1469
1522
  },
1470
- /* @__PURE__ */ React.createElement(import_fa3.FaChevronRight, { size: 30 })
1523
+ /* @__PURE__ */ React.createElement(import_fa4.FaChevronRight, { size: 30 })
1471
1524
  )), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ React.createElement(date_picker_default, { name: "time2", control, label: "\u062A\u0627\u0631\u06CC\u062E \u062A\u0627", minDate: (0, import_moment.default)(watch("time")), persian: true, align: "center", clear: false, size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React.createElement(
1472
1525
  import_Button2.default,
1473
1526
  {
@@ -1480,7 +1533,7 @@ function DateFilterRange({ FromDate, ToDate }) {
1480
1533
  onClick: () => handleDate("backward", "time2"),
1481
1534
  disabled: isLastDisabledTime
1482
1535
  },
1483
- /* @__PURE__ */ React.createElement(import_fa3.FaChevronLeft, { size: 30 })
1536
+ /* @__PURE__ */ React.createElement(import_fa4.FaChevronLeft, { size: 30 })
1484
1537
  )))), /* @__PURE__ */ React.createElement(import_Grid2.default, { container: true, size: 12 }, /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 12 })));
1485
1538
  }
1486
1539
 
@@ -1493,7 +1546,7 @@ var import_moment2 = __toESM(require("moment"));
1493
1546
  var import_react9 = __toESM(require("react"));
1494
1547
  var import_react10 = require("react");
1495
1548
  var import_react_hook_form6 = require("react-hook-form");
1496
- var import_fa4 = require("react-icons/fa");
1549
+ var import_fa5 = require("react-icons/fa");
1497
1550
  var yup2 = __toESM(require("yup"));
1498
1551
  var nowUTC2 = import_moment2.default.utc();
1499
1552
  var dateTimeWithIranTime3 = nowUTC2;
@@ -1547,7 +1600,7 @@ function DateFilter({ setHandler }) {
1547
1600
  onClick: () => handleDate("forward"),
1548
1601
  disabled: isNextDisabled
1549
1602
  },
1550
- /* @__PURE__ */ import_react9.default.createElement(import_fa4.FaChevronRight, { size: 30 })
1603
+ /* @__PURE__ */ import_react9.default.createElement(import_fa5.FaChevronRight, { size: 30 })
1551
1604
  )), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ import_react9.default.createElement(date_picker_default, { name: "time", control, label: "", persian: true, clear: false, align: "center", size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ import_react9.default.createElement(
1552
1605
  import_Button3.default,
1553
1606
  {
@@ -1559,7 +1612,7 @@ function DateFilter({ setHandler }) {
1559
1612
  },
1560
1613
  onClick: () => handleDate("backward")
1561
1614
  },
1562
- /* @__PURE__ */ import_react9.default.createElement(import_fa4.FaChevronLeft, { size: 30 })
1615
+ /* @__PURE__ */ import_react9.default.createElement(import_fa5.FaChevronLeft, { size: 30 })
1563
1616
  )))), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { container: true, size: 12 }, /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: 12 })));
1564
1617
  }
1565
1618
 
@@ -1950,6 +2003,12 @@ function SearchLicensePlate({
1950
2003
  }
1951
2004
  }, [data]);
1952
2005
  const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
2006
+ if (inputName !== "input2") {
2007
+ const englishInput = (0, import_utils2.convertToEnglishDigits)(enteredInput);
2008
+ if (!/^\d*$/.test(englishInput)) {
2009
+ return;
2010
+ }
2011
+ }
1953
2012
  const newInputValues = {
1954
2013
  ...inputValues,
1955
2014
  [inputName]: enteredInput
@@ -2060,7 +2119,13 @@ function SearchLicensePlate({
2060
2119
  cursor: readOnly || !!data && readOnly ? "" : "text"
2061
2120
  },
2062
2121
  value: (0, import_utils2.convertToPersianDigits)(inputValues.input1),
2063
- onChange: (e) => handleInputChange(e.target.value, "input1", 2)
2122
+ onChange: (e) => {
2123
+ const value = e.target.value;
2124
+ const englishValue = (0, import_utils2.convertToEnglishDigits)(value);
2125
+ if (/^\d*$/.test(englishValue)) {
2126
+ handleInputChange(value, "input1", 2);
2127
+ }
2128
+ }
2064
2129
  }
2065
2130
  ),
2066
2131
  /* @__PURE__ */ import_react14.default.createElement(
@@ -2205,7 +2270,13 @@ function SearchLicensePlate({
2205
2270
  cursor: readOnly || !!data && readOnly ? "" : "text"
2206
2271
  },
2207
2272
  value: (0, import_utils2.convertToPersianDigits)(inputValues.input3),
2208
- onChange: (e) => handleInputChange(e.target.value, "input3", 3)
2273
+ onChange: (e) => {
2274
+ const value = e.target.value;
2275
+ const englishValue = (0, import_utils2.convertToEnglishDigits)(value);
2276
+ if (/^\d*$/.test(englishValue)) {
2277
+ handleInputChange(value, "input3", 3);
2278
+ }
2279
+ }
2209
2280
  }
2210
2281
  ),
2211
2282
  /* @__PURE__ */ import_react14.default.createElement(
@@ -2244,7 +2315,13 @@ function SearchLicensePlate({
2244
2315
  cursor: readOnly || !!data && readOnly ? "" : "text"
2245
2316
  },
2246
2317
  value: (0, import_utils2.convertToPersianDigits)(inputValues.input4),
2247
- onChange: (e) => handleInputChange(e.target.value, "input4", 2)
2318
+ onChange: (e) => {
2319
+ const value = e.target.value;
2320
+ const englishValue = (0, import_utils2.convertToEnglishDigits)(value);
2321
+ if (/^\d*$/.test(englishValue)) {
2322
+ handleInputChange(value, "input4", 2);
2323
+ }
2324
+ }
2248
2325
  }
2249
2326
  ),
2250
2327
  /* @__PURE__ */ import_react14.default.createElement(
@@ -2630,7 +2707,7 @@ var import_material16 = require("@mui/material");
2630
2707
  var import_Stack = __toESM(require("@mui/material/Stack"));
2631
2708
  var import_system5 = require("@mui/system");
2632
2709
  var React16 = __toESM(require("react"));
2633
- var import_fa5 = require("react-icons/fa");
2710
+ var import_fa6 = require("react-icons/fa");
2634
2711
  function PaginationList({
2635
2712
  currentPage,
2636
2713
  setCurrentPage,
@@ -2674,7 +2751,7 @@ function PaginationList({
2674
2751
  justifyContent: "center"
2675
2752
  },
2676
2753
  size: "large",
2677
- startIcon: /* @__PURE__ */ React16.createElement(import_fa5.FaChevronRight, null)
2754
+ startIcon: /* @__PURE__ */ React16.createElement(import_fa6.FaChevronRight, null)
2678
2755
  },
2679
2756
  "\u0642\u0628\u0644\u06CC",
2680
2757
  " "
@@ -2715,7 +2792,7 @@ function PaginationList({
2715
2792
  justifyContent: "center"
2716
2793
  },
2717
2794
  size: "large",
2718
- endIcon: /* @__PURE__ */ React16.createElement(import_fa5.FaChevronLeft, null)
2795
+ endIcon: /* @__PURE__ */ React16.createElement(import_fa6.FaChevronLeft, null)
2719
2796
  },
2720
2797
  "\u0628\u0639\u062F\u06CC",
2721
2798
  " "