@mamrp/components 1.7.69 → 1.7.71

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
@@ -988,7 +988,7 @@ import {
988
988
  useTheme as useTheme3
989
989
  } from "@mui/material";
990
990
  import moment from "moment-jalaali";
991
- import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef4, useState as useState5 } from "react";
991
+ import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef4, useState as useState6 } from "react";
992
992
  import { Controller as Controller3 } from "react-hook-form";
993
993
  import {
994
994
  MdChevronLeft,
@@ -999,7 +999,7 @@ import {
999
999
 
1000
1000
  // src/draggable-paper/index.tsx
1001
1001
  import { Paper } from "@mui/material";
1002
- import { useRef as useRef3 } from "react";
1002
+ import { useRef as useRef3, useState as useState5 } from "react";
1003
1003
  import Draggable from "react-draggable";
1004
1004
  function DraggablePaper({
1005
1005
  handle = "#draggable-dialog",
@@ -1007,16 +1007,40 @@ function DraggablePaper({
1007
1007
  ...props
1008
1008
  }) {
1009
1009
  const nodeRef = useRef3(null);
1010
+ const [position, setPosition] = useState5({ x: 0, y: 0 });
1011
+ const [dragging, setDragging] = useState5(false);
1012
+ const handleDrag = (_, data) => {
1013
+ setPosition({ x: data.x, y: data.y });
1014
+ };
1015
+ const handleStart = () => {
1016
+ setDragging(true);
1017
+ };
1018
+ const handleStop = () => {
1019
+ setDragging(false);
1020
+ setPosition({ x: 0, y: 0 });
1021
+ };
1010
1022
  return /* @__PURE__ */ React.createElement(
1011
1023
  Draggable,
1012
1024
  {
1013
1025
  nodeRef,
1014
1026
  handle,
1015
1027
  cancel,
1016
- bounds: "parent",
1017
- defaultPosition: { x: 0, y: 0 }
1028
+ position,
1029
+ onStart: handleStart,
1030
+ onDrag: handleDrag,
1031
+ onStop: handleStop
1018
1032
  },
1019
- /* @__PURE__ */ React.createElement(Paper, { ref: nodeRef, ...props })
1033
+ /* @__PURE__ */ React.createElement(
1034
+ Paper,
1035
+ {
1036
+ ref: nodeRef,
1037
+ ...props,
1038
+ sx: {
1039
+ transition: dragging ? "none" : "transform 250ms cubic-bezier(0.4, 0, 0.2, 1)",
1040
+ ...props.sx
1041
+ }
1042
+ }
1043
+ )
1020
1044
  );
1021
1045
  }
1022
1046
 
@@ -1100,14 +1124,14 @@ var DateTimePickerComponent = ({
1100
1124
  variant = "outlined"
1101
1125
  }) => {
1102
1126
  const theme4 = useTheme3();
1103
- const [isOpen, setIsOpen] = useState5(false);
1104
- const [hasUserInteracted, setHasUserInteracted] = useState5(false);
1127
+ const [isOpen, setIsOpen] = useState6(false);
1128
+ const [hasUserInteracted, setHasUserInteracted] = useState6(false);
1105
1129
  const hourInputRef = useRef4(null);
1106
1130
  const minuteInputRef = useRef4(null);
1107
- const [hourInputValue, setHourInputValue] = useState5("");
1108
- const [minuteInputValue, setMinuteInputValue] = useState5("");
1109
- const [isEditingHour, setIsEditingHour] = useState5(false);
1110
- const [isEditingMinute, setIsEditingMinute] = useState5(false);
1131
+ const [hourInputValue, setHourInputValue] = useState6("");
1132
+ const [minuteInputValue, setMinuteInputValue] = useState6("");
1133
+ const [isEditingHour, setIsEditingHour] = useState6(false);
1134
+ const [isEditingMinute, setIsEditingMinute] = useState6(false);
1111
1135
  const parseValue = (val) => {
1112
1136
  if (val) {
1113
1137
  const m = moment(val);
@@ -1130,9 +1154,9 @@ var DateTimePickerComponent = ({
1130
1154
  minute: now.minute()
1131
1155
  };
1132
1156
  };
1133
- const [selectedDate, setSelectedDate] = useState5(() => parseValue(value));
1134
- const [viewYear, setViewYear] = useState5(selectedDate.year);
1135
- const [viewMonth, setViewMonth] = useState5(selectedDate.month);
1157
+ const [selectedDate, setSelectedDate] = useState6(() => parseValue(value));
1158
+ const [viewYear, setViewYear] = useState6(selectedDate.year);
1159
+ const [viewMonth, setViewMonth] = useState6(selectedDate.month);
1136
1160
  useEffect2(() => {
1137
1161
  const parsed = parseValue(value);
1138
1162
  setSelectedDate(parsed);
@@ -1819,7 +1843,7 @@ import Dialog5 from "@mui/material/Dialog";
1819
1843
  import DialogActions4 from "@mui/material/DialogActions";
1820
1844
  import DialogContent5 from "@mui/material/DialogContent";
1821
1845
  import DialogTitle5 from "@mui/material/DialogTitle";
1822
- import { useState as useState6, useEffect as useEffect3, useRef as useRef5 } from "react";
1846
+ import { useState as useState7, useEffect as useEffect3, useRef as useRef5 } from "react";
1823
1847
  import { MdClose as MdClose4 } from "react-icons/md";
1824
1848
  import { Controller as Controller4 } from "react-hook-form";
1825
1849
  import { Clock } from "@mamrp/icons/common";
@@ -1869,9 +1893,9 @@ var TimePickerComponent = ({
1869
1893
  const theme4 = useTheme4();
1870
1894
  const initialHour = value ? parseInt(value.split(":")[0]) : null;
1871
1895
  const initialMinute = value ? parseInt(value.split(":")[1]) : null;
1872
- const [isModalOpen, setIsModalOpen] = useState6(false);
1873
- const [selectedHour, setSelectedHour] = useState6(initialHour);
1874
- const [selectedMinute, setSelectedMinute] = useState6(
1896
+ const [isModalOpen, setIsModalOpen] = useState7(false);
1897
+ const [selectedHour, setSelectedHour] = useState7(initialHour);
1898
+ const [selectedMinute, setSelectedMinute] = useState7(
1875
1899
  initialMinute
1876
1900
  );
1877
1901
  const hourRefs = useRef5([]);
@@ -2284,7 +2308,7 @@ import { DatePicker, LocalizationProvider } from "@mui/x-date-pickers";
2284
2308
  import { AdapterMomentJalaali } from "@mui/x-date-pickers/AdapterMomentJalaali";
2285
2309
  import dayjs from "dayjs";
2286
2310
  import moment2 from "moment-jalaali";
2287
- import React9, { useState as useState7 } from "react";
2311
+ import React9, { useState as useState8 } from "react";
2288
2312
  import { Controller as Controller5 } from "react-hook-form";
2289
2313
  import { MdChevronLeft as MdChevronLeft2, MdChevronRight as MdChevronRight2 } from "react-icons/md";
2290
2314
  moment2.locale("fa");
@@ -2341,7 +2365,7 @@ var JalaliDatePicker = ({
2341
2365
  name,
2342
2366
  control,
2343
2367
  render: ({ field, fieldState: { error } }) => {
2344
- const [open, setOpen] = useState7(false);
2368
+ const [open, setOpen] = useState8(false);
2345
2369
  const handlePreviousDate = (e) => {
2346
2370
  e.stopPropagation();
2347
2371
  const currentValue = field.value ? moment2(field.value) : moment2();
@@ -3187,7 +3211,7 @@ import { Box as Box13 } from "@mui/system";
3187
3211
  import { DateTimePicker, LocalizationProvider as LocalizationProvider3 } from "@mui/x-date-pickers";
3188
3212
  import { AdapterMomentJalaali as AdapterMomentJalaali3 } from "@mui/x-date-pickers/AdapterMomentJalaali";
3189
3213
  import moment6 from "moment-jalaali";
3190
- import React11, { useState as useState8 } from "react";
3214
+ import React11, { useState as useState9 } from "react";
3191
3215
  import { Controller as Controller7 } from "react-hook-form";
3192
3216
  moment6.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
3193
3217
  var JalaliDatePicker2 = ({
@@ -3204,7 +3228,7 @@ var JalaliDatePicker2 = ({
3204
3228
  }) => {
3205
3229
  const today = moment6();
3206
3230
  const isMobile = useMediaQuery4("(max-width:700px)");
3207
- const [open, setOpen] = useState8(false);
3231
+ const [open, setOpen] = useState9(false);
3208
3232
  const customLocaleText = {
3209
3233
  cancelButtonLabel: "\u0644\u063A\u0648",
3210
3234
  okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
@@ -3490,7 +3514,7 @@ import { Box as Box14, Typography as Typography8 } from "@mui/material";
3490
3514
  import { LocalizationProvider as LocalizationProvider4 } from "@mui/x-date-pickers";
3491
3515
  import { AdapterMomentJalaali as AdapterMomentJalaali4 } from "@mui/x-date-pickers/AdapterMomentJalaali";
3492
3516
  import moment7 from "moment-jalaali";
3493
- import React12, { useEffect as useEffect6, useState as useState9 } from "react";
3517
+ import React12, { useEffect as useEffect6, useState as useState10 } from "react";
3494
3518
  import { useWatch } from "react-hook-form";
3495
3519
  moment7.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
3496
3520
  var JalaliDateTimeRangePicker = ({
@@ -3505,7 +3529,7 @@ var JalaliDateTimeRangePicker = ({
3505
3529
  const startDate = useWatch({ control, name: startName });
3506
3530
  const validStartDate = startDate ? moment7(startDate) : null;
3507
3531
  const defaultStartDate = moment7().add(3.5, "hours").toDate();
3508
- const [isStartDateChanged, setIsStartDateChanged] = useState9(false);
3532
+ const [isStartDateChanged, setIsStartDateChanged] = useState10(false);
3509
3533
  useEffect6(() => {
3510
3534
  if (validStartDate && !validStartDate.isSame(defaultStartDate, "minute")) {
3511
3535
  setIsStartDateChanged(true);
@@ -3561,7 +3585,7 @@ import {
3561
3585
  Typography as Typography10
3562
3586
  } from "@mui/material";
3563
3587
  import Image3 from "next/image";
3564
- import React13, { useState as useState11 } from "react";
3588
+ import React13, { useState as useState12 } from "react";
3565
3589
  import {
3566
3590
  Controller as Controller8
3567
3591
  } from "react-hook-form";
@@ -3577,7 +3601,7 @@ import {
3577
3601
  Typography as Typography9
3578
3602
  } from "@mui/material";
3579
3603
  import Image2 from "next/image";
3580
- import { useCallback as useCallback2, useEffect as useEffect7, useState as useState10 } from "react";
3604
+ import { useCallback as useCallback2, useEffect as useEffect7, useState as useState11 } from "react";
3581
3605
  import {
3582
3606
  MdClose as MdClose5,
3583
3607
  MdRotateLeft,
@@ -3595,15 +3619,15 @@ function ImageViewer({
3595
3619
  noRotate = false,
3596
3620
  noZoom = false
3597
3621
  }) {
3598
- const [zoom, setZoom] = useState10(1);
3599
- const [rotate, setRotate] = useState10(0);
3600
- const [loading, setLoading] = useState10(true);
3601
- const [viewerOpen, setViewerOpen] = useState10(false);
3602
- const [viewerSrc, setViewerSrc] = useState10("");
3603
- const [position, setPosition] = useState10({ x: 0, y: 0 });
3604
- const [dragging, setDragging] = useState10(false);
3605
- const [startMouse, setStartMouse] = useState10({ x: 0, y: 0 });
3606
- const [startOffset, setStartOffset] = useState10({ x: 0, y: 0 });
3622
+ const [zoom, setZoom] = useState11(1);
3623
+ const [rotate, setRotate] = useState11(0);
3624
+ const [loading, setLoading] = useState11(true);
3625
+ const [viewerOpen, setViewerOpen] = useState11(false);
3626
+ const [viewerSrc, setViewerSrc] = useState11("");
3627
+ const [position, setPosition] = useState11({ x: 0, y: 0 });
3628
+ const [dragging, setDragging] = useState11(false);
3629
+ const [startMouse, setStartMouse] = useState11({ x: 0, y: 0 });
3630
+ const [startOffset, setStartOffset] = useState11({ x: 0, y: 0 });
3607
3631
  const reset = () => {
3608
3632
  setZoom(1);
3609
3633
  setRotate(0);
@@ -3786,8 +3810,8 @@ var UploadImage = ({
3786
3810
  allowGallery = false,
3787
3811
  disableRemove
3788
3812
  }) => {
3789
- const [viewerOpen, setViewerOpen] = useState11(false);
3790
- const [viewerSrc, setViewerSrc] = useState11("");
3813
+ const [viewerOpen, setViewerOpen] = useState12(false);
3814
+ const [viewerSrc, setViewerSrc] = useState12("");
3791
3815
  const compressImage = (file, quality = 0.9, maxWidth = 1600, maxHeight = 1600) => {
3792
3816
  return new Promise((resolve) => {
3793
3817
  const reader = new FileReader();
@@ -4162,7 +4186,7 @@ import {
4162
4186
  MdClose as MdClose6
4163
4187
  } from "react-icons/md";
4164
4188
  import Image4 from "next/image";
4165
- import { useEffect as useEffect8, useState as useState12, useCallback as useCallback3 } from "react";
4189
+ import { useEffect as useEffect8, useState as useState13, useCallback as useCallback3 } from "react";
4166
4190
  function imgViewer({
4167
4191
  open,
4168
4192
  handleClose,
@@ -4174,13 +4198,13 @@ function imgViewer({
4174
4198
  noZoom = false,
4175
4199
  unoptimized = false
4176
4200
  }) {
4177
- const [zoom, setZoom] = useState12(1);
4178
- const [rotate, setRotate] = useState12(0);
4179
- const [loading, setLoading] = useState12(true);
4180
- const [position, setPosition] = useState12({ x: 0, y: 0 });
4181
- const [dragging, setDragging] = useState12(false);
4182
- const [startMouse, setStartMouse] = useState12({ x: 0, y: 0 });
4183
- const [startOffset, setStartOffset] = useState12({ x: 0, y: 0 });
4201
+ const [zoom, setZoom] = useState13(1);
4202
+ const [rotate, setRotate] = useState13(0);
4203
+ const [loading, setLoading] = useState13(true);
4204
+ const [position, setPosition] = useState13({ x: 0, y: 0 });
4205
+ const [dragging, setDragging] = useState13(false);
4206
+ const [startMouse, setStartMouse] = useState13({ x: 0, y: 0 });
4207
+ const [startOffset, setStartOffset] = useState13({ x: 0, y: 0 });
4184
4208
  const reset = () => {
4185
4209
  setZoom(1);
4186
4210
  setRotate(0);
@@ -4333,7 +4357,7 @@ import Dialog8 from "@mui/material/Dialog";
4333
4357
  import DialogContent6 from "@mui/material/DialogContent";
4334
4358
  import DialogTitle6 from "@mui/material/DialogTitle";
4335
4359
  import Image5 from "next/image";
4336
- import { useEffect as useEffect9, useRef as useRef7, useState as useState13 } from "react";
4360
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState14 } from "react";
4337
4361
  import { IoClose as IoClose2 } from "react-icons/io5";
4338
4362
  function SearchLicensePlate({
4339
4363
  width = "100%",
@@ -4344,8 +4368,8 @@ function SearchLicensePlate({
4344
4368
  size = "small"
4345
4369
  }) {
4346
4370
  const theme4 = useTheme5();
4347
- const [open, setOpen] = useState13(false);
4348
- const [inputValues, setInputValues] = useState13({
4371
+ const [open, setOpen] = useState14(false);
4372
+ const [inputValues, setInputValues] = useState14({
4349
4373
  input1: "",
4350
4374
  input2: "",
4351
4375
  input3: "",
@@ -4632,7 +4656,7 @@ import {
4632
4656
  import { AdapterMomentJalaali as AdapterMomentJalaali5 } from "@mui/x-date-pickers/AdapterMomentJalaali";
4633
4657
  import dayjs3 from "dayjs";
4634
4658
  import moment8 from "moment-jalaali";
4635
- import React14, { useState as useState14 } from "react";
4659
+ import React14, { useState as useState15 } from "react";
4636
4660
  import { Controller as Controller9 } from "react-hook-form";
4637
4661
  moment8.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
4638
4662
  var JalaliDatePicker3 = ({
@@ -4643,7 +4667,7 @@ var JalaliDatePicker3 = ({
4643
4667
  }) => {
4644
4668
  const today = moment8();
4645
4669
  const isMobile = useMediaQuery5("(max-width:700px)");
4646
- const [open, setOpen] = useState14(false);
4670
+ const [open, setOpen] = useState15(false);
4647
4671
  const customLocaleText = {
4648
4672
  cancelButtonLabel: "\u0644\u063A\u0648",
4649
4673
  okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
@@ -5197,7 +5221,7 @@ import {
5197
5221
  Select,
5198
5222
  Typography as Typography16
5199
5223
  } from "@mui/material";
5200
- import React19, { useState as useState15 } from "react";
5224
+ import React19, { useState as useState16 } from "react";
5201
5225
  var backendResponse = {
5202
5226
  value: {
5203
5227
  data: [
@@ -5250,9 +5274,9 @@ var backendResponse = {
5250
5274
  }
5251
5275
  };
5252
5276
  var NestedSelect = () => {
5253
- const [selectedItem, setSelectedItem] = useState15(null);
5254
- const [openMenus, setOpenMenus] = useState15({});
5255
- const [menuOpen, setMenuOpen] = useState15(false);
5277
+ const [selectedItem, setSelectedItem] = useState16(null);
5278
+ const [openMenus, setOpenMenus] = useState16({});
5279
+ const [menuOpen, setMenuOpen] = useState16(false);
5256
5280
  const handleSelect = (item) => {
5257
5281
  setSelectedItem((prev) => prev?.id === item.id ? null : item);
5258
5282
  };
@@ -6201,7 +6225,7 @@ import {
6201
6225
  DialogActions as DialogActions6
6202
6226
  } from "@mui/material";
6203
6227
  import { MdMyLocation, MdOutlineClear as MdOutlineClear2 } from "react-icons/md";
6204
- import { useEffect as useEffect12, useRef as useRef8, useState as useState17 } from "react";
6228
+ import { useEffect as useEffect12, useRef as useRef8, useState as useState18 } from "react";
6205
6229
  import toast2, { Toaster } from "react-hot-toast";
6206
6230
  import { useController } from "react-hook-form";
6207
6231
  function MapLocationPicker({
@@ -6239,12 +6263,12 @@ function MapLocationPicker({
6239
6263
  const mapRef = useRef8(null);
6240
6264
  const mapInstanceRef = useRef8(null);
6241
6265
  const markerRef = useRef8(null);
6242
- const [isMapLoading, setIsMapLoading] = useState17(true);
6243
- const [isGeocoding, setIsGeocoding] = useState17(false);
6244
- const [isGeolocating, setIsGeolocating] = useState17(false);
6245
- const [showGpsDialog, setShowGpsDialog] = useState17(false);
6246
- const [gpsErrorType, setGpsErrorType] = useState17("other");
6247
- const [zoom, setZoom] = useState17(defaultZoom);
6266
+ const [isMapLoading, setIsMapLoading] = useState18(true);
6267
+ const [isGeocoding, setIsGeocoding] = useState18(false);
6268
+ const [isGeolocating, setIsGeolocating] = useState18(false);
6269
+ const [showGpsDialog, setShowGpsDialog] = useState18(false);
6270
+ const [gpsErrorType, setGpsErrorType] = useState18("other");
6271
+ const [zoom, setZoom] = useState18(defaultZoom);
6248
6272
  const hasExistingLocation = latitude !== null && longitude !== null;
6249
6273
  const initialLat = hasExistingLocation ? latitude : defaultLat;
6250
6274
  const initialLng = hasExistingLocation ? longitude : defaultLng;