@mamrp/components 1.0.21 → 1.0.23

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.mjs CHANGED
@@ -110,6 +110,12 @@ function LicensePlate({
110
110
  }
111
111
  }, [data]);
112
112
  const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
113
+ if (inputName !== "input2") {
114
+ const englishInput = convertToEnglishDigits(enteredInput);
115
+ if (!/^\d*$/.test(englishInput)) {
116
+ return;
117
+ }
118
+ }
113
119
  const newInputValues = {
114
120
  ...inputValues,
115
121
  [inputName]: enteredInput
@@ -205,7 +211,13 @@ function LicensePlate({
205
211
  cursor: readOnly || !!data && readOnly ? "" : "text"
206
212
  },
207
213
  value: convertToPersianDigits(inputValues.input1),
208
- onChange: (e) => handleInputChange(e.target.value, "input1", 2)
214
+ onChange: (e) => {
215
+ const value = e.target.value;
216
+ const englishValue = convertToEnglishDigits(value);
217
+ if (/^\d*$/.test(englishValue)) {
218
+ handleInputChange(value, "input1", 2);
219
+ }
220
+ }
209
221
  }
210
222
  ),
211
223
  /* @__PURE__ */ React.createElement(
@@ -352,7 +364,13 @@ function LicensePlate({
352
364
  cursor: readOnly || !!data && readOnly ? "" : "text"
353
365
  },
354
366
  value: convertToPersianDigits(inputValues.input3),
355
- onChange: (e) => handleInputChange(e.target.value, "input3", 3)
367
+ onChange: (e) => {
368
+ const value = e.target.value;
369
+ const englishValue = convertToEnglishDigits(value);
370
+ if (/^\d*$/.test(englishValue)) {
371
+ handleInputChange(value, "input3", 3);
372
+ }
373
+ }
356
374
  }
357
375
  ),
358
376
  /* @__PURE__ */ React.createElement(
@@ -392,7 +410,13 @@ function LicensePlate({
392
410
  cursor: readOnly || !!data && readOnly ? "" : "text"
393
411
  },
394
412
  value: convertToPersianDigits(inputValues.input4),
395
- onChange: (e) => handleInputChange(e.target.value, "input4", 2)
413
+ onChange: (e) => {
414
+ const value = e.target.value;
415
+ const englishValue = convertToEnglishDigits(value);
416
+ if (/^\d*$/.test(englishValue)) {
417
+ handleInputChange(value, "input4", 2);
418
+ }
419
+ }
396
420
  }
397
421
  ),
398
422
  /* @__PURE__ */ React.createElement(
@@ -780,28 +804,46 @@ import Dialog2 from "@mui/material/Dialog";
780
804
  import DialogActions from "@mui/material/DialogActions";
781
805
  import DialogContent2 from "@mui/material/DialogContent";
782
806
  import DialogTitle2 from "@mui/material/DialogTitle";
783
- import { Box as Box5, Button as Button3, Divider, IconButton as IconButton2 } from "@mui/material";
784
- import { AiOutlineDeliveredProcedure } from "react-icons/ai";
807
+ import {
808
+ Box as Box5,
809
+ Button as Button3,
810
+ CircularProgress,
811
+ Divider,
812
+ IconButton as IconButton2,
813
+ useMediaQuery
814
+ } from "@mui/material";
815
+ import { FaRegTrashAlt } from "react-icons/fa";
785
816
  import { MdClose, MdOutlineCancel } from "react-icons/md";
786
- import Link from "next/link";
787
817
  function ConfirmationDialog({
788
818
  open,
789
819
  handleClose,
790
820
  callback,
791
821
  callbackParams,
792
822
  headerText,
793
- bodyText
823
+ bodyText,
824
+ isLoading,
825
+ maxWidth,
826
+ iconColor,
827
+ color,
828
+ actionTitle
794
829
  }) {
795
- return /* @__PURE__ */ React7.createElement(Dialog2, { open, onClose: handleClose, fullWidth: true, maxWidth: "sm" }, /* @__PURE__ */ React7.createElement(Box5, null, /* @__PURE__ */ React7.createElement(
830
+ const isMobile = useMediaQuery("(max-width:785px)");
831
+ return /* @__PURE__ */ React7.createElement(Dialog2, { open, onClose: handleClose, fullWidth: true, maxWidth }, /* @__PURE__ */ React7.createElement(Box5, null, /* @__PURE__ */ React7.createElement(
796
832
  DialogTitle2,
797
833
  {
798
834
  fontWeight: 700,
799
835
  fontSize: "1.2rem",
800
836
  display: "flex",
801
837
  alignItems: "center",
802
- gap: "4px"
838
+ gap: 1
803
839
  },
804
- /* @__PURE__ */ React7.createElement(AiOutlineDeliveredProcedure, { style: { color: "inherit" }, size: 22 }),
840
+ /* @__PURE__ */ React7.createElement(
841
+ FaRegTrashAlt,
842
+ {
843
+ style: { color: iconColor },
844
+ size: isMobile ? 18 : 20
845
+ }
846
+ ),
805
847
  headerText
806
848
  ), /* @__PURE__ */ React7.createElement(
807
849
  IconButton2,
@@ -816,7 +858,25 @@ function ConfirmationDialog({
816
858
  }
817
859
  },
818
860
  /* @__PURE__ */ React7.createElement(MdClose, null)
819
- ), /* @__PURE__ */ React7.createElement(Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React7.createElement(DialogContent2, null, bodyText), /* @__PURE__ */ React7.createElement(
861
+ ), /* @__PURE__ */ React7.createElement(Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React7.createElement(
862
+ DialogContent2,
863
+ {
864
+ sx: {
865
+ px: isMobile ? 2 : 3,
866
+ py: isMobile ? 1.5 : 2,
867
+ "& .MuiTypography-root": {
868
+ fontSize: isMobile ? "0.875rem" : "1rem",
869
+ lineHeight: isMobile ? 1.5 : 1.6,
870
+ gap: isMobile ? "2px" : "4px",
871
+ flexWrap: "wrap",
872
+ wordBreak: "break-word",
873
+ overflowWrap: "break-word",
874
+ whiteSpace: "normal"
875
+ }
876
+ }
877
+ },
878
+ bodyText
879
+ ), /* @__PURE__ */ React7.createElement(
820
880
  DialogActions,
821
881
  {
822
882
  sx: {
@@ -828,27 +888,27 @@ function ConfirmationDialog({
828
888
  padding: "2rem"
829
889
  }
830
890
  },
831
- /* @__PURE__ */ React7.createElement(Link, { href: "/module/transportation/workflow/confirm-deliver" }, /* @__PURE__ */ React7.createElement(
891
+ /* @__PURE__ */ React7.createElement(
832
892
  Button3,
833
893
  {
894
+ disabled: isLoading,
834
895
  onClick: () => {
835
896
  callback(callbackParams);
836
- handleClose();
837
897
  },
838
898
  variant: "contained",
839
- color: "primary",
840
- startIcon: /* @__PURE__ */ React7.createElement(AiOutlineDeliveredProcedure, { size: 16 }),
841
- sx: { minWidth: "120px" }
899
+ color,
900
+ sx: { minWidth: "120px" },
901
+ startIcon: isLoading ? /* @__PURE__ */ React7.createElement(CircularProgress, { sx: { color: "white" }, size: 20 }) : /* @__PURE__ */ React7.createElement(FaRegTrashAlt, { size: 16 })
842
902
  },
843
- "\u062A\u0623\u06CC\u06CC\u062F"
844
- )),
903
+ actionTitle
904
+ ),
845
905
  /* @__PURE__ */ React7.createElement(
846
906
  Button3,
847
907
  {
848
908
  onClick: handleClose,
849
909
  variant: "outlined",
850
- color: "inherit",
851
- startIcon: /* @__PURE__ */ React7.createElement(MdOutlineCancel, null),
910
+ color,
911
+ startIcon: /* @__PURE__ */ React7.createElement(MdOutlineCancel, { size: 15 }),
852
912
  sx: { minWidth: "120px" }
853
913
  },
854
914
  "\u0627\u0646\u0635\u0631\u0627\u0641"
@@ -1117,7 +1177,7 @@ var TimePickerComponent = ({
1117
1177
  import { yupResolver } from "@hookform/resolvers/yup";
1118
1178
  import Button5 from "@mui/material/Button";
1119
1179
  import Grid from "@mui/material/Grid2";
1120
- import { GlobalStyles, useMediaQuery } from "@mui/system";
1180
+ import { GlobalStyles, useMediaQuery as useMediaQuery2 } from "@mui/system";
1121
1181
  import moment2 from "moment";
1122
1182
  import { useEffect as useEffect3 } from "react";
1123
1183
  import { useForm } from "react-hook-form";
@@ -1126,7 +1186,7 @@ import * as yup from "yup";
1126
1186
 
1127
1187
  // src/date-picker/index.tsx
1128
1188
  import { Box as Box7, Typography as Typography4 } from "@mui/material";
1129
- import CircularProgress from "@mui/material/CircularProgress";
1189
+ import CircularProgress2 from "@mui/material/CircularProgress";
1130
1190
  import { DatePicker, LocalizationProvider } from "@mui/x-date-pickers";
1131
1191
  import { AdapterMomentJalaali } from "@mui/x-date-pickers/AdapterMomentJalaali";
1132
1192
  import dayjs from "dayjs";
@@ -1222,7 +1282,7 @@ var JalaliDatePicker = ({
1222
1282
  },
1223
1283
  InputProps: {
1224
1284
  ...isLoading && {
1225
- endAdornment: /* @__PURE__ */ React8.createElement(CircularProgress, { color: "secondary", size: 20 })
1285
+ endAdornment: /* @__PURE__ */ React8.createElement(CircularProgress2, { color: "secondary", size: 20 })
1226
1286
  } || disabled && { endAdornment: false },
1227
1287
  ...field.value && {
1228
1288
  value: persian ? `${moment(field.value).format("dddd - jDD/jMMMM/jYYYY")}` : `${moment(field.value).format("jYYYY/jMM/jDD")}`
@@ -1338,8 +1398,8 @@ var defaultValues = {
1338
1398
  // تبدیل به ISO بدون تغییر آفست
1339
1399
  };
1340
1400
  function DateFilterRange({ FromDate, ToDate }) {
1341
- const isMobile = useMediaQuery("(max-width:900px)");
1342
- const isSmMobile = useMediaQuery("(max-width:600px)");
1401
+ const isMobile = useMediaQuery2("(max-width:900px)");
1402
+ const isSmMobile = useMediaQuery2("(max-width:600px)");
1343
1403
  const { control, watch, setValue } = useForm({
1344
1404
  defaultValues,
1345
1405
  mode: "onChange",
@@ -1434,7 +1494,7 @@ function DateFilterRange({ FromDate, ToDate }) {
1434
1494
  import { yupResolver as yupResolver2 } from "@hookform/resolvers/yup";
1435
1495
  import Button6 from "@mui/material/Button";
1436
1496
  import Grid2 from "@mui/material/Grid2";
1437
- import { GlobalStyles as GlobalStyles2, useMediaQuery as useMediaQuery2 } from "@mui/system";
1497
+ import { GlobalStyles as GlobalStyles2, useMediaQuery as useMediaQuery3 } from "@mui/system";
1438
1498
  import moment3 from "moment";
1439
1499
  import React9 from "react";
1440
1500
  import { useEffect as useEffect4 } from "react";
@@ -1449,8 +1509,8 @@ var defaultValues2 = {
1449
1509
  // تبدیل به ISO بدون تغییر آفست
1450
1510
  };
1451
1511
  function DateFilter({ setHandler }) {
1452
- const isMobile = useMediaQuery2("(max-width:900px)");
1453
- const isSmMobile = useMediaQuery2("(max-width:600px)");
1512
+ const isMobile = useMediaQuery3("(max-width:900px)");
1513
+ const isSmMobile = useMediaQuery3("(max-width:600px)");
1454
1514
  const { control, watch, setValue } = useForm2({
1455
1515
  defaultValues: defaultValues2,
1456
1516
  mode: "onChange",
@@ -1511,7 +1571,7 @@ function DateFilter({ setHandler }) {
1511
1571
 
1512
1572
  // src/date-time-picker/index.tsx
1513
1573
  import { Typography as Typography5 } from "@mui/material";
1514
- import useMediaQuery3 from "@mui/material/useMediaQuery";
1574
+ import useMediaQuery4 from "@mui/material/useMediaQuery";
1515
1575
  import { Box as Box8 } from "@mui/system";
1516
1576
  import { DateTimePicker, LocalizationProvider as LocalizationProvider2 } from "@mui/x-date-pickers";
1517
1577
  import { AdapterMomentJalaali as AdapterMomentJalaali2 } from "@mui/x-date-pickers/AdapterMomentJalaali";
@@ -1531,7 +1591,7 @@ var JalaliDatePicker2 = ({
1531
1591
  centeredTime = false
1532
1592
  }) => {
1533
1593
  const today = moment4();
1534
- const isMobile = useMediaQuery3("(max-width:700px)");
1594
+ const isMobile = useMediaQuery4("(max-width:700px)");
1535
1595
  const [open, setOpen] = useState5(false);
1536
1596
  const customLocaleText = {
1537
1597
  cancelButtonLabel: "\u0644\u063A\u0648",
@@ -2209,7 +2269,7 @@ function SearchLicensePlate({
2209
2269
 
2210
2270
  // src/mobile-date-time-picker/index.tsx
2211
2271
  import { Button as Button8, Typography as Typography8 } from "@mui/material";
2212
- import useMediaQuery4 from "@mui/material/useMediaQuery";
2272
+ import useMediaQuery5 from "@mui/material/useMediaQuery";
2213
2273
  import { Box as Box11 } from "@mui/system";
2214
2274
  import {
2215
2275
  MobileDateTimePicker,
@@ -2228,7 +2288,7 @@ var JalaliDatePicker3 = ({
2228
2288
  isLoading
2229
2289
  }) => {
2230
2290
  const today = moment6();
2231
- const isMobile = useMediaQuery4("(max-width:700px)");
2291
+ const isMobile = useMediaQuery5("(max-width:700px)");
2232
2292
  const [open, setOpen] = useState8(false);
2233
2293
  const customLocaleText = {
2234
2294
  cancelButtonLabel: "\u0644\u063A\u0648",
@@ -2456,7 +2516,7 @@ import DialogTitle5 from "@mui/material/DialogTitle";
2456
2516
  import {
2457
2517
  Box as Box12,
2458
2518
  Button as Button9,
2459
- CircularProgress as CircularProgress2,
2519
+ CircularProgress as CircularProgress3,
2460
2520
  Divider as Divider3,
2461
2521
  IconButton as IconButton5
2462
2522
  } from "@mui/material";
@@ -2518,7 +2578,7 @@ function ConfirmationDialog2({
2518
2578
  variant: "contained",
2519
2579
  color: "error",
2520
2580
  sx: { minWidth: "120px" },
2521
- startIcon: isLoading ? /* @__PURE__ */ React14.createElement(CircularProgress2, { sx: { color: "white" }, size: 20 }) : /* @__PURE__ */ React14.createElement(Delete, { size: 16 })
2581
+ startIcon: isLoading ? /* @__PURE__ */ React14.createElement(CircularProgress3, { sx: { color: "white" }, size: 20 }) : /* @__PURE__ */ React14.createElement(Delete, { size: 16 })
2522
2582
  },
2523
2583
  "\u062D\u0630\u0641"
2524
2584
  ),
@@ -3148,7 +3208,7 @@ import TextField3 from "@mui/material/TextField";
3148
3208
  import { forwardRef } from "react";
3149
3209
  import { Controller as Controller8 } from "react-hook-form";
3150
3210
  import { NumericFormat } from "react-number-format";
3151
- import CircularProgress3 from "@mui/material/CircularProgress";
3211
+ import CircularProgress4 from "@mui/material/CircularProgress";
3152
3212
  import InputAdornment2 from "@mui/material/InputAdornment";
3153
3213
  import React22 from "react";
3154
3214
  var FormInputNumber = ({
@@ -3231,7 +3291,7 @@ var FormInputNumber = ({
3231
3291
  maxLength,
3232
3292
  decimalScale
3233
3293
  },
3234
- endAdornment: isLoading ? /* @__PURE__ */ React22.createElement(InputAdornment2, { position: "end" }, /* @__PURE__ */ React22.createElement(CircularProgress3, { size: 20 })) : endAdornment,
3294
+ endAdornment: isLoading ? /* @__PURE__ */ React22.createElement(InputAdornment2, { position: "end" }, /* @__PURE__ */ React22.createElement(CircularProgress4, { size: 20 })) : endAdornment,
3235
3295
  startAdornment
3236
3296
  },
3237
3297
  ...rest
@@ -3279,7 +3339,7 @@ var NumericFormatCustom = forwardRef(
3279
3339
  var number_type_default = FormInputNumber;
3280
3340
 
3281
3341
  // src/text-field/text-type/index.tsx
3282
- import CircularProgress4 from "@mui/material/CircularProgress";
3342
+ import CircularProgress5 from "@mui/material/CircularProgress";
3283
3343
  import InputAdornment3 from "@mui/material/InputAdornment";
3284
3344
  import TextField4 from "@mui/material/TextField";
3285
3345
  import React23 from "react";
@@ -3325,7 +3385,7 @@ var FormInputText = ({
3325
3385
  readOnly
3326
3386
  },
3327
3387
  InputProps: {
3328
- endAdornment: isLoading ? /* @__PURE__ */ React23.createElement(InputAdornment3, { position: "end" }, /* @__PURE__ */ React23.createElement(CircularProgress4, { size: 20 })) : null
3388
+ endAdornment: isLoading ? /* @__PURE__ */ React23.createElement(InputAdornment3, { position: "end" }, /* @__PURE__ */ React23.createElement(CircularProgress5, { size: 20 })) : null
3329
3389
  },
3330
3390
  InputLabelProps: { shrink: true },
3331
3391
  inputRef: ref,