@mamrp/components 1.0.0

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 ADDED
@@ -0,0 +1,3802 @@
1
+ // react-shim.js
2
+ import * as React from "react";
3
+
4
+ // src/auto-complete/selector/index.tsx
5
+ import { Popper, Typography as Typography2 } from "@mui/material";
6
+ import Autocomplete from "@mui/material/Autocomplete";
7
+ import TextField from "@mui/material/TextField";
8
+ import * as React3 from "react";
9
+ import { Controller } from "react-hook-form";
10
+
11
+ // src/constants/httpMethod.ts
12
+ var numberToHttpMethodMapping = {
13
+ 0: "POST",
14
+ 1: "GET",
15
+ 2: "PUT",
16
+ 3: "DELETE"
17
+ };
18
+
19
+ // src/auto-complete/selector/custome-style.tsx
20
+ import React2 from "react";
21
+
22
+ // src/license-plate/index.tsx
23
+ import { Box, IconButton, Typography, useTheme } from "@mui/material";
24
+ import Button from "@mui/material/Button";
25
+ import Dialog from "@mui/material/Dialog";
26
+ import DialogContent from "@mui/material/DialogContent";
27
+ import DialogTitle from "@mui/material/DialogTitle";
28
+ import Image from "next/image";
29
+ import { useEffect, useRef, useState } from "react";
30
+ import { IoClose } from "react-icons/io5";
31
+
32
+ // src/constants/letters.ts
33
+ var letters = [
34
+ "\u0627\u0644\u0641",
35
+ "\u0628",
36
+ "\u067E",
37
+ "\u062A",
38
+ "\u062B",
39
+ "\u062C",
40
+ "\u0686",
41
+ "\u062D",
42
+ "\u062E",
43
+ "\u062F",
44
+ "\u0630",
45
+ "\u0631",
46
+ "\u0632",
47
+ "\u0698",
48
+ "\u0633",
49
+ "\u0634",
50
+ "\u0635",
51
+ "\u0636",
52
+ "\u0637",
53
+ "\u0638",
54
+ "\u0639",
55
+ "\u063A",
56
+ "\u0641",
57
+ "\u0642",
58
+ "\u06A9",
59
+ "\u06AF",
60
+ "\u0644",
61
+ "\u0645",
62
+ "\u0646",
63
+ "\u0648",
64
+ "\u0647",
65
+ "\u06CC"
66
+ ];
67
+ var letters_default = letters;
68
+
69
+ // src/license-plate/index.tsx
70
+ import { convertToEnglishDigits, convertToPersianDigits } from "@mamrp/utils";
71
+ function LicensePlate({
72
+ width = "100%",
73
+ name,
74
+ setValue,
75
+ data,
76
+ readOnly = true,
77
+ size
78
+ }) {
79
+ const theme = useTheme();
80
+ const [open, setOpen] = useState(false);
81
+ const [selectedValue, setSelectedValue] = useState("");
82
+ const [inputValues, setInputValues] = useState({
83
+ input1: "",
84
+ input2: "",
85
+ input3: "",
86
+ input4: ""
87
+ });
88
+ const inputRefs = {
89
+ input1: useRef(null),
90
+ input2: useRef(null),
91
+ input3: useRef(null),
92
+ input4: useRef(null)
93
+ };
94
+ useEffect(() => {
95
+ if (data) {
96
+ let newdata = data.split(" ").filter((word) => word !== "\u0627\u06CC\u0631\u0627\u0646");
97
+ setInputValues({
98
+ input1: newdata[0],
99
+ input2: newdata[1],
100
+ input3: newdata[2],
101
+ input4: newdata[3]
102
+ });
103
+ } else if (data == "") {
104
+ setInputValues({
105
+ input1: "",
106
+ input2: "",
107
+ input3: "",
108
+ input4: ""
109
+ });
110
+ }
111
+ }, [data]);
112
+ const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
113
+ const newInputValues = {
114
+ ...inputValues,
115
+ [inputName]: enteredInput
116
+ };
117
+ setInputValues(newInputValues);
118
+ const formattedPlate = convertToEnglishDigits(newInputValues.input1) + " " + newInputValues.input2 + " " + convertToEnglishDigits(newInputValues.input3) + " \u0627\u06CC\u0631\u0627\u0646 " + convertToEnglishDigits(newInputValues.input4);
119
+ setValue(name, formattedPlate);
120
+ if (enteredInput.length === maxlength || minLength === 1) {
121
+ if (inputName === "input1") {
122
+ setOpen(true);
123
+ } else if (inputName === "input2") {
124
+ setSelectedValue(enteredInput);
125
+ setOpen(false);
126
+ } else {
127
+ inputRefs["input4"]?.current?.focus();
128
+ }
129
+ }
130
+ };
131
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
132
+ Box,
133
+ {
134
+ sx: {
135
+ width,
136
+ border: "1px solid #e5e7eb",
137
+ borderRadius: "7px",
138
+ display: "flex",
139
+ alignItems: "center"
140
+ },
141
+ dir: "ltr"
142
+ },
143
+ /* @__PURE__ */ React.createElement(
144
+ Box,
145
+ {
146
+ sx: {
147
+ display: "flex",
148
+ alignItems: "center"
149
+ }
150
+ },
151
+ /* @__PURE__ */ React.createElement(
152
+ Box,
153
+ {
154
+ sx: {
155
+ backgroundColor: "#172554",
156
+ width: size === "small" ? "30px" : "36px",
157
+ minHeight: size === "small" ? "40px" : "52px",
158
+ maxHeight: size === "small" ? "40px" : "52px",
159
+ display: "flex",
160
+ justifyContent: "center",
161
+ alignItems: "center",
162
+ borderRadius: "7px",
163
+ mr: 0.4
164
+ }
165
+ },
166
+ /* @__PURE__ */ React.createElement(
167
+ Image,
168
+ {
169
+ src: "/assets/images/iran-flag-dark.svg",
170
+ alt: "Iran Flag",
171
+ width: size === "small" ? 16 : 20,
172
+ height: size === "small" ? 14 : 12
173
+ }
174
+ )
175
+ )
176
+ ),
177
+ /* @__PURE__ */ React.createElement(
178
+ Box,
179
+ {
180
+ sx: {
181
+ width: "100%",
182
+ display: "flex",
183
+ justifyContent: "space-around",
184
+ fontSize: "1.125rem",
185
+ lineHeight: "1.75rem",
186
+ fontWeight: 600,
187
+ color: "#1f2937",
188
+ alignItems: "center"
189
+ }
190
+ },
191
+ /* @__PURE__ */ React.createElement(
192
+ "input",
193
+ {
194
+ disabled: readOnly || !!data && readOnly,
195
+ ref: inputRefs.input1,
196
+ type: "text",
197
+ maxLength: 2,
198
+ placeholder: "- -",
199
+ style: {
200
+ color: theme.palette.text.primary,
201
+ width: "24px",
202
+ textAlign: "center",
203
+ backgroundColor: "transparent",
204
+ outline: "none",
205
+ cursor: readOnly || !!data && readOnly ? "" : "text"
206
+ },
207
+ value: convertToPersianDigits(inputValues.input1),
208
+ onChange: (e) => handleInputChange(e.target.value, "input1", 2)
209
+ }
210
+ ),
211
+ /* @__PURE__ */ React.createElement(
212
+ Box,
213
+ {
214
+ sx: {
215
+ display: "flex",
216
+ alignItems: "center"
217
+ }
218
+ },
219
+ !data && /* @__PURE__ */ React.createElement(
220
+ Image,
221
+ {
222
+ src: "/assets/images/solid-arrow-down.svg",
223
+ width: 20,
224
+ height: 20,
225
+ alt: "arrow",
226
+ style: { cursor: "pointer", marginRight: 4 }
227
+ }
228
+ ),
229
+ /* @__PURE__ */ React.createElement(
230
+ "input",
231
+ {
232
+ disabled: readOnly || !!data && readOnly,
233
+ ref: inputRefs.input2,
234
+ onClick: () => {
235
+ if (!(readOnly || !!data && readOnly)) {
236
+ setOpen(true);
237
+ }
238
+ },
239
+ type: "text",
240
+ minLength: 1,
241
+ maxLength: 3,
242
+ placeholder: "-",
243
+ style: {
244
+ color: theme.palette.text.primary,
245
+ width: "28px",
246
+ textAlign: "center",
247
+ backgroundColor: "transparent",
248
+ outline: "none",
249
+ cursor: readOnly || !!data && readOnly ? "" : "pointer"
250
+ },
251
+ value: inputValues.input2,
252
+ readOnly: true
253
+ }
254
+ )
255
+ ),
256
+ /* @__PURE__ */ React.createElement(
257
+ Dialog,
258
+ {
259
+ dir: "rtl",
260
+ open,
261
+ onClose: () => setOpen(false),
262
+ "aria-labelledby": "alert-dialog-title",
263
+ "aria-describedby": "alert-dialog-description"
264
+ },
265
+ /* @__PURE__ */ React.createElement(
266
+ Box,
267
+ {
268
+ sx: {
269
+ display: "flex",
270
+ justifyContent: "space-between",
271
+ alignItems: "center",
272
+ backgroundColor: "#f5f5f5"
273
+ // bg-neutral-100
274
+ }
275
+ },
276
+ /* @__PURE__ */ React.createElement(DialogTitle, { id: "alert-dialog-title" }, "\u0627\u0646\u062A\u062E\u0627\u0628 \u062D\u0631\u0641 \u067E\u0644\u0627\u06A9"),
277
+ /* @__PURE__ */ React.createElement(
278
+ Box,
279
+ {
280
+ sx: {
281
+ cursor: "pointer",
282
+ paddingRight: "1rem",
283
+ color: "#737373"
284
+ // text-neutral-500
285
+ },
286
+ onClick: () => setOpen(false)
287
+ },
288
+ /* @__PURE__ */ React.createElement(IconButton, null, /* @__PURE__ */ React.createElement(IoClose, null))
289
+ )
290
+ ),
291
+ /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(
292
+ Box,
293
+ {
294
+ sx: {
295
+ display: "flex",
296
+ alignItems: "center",
297
+ justifyContent: "center",
298
+ flexWrap: "wrap",
299
+ gap: 2,
300
+ my: 2
301
+ }
302
+ },
303
+ letters_default.map((letter, index) => /* @__PURE__ */ React.createElement(
304
+ Button,
305
+ {
306
+ key: index,
307
+ variant: "outlined",
308
+ color: "primary",
309
+ sx: {
310
+ border: "none",
311
+ backgroundColor: "#f0f0f0",
312
+ width: "70px",
313
+ height: "50px",
314
+ fontWeight: "bold",
315
+ ":hover": {
316
+ backgroundColor: "#e3e3e3"
317
+ }
318
+ },
319
+ onClick: () => handleInputChange(letter, "input2", 3, 1)
320
+ },
321
+ /* @__PURE__ */ React.createElement(Typography, { color: "#117A4F", fontWeight: "bold" }, letter)
322
+ ))
323
+ ), /* @__PURE__ */ React.createElement(Box, { sx: { display: "flex", justifyContent: "center", mt: 2.5 } }, /* @__PURE__ */ React.createElement(
324
+ Button,
325
+ {
326
+ sx: { width: "6rem" },
327
+ variant: "outlined",
328
+ color: "error",
329
+ onClick: () => {
330
+ handleInputChange("", "input2", 3, 1);
331
+ setOpen(false);
332
+ }
333
+ },
334
+ "\u062D\u0630\u0641 \u062D\u0631\u0641"
335
+ )))
336
+ ),
337
+ /* @__PURE__ */ React.createElement(
338
+ "input",
339
+ {
340
+ disabled: readOnly || !!data && readOnly,
341
+ ref: inputRefs.input3,
342
+ type: "text",
343
+ maxLength: 3,
344
+ placeholder: "- - -",
345
+ style: {
346
+ color: theme.palette.text.primary,
347
+ width: "40px",
348
+ // w-10
349
+ textAlign: "center",
350
+ backgroundColor: "transparent",
351
+ outline: "none",
352
+ cursor: readOnly || !!data && readOnly ? "" : "text"
353
+ },
354
+ value: convertToPersianDigits(inputValues.input3),
355
+ onChange: (e) => handleInputChange(e.target.value, "input3", 3)
356
+ }
357
+ ),
358
+ /* @__PURE__ */ React.createElement(
359
+ Box,
360
+ {
361
+ sx: {
362
+ height: "40px",
363
+ width: "1px",
364
+ backgroundColor: "#e5e7eb"
365
+ }
366
+ }
367
+ ),
368
+ /* @__PURE__ */ React.createElement(
369
+ Box,
370
+ {
371
+ sx: {
372
+ display: "flex",
373
+ flexDirection: "column-reverse",
374
+ gap: size === "small" ? 0.25 : 1,
375
+ alignItems: "center"
376
+ }
377
+ },
378
+ /* @__PURE__ */ React.createElement(
379
+ "input",
380
+ {
381
+ disabled: readOnly || !!data && readOnly,
382
+ ref: inputRefs.input4,
383
+ type: "text",
384
+ maxLength: 2,
385
+ placeholder: "- -",
386
+ style: {
387
+ color: theme.palette.text.primary,
388
+ width: "24px",
389
+ textAlign: "center",
390
+ backgroundColor: "transparent",
391
+ outline: "none",
392
+ cursor: readOnly || !!data && readOnly ? "" : "text"
393
+ },
394
+ value: convertToPersianDigits(inputValues.input4),
395
+ onChange: (e) => handleInputChange(e.target.value, "input4", 2)
396
+ }
397
+ ),
398
+ /* @__PURE__ */ React.createElement(
399
+ Image,
400
+ {
401
+ src: "/assets/images/iran.svg",
402
+ alt: "Iran",
403
+ width: size === "small" ? 25 : 30,
404
+ height: size === "small" ? 21 : 26
405
+ }
406
+ )
407
+ )
408
+ )
409
+ ));
410
+ }
411
+
412
+ // src/auto-complete/selector/custome-style.tsx
413
+ import { Box as Box2 } from "@mui/material";
414
+ import { FaCar } from "react-icons/fa";
415
+ function CustomeStyle({
416
+ props,
417
+ option,
418
+ multipleitems
419
+ }) {
420
+ let methodColor = "black";
421
+ let boldOption = multipleitems ? "bold" : "normal";
422
+ if (option.httpMethod === "GET") {
423
+ methodColor = "#4990e2";
424
+ } else if (option.httpMethod === "POST") {
425
+ methodColor = "green";
426
+ } else if (option.httpMethod === "DELETE") {
427
+ methodColor = "red";
428
+ } else if (option.httpMethod === "PUT") {
429
+ methodColor = "orange";
430
+ }
431
+ if (option.httpMethod || option.url) {
432
+ return /* @__PURE__ */ React2.createElement("li", { ...props, key: option.key }, /* @__PURE__ */ React2.createElement(
433
+ "div",
434
+ {
435
+ style: {
436
+ display: "flex",
437
+ alignItems: "center",
438
+ flexDirection: "row",
439
+ width: "100%"
440
+ }
441
+ },
442
+ /* @__PURE__ */ React2.createElement(
443
+ "div",
444
+ {
445
+ style: {
446
+ display: "flex",
447
+ flexDirection: "column",
448
+ justifyContent: "space-between",
449
+ width: "100%"
450
+ }
451
+ },
452
+ /* @__PURE__ */ React2.createElement("div", { style: { fontWeight: boldOption } }, option.title),
453
+ /* @__PURE__ */ React2.createElement("span", { style: { fontSize: "small", color: "gray" } }, option.url)
454
+ ),
455
+ /* @__PURE__ */ React2.createElement("div", { style: { fontWeight: "normal", color: methodColor } }, option.httpMethod)
456
+ ));
457
+ } else if (option.licensePlate) {
458
+ return /* @__PURE__ */ React2.createElement("li", { ...props, key: option.key }, /* @__PURE__ */ React2.createElement(
459
+ "div",
460
+ {
461
+ style: {
462
+ display: "flex",
463
+ alignItems: "center",
464
+ flexDirection: "row",
465
+ width: "100%",
466
+ flexWrap: "wrap"
467
+ }
468
+ },
469
+ /* @__PURE__ */ React2.createElement(FaCar, null),
470
+ /* @__PURE__ */ React2.createElement(Box2, { sx: { marginLeft: "7px" } }, option.title),
471
+ /* @__PURE__ */ React2.createElement(
472
+ "div",
473
+ {
474
+ style: {
475
+ marginTop: 1,
476
+ display: "flex",
477
+ flexDirection: "column",
478
+ justifyContent: "space-between",
479
+ width: "100%"
480
+ }
481
+ },
482
+ /* @__PURE__ */ React2.createElement(LicensePlate, { data: option.licensePlate })
483
+ )
484
+ ));
485
+ } else {
486
+ return /* @__PURE__ */ React2.createElement("li", { ...props, key: option.key }, /* @__PURE__ */ React2.createElement(
487
+ "div",
488
+ {
489
+ style: {
490
+ display: "flex",
491
+ alignItems: "center",
492
+ flexDirection: "row",
493
+ width: "100%"
494
+ }
495
+ },
496
+ /* @__PURE__ */ React2.createElement(
497
+ "div",
498
+ {
499
+ style: {
500
+ display: "flex",
501
+ flexDirection: "column",
502
+ justifyContent: "space-between",
503
+ width: "100%"
504
+ }
505
+ },
506
+ /* @__PURE__ */ React2.createElement("div", { style: { fontWeight: boldOption } }, option.title)
507
+ )
508
+ ));
509
+ }
510
+ }
511
+
512
+ // src/auto-complete/selector/index.tsx
513
+ function MultipleSelectChip({
514
+ name,
515
+ control,
516
+ label,
517
+ data,
518
+ multipleitems,
519
+ //قابلیت انتخاب چند گزینه ای
520
+ isLoading,
521
+ disabled = false,
522
+ size = "medium",
523
+ clear = false
524
+ }) {
525
+ const dataOptions = data?.map((value) => ({
526
+ title: value.userName || value.name || `${value.firstName} ${value.lastName}`,
527
+ key: value.id || `key_${Math.random()}`,
528
+ // Assuming each item has an 'id'
529
+ httpMethod: numberToHttpMethodMapping[value.httpMethod],
530
+ url: value.url,
531
+ licensePlate: value.licensePlate
532
+ })) || [];
533
+ const combinedOptions = [
534
+ multipleitems && dataOptions.length > 0 && { title: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0647\u0645\u0647", key: "All" },
535
+ ...dataOptions
536
+ ].filter(Boolean);
537
+ const [selectedValues, setSelectedValues] = React3.useState([]);
538
+ const handleChange = (event, value, onChange) => {
539
+ console.log(value);
540
+ if (multipleitems) {
541
+ if (value.some((item) => item.title === "\u0627\u0646\u062A\u062E\u0627\u0628 \u0647\u0645\u0647")) {
542
+ const allItems = [...dataOptions];
543
+ setSelectedValues(allItems);
544
+ onChange(allItems.map((item) => item.key));
545
+ } else {
546
+ setSelectedValues(value);
547
+ onChange(value.map((item) => item.key));
548
+ }
549
+ } else {
550
+ setSelectedValues([value]);
551
+ onChange(value?.key || null);
552
+ }
553
+ };
554
+ function search(option, value) {
555
+ if (option.title.includes(value.title)) {
556
+ return true;
557
+ }
558
+ if (value.title.includes(option.title)) {
559
+ return true;
560
+ }
561
+ return false;
562
+ }
563
+ const CustomStyledValue = ({ children }) => /* @__PURE__ */ React3.createElement("span", { style: { color: "green", fontStyle: "italic" } }, children);
564
+ return /* @__PURE__ */ React3.createElement(
565
+ Controller,
566
+ {
567
+ name,
568
+ control,
569
+ render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ React3.createElement(
570
+ Autocomplete,
571
+ {
572
+ disableClearable: clear,
573
+ disabled: disabled || isLoading,
574
+ disablePortal: true,
575
+ size,
576
+ disableCloseOnSelect: multipleitems,
577
+ options: combinedOptions,
578
+ multiple: multipleitems,
579
+ sx: {
580
+ width: "100%"
581
+ },
582
+ noOptionsText: "\u062F\u0627\u062F\u0647 \u0627\u06CC \u0628\u0631\u0627\u06CC \u0646\u0645\u0627\u06CC\u0634 \u0648\u062C\u0648\u062F \u0646\u062F\u0627\u0631\u062F",
583
+ value: multipleitems ? selectedValues : combinedOptions.find(
584
+ (option) => String(option.key) === String(value)
585
+ ) || { title: "", key: "" },
586
+ onChange: (event, value2) => {
587
+ handleChange(event, value2, onChange);
588
+ },
589
+ isOptionEqualToValue: (option, value2) => String(option.key) === String(value2?.key),
590
+ getOptionLabel: (option) => option.title,
591
+ loading: isLoading,
592
+ loadingText: "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...",
593
+ renderOption: (props, option) => {
594
+ return /* @__PURE__ */ React3.createElement(
595
+ CustomeStyle,
596
+ {
597
+ props,
598
+ option,
599
+ multipleitems: !!multipleitems
600
+ }
601
+ );
602
+ },
603
+ slots: { popper: Popper },
604
+ slotProps: {
605
+ popper: {
606
+ modifiers: [
607
+ {
608
+ name: "preventOverflow",
609
+ options: {
610
+ boundary: "window",
611
+ rootBoundary: "viewport",
612
+ altBoundary: true,
613
+ padding: 10
614
+ }
615
+ },
616
+ {
617
+ name: "flip",
618
+ options: {
619
+ fallbackPlacements: ["top", "bottom"]
620
+ // Ensures it flips to the top if needed
621
+ }
622
+ }
623
+ ]
624
+ }
625
+ },
626
+ renderInput: (params) => /* @__PURE__ */ React3.createElement(
627
+ TextField,
628
+ {
629
+ ...params,
630
+ label,
631
+ error: !!error,
632
+ helperText: error?.message,
633
+ inputRef: ref,
634
+ InputProps: {
635
+ ...params.InputProps,
636
+ startAdornment: /* @__PURE__ */ React3.createElement(
637
+ "div",
638
+ {
639
+ style: {
640
+ display: "flex",
641
+ flexWrap: "wrap",
642
+ maxHeight: "250px",
643
+ // Set the maximum height for the chip container
644
+ overflowY: "auto",
645
+ // Enable vertical scroll
646
+ padding: 0
647
+ // Remove any padding to ensure chips stay inside the container
648
+ }
649
+ },
650
+ /* @__PURE__ */ React3.createElement(React3.Fragment, null, isLoading ? /* @__PURE__ */ React3.createElement(Typography2, { sx: { marginRight: 1 } }, "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...") : null, params.InputProps.startAdornment)
651
+ )
652
+ }
653
+ }
654
+ )
655
+ }
656
+ )
657
+ }
658
+ );
659
+ }
660
+
661
+ // src/button/search/index.tsx
662
+ import { Box as Box3, Button as Button2, Stack, styled, useTheme as useTheme2 } from "@mui/material";
663
+ import React4 from "react";
664
+ import { IoIosArrowUp } from "react-icons/io";
665
+ var AnimatedIcon = styled(IoIosArrowUp, {
666
+ shouldForwardProp: (prop) => prop !== "isShowFilter"
667
+ // Don't pass isShowFilter to the underlying component
668
+ })(({ isShowFilter }) => ({
669
+ transition: "all 0.5s ease",
670
+ transform: `rotate(${isShowFilter ? 0 : "0.5turn"})`
671
+ }));
672
+ function AdvancedSearchButton({
673
+ isShowFilter,
674
+ setIsShowFilter,
675
+ color = "black",
676
+ title = "\u0641\u0631\u0645 \u062C\u0633\u062A\u062C\u0648",
677
+ optional,
678
+ icon,
679
+ borderRadius,
680
+ paddingY,
681
+ fontSize
682
+ }) {
683
+ const theme = useTheme2();
684
+ return /* @__PURE__ */ React4.createElement(
685
+ Button2,
686
+ {
687
+ onClick: () => {
688
+ setIsShowFilter((prev) => !prev);
689
+ optional && optional(false);
690
+ },
691
+ startIcon: /* @__PURE__ */ React4.createElement(AnimatedIcon, { isShowFilter }),
692
+ sx: {
693
+ color: theme.palette.text.primary ?? color,
694
+ borderRadius,
695
+ paddingY,
696
+ fontSize
697
+ },
698
+ fullWidth: true
699
+ },
700
+ /* @__PURE__ */ React4.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React4.createElement(Box3, null, icon ? icon : null), /* @__PURE__ */ React4.createElement(Box3, null, title))
701
+ );
702
+ }
703
+
704
+ // src/card-skeleton/index.tsx
705
+ import React5 from "react";
706
+ import { Box as Box4, Card, CardContent, Skeleton, Stack as Stack2 } from "@mui/material";
707
+ function SkeletonCard() {
708
+ return /* @__PURE__ */ React5.createElement(
709
+ Card,
710
+ {
711
+ sx: {
712
+ minWidth: 300,
713
+ borderRadius: "12px"
714
+ }
715
+ },
716
+ /* @__PURE__ */ React5.createElement(CardContent, { sx: { padding: "1rem 1rem !important" } }, /* @__PURE__ */ React5.createElement(Stack2, { spacing: 2 }, /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React5.createElement(Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ React5.createElement(Skeleton, { variant: "text", width: 100, height: 20 })), /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React5.createElement(Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ React5.createElement(Skeleton, { variant: "text", width: 100, height: 20 }))), /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React5.createElement(Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ React5.createElement(Skeleton, { variant: "text", width: 100, height: 20 })), /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React5.createElement(Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ React5.createElement(Skeleton, { variant: "text", width: 80, height: 20 }))), /* @__PURE__ */ React5.createElement(
717
+ Stack2,
718
+ {
719
+ direction: "row",
720
+ spacing: 2,
721
+ alignItems: "center",
722
+ justifyContent: "space-between"
723
+ },
724
+ /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React5.createElement(Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ React5.createElement(Skeleton, { variant: "text", width: 80, height: 20 })),
725
+ /* @__PURE__ */ React5.createElement(Stack2, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ React5.createElement(Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ React5.createElement(Skeleton, { variant: "text", width: 80, height: 20 }))
726
+ ), /* @__PURE__ */ React5.createElement(
727
+ Box4,
728
+ {
729
+ sx: {
730
+ display: "flex",
731
+ justifyContent: "center",
732
+ paddingY: "0.5rem"
733
+ }
734
+ },
735
+ /* @__PURE__ */ React5.createElement(Skeleton, { variant: "rectangular", width: 240, height: 40 })
736
+ ), /* @__PURE__ */ React5.createElement(
737
+ Box4,
738
+ {
739
+ sx: {
740
+ display: "flex",
741
+ justifyContent: "center",
742
+ paddingTop: "1.5rem"
743
+ }
744
+ },
745
+ /* @__PURE__ */ React5.createElement(Skeleton, { variant: "rectangular", width: 200, height: 40 })
746
+ )))
747
+ );
748
+ }
749
+ var card_skeleton_default = SkeletonCard;
750
+
751
+ // src/checkbox/index.tsx
752
+ import { Controller as Controller2 } from "react-hook-form";
753
+ import { FormControlLabel, Checkbox } from "@mui/material";
754
+ import React6 from "react";
755
+ function CustomCheckbox({ name, control, label }) {
756
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
757
+ Controller2,
758
+ {
759
+ name,
760
+ control,
761
+ defaultValue: false,
762
+ render: ({ field }) => /* @__PURE__ */ React6.createElement(
763
+ FormControlLabel,
764
+ {
765
+ control: /* @__PURE__ */ React6.createElement(
766
+ Checkbox,
767
+ {
768
+ ...field,
769
+ checked: field.value
770
+ }
771
+ ),
772
+ label
773
+ }
774
+ )
775
+ }
776
+ ));
777
+ }
778
+
779
+ // src/confirmation-modal/index.tsx
780
+ import * as React7 from "react";
781
+ import Dialog2 from "@mui/material/Dialog";
782
+ import DialogActions from "@mui/material/DialogActions";
783
+ import DialogContent2 from "@mui/material/DialogContent";
784
+ import DialogTitle2 from "@mui/material/DialogTitle";
785
+ import { Box as Box5, Button as Button3, Divider, IconButton as IconButton2 } from "@mui/material";
786
+ import { AiOutlineDeliveredProcedure } from "react-icons/ai";
787
+ import { MdClose, MdOutlineCancel } from "react-icons/md";
788
+ import Link from "next/link";
789
+ function ConfirmationDialog({
790
+ open,
791
+ handleClose,
792
+ callback,
793
+ callbackParams,
794
+ headerText,
795
+ bodyText
796
+ }) {
797
+ return /* @__PURE__ */ React7.createElement(Dialog2, { open, onClose: handleClose, fullWidth: true, maxWidth: "sm" }, /* @__PURE__ */ React7.createElement(Box5, null, /* @__PURE__ */ React7.createElement(
798
+ DialogTitle2,
799
+ {
800
+ fontWeight: 700,
801
+ fontSize: "1.2rem",
802
+ display: "flex",
803
+ alignItems: "center",
804
+ gap: "4px"
805
+ },
806
+ /* @__PURE__ */ React7.createElement(AiOutlineDeliveredProcedure, { style: { color: "inherit" }, size: 22 }),
807
+ headerText
808
+ ), /* @__PURE__ */ React7.createElement(
809
+ IconButton2,
810
+ {
811
+ "aria-label": "close",
812
+ onClick: handleClose,
813
+ sx: {
814
+ position: "absolute",
815
+ right: 8,
816
+ top: 8,
817
+ color: (theme) => theme.palette.grey[500]
818
+ }
819
+ },
820
+ /* @__PURE__ */ React7.createElement(MdClose, null)
821
+ ), /* @__PURE__ */ React7.createElement(Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React7.createElement(DialogContent2, null, bodyText), /* @__PURE__ */ React7.createElement(
822
+ DialogActions,
823
+ {
824
+ sx: {
825
+ display: "flex",
826
+ justifyContent: "flex-end",
827
+ width: "100%",
828
+ gap: "12px",
829
+ alignItems: "center",
830
+ padding: "2rem"
831
+ }
832
+ },
833
+ /* @__PURE__ */ React7.createElement(Link, { href: "/module/transportation/workflow/confirm-deliver" }, /* @__PURE__ */ React7.createElement(
834
+ Button3,
835
+ {
836
+ onClick: () => {
837
+ callback(callbackParams);
838
+ handleClose();
839
+ },
840
+ variant: "contained",
841
+ color: "primary",
842
+ startIcon: /* @__PURE__ */ React7.createElement(AiOutlineDeliveredProcedure, { size: 16 }),
843
+ sx: { minWidth: "120px" }
844
+ },
845
+ "\u062A\u0623\u06CC\u06CC\u062F"
846
+ )),
847
+ /* @__PURE__ */ React7.createElement(
848
+ Button3,
849
+ {
850
+ onClick: handleClose,
851
+ variant: "outlined",
852
+ color: "inherit",
853
+ startIcon: /* @__PURE__ */ React7.createElement(MdOutlineCancel, null),
854
+ sx: { minWidth: "120px" }
855
+ },
856
+ "\u0627\u0646\u0635\u0631\u0627\u0641"
857
+ )
858
+ )));
859
+ }
860
+
861
+ // src/custom-time-picker/index.tsx
862
+ import {
863
+ Box as Box6,
864
+ Button as Button4,
865
+ Divider as Divider2,
866
+ IconButton as IconButton3,
867
+ Typography as Typography3,
868
+ TextField as TextField2,
869
+ InputAdornment,
870
+ useTheme as useTheme3
871
+ } from "@mui/material";
872
+ import Dialog3 from "@mui/material/Dialog";
873
+ import DialogActions2 from "@mui/material/DialogActions";
874
+ import DialogContent3 from "@mui/material/DialogContent";
875
+ import DialogTitle3 from "@mui/material/DialogTitle";
876
+ import { useState as useState3, useEffect as useEffect2, useRef as useRef2 } from "react";
877
+ import { MdClose as MdClose2 } from "react-icons/md";
878
+ import Tooltip from "@mui/material/Tooltip";
879
+ import { Controller as Controller3 } from "react-hook-form";
880
+ import { Clock } from "@mamrp/icons/common";
881
+ function CustomTimePicker({
882
+ name,
883
+ control,
884
+ label,
885
+ size = "small",
886
+ fullwidth = false,
887
+ autoRefresh = false,
888
+ disabled = false
889
+ }) {
890
+ return /* @__PURE__ */ React.createElement(
891
+ Controller3,
892
+ {
893
+ name,
894
+ control,
895
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ React.createElement(
896
+ TimePickerComponent,
897
+ {
898
+ ...field,
899
+ label,
900
+ size,
901
+ error,
902
+ fullwidth,
903
+ autoRefresh,
904
+ disabled
905
+ }
906
+ )
907
+ }
908
+ );
909
+ }
910
+ var TimePickerComponent = ({
911
+ value,
912
+ onChange,
913
+ onBlur,
914
+ label,
915
+ size = "small",
916
+ error,
917
+ fullwidth,
918
+ autoRefresh,
919
+ disabled = false
920
+ }) => {
921
+ const theme = useTheme3();
922
+ const initialHour = value ? parseInt(value.split(":")[0]) : null;
923
+ const initialMinute = value ? parseInt(value.split(":")[1]) : null;
924
+ const [isModalOpen, setIsModalOpen] = useState3(false);
925
+ const [selectedHour, setSelectedHour] = useState3(initialHour);
926
+ const [selectedMinute, setSelectedMinute] = useState3(
927
+ initialMinute
928
+ );
929
+ const hourRefs = useRef2([]);
930
+ const minuteRefs = useRef2([]);
931
+ const hours = Array.from({ length: 24 }, (_, i) => i);
932
+ const minutes = Array.from({ length: 60 }, (_, i) => i);
933
+ useEffect2(() => {
934
+ if (isModalOpen) {
935
+ setTimeout(() => {
936
+ if (selectedHour !== null) {
937
+ hourRefs.current[selectedHour]?.scrollIntoView({
938
+ behavior: "smooth",
939
+ block: "center"
940
+ });
941
+ }
942
+ if (selectedMinute !== null) {
943
+ minuteRefs.current[selectedMinute]?.scrollIntoView({
944
+ behavior: "smooth",
945
+ block: "center"
946
+ });
947
+ }
948
+ }, 0);
949
+ }
950
+ }, [isModalOpen, selectedHour, selectedMinute]);
951
+ useEffect2(() => {
952
+ const updatedHour = value ? parseInt(value.split(":")[0]) : null;
953
+ setSelectedHour(updatedHour);
954
+ const updatedMinute = value ? parseInt(value.split(":")[1]) : null;
955
+ setSelectedMinute(updatedMinute);
956
+ }, [value, autoRefresh]);
957
+ const handleSelectHour = (hour) => {
958
+ setSelectedHour(hour);
959
+ if (selectedMinute !== null) {
960
+ onChange(formatTime(hour, selectedMinute));
961
+ }
962
+ };
963
+ const handleSelectMinute = (minute) => {
964
+ setSelectedMinute(minute);
965
+ if (selectedHour !== null) {
966
+ onChange(formatTime(selectedHour, minute));
967
+ }
968
+ };
969
+ const formatTime = (hour, minute) => {
970
+ return `${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}`;
971
+ };
972
+ const handleInputChange = (e) => {
973
+ let inputValue = e.target.value;
974
+ if (!/^\d{0,2}:\d{0,2}$/.test(inputValue)) {
975
+ return;
976
+ }
977
+ const [hourPart = "", minutePart = ""] = inputValue.split(":");
978
+ if (parseInt(hourPart) > 23) {
979
+ inputValue = `23:${minutePart}`;
980
+ }
981
+ if (parseInt(minutePart) > 59) {
982
+ inputValue = `${hourPart}:59`;
983
+ }
984
+ if (hourPart.length === 2 && !inputValue.includes(":")) {
985
+ inputValue = hourPart + ":";
986
+ }
987
+ onChange(inputValue);
988
+ };
989
+ const handleBlur = () => {
990
+ if (!value || value === ":") {
991
+ onChange("00:00");
992
+ return;
993
+ }
994
+ const [hourPart = "0", minutePart = "0"] = value.split(":");
995
+ const hour = Math.min(23, parseInt(hourPart) || 0);
996
+ const minute = Math.min(59, parseInt(minutePart) || 0);
997
+ const formattedTime = formatTime(hour, minute);
998
+ onChange(formattedTime);
999
+ };
1000
+ return /* @__PURE__ */ React.createElement(Box6, { display: "flex", alignItems: "center", gap: 0.5, sx: { width: "100%" } }, /* @__PURE__ */ React.createElement(
1001
+ TextField2,
1002
+ {
1003
+ disabled,
1004
+ label,
1005
+ value,
1006
+ onChange: handleInputChange,
1007
+ onBlur: handleBlur,
1008
+ InputLabelProps: { shrink: true },
1009
+ variant: "outlined",
1010
+ size,
1011
+ inputProps: {
1012
+ maxLength: 5,
1013
+ // Ensures the format is always "HH:MM"
1014
+ style: { textAlign: "center" }
1015
+ },
1016
+ InputProps: {
1017
+ ...!disabled && {
1018
+ endAdornment: /* @__PURE__ */ React.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(Tooltip, { title: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646" }, /* @__PURE__ */ React.createElement(IconButton3, { onClick: () => setIsModalOpen(true) }, /* @__PURE__ */ React.createElement(Clock, { size: 22, color: theme.palette.text.primary }))))
1019
+ }
1020
+ },
1021
+ sx: { width: fullwidth ? "100%" : "8rem" },
1022
+ fullWidth: true
1023
+ }
1024
+ ), /* @__PURE__ */ React.createElement(
1025
+ Dialog3,
1026
+ {
1027
+ open: isModalOpen,
1028
+ onClose: () => setIsModalOpen(false),
1029
+ fullWidth: true,
1030
+ maxWidth: "xs"
1031
+ },
1032
+ /* @__PURE__ */ React.createElement(
1033
+ DialogTitle3,
1034
+ {
1035
+ fontWeight: 700,
1036
+ fontSize: "1.2rem",
1037
+ display: "flex",
1038
+ alignItems: "center",
1039
+ gap: "4px"
1040
+ },
1041
+ "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646"
1042
+ ),
1043
+ /* @__PURE__ */ React.createElement(
1044
+ IconButton3,
1045
+ {
1046
+ "aria-label": "close",
1047
+ onClick: () => setIsModalOpen(false),
1048
+ sx: {
1049
+ position: "absolute",
1050
+ right: 8,
1051
+ top: 8,
1052
+ color: (theme2) => theme2.palette.grey[500]
1053
+ }
1054
+ },
1055
+ /* @__PURE__ */ React.createElement(MdClose2, null)
1056
+ ),
1057
+ /* @__PURE__ */ React.createElement(Divider2, { sx: { my: "10px" } }),
1058
+ /* @__PURE__ */ React.createElement(DialogContent3, null, /* @__PURE__ */ React.createElement(Box6, { display: "flex", justifyContent: "space-between", gap: "20px" }, /* @__PURE__ */ React.createElement(Box6, { flex: 1 }, /* @__PURE__ */ React.createElement(Typography3, { variant: "h6", textAlign: "center", gutterBottom: true }, "\u062F\u0642\u06CC\u0642\u0647"), /* @__PURE__ */ React.createElement(
1059
+ Box6,
1060
+ {
1061
+ maxHeight: "200px",
1062
+ overflow: "auto",
1063
+ border: "1px solid lightgray",
1064
+ borderRadius: "8px"
1065
+ },
1066
+ minutes.map((minute) => /* @__PURE__ */ React.createElement(
1067
+ Box6,
1068
+ {
1069
+ key: minute,
1070
+ ref: (el) => {
1071
+ minuteRefs.current[minute] = el;
1072
+ },
1073
+ p: "10px",
1074
+ textAlign: "center",
1075
+ bgcolor: minute === selectedMinute ? "primary.light" : "inherit",
1076
+ color: minute === selectedMinute ? "white" : "inherit",
1077
+ sx: { cursor: "pointer" },
1078
+ onClick: () => handleSelectMinute(minute)
1079
+ },
1080
+ /* @__PURE__ */ React.createElement(Typography3, null, minute.toString().padStart(2, "0"))
1081
+ ))
1082
+ )), /* @__PURE__ */ React.createElement(Box6, { flex: 1 }, /* @__PURE__ */ React.createElement(Typography3, { variant: "h6", textAlign: "center", gutterBottom: true }, "\u0633\u0627\u0639\u062A"), /* @__PURE__ */ React.createElement(
1083
+ Box6,
1084
+ {
1085
+ maxHeight: "200px",
1086
+ overflow: "auto",
1087
+ border: "1px solid lightgray",
1088
+ borderRadius: "8px"
1089
+ },
1090
+ hours.map((hour) => /* @__PURE__ */ React.createElement(
1091
+ Box6,
1092
+ {
1093
+ key: hour,
1094
+ ref: (el) => {
1095
+ hourRefs.current[hour] = el;
1096
+ },
1097
+ p: "10px",
1098
+ textAlign: "center",
1099
+ bgcolor: hour === selectedHour ? "primary.light" : "inherit",
1100
+ color: hour === selectedHour ? "white" : "inherit",
1101
+ sx: { cursor: "pointer" },
1102
+ onClick: () => handleSelectHour(hour)
1103
+ },
1104
+ /* @__PURE__ */ React.createElement(Typography3, null, hour.toString().padStart(2, "0"))
1105
+ ))
1106
+ )))),
1107
+ /* @__PURE__ */ React.createElement(DialogActions2, { sx: { padding: 2 } }, /* @__PURE__ */ React.createElement(
1108
+ Button4,
1109
+ {
1110
+ onClick: () => setIsModalOpen(false),
1111
+ sx: { fontSize: "1.1rem" }
1112
+ },
1113
+ "\u0627\u0646\u062A\u062E\u0627\u0628"
1114
+ ))
1115
+ ));
1116
+ };
1117
+
1118
+ // src/date-filter-range/index.tsx
1119
+ import { yupResolver } from "@hookform/resolvers/yup";
1120
+ import Button5 from "@mui/material/Button";
1121
+ import Grid from "@mui/material/Grid2";
1122
+ import { GlobalStyles, useMediaQuery } from "@mui/system";
1123
+ import moment2 from "moment";
1124
+ import { useEffect as useEffect3 } from "react";
1125
+ import { useForm } from "react-hook-form";
1126
+ import { FaChevronLeft, FaChevronRight } from "react-icons/fa";
1127
+ import * as yup from "yup";
1128
+
1129
+ // src/date-picker/index.tsx
1130
+ import { Box as Box7, Typography as Typography4 } from "@mui/material";
1131
+ import CircularProgress from "@mui/material/CircularProgress";
1132
+ import { DatePicker, LocalizationProvider } from "@mui/x-date-pickers";
1133
+ import { AdapterMomentJalaali } from "@mui/x-date-pickers/AdapterMomentJalaali";
1134
+ import dayjs from "dayjs";
1135
+ import moment from "moment-jalaali";
1136
+ import "moment/locale/fa";
1137
+ import React8, { useState as useState4 } from "react";
1138
+ import { Controller as Controller4 } from "react-hook-form";
1139
+ moment.locale("fa");
1140
+ moment.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1141
+ var JalaliDatePicker = ({
1142
+ name,
1143
+ control,
1144
+ label,
1145
+ size = "medium",
1146
+ disabled = false,
1147
+ persian = false,
1148
+ align = "left",
1149
+ isLoading,
1150
+ maxDate,
1151
+ minDate,
1152
+ clear = true
1153
+ }) => {
1154
+ const today = moment();
1155
+ const [open, setOpen] = useState4(false);
1156
+ const customLocaleText = {
1157
+ cancelButtonLabel: "\u0644\u063A\u0648",
1158
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
1159
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
1160
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646",
1161
+ start: "\u0634\u0631\u0648\u0639",
1162
+ end: "\u067E\u0627\u06CC\u0627\u0646",
1163
+ previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
1164
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
1165
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
1166
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
1167
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1168
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1169
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1170
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1171
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
1172
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
1173
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
1174
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
1175
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
1176
+ calendarWeekNumberHeaderText: "#",
1177
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
1178
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
1179
+ };
1180
+ return /* @__PURE__ */ React8.createElement(
1181
+ LocalizationProvider,
1182
+ {
1183
+ dateAdapter: AdapterMomentJalaali,
1184
+ localeText: customLocaleText
1185
+ },
1186
+ /* @__PURE__ */ React8.createElement(
1187
+ Controller4,
1188
+ {
1189
+ name,
1190
+ control,
1191
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ React8.createElement(Box7, { sx: { width: "100%" } }, /* @__PURE__ */ React8.createElement(
1192
+ DatePicker,
1193
+ {
1194
+ disabled: isLoading || disabled,
1195
+ closeOnSelect: false,
1196
+ openTo: "day",
1197
+ views: ["year", "month", "day"],
1198
+ label,
1199
+ value: field.value ? moment(field.value) : null,
1200
+ slotProps: {
1201
+ ...clear && !disabled ? { field: { clearable: true } } : {},
1202
+ popper: {
1203
+ modifiers: [
1204
+ {
1205
+ name: "preventOverflow",
1206
+ options: {
1207
+ boundary: "window"
1208
+ }
1209
+ },
1210
+ {
1211
+ name: "flip",
1212
+ options: {
1213
+ fallbackPlacements: ["right", "left", "top"]
1214
+ }
1215
+ }
1216
+ ]
1217
+ },
1218
+ textField: {
1219
+ size,
1220
+ placeholder: field.value ? "" : "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ",
1221
+ InputLabelProps: {
1222
+ shrink: true,
1223
+ style: { color: error ? "#D32F2F" : "inherit" }
1224
+ },
1225
+ InputProps: {
1226
+ ...isLoading && { endAdornment: /* @__PURE__ */ React8.createElement(CircularProgress, { color: "secondary", size: 20 }) } || disabled && { endAdornment: false },
1227
+ ...field.value && {
1228
+ value: persian ? `${moment(field.value).format("dddd - jDD/jMMMM/jYYYY")}` : `${moment(field.value).format("jYYYY/jMM/jDD")}`
1229
+ },
1230
+ sx: {
1231
+ textAlign: align,
1232
+ "& input": {
1233
+ textAlign: align,
1234
+ direction: "rtl"
1235
+ }
1236
+ }
1237
+ }
1238
+ },
1239
+ actionBar: {
1240
+ actions: ["cancel", "accept"]
1241
+ // نمایش دکمه‌های تأیید، لغو و پاک کردن
1242
+ }
1243
+ },
1244
+ onChange: (value) => {
1245
+ if (value == null) {
1246
+ field.onChange(null);
1247
+ }
1248
+ },
1249
+ onAccept: (newValue) => {
1250
+ if (newValue) {
1251
+ const currentDate = dayjs(newValue);
1252
+ const nowUTC3 = /* @__PURE__ */ new Date();
1253
+ let iranHour = nowUTC3.getUTCHours();
1254
+ let iranMinute = nowUTC3.getUTCMinutes();
1255
+ const dateTimeWithIranTime4 = currentDate.hour(iranHour).minute(iranMinute).second(nowUTC3.getUTCSeconds());
1256
+ console.log(
1257
+ currentDate.format("YYYY-MM-DDTHH:mm:ss"),
1258
+ dateTimeWithIranTime4.format("YYYY-MM-DDTHH:mm:ss")
1259
+ );
1260
+ field.onChange(
1261
+ dateTimeWithIranTime4.format("YYYY-MM-DDTHH:mm:ss")
1262
+ );
1263
+ } else {
1264
+ field.onChange(null);
1265
+ }
1266
+ },
1267
+ sx: {
1268
+ width: "100%",
1269
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
1270
+ "& .MuiOutlinedInput-notchedOutline": {
1271
+ borderColor: error ? "#D32F2F" : "#C4C4C4"
1272
+ },
1273
+ "& .MuiInputBase-root": {
1274
+ height: size === "small" ? 40 : 56
1275
+ }
1276
+ },
1277
+ slots: {
1278
+ ...!clear && {
1279
+ clearButton: React8.Fragment,
1280
+ clearIcon: React8.Fragment
1281
+ },
1282
+ toolbar: (props) => {
1283
+ const currentDate = moment(field.value);
1284
+ const formattedDate = currentDate.format("dddd, jDD jMMMM");
1285
+ return /* @__PURE__ */ React8.createElement(
1286
+ Box7,
1287
+ {
1288
+ sx: {
1289
+ my: 2,
1290
+ mx: 4
1291
+ }
1292
+ },
1293
+ /* @__PURE__ */ React8.createElement(Typography4, { variant: "overline", color: "primary" }, "\u062A\u0627\u0631\u06CC\u062E \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F"),
1294
+ /* @__PURE__ */ React8.createElement(Typography4, { variant: "h4" }, formattedDate == "Invalid date" ? "" : formattedDate)
1295
+ );
1296
+ },
1297
+ monthButton: (props) => {
1298
+ return /* @__PURE__ */ React8.createElement(
1299
+ "button",
1300
+ {
1301
+ className: `${props.className}`,
1302
+ style: {
1303
+ width: "80%",
1304
+ padding: "10px",
1305
+ marginBottom: "20px",
1306
+ border: "1px solid #ccc",
1307
+ borderRadius: "12px",
1308
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
1309
+ fontSize: "14px",
1310
+ cursor: props.disabled ? "default" : "pointer"
1311
+ },
1312
+ disabled: props.disabled,
1313
+ onFocus: props.onFocus,
1314
+ onBlur: props.onBlur,
1315
+ onClick: props.onClick,
1316
+ ref: props.ref
1317
+ },
1318
+ props["aria-label"],
1319
+ " "
1320
+ );
1321
+ }
1322
+ },
1323
+ minDate: minDate ? minDate : null,
1324
+ maxDate: maxDate ? maxDate : today
1325
+ }
1326
+ ), error && /* @__PURE__ */ React8.createElement(Typography4, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message))
1327
+ }
1328
+ )
1329
+ );
1330
+ };
1331
+ var date_picker_default = JalaliDatePicker;
1332
+
1333
+ // src/date-filter-range/index.tsx
1334
+ var nowUTC = moment2.utc();
1335
+ var dateTimeWithIranTime2 = nowUTC;
1336
+ var dateTimeWithIranTime = nowUTC;
1337
+ var RoleFormSchema = yup.object().shape({});
1338
+ var defaultValues = {
1339
+ time: dateTimeWithIranTime.toDate().toISOString(),
1340
+ // تبدیل به ISO بدون تغییر آفست
1341
+ time2: dateTimeWithIranTime2.toDate().toISOString()
1342
+ // تبدیل به ISO بدون تغییر آفست
1343
+ };
1344
+ function DateFilterRange({ FromDate, ToDate }) {
1345
+ const isMobile = useMediaQuery("(max-width:900px)");
1346
+ const isSmMobile = useMediaQuery("(max-width:600px)");
1347
+ const { control, watch, setValue } = useForm({
1348
+ defaultValues,
1349
+ mode: "onChange",
1350
+ resolver: yupResolver(RoleFormSchema)
1351
+ });
1352
+ useEffect3(() => {
1353
+ FromDate(nowUTC);
1354
+ ToDate(nowUTC);
1355
+ }, []);
1356
+ const currentDate = watch("time");
1357
+ const currentDate2 = watch("time2");
1358
+ useEffect3(() => {
1359
+ FromDate(currentDate);
1360
+ ToDate(currentDate2);
1361
+ }, [currentDate, currentDate2]);
1362
+ const handleDate = (direction, time) => {
1363
+ const currentDate3 = watch(time);
1364
+ const newDate = moment2(currentDate3);
1365
+ if (direction === "forward") {
1366
+ newDate.add(1, "day");
1367
+ } else if (direction === "backward") {
1368
+ newDate.subtract(1, "day");
1369
+ }
1370
+ setValue(time, newDate.toISOString());
1371
+ };
1372
+ const isNextDisabledTime = moment2(watch("time")).format("YYYY-MM-DD") == moment2(watch("time2")).format("YYYY-MM-DD");
1373
+ const isLastDisabledTime = moment2(watch("time")).format("YYYY-MM-DD") == moment2(watch("time2")).format("YYYY-MM-DD");
1374
+ const today = moment2().format("YYYY-MM-DD");
1375
+ const isNextDisabled = moment2(watch("time")).format("YYYY-MM-DD") >= today;
1376
+ const isNextDisabledTime2 = moment2(watch("time2")).format("YYYY-MM-DD") >= today;
1377
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(GlobalStyles, { styles: {
1378
+ //حذف مارجین های اضافی سمت راست و چپ
1379
+ ".MuiBox-root.muirtl-1crki0u": {
1380
+ marginLeft: 0,
1381
+ marginRight: 0
1382
+ }
1383
+ } }), /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2, justifyContent: "center", alignItems: "center", paddingTop: 3, width: "100%" }, /* @__PURE__ */ React.createElement(Grid, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(Grid, { size: 2, justifyContent: "start" }, /* @__PURE__ */ React.createElement(
1384
+ Button5,
1385
+ {
1386
+ sx: {
1387
+ display: "flex",
1388
+ width: "100%",
1389
+ justifyContent: "center",
1390
+ padding: 0
1391
+ },
1392
+ onClick: () => handleDate("forward", "time"),
1393
+ disabled: isNextDisabled || isNextDisabledTime
1394
+ },
1395
+ /* @__PURE__ */ React.createElement(FaChevronRight, { size: 30 })
1396
+ )), /* @__PURE__ */ React.createElement(Grid, { 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: moment2(watch("time2")), align: "center", persian: true, clear: false, size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React.createElement(Grid, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React.createElement(
1397
+ Button5,
1398
+ {
1399
+ sx: {
1400
+ display: "flex",
1401
+ width: "100%",
1402
+ justifyContent: "center",
1403
+ padding: 0
1404
+ },
1405
+ onClick: () => handleDate("backward", "time")
1406
+ },
1407
+ /* @__PURE__ */ React.createElement(FaChevronLeft, { size: 30 })
1408
+ ))), /* @__PURE__ */ React.createElement(Grid, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(Grid, { size: 2, justifyContent: "start" }, /* @__PURE__ */ React.createElement(
1409
+ Button5,
1410
+ {
1411
+ sx: {
1412
+ display: "flex",
1413
+ width: "100%",
1414
+ justifyContent: "center",
1415
+ padding: 0
1416
+ },
1417
+ onClick: () => handleDate("forward", "time2"),
1418
+ disabled: isNextDisabledTime2
1419
+ },
1420
+ /* @__PURE__ */ React.createElement(FaChevronRight, { size: 30 })
1421
+ )), /* @__PURE__ */ React.createElement(Grid, { 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: moment2(watch("time")), persian: true, align: "center", clear: false, size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React.createElement(Grid, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React.createElement(
1422
+ Button5,
1423
+ {
1424
+ sx: {
1425
+ display: "flex",
1426
+ width: "100%",
1427
+ justifyContent: "center",
1428
+ padding: 0
1429
+ },
1430
+ onClick: () => handleDate("backward", "time2"),
1431
+ disabled: isLastDisabledTime
1432
+ },
1433
+ /* @__PURE__ */ React.createElement(FaChevronLeft, { size: 30 })
1434
+ )))), /* @__PURE__ */ React.createElement(Grid, { container: true, size: 12 }, /* @__PURE__ */ React.createElement(Grid, { size: 12 })));
1435
+ }
1436
+
1437
+ // src/date-filter/index.tsx
1438
+ import { yupResolver as yupResolver2 } from "@hookform/resolvers/yup";
1439
+ import Button6 from "@mui/material/Button";
1440
+ import Grid2 from "@mui/material/Grid2";
1441
+ import { GlobalStyles as GlobalStyles2, useMediaQuery as useMediaQuery2 } from "@mui/system";
1442
+ import moment3 from "moment";
1443
+ import React9 from "react";
1444
+ import { useEffect as useEffect4 } from "react";
1445
+ import { useForm as useForm2 } from "react-hook-form";
1446
+ import { FaChevronLeft as FaChevronLeft2, FaChevronRight as FaChevronRight2 } from "react-icons/fa";
1447
+ import * as yup2 from "yup";
1448
+ var nowUTC2 = moment3.utc();
1449
+ var dateTimeWithIranTime3 = nowUTC2;
1450
+ var RoleFormSchema2 = yup2.object().shape({});
1451
+ var defaultValues2 = {
1452
+ time: dateTimeWithIranTime3.toDate().toISOString()
1453
+ // تبدیل به ISO بدون تغییر آفست
1454
+ };
1455
+ function DateFilter({ setHandler }) {
1456
+ const isMobile = useMediaQuery2("(max-width:900px)");
1457
+ const isSmMobile = useMediaQuery2("(max-width:600px)");
1458
+ const { control, watch, setValue } = useForm2({
1459
+ defaultValues: defaultValues2,
1460
+ mode: "onChange",
1461
+ resolver: yupResolver2(RoleFormSchema2)
1462
+ });
1463
+ useEffect4(() => {
1464
+ setHandler(moment3().toISOString());
1465
+ }, []);
1466
+ const currentDate = watch("time");
1467
+ useEffect4(() => {
1468
+ setHandler(currentDate);
1469
+ }, [currentDate]);
1470
+ const handleDate = (direction) => {
1471
+ const currentDate2 = watch("time");
1472
+ const newDate = moment3(currentDate2);
1473
+ if (direction === "forward") {
1474
+ newDate.add(1, "day");
1475
+ } else if (direction === "backward") {
1476
+ newDate.subtract(1, "day");
1477
+ }
1478
+ setValue("time", newDate.toISOString());
1479
+ };
1480
+ const today = moment3().format("YYYY-MM-DD");
1481
+ const isNextDisabled = moment3(watch("time")).format("YYYY-MM-DD") >= today;
1482
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(GlobalStyles2, { styles: {
1483
+ //حذف مارجین های اضافی سمت راست و چپ
1484
+ ".MuiBox-root.muirtl-1crki0u": {
1485
+ marginLeft: 0,
1486
+ marginRight: 0
1487
+ }
1488
+ } }), /* @__PURE__ */ React9.createElement(Grid2, { container: true, spacing: 2, justifyContent: "center", alignItems: "center", paddingTop: 3, width: "100%" }, /* @__PURE__ */ React9.createElement(Grid2, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React9.createElement(Grid2, { size: 2, justifyContent: "start" }, /* @__PURE__ */ React9.createElement(
1489
+ Button6,
1490
+ {
1491
+ sx: {
1492
+ display: "flex",
1493
+ width: "100%",
1494
+ justifyContent: "center",
1495
+ padding: 0
1496
+ },
1497
+ onClick: () => handleDate("forward"),
1498
+ disabled: isNextDisabled
1499
+ },
1500
+ /* @__PURE__ */ React9.createElement(FaChevronRight2, { size: 30 })
1501
+ )), /* @__PURE__ */ React9.createElement(Grid2, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ React9.createElement(date_picker_default, { name: "time", control, label: "", persian: true, clear: false, align: "center", size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React9.createElement(Grid2, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React9.createElement(
1502
+ Button6,
1503
+ {
1504
+ sx: {
1505
+ display: "flex",
1506
+ width: "100%",
1507
+ justifyContent: "center",
1508
+ padding: 0
1509
+ },
1510
+ onClick: () => handleDate("backward")
1511
+ },
1512
+ /* @__PURE__ */ React9.createElement(FaChevronLeft2, { size: 30 })
1513
+ )))), /* @__PURE__ */ React9.createElement(Grid2, { container: true, size: 12 }, /* @__PURE__ */ React9.createElement(Grid2, { size: 12 })));
1514
+ }
1515
+
1516
+ // src/date-time-picker/index.tsx
1517
+ import { Typography as Typography5 } from "@mui/material";
1518
+ import useMediaQuery3 from "@mui/material/useMediaQuery";
1519
+ import { Box as Box8 } from "@mui/system";
1520
+ import { DateTimePicker, LocalizationProvider as LocalizationProvider2 } from "@mui/x-date-pickers";
1521
+ import { AdapterMomentJalaali as AdapterMomentJalaali2 } from "@mui/x-date-pickers/AdapterMomentJalaali";
1522
+ import moment4 from "moment-jalaali";
1523
+ import React10, { useState as useState5 } from "react";
1524
+ import { Controller as Controller5 } from "react-hook-form";
1525
+ moment4.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1526
+ var JalaliDatePicker2 = ({
1527
+ size = "medium",
1528
+ name,
1529
+ control,
1530
+ label,
1531
+ isLoading,
1532
+ disabled,
1533
+ minDateTime,
1534
+ // Add the new optional prop
1535
+ centeredTime = false
1536
+ }) => {
1537
+ const today = moment4();
1538
+ const isMobile = useMediaQuery3("(max-width:700px)");
1539
+ const [open, setOpen] = useState5(false);
1540
+ const customLocaleText = {
1541
+ cancelButtonLabel: "\u0644\u063A\u0648",
1542
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
1543
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
1544
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646",
1545
+ start: "\u0634\u0631\u0648\u0639",
1546
+ end: "\u067E\u0627\u06CC\u0627\u0646",
1547
+ previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
1548
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
1549
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
1550
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
1551
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1552
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1553
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1554
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1555
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
1556
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
1557
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
1558
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
1559
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
1560
+ calendarWeekNumberHeaderText: "#",
1561
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
1562
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
1563
+ };
1564
+ return /* @__PURE__ */ React10.createElement(
1565
+ LocalizationProvider2,
1566
+ {
1567
+ dateAdapter: AdapterMomentJalaali2,
1568
+ localeText: customLocaleText
1569
+ },
1570
+ /* @__PURE__ */ React10.createElement(
1571
+ Controller5,
1572
+ {
1573
+ name,
1574
+ control,
1575
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ React10.createElement(Box8, { sx: { width: "100%" } }, /* @__PURE__ */ React10.createElement(
1576
+ DateTimePicker,
1577
+ {
1578
+ open,
1579
+ onClose: () => {
1580
+ setOpen(false);
1581
+ field.onBlur();
1582
+ },
1583
+ onOpen: () => setOpen(true),
1584
+ orientation: isMobile ? "portrait" : "landscape",
1585
+ disabled: isLoading || disabled,
1586
+ openTo: "day",
1587
+ views: ["year", "month", "day", "hours", "minutes"],
1588
+ label,
1589
+ value: field.value ? moment4.utc(field.value).utcOffset(210) : null,
1590
+ onChange: (newValue) => {
1591
+ if (newValue) {
1592
+ field.onChange(
1593
+ moment4(newValue).utc().locale("en").format("YYYY-MM-DDTHH:mm:ss[Z]")
1594
+ );
1595
+ } else {
1596
+ field.onChange(null);
1597
+ }
1598
+ },
1599
+ onAccept: () => {
1600
+ setOpen(false);
1601
+ field.onBlur();
1602
+ },
1603
+ onError: () => {
1604
+ setOpen(false);
1605
+ field.onBlur();
1606
+ },
1607
+ format: `jDD jMMMM jYYYY ${" "} - ${" "} HH:mm`,
1608
+ minDateTime,
1609
+ timeSteps: { minutes: 1 },
1610
+ slots: {
1611
+ toolbar: (props) => {
1612
+ const currentDate = moment4.utc(field.value || today).utcOffset(210);
1613
+ let formattedDay, formattedDate, formattedYear, formattedTime;
1614
+ if (field.value) {
1615
+ formattedDay = currentDate.format("dddd");
1616
+ formattedDate = currentDate.format("jDD jMMMM");
1617
+ formattedYear = currentDate.format("jYYYY");
1618
+ formattedTime = currentDate.format("HH:mm");
1619
+ } else {
1620
+ formattedDay = "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u0646\u062A\u062E\u0627\u0628 \u0646\u0634\u062F\u0647 \u0627\u0633\u062A", formattedDate = "", formattedYear = "", formattedTime = "";
1621
+ }
1622
+ return /* @__PURE__ */ React10.createElement(
1623
+ Box8,
1624
+ {
1625
+ sx: {
1626
+ padding: "16px",
1627
+ textAlign: "left",
1628
+ display: "flex",
1629
+ flexDirection: "row",
1630
+ justifyContent: "start",
1631
+ alignItems: "center",
1632
+ gap: 1
1633
+ }
1634
+ },
1635
+ /* @__PURE__ */ React10.createElement(
1636
+ Typography5,
1637
+ {
1638
+ fontSize: 16,
1639
+ variant: "overline",
1640
+ color: "primary"
1641
+ },
1642
+ `${formattedDay}\u060C`
1643
+ ),
1644
+ /* @__PURE__ */ React10.createElement(
1645
+ Typography5,
1646
+ {
1647
+ variant: "h4",
1648
+ fontSize: 26,
1649
+ style: { fontWeight: "bold" }
1650
+ },
1651
+ `${formattedDate}`
1652
+ ),
1653
+ /* @__PURE__ */ React10.createElement(
1654
+ Typography5,
1655
+ {
1656
+ fontSize: 16,
1657
+ variant: "body2",
1658
+ color: "textSecondary"
1659
+ },
1660
+ `${formattedYear}`
1661
+ ),
1662
+ field.value && /* @__PURE__ */ React10.createElement(Typography5, null, "-"),
1663
+ /* @__PURE__ */ React10.createElement(
1664
+ Typography5,
1665
+ {
1666
+ fontSize: 16,
1667
+ variant: "body2",
1668
+ color: "textSecondary",
1669
+ style: { fontWeight: "bold" }
1670
+ },
1671
+ `${formattedTime}`
1672
+ )
1673
+ );
1674
+ },
1675
+ monthButton: (props) => {
1676
+ return /* @__PURE__ */ React10.createElement(
1677
+ "button",
1678
+ {
1679
+ className: `${props.className}`,
1680
+ style: {
1681
+ width: "80%",
1682
+ padding: "10px",
1683
+ marginBottom: "20px",
1684
+ border: "1px solid #ccc",
1685
+ borderRadius: "12px",
1686
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
1687
+ fontSize: "14px",
1688
+ cursor: props.disabled ? "default" : "pointer"
1689
+ },
1690
+ disabled: props.disabled,
1691
+ onFocus: props.onFocus,
1692
+ onBlur: props.onBlur,
1693
+ onClick: props.onClick,
1694
+ ref: props.ref
1695
+ },
1696
+ props["aria-label"],
1697
+ " "
1698
+ );
1699
+ }
1700
+ },
1701
+ sx: {
1702
+ width: "100%",
1703
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
1704
+ "& .MuiOutlinedInput-notchedOutline": {
1705
+ borderColor: error ? "#D32F2F" : "#C4C4C4"
1706
+ }
1707
+ },
1708
+ maxDate: today,
1709
+ slotProps: {
1710
+ mobilePaper: {
1711
+ sx: {
1712
+ "& .MuiClock-root": {
1713
+ backgroundColor: "transparent",
1714
+ display: "flex",
1715
+ justifyContent: "center",
1716
+ alignItems: "center"
1717
+ },
1718
+ "& .MuiClock-clock": {
1719
+ mt: 4,
1720
+ pt: 0.5,
1721
+ width: 230,
1722
+ height: 230,
1723
+ backgroundColor: "rgba(0, 0, 0, 0.03)",
1724
+ borderRadius: "50%",
1725
+ border: "4px solid rgba(0, 0, 0, 0.04)"
1726
+ },
1727
+ "& .MuiClock-pin": {
1728
+ backgroundColor: "#085938"
1729
+ },
1730
+ "& .MuiClockPointer-root, & .MuiClockPointer-thumb": {
1731
+ backgroundColor: "#085938"
1732
+ },
1733
+ "& .MuiClockNumber-root": {
1734
+ color: "#000",
1735
+ fontSize: "16px"
1736
+ },
1737
+ "&.Mui-selected, &.Mui-focusVisible": {
1738
+ color: "#FFF"
1739
+ }
1740
+ }
1741
+ },
1742
+ textField: {
1743
+ size,
1744
+ placeholder: "",
1745
+ onClick: () => {
1746
+ if (!open) setOpen(true);
1747
+ },
1748
+ InputLabelProps: {
1749
+ shrink: true,
1750
+ style: { color: error ? "#D32F2F" : "inherit" }
1751
+ },
1752
+ InputProps: {
1753
+ ...disabled && { endAdornment: false },
1754
+ sx: {
1755
+ textAlign: centeredTime ? "center" : "left",
1756
+ // Center or left align
1757
+ "& input": {
1758
+ textAlign: centeredTime ? "center" : "left"
1759
+ // Ensure input text is centered
1760
+ }
1761
+ }
1762
+ }
1763
+ },
1764
+ popper: {
1765
+ modifiers: [
1766
+ {
1767
+ name: "preventOverflow",
1768
+ options: {
1769
+ boundary: "window"
1770
+ }
1771
+ },
1772
+ {
1773
+ name: "flip",
1774
+ options: {
1775
+ fallbackPlacements: ["right", "left", "top"]
1776
+ }
1777
+ }
1778
+ ]
1779
+ }
1780
+ }
1781
+ }
1782
+ ), error && /* @__PURE__ */ React10.createElement(Typography5, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message))
1783
+ }
1784
+ )
1785
+ );
1786
+ };
1787
+ var date_time_picker_default = JalaliDatePicker2;
1788
+
1789
+ // src/date-time-range-picker/index.tsx
1790
+ import { Box as Box9, Typography as Typography6 } from "@mui/material";
1791
+ import { LocalizationProvider as LocalizationProvider3 } from "@mui/x-date-pickers";
1792
+ import { AdapterMomentJalaali as AdapterMomentJalaali3 } from "@mui/x-date-pickers/AdapterMomentJalaali";
1793
+ import moment5 from "moment-jalaali";
1794
+ import React11, { useEffect as useEffect5, useState as useState6 } from "react";
1795
+ import { useWatch } from "react-hook-form";
1796
+ moment5.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1797
+ var JalaliDateTimeRangePicker = ({
1798
+ control,
1799
+ startName,
1800
+ endName,
1801
+ startLabel,
1802
+ endLabel,
1803
+ disabled = false,
1804
+ isLoading = false
1805
+ }) => {
1806
+ const startDate = useWatch({ control, name: startName });
1807
+ const validStartDate = startDate ? moment5(startDate) : null;
1808
+ const defaultStartDate = moment5().add(3.5, "hours").toDate();
1809
+ const [isStartDateChanged, setIsStartDateChanged] = useState6(false);
1810
+ useEffect5(() => {
1811
+ if (validStartDate && !validStartDate.isSame(defaultStartDate, "minute")) {
1812
+ setIsStartDateChanged(true);
1813
+ } else if (validStartDate && validStartDate.isSame(defaultStartDate, "minute")) {
1814
+ setIsStartDateChanged(false);
1815
+ }
1816
+ }, [validStartDate, defaultStartDate]);
1817
+ return /* @__PURE__ */ React11.createElement(LocalizationProvider3, { dateAdapter: AdapterMomentJalaali3 }, /* @__PURE__ */ React11.createElement(
1818
+ Box9,
1819
+ {
1820
+ sx: {
1821
+ display: "flex",
1822
+ alignItems: "center",
1823
+ flexDirection: "row",
1824
+ gap: 1
1825
+ }
1826
+ },
1827
+ /* @__PURE__ */ React11.createElement(
1828
+ date_time_picker_default,
1829
+ {
1830
+ control,
1831
+ name: startName,
1832
+ label: startLabel,
1833
+ disabled: disabled || isLoading
1834
+ }
1835
+ ),
1836
+ /* @__PURE__ */ React11.createElement(Typography6, { variant: "h6" }, "-"),
1837
+ /* @__PURE__ */ React11.createElement(
1838
+ date_time_picker_default,
1839
+ {
1840
+ control,
1841
+ name: endName,
1842
+ label: endLabel,
1843
+ disabled: disabled || isLoading,
1844
+ minDateTime: isStartDateChanged ? moment5(startDate) : void 0
1845
+ }
1846
+ )
1847
+ ));
1848
+ };
1849
+ var date_time_range_picker_default = JalaliDateTimeRangePicker;
1850
+
1851
+ // src/license-plate-search/index.tsx
1852
+ import { convertToEnglishDigits as convertToEnglishDigits2, convertToPersianDigits as convertToPersianDigits2 } from "@mamrp/utils";
1853
+ import { Box as Box10, IconButton as IconButton4, Typography as Typography7 } from "@mui/material";
1854
+ import Button7 from "@mui/material/Button";
1855
+ import Dialog4 from "@mui/material/Dialog";
1856
+ import DialogContent4 from "@mui/material/DialogContent";
1857
+ import DialogTitle4 from "@mui/material/DialogTitle";
1858
+ import Image2 from "next/image";
1859
+ import { useEffect as useEffect6, useRef as useRef3, useState as useState7 } from "react";
1860
+ import { IoClose as IoClose2 } from "react-icons/io5";
1861
+ import React12 from "react";
1862
+ function SearchLicensePlate({
1863
+ width = "100%",
1864
+ part,
1865
+ setValue,
1866
+ data,
1867
+ readOnly = true,
1868
+ size
1869
+ }) {
1870
+ const [open, setOpen] = useState7(false);
1871
+ const [selectedValue, setSelectedValue] = useState7("");
1872
+ const [inputValues, setInputValues] = useState7({
1873
+ input1: "",
1874
+ input2: "",
1875
+ input3: "",
1876
+ input4: ""
1877
+ });
1878
+ const inputRefs = {
1879
+ input1: useRef3(null),
1880
+ input2: useRef3(null),
1881
+ input3: useRef3(null),
1882
+ input4: useRef3(null)
1883
+ };
1884
+ useEffect6(() => {
1885
+ if (data) {
1886
+ let newdata = data.split(" ").filter((word) => word !== "\u0627\u06CC\u0631\u0627\u0646");
1887
+ setInputValues({
1888
+ input1: newdata[0],
1889
+ input2: newdata[1],
1890
+ input3: newdata[2],
1891
+ input4: newdata[3]
1892
+ });
1893
+ } else if (data == "") {
1894
+ setInputValues({
1895
+ input1: "",
1896
+ input2: "",
1897
+ input3: "",
1898
+ input4: ""
1899
+ });
1900
+ }
1901
+ }, [data]);
1902
+ const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
1903
+ const newInputValues = {
1904
+ ...inputValues,
1905
+ [inputName]: enteredInput
1906
+ };
1907
+ setInputValues(newInputValues);
1908
+ const formattedPlate = convertToEnglishDigits2(newInputValues.input1) + " " + newInputValues.input2 + " " + convertToEnglishDigits2(newInputValues.input3) + " \u0627\u06CC\u0631\u0627\u0646 " + convertToEnglishDigits2(newInputValues.input4);
1909
+ setValue(part[0], convertToEnglishDigits2(newInputValues.input1));
1910
+ setValue(part[1], newInputValues.input2);
1911
+ setValue(part[2], convertToEnglishDigits2(newInputValues.input3));
1912
+ setValue(part[3], convertToEnglishDigits2(newInputValues.input4));
1913
+ if (enteredInput.length === maxlength || minLength === 1) {
1914
+ if (inputName === "input1") {
1915
+ setOpen(true);
1916
+ } else if (inputName === "input2") {
1917
+ setSelectedValue(enteredInput);
1918
+ setOpen(false);
1919
+ } else {
1920
+ inputRefs["input4"]?.current?.focus();
1921
+ }
1922
+ }
1923
+ };
1924
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
1925
+ Box10,
1926
+ {
1927
+ sx: {
1928
+ width,
1929
+ border: "1px solid #e5e7eb",
1930
+ borderRadius: "7px",
1931
+ display: "flex",
1932
+ alignItems: "center"
1933
+ },
1934
+ dir: "ltr"
1935
+ },
1936
+ /* @__PURE__ */ React12.createElement(
1937
+ Box10,
1938
+ {
1939
+ sx: {
1940
+ display: "flex",
1941
+ alignItems: "center"
1942
+ }
1943
+ },
1944
+ /* @__PURE__ */ React12.createElement(
1945
+ Box10,
1946
+ {
1947
+ sx: {
1948
+ backgroundColor: "#172554",
1949
+ width: size === "small" ? "30px" : "36px",
1950
+ minHeight: size === "small" ? "40px" : "52px",
1951
+ maxHeight: size === "small" ? "40px" : "52px",
1952
+ display: "flex",
1953
+ justifyContent: "center",
1954
+ alignItems: "center",
1955
+ borderRadius: "7px",
1956
+ mr: 0.4
1957
+ }
1958
+ },
1959
+ /* @__PURE__ */ React12.createElement(
1960
+ Image2,
1961
+ {
1962
+ src: "/assets/images/iran-flag-dark.svg",
1963
+ alt: "Iran Flag",
1964
+ width: size === "small" ? 16 : 20,
1965
+ height: size === "small" ? 14 : 12,
1966
+ style: { cursor: "pointer" },
1967
+ onClick: () => {
1968
+ setInputValues({
1969
+ input1: "",
1970
+ input2: "",
1971
+ input3: "",
1972
+ input4: ""
1973
+ });
1974
+ setValue(part[0], "");
1975
+ setValue(part[1], "");
1976
+ setValue(part[2], "");
1977
+ setValue(part[3], "");
1978
+ }
1979
+ }
1980
+ )
1981
+ )
1982
+ ),
1983
+ /* @__PURE__ */ React12.createElement(
1984
+ Box10,
1985
+ {
1986
+ sx: {
1987
+ width: "100%",
1988
+ display: "flex",
1989
+ justifyContent: "space-around",
1990
+ fontSize: "1.125rem",
1991
+ lineHeight: "1.75rem",
1992
+ fontWeight: 600,
1993
+ color: "#1f2937",
1994
+ alignItems: "center"
1995
+ }
1996
+ },
1997
+ /* @__PURE__ */ React12.createElement(
1998
+ "input",
1999
+ {
2000
+ disabled: readOnly || !!data && readOnly,
2001
+ ref: inputRefs.input1,
2002
+ type: "text",
2003
+ maxLength: 2,
2004
+ placeholder: "- -",
2005
+ style: {
2006
+ width: "24px",
2007
+ textAlign: "center",
2008
+ backgroundColor: "transparent",
2009
+ outline: "none",
2010
+ cursor: readOnly || !!data && readOnly ? "" : "text"
2011
+ },
2012
+ value: convertToPersianDigits2(inputValues.input1),
2013
+ onChange: (e) => handleInputChange(e.target.value, "input1", 2)
2014
+ }
2015
+ ),
2016
+ /* @__PURE__ */ React12.createElement(
2017
+ Box10,
2018
+ {
2019
+ sx: {
2020
+ display: "flex",
2021
+ alignItems: "center"
2022
+ }
2023
+ },
2024
+ !data && /* @__PURE__ */ React12.createElement(
2025
+ Image2,
2026
+ {
2027
+ src: "/assets/images/solid-arrow-down.svg",
2028
+ width: 20,
2029
+ height: 20,
2030
+ alt: "arrow",
2031
+ style: { cursor: "pointer", marginRight: 4 }
2032
+ }
2033
+ ),
2034
+ /* @__PURE__ */ React12.createElement(
2035
+ "input",
2036
+ {
2037
+ disabled: readOnly || !!data && readOnly,
2038
+ ref: inputRefs.input2,
2039
+ onClick: () => {
2040
+ if (!(readOnly || !!data && readOnly)) {
2041
+ setOpen(true);
2042
+ }
2043
+ },
2044
+ type: "text",
2045
+ minLength: 1,
2046
+ maxLength: 3,
2047
+ placeholder: "-",
2048
+ style: {
2049
+ width: "28px",
2050
+ textAlign: "center",
2051
+ backgroundColor: "transparent",
2052
+ outline: "none",
2053
+ cursor: readOnly || !!data && readOnly ? "" : "pointer"
2054
+ },
2055
+ value: inputValues.input2,
2056
+ readOnly: true
2057
+ }
2058
+ )
2059
+ ),
2060
+ /* @__PURE__ */ React12.createElement(
2061
+ Dialog4,
2062
+ {
2063
+ dir: "rtl",
2064
+ open,
2065
+ onClose: () => setOpen(false),
2066
+ "aria-labelledby": "alert-dialog-title",
2067
+ "aria-describedby": "alert-dialog-description"
2068
+ },
2069
+ /* @__PURE__ */ React12.createElement(
2070
+ Box10,
2071
+ {
2072
+ sx: {
2073
+ display: "flex",
2074
+ justifyContent: "space-between",
2075
+ alignItems: "center",
2076
+ backgroundColor: "#f5f5f5"
2077
+ // bg-neutral-100
2078
+ }
2079
+ },
2080
+ /* @__PURE__ */ React12.createElement(DialogTitle4, { id: "alert-dialog-title" }, "\u0627\u0646\u062A\u062E\u0627\u0628 \u062D\u0631\u0641 \u067E\u0644\u0627\u06A9"),
2081
+ /* @__PURE__ */ React12.createElement(
2082
+ Box10,
2083
+ {
2084
+ sx: {
2085
+ cursor: "pointer",
2086
+ paddingRight: "1rem",
2087
+ color: "#737373"
2088
+ // text-neutral-500
2089
+ },
2090
+ onClick: () => setOpen(false)
2091
+ },
2092
+ /* @__PURE__ */ React12.createElement(IconButton4, null, /* @__PURE__ */ React12.createElement(IoClose2, null))
2093
+ )
2094
+ ),
2095
+ /* @__PURE__ */ React12.createElement(DialogContent4, null, /* @__PURE__ */ React12.createElement(
2096
+ Box10,
2097
+ {
2098
+ sx: {
2099
+ display: "flex",
2100
+ alignItems: "center",
2101
+ justifyContent: "center",
2102
+ flexWrap: "wrap",
2103
+ gap: 2,
2104
+ my: 2
2105
+ }
2106
+ },
2107
+ letters_default.map((letter, index) => /* @__PURE__ */ React12.createElement(
2108
+ Button7,
2109
+ {
2110
+ key: index,
2111
+ variant: "outlined",
2112
+ color: "primary",
2113
+ sx: {
2114
+ border: "none",
2115
+ backgroundColor: "#f0f0f0",
2116
+ width: "70px",
2117
+ height: "50px",
2118
+ fontWeight: "bold",
2119
+ ":hover": {
2120
+ backgroundColor: "#e3e3e3"
2121
+ }
2122
+ },
2123
+ onClick: () => handleInputChange(letter, "input2", 3, 1)
2124
+ },
2125
+ /* @__PURE__ */ React12.createElement(Typography7, { color: "#117A4F", fontWeight: "bold" }, letter)
2126
+ ))
2127
+ ), /* @__PURE__ */ React12.createElement(Box10, { sx: { display: "flex", justifyContent: "center", mt: 2.5 } }, /* @__PURE__ */ React12.createElement(
2128
+ Button7,
2129
+ {
2130
+ sx: { width: "6rem" },
2131
+ variant: "outlined",
2132
+ color: "error",
2133
+ onClick: () => {
2134
+ handleInputChange("", "input2", 3, 1);
2135
+ setOpen(false);
2136
+ }
2137
+ },
2138
+ "\u062D\u0630\u0641 \u062D\u0631\u0641"
2139
+ )))
2140
+ ),
2141
+ /* @__PURE__ */ React12.createElement(
2142
+ "input",
2143
+ {
2144
+ disabled: readOnly || !!data && readOnly,
2145
+ ref: inputRefs.input3,
2146
+ type: "text",
2147
+ maxLength: 3,
2148
+ placeholder: "- - -",
2149
+ style: {
2150
+ width: "40px",
2151
+ // w-10
2152
+ textAlign: "center",
2153
+ backgroundColor: "transparent",
2154
+ outline: "none",
2155
+ cursor: readOnly || !!data && readOnly ? "" : "text"
2156
+ },
2157
+ value: convertToPersianDigits2(inputValues.input3),
2158
+ onChange: (e) => handleInputChange(e.target.value, "input3", 3)
2159
+ }
2160
+ ),
2161
+ /* @__PURE__ */ React12.createElement(
2162
+ Box10,
2163
+ {
2164
+ sx: {
2165
+ height: "40px",
2166
+ width: "1px",
2167
+ backgroundColor: "#e5e7eb"
2168
+ }
2169
+ }
2170
+ ),
2171
+ /* @__PURE__ */ React12.createElement(
2172
+ Box10,
2173
+ {
2174
+ sx: {
2175
+ display: "flex",
2176
+ flexDirection: "column-reverse",
2177
+ gap: size === "small" ? 0.25 : 1,
2178
+ alignItems: "center"
2179
+ }
2180
+ },
2181
+ /* @__PURE__ */ React12.createElement(
2182
+ "input",
2183
+ {
2184
+ disabled: readOnly || !!data && readOnly,
2185
+ ref: inputRefs.input4,
2186
+ type: "text",
2187
+ maxLength: 2,
2188
+ placeholder: "- -",
2189
+ style: {
2190
+ width: "24px",
2191
+ textAlign: "center",
2192
+ backgroundColor: "transparent",
2193
+ outline: "none",
2194
+ cursor: readOnly || !!data && readOnly ? "" : "text"
2195
+ },
2196
+ value: convertToPersianDigits2(inputValues.input4),
2197
+ onChange: (e) => handleInputChange(e.target.value, "input4", 2)
2198
+ }
2199
+ ),
2200
+ /* @__PURE__ */ React12.createElement(
2201
+ Image2,
2202
+ {
2203
+ src: "/assets/images/iran.svg",
2204
+ alt: "Iran",
2205
+ width: size === "small" ? 25 : 30,
2206
+ height: size === "small" ? 21 : 26
2207
+ }
2208
+ )
2209
+ )
2210
+ )
2211
+ ));
2212
+ }
2213
+
2214
+ // src/loading/index.tsx
2215
+ import React13 from "react";
2216
+ function Loading() {
2217
+ return /* @__PURE__ */ React13.createElement("div", { className: "loading" }, /* @__PURE__ */ React13.createElement(
2218
+ "img",
2219
+ {
2220
+ src: "/assets/images/favicon.ico",
2221
+ alt: "MAM Logo",
2222
+ className: "mam-logo"
2223
+ }
2224
+ ), /* @__PURE__ */ React13.createElement("p", { className: "message" }, "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC\u060C \u0644\u0637\u0641\u0627 \u0645\u0646\u062A\u0638\u0631 \u0628\u0645\u0627\u0646\u06CC\u062F", /* @__PURE__ */ React13.createElement("span", { className: "dots" }, /* @__PURE__ */ React13.createElement("span", null, "."), /* @__PURE__ */ React13.createElement("span", null, "."), /* @__PURE__ */ React13.createElement("span", null, "."), /* @__PURE__ */ React13.createElement("span", null, "."))), /* @__PURE__ */ React13.createElement("style", null, `
2225
+ .loading {
2226
+ position: fixed;
2227
+ top: 0;
2228
+ left: 0;
2229
+ width: 100%;
2230
+ height: 100%;
2231
+ display: flex;
2232
+ flex-direction: column;
2233
+ justify-content: center;
2234
+ align-items: center;
2235
+ background-color: #065938;
2236
+ color: #fff;
2237
+ z-index: 9999;
2238
+ }
2239
+ .mam-logo {
2240
+ width: 120px;
2241
+ height: auto;
2242
+ margin-bottom: 5px;
2243
+ animation: float 3s ease-in-out infinite, glow 1.5s alternate infinite ease-in-out;
2244
+ }
2245
+ @keyframes float {
2246
+ 0%, 100% {
2247
+ transform: translateY(0);
2248
+ }
2249
+
2250
+ }
2251
+ @keyframes glow {
2252
+ 0% {
2253
+ filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
2254
+ }
2255
+ 100% {
2256
+ filter: drop-shadow(0 0 20px rgba(255, 255, 255, 1));
2257
+ }
2258
+ }
2259
+ .message {
2260
+ font-size: 1.2rem;
2261
+ font-weight: bold;
2262
+ display: flex;
2263
+ align-items: center;
2264
+ }
2265
+ .dots {
2266
+ display: inline-block;
2267
+ margin-left: 5px;
2268
+ }
2269
+ .dots span {
2270
+ animation: blink 1.5s step-start infinite;
2271
+ font-size: 1.5rem;
2272
+ }
2273
+ .dots span:nth-child(1) {
2274
+ animation-delay: 0s;
2275
+ }
2276
+ .dots span:nth-child(2) {
2277
+ animation-delay: 0.3s;
2278
+ }
2279
+ .dots span:nth-child(3) {
2280
+ animation-delay: 0.6s;
2281
+ }
2282
+ @keyframes blink {
2283
+ 0% {
2284
+ opacity: 0;
2285
+ }
2286
+ 50% {
2287
+ opacity: 1;
2288
+ }
2289
+ 100% {
2290
+ opacity: 0;
2291
+ }
2292
+ }
2293
+ `));
2294
+ }
2295
+
2296
+ // src/mobile-date-time-picker/index.tsx
2297
+ import { Button as Button8, Typography as Typography8 } from "@mui/material";
2298
+ import useMediaQuery4 from "@mui/material/useMediaQuery";
2299
+ import { Box as Box11 } from "@mui/system";
2300
+ import {
2301
+ MobileDateTimePicker,
2302
+ LocalizationProvider as LocalizationProvider4
2303
+ } from "@mui/x-date-pickers";
2304
+ import { AdapterMomentJalaali as AdapterMomentJalaali4 } from "@mui/x-date-pickers/AdapterMomentJalaali";
2305
+ import dayjs2 from "dayjs";
2306
+ import moment6 from "moment-jalaali";
2307
+ import React14, { useState as useState8 } from "react";
2308
+ import { Controller as Controller6 } from "react-hook-form";
2309
+ moment6.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
2310
+ var JalaliDatePicker3 = ({
2311
+ name,
2312
+ control,
2313
+ label,
2314
+ isLoading
2315
+ }) => {
2316
+ const today = moment6();
2317
+ const isMobile = useMediaQuery4("(max-width:700px)");
2318
+ const [open, setOpen] = useState8(false);
2319
+ const customLocaleText = {
2320
+ cancelButtonLabel: "\u0644\u063A\u0648",
2321
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
2322
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
2323
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646",
2324
+ start: "\u0634\u0631\u0648\u0639",
2325
+ end: "\u067E\u0627\u06CC\u0627\u0646",
2326
+ previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
2327
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
2328
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
2329
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
2330
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
2331
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
2332
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
2333
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
2334
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
2335
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
2336
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
2337
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
2338
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
2339
+ calendarWeekNumberHeaderText: "#",
2340
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
2341
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
2342
+ };
2343
+ return /* @__PURE__ */ React14.createElement(
2344
+ LocalizationProvider4,
2345
+ {
2346
+ dateAdapter: AdapterMomentJalaali4,
2347
+ localeText: customLocaleText
2348
+ },
2349
+ /* @__PURE__ */ React14.createElement(
2350
+ Controller6,
2351
+ {
2352
+ name,
2353
+ control,
2354
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ React14.createElement(Box11, { sx: { width: "100%" } }, /* @__PURE__ */ React14.createElement(
2355
+ MobileDateTimePicker,
2356
+ {
2357
+ open,
2358
+ onClose: () => {
2359
+ setOpen(false);
2360
+ field.onBlur();
2361
+ },
2362
+ onOpen: () => setOpen(true),
2363
+ orientation: isMobile ? "portrait" : "landscape",
2364
+ disabled: isLoading,
2365
+ openTo: "day",
2366
+ views: ["year", "month", "day", "hours", "minutes"],
2367
+ label,
2368
+ value: field.value ? moment6(field.value) : null,
2369
+ onChange: (newValue) => {
2370
+ if (newValue) {
2371
+ field.onChange(dayjs2(newValue).format("YYYY-MM-DDTHH:mm:ss"));
2372
+ } else {
2373
+ field.onChange(null);
2374
+ }
2375
+ },
2376
+ onAccept: () => {
2377
+ setOpen(false);
2378
+ field.onBlur();
2379
+ },
2380
+ onError: () => {
2381
+ setOpen(false);
2382
+ field.onBlur();
2383
+ },
2384
+ format: `jDD jMMMM jYYYY ${" "} - ${" "} HH:mm`,
2385
+ slots: {
2386
+ toolbar: (props) => {
2387
+ const currentDate = moment6(field.value || null);
2388
+ let formattedDay, formattedDate, formattedYear, formattedTime;
2389
+ if (field.value) {
2390
+ formattedDay = currentDate.format("dddd");
2391
+ formattedDate = currentDate.format("jDD jMMMM");
2392
+ formattedYear = currentDate.format("jYYYY");
2393
+ formattedTime = currentDate.format("HH:mm");
2394
+ } else {
2395
+ formattedDay = "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u0646\u062A\u062E\u0627\u0628 \u0646\u0634\u062F\u0647 \u0627\u0633\u062A", formattedDate = "", formattedYear = "", formattedTime = "";
2396
+ }
2397
+ return /* @__PURE__ */ React14.createElement(
2398
+ Box11,
2399
+ {
2400
+ sx: {
2401
+ padding: "16px",
2402
+ textAlign: "left",
2403
+ display: "flex",
2404
+ flexDirection: "row",
2405
+ justifyContent: "start",
2406
+ alignItems: "center",
2407
+ gap: 1
2408
+ }
2409
+ },
2410
+ /* @__PURE__ */ React14.createElement(
2411
+ Typography8,
2412
+ {
2413
+ fontSize: 16,
2414
+ variant: "overline",
2415
+ color: "primary"
2416
+ },
2417
+ `${formattedDay}\u060C`
2418
+ ),
2419
+ /* @__PURE__ */ React14.createElement(
2420
+ Typography8,
2421
+ {
2422
+ variant: "h4",
2423
+ fontSize: 26,
2424
+ style: { fontWeight: "bold" }
2425
+ },
2426
+ `${formattedDate}`
2427
+ ),
2428
+ /* @__PURE__ */ React14.createElement(
2429
+ Typography8,
2430
+ {
2431
+ fontSize: 16,
2432
+ variant: "body2",
2433
+ color: "textSecondary"
2434
+ },
2435
+ `${formattedYear}`
2436
+ ),
2437
+ field.value && /* @__PURE__ */ React14.createElement(Typography8, null, "-"),
2438
+ /* @__PURE__ */ React14.createElement(
2439
+ Typography8,
2440
+ {
2441
+ fontSize: 16,
2442
+ variant: "body2",
2443
+ color: "textSecondary",
2444
+ style: { fontWeight: "bold" }
2445
+ },
2446
+ `${formattedTime}`
2447
+ )
2448
+ );
2449
+ },
2450
+ monthButton: (props) => {
2451
+ return /* @__PURE__ */ React14.createElement(
2452
+ Button8,
2453
+ {
2454
+ className: props.className,
2455
+ style: {
2456
+ width: "80%",
2457
+ padding: "10px",
2458
+ marginBottom: "20px",
2459
+ border: "1px solid #ccc",
2460
+ borderRadius: "12px",
2461
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
2462
+ fontSize: "14px",
2463
+ cursor: props.disabled ? "default" : "pointer"
2464
+ },
2465
+ disabled: props.disabled,
2466
+ onClick: props.onClick
2467
+ },
2468
+ props["aria-label"]
2469
+ );
2470
+ }
2471
+ },
2472
+ sx: {
2473
+ width: "100%",
2474
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
2475
+ "& .MuiOutlinedInput-notchedOutline": {
2476
+ borderColor: error ? "#D32F2F" : "#C4C4C4"
2477
+ }
2478
+ },
2479
+ maxDate: today,
2480
+ slotProps: {
2481
+ mobilePaper: {
2482
+ sx: {
2483
+ "& .MuiClock-root": {
2484
+ backgroundColor: "transparent",
2485
+ display: "flex",
2486
+ justifyContent: "center",
2487
+ alignItems: "center"
2488
+ },
2489
+ "& .MuiClock-clock": {
2490
+ mt: 4,
2491
+ pt: 0.5,
2492
+ width: 230,
2493
+ height: 230,
2494
+ backgroundColor: "rgba(0, 0, 0, 0.03)",
2495
+ borderRadius: "50%",
2496
+ border: "4px solid rgba(0, 0, 0, 0.04)"
2497
+ },
2498
+ "& .MuiClock-pin": {
2499
+ backgroundColor: "#085938"
2500
+ },
2501
+ "& .MuiClockPointer-root, & .MuiClockPointer-thumb": {
2502
+ backgroundColor: "#085938"
2503
+ },
2504
+ "& .MuiClockNumber-root": {
2505
+ color: "#000",
2506
+ fontSize: "16px"
2507
+ },
2508
+ "&.Mui-selected, &.Mui-focusVisible": {
2509
+ color: "#FFF"
2510
+ }
2511
+ }
2512
+ },
2513
+ textField: {
2514
+ placeholder: field.value ? "" : "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0628\u0647 \u0647\u0645\u0631\u0627\u0647 \u0632\u0645\u0627\u0646",
2515
+ onClick: () => {
2516
+ if (!open) setOpen(true);
2517
+ },
2518
+ InputLabelProps: {
2519
+ shrink: true,
2520
+ style: { color: error ? "#D32F2F" : "inherit" }
2521
+ },
2522
+ InputProps: {
2523
+ onFocus: () => {
2524
+ }
2525
+ }
2526
+ }
2527
+ }
2528
+ }
2529
+ ), error && /* @__PURE__ */ React14.createElement(Typography8, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message))
2530
+ }
2531
+ )
2532
+ );
2533
+ };
2534
+ var mobile_date_time_picker_default = JalaliDatePicker3;
2535
+
2536
+ // src/modal/index.tsx
2537
+ import * as React15 from "react";
2538
+ import Dialog5 from "@mui/material/Dialog";
2539
+ import DialogActions3 from "@mui/material/DialogActions";
2540
+ import DialogContent5 from "@mui/material/DialogContent";
2541
+ import DialogTitle5 from "@mui/material/DialogTitle";
2542
+ import {
2543
+ Box as Box12,
2544
+ Button as Button9,
2545
+ CircularProgress as CircularProgress2,
2546
+ Divider as Divider3,
2547
+ IconButton as IconButton5
2548
+ } from "@mui/material";
2549
+ import { FaRegTrashAlt } from "react-icons/fa";
2550
+ import { MdClose as MdClose3, MdOutlineCancel as MdOutlineCancel2 } from "react-icons/md";
2551
+ function ConfirmationDialog2({
2552
+ open,
2553
+ handleClose,
2554
+ callback,
2555
+ callbackParams,
2556
+ headerText,
2557
+ bodyText,
2558
+ isLoading
2559
+ }) {
2560
+ return /* @__PURE__ */ React15.createElement(Dialog5, { open, onClose: handleClose, fullWidth: true, maxWidth: "xs" }, /* @__PURE__ */ React15.createElement(Box12, null, /* @__PURE__ */ React15.createElement(
2561
+ DialogTitle5,
2562
+ {
2563
+ fontWeight: 700,
2564
+ fontSize: "1.2rem",
2565
+ display: "flex",
2566
+ alignItems: "center",
2567
+ gap: 1
2568
+ },
2569
+ /* @__PURE__ */ React15.createElement(FaRegTrashAlt, { style: { color: "red" }, size: 18 }),
2570
+ headerText
2571
+ ), /* @__PURE__ */ React15.createElement(
2572
+ IconButton5,
2573
+ {
2574
+ "aria-label": "close",
2575
+ onClick: handleClose,
2576
+ sx: {
2577
+ position: "absolute",
2578
+ right: 8,
2579
+ top: 8,
2580
+ color: (theme) => theme.palette.grey[500]
2581
+ }
2582
+ },
2583
+ /* @__PURE__ */ React15.createElement(MdClose3, null)
2584
+ ), /* @__PURE__ */ React15.createElement(Divider3, { sx: { my: "10px" } }), /* @__PURE__ */ React15.createElement(DialogContent5, null, bodyText), /* @__PURE__ */ React15.createElement(
2585
+ DialogActions3,
2586
+ {
2587
+ sx: {
2588
+ display: "flex",
2589
+ justifyContent: "flex-end",
2590
+ width: "100%",
2591
+ gap: "12px",
2592
+ alignItems: "center",
2593
+ padding: "2rem"
2594
+ }
2595
+ },
2596
+ /* @__PURE__ */ React15.createElement(
2597
+ Button9,
2598
+ {
2599
+ disabled: isLoading,
2600
+ onClick: () => {
2601
+ callback(callbackParams);
2602
+ handleClose();
2603
+ },
2604
+ variant: "contained",
2605
+ color: "error",
2606
+ sx: { minWidth: "120px" },
2607
+ startIcon: isLoading ? /* @__PURE__ */ React15.createElement(CircularProgress2, { sx: { color: "white" }, size: 20 }) : /* @__PURE__ */ React15.createElement(FaRegTrashAlt, { size: 16 })
2608
+ },
2609
+ "\u062D\u0630\u0641"
2610
+ ),
2611
+ /* @__PURE__ */ React15.createElement(
2612
+ Button9,
2613
+ {
2614
+ onClick: handleClose,
2615
+ variant: "outlined",
2616
+ color: "error",
2617
+ startIcon: /* @__PURE__ */ React15.createElement(MdOutlineCancel2, { size: 15 }),
2618
+ sx: { minWidth: "120px" }
2619
+ },
2620
+ "\u0627\u0646\u0635\u0631\u0627\u0641"
2621
+ )
2622
+ )));
2623
+ }
2624
+
2625
+ // src/no-result/index.tsx
2626
+ import {
2627
+ Card as Card2,
2628
+ Stack as Stack3,
2629
+ Typography as Typography9,
2630
+ useTheme as useTheme4
2631
+ } from "@mui/material";
2632
+ import React16 from "react";
2633
+ function NoResult({
2634
+ title = "\u062F\u0627\u062F\u0647 \u0627\u06CC \u0628\u0631\u0627\u06CC \u0646\u0645\u0627\u06CC\u0634 \u0648\u062C\u0648\u062F \u0646\u062F\u0627\u0631\u062F!",
2635
+ description,
2636
+ sx = {}
2637
+ }) {
2638
+ const theme = useTheme4();
2639
+ return /* @__PURE__ */ React16.createElement(
2640
+ Card2,
2641
+ {
2642
+ sx: {
2643
+ width: "100%",
2644
+ minWidth: 300,
2645
+ borderRadius: "12px",
2646
+ border: `1px solid ${theme.palette.secondary.light}`
2647
+ }
2648
+ },
2649
+ /* @__PURE__ */ React16.createElement(
2650
+ Stack3,
2651
+ {
2652
+ spacing: 2,
2653
+ alignItems: "center",
2654
+ sx: {
2655
+ py: 5,
2656
+ ...sx
2657
+ }
2658
+ },
2659
+ /* @__PURE__ */ React16.createElement(
2660
+ "img",
2661
+ {
2662
+ src: "/assets/images/no-data.png",
2663
+ alt: "No Data",
2664
+ height: 100,
2665
+ width: 100
2666
+ }
2667
+ ),
2668
+ /* @__PURE__ */ React16.createElement(Stack3, { spacing: 1, alignItems: "center" }, /* @__PURE__ */ React16.createElement(Typography9, { fontWeight: "600" }, title), description && /* @__PURE__ */ React16.createElement(Typography9, { fontWeight: "500" }, description))
2669
+ )
2670
+ );
2671
+ }
2672
+
2673
+ // src/pagination-list/index.tsx
2674
+ import { convertToPersianDigits as convertToPersianDigits3 } from "@mamrp/utils";
2675
+ import { Button as Button10 } from "@mui/material";
2676
+ import Stack4 from "@mui/material/Stack";
2677
+ import { Box as Box13 } from "@mui/system";
2678
+ import * as React17 from "react";
2679
+ import { FaChevronLeft as FaChevronLeft3, FaChevronRight as FaChevronRight3 } from "react-icons/fa";
2680
+ function PaginationList({
2681
+ currentPage,
2682
+ setCurrentPage,
2683
+ totalPages
2684
+ }) {
2685
+ React17.useEffect(() => {
2686
+ window.scrollTo({ top: 0, behavior: "smooth" });
2687
+ }, [currentPage]);
2688
+ const handlePrevious = () => {
2689
+ if (currentPage > 1) {
2690
+ setCurrentPage(currentPage - 1);
2691
+ }
2692
+ };
2693
+ const handleNext = () => {
2694
+ if (currentPage < totalPages) {
2695
+ setCurrentPage(currentPage + 1);
2696
+ }
2697
+ };
2698
+ return /* @__PURE__ */ React17.createElement(
2699
+ Stack4,
2700
+ {
2701
+ direction: "row",
2702
+ spacing: 2,
2703
+ alignItems: "center",
2704
+ justifyContent: "center"
2705
+ },
2706
+ /* @__PURE__ */ React17.createElement(
2707
+ Button10,
2708
+ {
2709
+ variant: "contained",
2710
+ onClick: handlePrevious,
2711
+ color: "warning",
2712
+ disabled: currentPage === 1,
2713
+ sx: {
2714
+ borderRadius: 2,
2715
+ width: "100px",
2716
+ height: "50px",
2717
+ minWidth: "unset",
2718
+ display: "flex",
2719
+ alignItems: "center",
2720
+ justifyContent: "center"
2721
+ },
2722
+ size: "large",
2723
+ startIcon: /* @__PURE__ */ React17.createElement(FaChevronRight3, null)
2724
+ },
2725
+ "\u0642\u0628\u0644\u06CC",
2726
+ " "
2727
+ ),
2728
+ /* @__PURE__ */ React17.createElement(
2729
+ Box13,
2730
+ {
2731
+ sx: {
2732
+ fontWeight: "bold",
2733
+ width: "120px",
2734
+ height: "50px",
2735
+ borderRadius: 2,
2736
+ display: "flex",
2737
+ alignItems: "center",
2738
+ justifyContent: "center",
2739
+ color: "#fff",
2740
+ fontSize: "1.5rem",
2741
+ backgroundColor: "#065938"
2742
+ }
2743
+ },
2744
+ /* @__PURE__ */ React17.createElement("span", { style: { margin: "0px 6px", fontSize: "1.2rem" } }, "\u0635\u0641\u062D\u0647"),
2745
+ convertToPersianDigits3(currentPage)
2746
+ ),
2747
+ /* @__PURE__ */ React17.createElement(
2748
+ Button10,
2749
+ {
2750
+ variant: "contained",
2751
+ onClick: handleNext,
2752
+ color: "warning",
2753
+ disabled: currentPage === totalPages,
2754
+ sx: {
2755
+ borderRadius: 2,
2756
+ width: "100px",
2757
+ height: "50px",
2758
+ minWidth: "unset",
2759
+ display: "flex",
2760
+ alignItems: "center",
2761
+ justifyContent: "center"
2762
+ },
2763
+ size: "large",
2764
+ endIcon: /* @__PURE__ */ React17.createElement(FaChevronLeft3, null)
2765
+ },
2766
+ "\u0628\u0639\u062F\u06CC",
2767
+ " "
2768
+ )
2769
+ );
2770
+ }
2771
+
2772
+ // src/radio-button/index.tsx
2773
+ import * as React18 from "react";
2774
+ import { Controller as Controller7 } from "react-hook-form";
2775
+ import Radio from "@mui/material/Radio";
2776
+ import RadioGroup from "@mui/material/RadioGroup";
2777
+ import FormControlLabel2 from "@mui/material/FormControlLabel";
2778
+ import FormControl from "@mui/material/FormControl";
2779
+ import FormLabel from "@mui/material/FormLabel";
2780
+ function RadioButton({ name, label, options, control }) {
2781
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(FormControl, { sx: {
2782
+ display: "flex",
2783
+ flexDirection: "row",
2784
+ alignItems: "center",
2785
+ justifyContent: "start"
2786
+ } }, /* @__PURE__ */ React18.createElement(FormLabel, { id: `${name}-label` }, label), /* @__PURE__ */ React18.createElement(
2787
+ Controller7,
2788
+ {
2789
+ name,
2790
+ control,
2791
+ render: ({ field }) => /* @__PURE__ */ React18.createElement(
2792
+ RadioGroup,
2793
+ {
2794
+ ...field,
2795
+ "aria-labelledby": `${name}-label`,
2796
+ value: field.value,
2797
+ sx: {
2798
+ display: "flex",
2799
+ flexDirection: "row",
2800
+ marginLeft: 5
2801
+ }
2802
+ },
2803
+ options.map((option) => /* @__PURE__ */ React18.createElement(
2804
+ FormControlLabel2,
2805
+ {
2806
+ key: option.value,
2807
+ value: option.value,
2808
+ control: /* @__PURE__ */ React18.createElement(Radio, { id: option.id }),
2809
+ label: option.name
2810
+ }
2811
+ ))
2812
+ )
2813
+ }
2814
+ )));
2815
+ }
2816
+
2817
+ // src/selector/index.tsx
2818
+ import { MdKeyboardArrowLeft, MdKeyboardArrowRight } from "react-icons/md";
2819
+ import {
2820
+ Checkbox as Checkbox2,
2821
+ Collapse,
2822
+ FormControl as FormControl2,
2823
+ IconButton as IconButton6,
2824
+ InputLabel,
2825
+ List,
2826
+ ListItemText,
2827
+ MenuItem,
2828
+ Select,
2829
+ Typography as Typography10
2830
+ } from "@mui/material";
2831
+ import React19, { useState as useState9 } from "react";
2832
+ var backendResponse = {
2833
+ value: {
2834
+ data: [
2835
+ {
2836
+ id: 287,
2837
+ title: "\u0648\u0642\u0641\u0647 \u062F\u0627\u062E\u0644 \u06A9\u0634\u062A\u0627\u0631\u06AF\u0627\u0647",
2838
+ parentId: null,
2839
+ level: 1,
2840
+ children: [
2841
+ {
2842
+ id: 292,
2843
+ title: "\u062E\u0637 \u06F2 \u06A9\u0634\u062A\u0627\u0631",
2844
+ parentId: 287,
2845
+ level: 2,
2846
+ children: [
2847
+ {
2848
+ id: 312,
2849
+ title: "\u062E\u0631\u0627\u0628\u06CC \u062F\u0633\u062A\u06AF\u0627\u0647 \u0645\u0642\u0639\u062F \u0632\u0646",
2850
+ parentId: 292,
2851
+ level: 3,
2852
+ children: []
2853
+ },
2854
+ {
2855
+ id: 313,
2856
+ title: "\u062E\u0631\u0627\u0628\u06CC \u062F\u0633\u062A\u06AF\u0627\u0647 \u0686\u0627\u06A9 \u0632\u0646",
2857
+ parentId: 292,
2858
+ level: 3,
2859
+ children: []
2860
+ }
2861
+ ]
2862
+ }
2863
+ ]
2864
+ },
2865
+ {
2866
+ id: 288,
2867
+ title: "\u0648\u0642\u0641\u0647 \u0642\u0628\u0644 \u0627\u0632 \u06A9\u0634\u062A\u0627\u0631\u06AF\u0627\u0647",
2868
+ parentId: null,
2869
+ level: 1,
2870
+ children: [
2871
+ {
2872
+ id: 289,
2873
+ title: "\u0633\u0631\u0648\u06CC\u0633 \u067E\u0631\u0633\u0646\u0644",
2874
+ parentId: 288,
2875
+ level: 2,
2876
+ children: []
2877
+ }
2878
+ ]
2879
+ }
2880
+ ]
2881
+ }
2882
+ };
2883
+ var NestedSelect = () => {
2884
+ const [selectedItem, setSelectedItem] = useState9(null);
2885
+ const [openMenus, setOpenMenus] = useState9({});
2886
+ const [menuOpen, setMenuOpen] = useState9(false);
2887
+ const handleSelect = (item) => {
2888
+ setSelectedItem((prev) => prev?.id === item.id ? null : item);
2889
+ };
2890
+ const handleToggle = (id) => {
2891
+ setOpenMenus((prev) => ({ ...prev, [id]: !prev[id] }));
2892
+ };
2893
+ const renderMenuItems = (items, level = 0) => {
2894
+ return items.map((item) => {
2895
+ const isParentSelected = selectedItem?.id === item.id;
2896
+ const isAnyChildSelected = item.children?.some(
2897
+ (child) => selectedItem?.id === child.id
2898
+ );
2899
+ return /* @__PURE__ */ React19.createElement("div", { key: item.id }, /* @__PURE__ */ React19.createElement(
2900
+ MenuItem,
2901
+ {
2902
+ onClick: (e) => {
2903
+ e.stopPropagation();
2904
+ handleSelect(item);
2905
+ },
2906
+ disabled: isAnyChildSelected,
2907
+ sx: { pl: level * 2 }
2908
+ },
2909
+ /* @__PURE__ */ React19.createElement(Checkbox2, { checked: isParentSelected }),
2910
+ /* @__PURE__ */ React19.createElement(ListItemText, { primary: item.title }),
2911
+ item.children && item.children.length > 0 && /* @__PURE__ */ React19.createElement(
2912
+ IconButton6,
2913
+ {
2914
+ size: "small",
2915
+ onClick: (e) => {
2916
+ e.stopPropagation();
2917
+ handleToggle(item.id);
2918
+ }
2919
+ },
2920
+ openMenus[item.id] ? /* @__PURE__ */ React19.createElement(MdKeyboardArrowLeft, null) : /* @__PURE__ */ React19.createElement(MdKeyboardArrowRight, null)
2921
+ )
2922
+ ), item.children && item.children.length > 0 && /* @__PURE__ */ React19.createElement(Collapse, { in: openMenus[item.id], timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React19.createElement(List, { component: "div", disablePadding: true }, renderMenuItems(item.children, level + 1))));
2923
+ });
2924
+ };
2925
+ return /* @__PURE__ */ React19.createElement(FormControl2, { fullWidth: true, variant: "outlined" }, /* @__PURE__ */ React19.createElement(InputLabel, { shrink: true }, "\u062F\u0633\u062A\u0647 \u0628\u0646\u062F\u06CC *"), /* @__PURE__ */ React19.createElement(
2926
+ Select,
2927
+ {
2928
+ label: "\u062F\u0633\u062A\u0647 \u0628\u0646\u062F\u06CC *",
2929
+ value: selectedItem?.id || "",
2930
+ displayEmpty: true,
2931
+ open: menuOpen,
2932
+ onOpen: () => setMenuOpen(true),
2933
+ onClose: () => setMenuOpen(false),
2934
+ renderValue: (selected) => selectedItem ? /* @__PURE__ */ React19.createElement(Typography10, null, selectedItem.title) : " "
2935
+ },
2936
+ renderMenuItems(backendResponse.value.data)
2937
+ ));
2938
+ };
2939
+ var selector_default = NestedSelect;
2940
+
2941
+ // src/spinner/sonar/index.tsx
2942
+ import { Box as Box14 } from "@mui/material";
2943
+ import { keyframes } from "@mui/system";
2944
+ import React20 from "react";
2945
+ var radarAnimation = keyframes`
2946
+ 0% {
2947
+ background: inherit;
2948
+ transform: scale(0);
2949
+ opacity: 0.9;
2950
+ }
2951
+ 100% {
2952
+ opacity: 0;
2953
+ transform: scale(4);
2954
+ }
2955
+ `;
2956
+ function SonarSpinner({ children }) {
2957
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Box14, { className: "absolute w-[30px] h-[30px] rounded-full bg-white z-10 flex items-center justify-center" }, children), /* @__PURE__ */ React20.createElement(
2958
+ Box14,
2959
+ {
2960
+ className: "root",
2961
+ sx: {
2962
+ position: "absolute",
2963
+ display: "flex",
2964
+ alignItems: "center",
2965
+ justifyContent: "center",
2966
+ backgroundColor: "white",
2967
+ transform: "translateZ(0)"
2968
+ }
2969
+ },
2970
+ /* @__PURE__ */ React20.createElement(
2971
+ Box14,
2972
+ {
2973
+ className: "radar",
2974
+ sx: {
2975
+ position: "absolute",
2976
+ zIndex: 1,
2977
+ width: "15px",
2978
+ height: "15px",
2979
+ borderRadius: "100%",
2980
+ display: "flex",
2981
+ alignItems: "center",
2982
+ justifyContent: "center",
2983
+ backgroundColor: "red",
2984
+ animation: `${radarAnimation} 1.2s linear infinite`,
2985
+ animationDelay: "0s"
2986
+ }
2987
+ },
2988
+ /* @__PURE__ */ React20.createElement(
2989
+ Box14,
2990
+ {
2991
+ className: "sonar",
2992
+ sx: {
2993
+ position: "absolute",
2994
+ zIndex: 1,
2995
+ width: "14px",
2996
+ height: "14px",
2997
+ borderRadius: "inherit",
2998
+ backgroundColor: "red"
2999
+ }
3000
+ }
3001
+ ),
3002
+ /* @__PURE__ */ React20.createElement(
3003
+ Box14,
3004
+ {
3005
+ className: "sonar delayed",
3006
+ sx: {
3007
+ position: "absolute",
3008
+ zIndex: 1,
3009
+ width: "7px",
3010
+ height: "7px",
3011
+ borderRadius: "100%",
3012
+ display: "flex",
3013
+ alignItems: "center",
3014
+ justifyContent: "center",
3015
+ animation: `${radarAnimation} 1.2s linear infinite`,
3016
+ animationDelay: "1s",
3017
+ backgroundColor: "red"
3018
+ }
3019
+ }
3020
+ )
3021
+ )
3022
+ ));
3023
+ }
3024
+
3025
+ // src/stepper/index.tsx
3026
+ import Box15 from "@mui/material/Box";
3027
+ import Step from "@mui/material/Step";
3028
+ import StepButton from "@mui/material/StepButton";
3029
+ import Stepper from "@mui/material/Stepper";
3030
+ import * as React21 from "react";
3031
+ function HorizontalStepper({
3032
+ steps,
3033
+ currentStep,
3034
+ setCurrentStep
3035
+ }) {
3036
+ const [completed, setCompleted] = React21.useState({});
3037
+ return /* @__PURE__ */ React21.createElement(Box15, { sx: { width: "100%" } }, /* @__PURE__ */ React21.createElement(Stepper, { nonLinear: true, activeStep: currentStep }, steps.map((label, index) => /* @__PURE__ */ React21.createElement(Step, { key: index, completed: completed[index] }, /* @__PURE__ */ React21.createElement(
3038
+ StepButton,
3039
+ {
3040
+ color: "inherit",
3041
+ disabled: !(index === 0 && currentStep === 1),
3042
+ onClick: () => {
3043
+ if (index === 0 && currentStep === 1) {
3044
+ setCurrentStep(0);
3045
+ }
3046
+ }
3047
+ },
3048
+ label
3049
+ )))));
3050
+ }
3051
+
3052
+ // src/switch-button/index.tsx
3053
+ import { Box as Box16, FormControlLabel as FormControlLabel3, Switch } from "@mui/material";
3054
+ import { styled as styled2 } from "@mui/system";
3055
+ import React22 from "react";
3056
+ var CustomSwitch = styled2(Switch)(({ theme }) => ({
3057
+ "& .MuiSwitch-switchBase.Mui-checked": {
3058
+ color: theme.palette.primary.main
3059
+ },
3060
+ "& .MuiSwitch-switchBase": {
3061
+ color: "#757575"
3062
+ },
3063
+ "& .MuiSwitch-track": {
3064
+ backgroundColor: "#E0E0E0"
3065
+ },
3066
+ "& .MuiSwitch-track.Mui-checked": {
3067
+ backgroundColor: theme.palette.primary.light
3068
+ }
3069
+ }));
3070
+ var BoxContainer = styled2(Box16)(({ theme }) => ({
3071
+ display: "flex",
3072
+ alignItems: "center",
3073
+ padding: "5px",
3074
+ backgroundColor: "#fafafa",
3075
+ borderRadius: "10px",
3076
+ transition: "all 0.3s ease",
3077
+ "&:hover": {
3078
+ backgroundColor: theme.palette.action.hover
3079
+ },
3080
+ // Conditionally apply smaller padding for mobile devices
3081
+ "@media (max-width:700px)": {
3082
+ padding: "0px"
3083
+ // Smaller padding for mobile
3084
+ }
3085
+ }));
3086
+ var LabelContainer = styled2("div")({
3087
+ display: "flex",
3088
+ alignItems: "center",
3089
+ justifyContent: "center",
3090
+ fontSize: "16px",
3091
+ fontWeight: "100",
3092
+ color: "#333",
3093
+ marginLeft: "8px",
3094
+ transition: "all 0.2s ease",
3095
+ // Conditionally apply smaller font size and margin for mobile devices
3096
+ "@media (max-width:700px)": {
3097
+ fontSize: "14px",
3098
+ // Smaller font size for mobile
3099
+ marginLeft: "2px",
3100
+ // Smaller margin for mobile
3101
+ marginRight: "0px"
3102
+ // Smaller
3103
+ }
3104
+ });
3105
+ var SwitchWithIcons = ({
3106
+ checked,
3107
+ handleChange,
3108
+ iconChecked,
3109
+ iconUnchecked
3110
+ }) => {
3111
+ return /* @__PURE__ */ React22.createElement(BoxContainer, null, /* @__PURE__ */ React22.createElement(
3112
+ FormControlLabel3,
3113
+ {
3114
+ control: /* @__PURE__ */ React22.createElement(
3115
+ CustomSwitch,
3116
+ {
3117
+ checked,
3118
+ onChange: handleChange,
3119
+ name: "switch"
3120
+ }
3121
+ ),
3122
+ label: /* @__PURE__ */ React22.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ React22.createElement("div", { style: { fontSize: 22, color: "#4CAF50" } }, "\u2714") : iconUnchecked ? iconUnchecked : /* @__PURE__ */ React22.createElement("div", { style: { fontSize: 20, color: "#757575" } }, "\u2718"))
3123
+ }
3124
+ ));
3125
+ };
3126
+ var switch_button_default = SwitchWithIcons;
3127
+
3128
+ // src/table/index.tsx
3129
+ import { Typography as Typography11 } from "@mui/material";
3130
+ import Skeleton2 from "@mui/material/Skeleton";
3131
+ import { styled as styled3 } from "@mui/material/styles";
3132
+ import {
3133
+ DataGrid
3134
+ } from "@mui/x-data-grid";
3135
+ import React23, { useEffect as useEffect8 } from "react";
3136
+ var ScrollableContainer = styled3("div")({
3137
+ width: "100%",
3138
+ overflowX: "auto"
3139
+ // Enable horizontal scrolling
3140
+ });
3141
+ var Table = ({
3142
+ pagingmode,
3143
+ totalRows,
3144
+ rows,
3145
+ columns,
3146
+ paginationModel,
3147
+ setPaginationModel,
3148
+ loading,
3149
+ rowId,
3150
+ _tools,
3151
+ _CustomFooter,
3152
+ rowInPage,
3153
+ highlightedRowId,
3154
+ evenRowBgColor = "transparent",
3155
+ sortFieldMapping,
3156
+ setsortQuery,
3157
+ sortQuery,
3158
+ fontSize,
3159
+ ...rest
3160
+ }) => {
3161
+ const [sortModel, setSortModel] = React23.useState([]);
3162
+ const handleSetQueryOptions = (options) => {
3163
+ if (!Array.isArray(options)) return;
3164
+ const formattedOptions = options.reduce((acc, item) => {
3165
+ const field = sortFieldMapping?.[item.field] || item.field;
3166
+ acc[field] = item.sort == "ask" ? 0 : 1;
3167
+ return acc;
3168
+ }, {});
3169
+ setsortQuery && setsortQuery(formattedOptions);
3170
+ };
3171
+ useEffect8(() => {
3172
+ if (sortQuery && Object.keys(sortQuery).length > 0) {
3173
+ const queryKey = Object.keys(sortQuery)[0];
3174
+ if (sortFieldMapping) {
3175
+ const fieldName = Object.keys(sortFieldMapping).find(
3176
+ (key) => sortFieldMapping[key] === queryKey
3177
+ );
3178
+ if (fieldName) {
3179
+ const sortDirection = sortQuery[queryKey];
3180
+ setSortModel([
3181
+ { field: fieldName, sort: sortDirection == 0 ? "asc" : "desc" }
3182
+ ]);
3183
+ }
3184
+ }
3185
+ } else {
3186
+ setSortModel([]);
3187
+ }
3188
+ }, [sortQuery]);
3189
+ const handleSortModelChange = React23.useCallback(
3190
+ (sortModel2) => {
3191
+ handleSetQueryOptions(
3192
+ sortModel2.map((item) => ({
3193
+ field: item.field,
3194
+ sort: item.sort === "asc" ? "ask" : item.sort === "desc" ? "desc" : item.sort
3195
+ }))
3196
+ );
3197
+ },
3198
+ []
3199
+ );
3200
+ const option = {
3201
+ ...!!setsortQuery && {
3202
+ sortingMode: "server",
3203
+ onSortModelChange: handleSortModelChange,
3204
+ sortModel
3205
+ },
3206
+ ...!pagingmode && { paginationMode: "server" },
3207
+ ...pagingmode == "client" && { paginationMode: "client" },
3208
+ ...!pagingmode && {
3209
+ onPaginationModelChange: setPaginationModel,
3210
+ paginationModel
3211
+ },
3212
+ ...pagingmode == "client" && {
3213
+ initialState: {
3214
+ pagination: {
3215
+ paginationModel: {
3216
+ pageSize: rowInPage ? rowInPage : 5,
3217
+ // Default page size (5)
3218
+ page: paginationModel?.page || 0
3219
+ // Default to page 0 if not provided
3220
+ }
3221
+ }
3222
+ }
3223
+ },
3224
+ ...pagingmode == "client" && {
3225
+ paginationModel
3226
+ // Connect paginationModel to DataGrid
3227
+ }
3228
+ };
3229
+ return /* @__PURE__ */ React23.createElement(ScrollableContainer, null, /* @__PURE__ */ React23.createElement(
3230
+ DataGrid,
3231
+ {
3232
+ rows,
3233
+ columns: columns.map((column) => ({ ...column })),
3234
+ disableRowSelectionOnClick: true,
3235
+ pagination: true,
3236
+ sx: {
3237
+ fontSize: fontSize ?? "0.875rem",
3238
+ "& .MuiDataGrid-columnHeaders": {
3239
+ backgroundColor: "rgba(0, 0, 0, 0.1)"
3240
+ },
3241
+ "& .MuiDataGrid-columnHeaderTitle": {
3242
+ fontSize: fontSize ?? "1rem"
3243
+ },
3244
+ "& .MuiDataGrid-row:nth-of-type(even)": {
3245
+ backgroundColor: evenRowBgColor
3246
+ },
3247
+ ...highlightedRowId && {
3248
+ "& .MuiDataGrid-row": {
3249
+ [`&[data-id="${highlightedRowId}"]`]: {
3250
+ backgroundColor: "#c5edd0"
3251
+ }
3252
+ }
3253
+ }
3254
+ },
3255
+ ...option,
3256
+ onPaginationModelChange: setPaginationModel,
3257
+ getRowId: rowId,
3258
+ disableColumnResize: true,
3259
+ autoHeight: true,
3260
+ rowCount: totalRows,
3261
+ pageSizeOptions: [5, 10, 25, 50, 75, 100],
3262
+ slotProps: {
3263
+ pagination: {
3264
+ labelRowsPerPage: "\u062A\u0639\u062F\u0627\u062F \u062F\u0631 \u0647\u0631 \u0635\u0641\u062D\u0647"
3265
+ }
3266
+ },
3267
+ disableColumnMenu: true,
3268
+ disableColumnFilter: true,
3269
+ loading,
3270
+ localeText: {
3271
+ noRowsLabel: "\u0647\u06CC\u0686 \u062F\u0627\u062F\u0647\u200C\u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F!",
3272
+ noResultsOverlayLabel: "\u0647\u06CC\u0686 \u062F\u0627\u062F\u0647\u200C\u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F!",
3273
+ MuiTablePagination: {
3274
+ labelDisplayedRows: ({ from, to, count }) => loading ? /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(
3275
+ Skeleton2,
3276
+ {
3277
+ variant: "text",
3278
+ width: 30,
3279
+ style: { display: "inline-block" }
3280
+ }
3281
+ ), " ", /* @__PURE__ */ React23.createElement(
3282
+ Skeleton2,
3283
+ {
3284
+ variant: "text",
3285
+ width: 30,
3286
+ style: { display: "inline-block" }
3287
+ }
3288
+ )) : `${from} - ${!isNaN(to) ? to : "..."} \u0627\u0632 ${count !== void 0 ? count : "..."}`
3289
+ },
3290
+ footerRowSelected: (count) => /* @__PURE__ */ React23.createElement(Typography11, null, "\u0633\u0637\u0631 \u0647\u0627\u06CC \u0627\u0646\u062A\u062E\u0627\u0628 \u0634\u062F\u0647 : ", count)
3291
+ },
3292
+ ...rest
3293
+ }
3294
+ ));
3295
+ };
3296
+ var table_default = Table;
3297
+
3298
+ // src/text-field/number-type/index.tsx
3299
+ import TextField3 from "@mui/material/TextField";
3300
+ import { forwardRef } from "react";
3301
+ import { Controller as Controller8 } from "react-hook-form";
3302
+ import { NumericFormat } from "react-number-format";
3303
+ import CircularProgress3 from "@mui/material/CircularProgress";
3304
+ import InputAdornment2 from "@mui/material/InputAdornment";
3305
+ import React24 from "react";
3306
+ var FormInputNumber = ({
3307
+ name,
3308
+ control,
3309
+ label,
3310
+ endAdornment,
3311
+ thousandSeparator,
3312
+ startAdornment,
3313
+ allowLeadingZeros = false,
3314
+ allowNegative = false,
3315
+ maxLength,
3316
+ isLoading,
3317
+ rules,
3318
+ data,
3319
+ borderColor,
3320
+ decimalScale = 2,
3321
+ ...rest
3322
+ }) => {
3323
+ return /* @__PURE__ */ React24.createElement(
3324
+ Controller8,
3325
+ {
3326
+ rules,
3327
+ name,
3328
+ control,
3329
+ render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ React24.createElement(
3330
+ TextField3,
3331
+ {
3332
+ disabled: isLoading,
3333
+ helperText: error ? error.message : null,
3334
+ size: "small",
3335
+ error: !!error,
3336
+ onChange,
3337
+ value: data && !value ? data : value == null ? "" : value,
3338
+ fullWidth: true,
3339
+ sx: {
3340
+ "& .MuiOutlinedInput-notchedOutline": {
3341
+ borderColor: borderColor ? borderColor : ""
3342
+ },
3343
+ "& .MuiOutlinedInput-root": {
3344
+ borderRadius: "12px",
3345
+ "&:hover fieldset": {
3346
+ borderColor: borderColor ?? "#085938"
3347
+ },
3348
+ "&.Mui-focused fieldset": {
3349
+ borderColor: borderColor ?? "#085938"
3350
+ }
3351
+ },
3352
+ "& .MuiInputLabel-root.Mui-focused": {
3353
+ color: "#085938"
3354
+ }
3355
+ },
3356
+ label,
3357
+ inputRef: ref,
3358
+ variant: "outlined",
3359
+ InputLabelProps: { shrink: true },
3360
+ InputProps: {
3361
+ inputComponent: NumericFormatCustom,
3362
+ inputProps: {
3363
+ thousandSeparator,
3364
+ allowLeadingZeros,
3365
+ allowNegative,
3366
+ maxLength,
3367
+ decimalScale
3368
+ },
3369
+ endAdornment: isLoading ? /* @__PURE__ */ React24.createElement(InputAdornment2, { position: "end" }, /* @__PURE__ */ React24.createElement(CircularProgress3, { size: 20 })) : null,
3370
+ startAdornment
3371
+ },
3372
+ ...rest
3373
+ }
3374
+ )
3375
+ }
3376
+ );
3377
+ };
3378
+ var NumericFormatCustom = forwardRef(
3379
+ function NumericFormatCustom2(props, ref) {
3380
+ const {
3381
+ onChange,
3382
+ thousandSeparator,
3383
+ allowLeadingZeros,
3384
+ allowNegative,
3385
+ maxLength,
3386
+ decimalScale,
3387
+ ...other
3388
+ } = props;
3389
+ return /* @__PURE__ */ React24.createElement(
3390
+ NumericFormat,
3391
+ {
3392
+ ...other,
3393
+ getInputRef: ref,
3394
+ onValueChange: (values) => {
3395
+ onChange({
3396
+ target: {
3397
+ name: props.name,
3398
+ value: values.value
3399
+ }
3400
+ });
3401
+ },
3402
+ maxLength,
3403
+ allowLeadingZeros,
3404
+ thousandSeparator,
3405
+ valueIsNumericString: true,
3406
+ allowNegative,
3407
+ decimalScale,
3408
+ fixedDecimalScale: false,
3409
+ dir: "ltr"
3410
+ }
3411
+ );
3412
+ }
3413
+ );
3414
+ var number_type_default = FormInputNumber;
3415
+
3416
+ // src/text-field/text-type/index.tsx
3417
+ import CircularProgress4 from "@mui/material/CircularProgress";
3418
+ import InputAdornment3 from "@mui/material/InputAdornment";
3419
+ import TextField4 from "@mui/material/TextField";
3420
+ import React25 from "react";
3421
+ import { Controller as Controller9 } from "react-hook-form";
3422
+ var FormInputText = ({
3423
+ name,
3424
+ control,
3425
+ label,
3426
+ maxLength,
3427
+ readOnly,
3428
+ rules,
3429
+ size = "small",
3430
+ disabled = false,
3431
+ multiline,
3432
+ isLoading,
3433
+ onBlurHandler,
3434
+ rows,
3435
+ ...rest
3436
+ }) => {
3437
+ return /* @__PURE__ */ React25.createElement(
3438
+ Controller9,
3439
+ {
3440
+ name,
3441
+ control,
3442
+ rules,
3443
+ render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ React25.createElement(
3444
+ TextField4,
3445
+ {
3446
+ disabled: disabled || isLoading,
3447
+ helperText: error ? error.message : null,
3448
+ multiline,
3449
+ size,
3450
+ rows: rows ? rows : void 0,
3451
+ error: !!error,
3452
+ onChange,
3453
+ value,
3454
+ fullWidth: true,
3455
+ label,
3456
+ variant: "outlined",
3457
+ inputProps: {
3458
+ ...rest.inputProps,
3459
+ maxLength,
3460
+ readOnly
3461
+ },
3462
+ InputProps: {
3463
+ endAdornment: isLoading ? /* @__PURE__ */ React25.createElement(InputAdornment3, { position: "end" }, /* @__PURE__ */ React25.createElement(CircularProgress4, { size: 20 })) : null
3464
+ },
3465
+ InputLabelProps: { shrink: true },
3466
+ inputRef: ref,
3467
+ ...rest
3468
+ }
3469
+ )
3470
+ }
3471
+ );
3472
+ };
3473
+ var text_type_default = FormInputText;
3474
+
3475
+ // src/upload-image/index.tsx
3476
+ import React26 from "react";
3477
+ import {
3478
+ Controller as Controller10
3479
+ } from "react-hook-form";
3480
+ import { Box as Box17, Button as Button11, Stack as Stack5, Typography as Typography12 } from "@mui/material";
3481
+ import { GrUpload, GrGallery } from "react-icons/gr";
3482
+ import { MdOutlineCameraAlt } from "react-icons/md";
3483
+ import Image3 from "next/image";
3484
+ var UploadImage = ({
3485
+ placeholder,
3486
+ name,
3487
+ selectedImage,
3488
+ setSelectedImage,
3489
+ control,
3490
+ errors,
3491
+ setValue,
3492
+ height,
3493
+ allowGallery = false,
3494
+ imageFit = "cover"
3495
+ }) => {
3496
+ const compressImage = (file, quality = 0.8, maxWidth = 800, maxHeight = 800) => {
3497
+ return new Promise((resolve) => {
3498
+ const reader = new FileReader();
3499
+ reader.readAsDataURL(file);
3500
+ reader.onload = (event) => {
3501
+ const img = new window.Image();
3502
+ img.src = event.target?.result;
3503
+ img.onload = () => {
3504
+ const canvas = document.createElement("canvas");
3505
+ let width = img.width;
3506
+ let height2 = img.height;
3507
+ if (width > maxWidth) {
3508
+ height2 *= maxWidth / width;
3509
+ width = maxWidth;
3510
+ }
3511
+ if (height2 > maxHeight) {
3512
+ width *= maxHeight / height2;
3513
+ height2 = maxHeight;
3514
+ }
3515
+ canvas.width = width;
3516
+ canvas.height = height2;
3517
+ const ctx = canvas.getContext("2d");
3518
+ if (ctx) {
3519
+ ctx.drawImage(img, 0, 0, width, height2);
3520
+ canvas.toBlob(
3521
+ (blob) => {
3522
+ if (blob) {
3523
+ const compressedFile = new File([blob], file.name, {
3524
+ type: "image/jpeg",
3525
+ lastModified: Date.now()
3526
+ });
3527
+ resolve(compressedFile);
3528
+ } else {
3529
+ resolve(null);
3530
+ }
3531
+ },
3532
+ "image/jpeg",
3533
+ quality
3534
+ );
3535
+ } else {
3536
+ resolve(null);
3537
+ }
3538
+ };
3539
+ };
3540
+ });
3541
+ };
3542
+ const handleImageChange = async (event, source) => {
3543
+ const file = event.target.files?.[0];
3544
+ if (file) {
3545
+ console.log(`Original File Size: ${(file.size / 1024).toFixed(2)} KB`);
3546
+ const compressedFile = await compressImage(file);
3547
+ if (compressedFile) {
3548
+ console.log(
3549
+ `Compressed File Size: ${(compressedFile.size / 1024).toFixed(2)} KB`
3550
+ );
3551
+ const objectURL = URL.createObjectURL(compressedFile);
3552
+ setSelectedImage(objectURL);
3553
+ setValue(name, compressedFile);
3554
+ }
3555
+ }
3556
+ };
3557
+ return /* @__PURE__ */ React26.createElement(
3558
+ Controller10,
3559
+ {
3560
+ name,
3561
+ control,
3562
+ render: ({ field }) => /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(
3563
+ "label",
3564
+ {
3565
+ htmlFor: "file-upload",
3566
+ style: {
3567
+ width: "100%",
3568
+ height: height || "200px",
3569
+ maxHeight: height ? "55vh" : "",
3570
+ border: selectedImage ? "" : "2px dashed #ccc",
3571
+ borderRadius: "10px",
3572
+ display: "flex",
3573
+ alignItems: "center",
3574
+ justifyContent: "center",
3575
+ color: "#aaa",
3576
+ marginTop: "2rem",
3577
+ cursor: allowGallery ? "default" : "pointer",
3578
+ position: "relative",
3579
+ overflow: "hidden"
3580
+ }
3581
+ },
3582
+ selectedImage ? /* @__PURE__ */ React26.createElement(
3583
+ Image3,
3584
+ {
3585
+ src: selectedImage,
3586
+ alt: "Preview",
3587
+ fill: true,
3588
+ objectFit: imageFit
3589
+ }
3590
+ ) : /* @__PURE__ */ React26.createElement(
3591
+ Stack5,
3592
+ {
3593
+ spacing: allowGallery ? 2 : 0,
3594
+ sx: { pt: allowGallery ? 2 : 0 }
3595
+ },
3596
+ /* @__PURE__ */ React26.createElement(
3597
+ Box17,
3598
+ {
3599
+ sx: {
3600
+ display: "flex",
3601
+ justifyContent: "center",
3602
+ alignItems: "center",
3603
+ gap: 1.5
3604
+ }
3605
+ },
3606
+ /* @__PURE__ */ React26.createElement(Box17, { sx: { paddingBottom: "0.5rem" } }, /* @__PURE__ */ React26.createElement(GrUpload, null)),
3607
+ placeholder
3608
+ ),
3609
+ allowGallery && /* @__PURE__ */ React26.createElement(Stack5, { spacing: 1.5 }, /* @__PURE__ */ React26.createElement(
3610
+ Button11,
3611
+ {
3612
+ sx: { width: "9rem" },
3613
+ variant: "outlined",
3614
+ color: "info",
3615
+ startIcon: /* @__PURE__ */ React26.createElement(MdOutlineCameraAlt, { size: 16 }),
3616
+ onClick: () => document.getElementById("camera-upload")?.click()
3617
+ },
3618
+ "\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0632 \u062F\u0648\u0631\u0628\u06CC\u0646"
3619
+ ), /* @__PURE__ */ React26.createElement(
3620
+ Button11,
3621
+ {
3622
+ sx: { width: "9rem" },
3623
+ variant: "outlined",
3624
+ color: "info",
3625
+ startIcon: /* @__PURE__ */ React26.createElement(GrGallery, { size: 16 }),
3626
+ onClick: () => document.getElementById("gallery-upload")?.click()
3627
+ },
3628
+ "\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0632 \u06AF\u0627\u0644\u0631\u06CC"
3629
+ )),
3630
+ !allowGallery && /* @__PURE__ */ React26.createElement(
3631
+ "input",
3632
+ {
3633
+ id: "file-upload",
3634
+ type: "file",
3635
+ accept: "image/*",
3636
+ capture: allowGallery ? void 0 : "environment",
3637
+ onChange: (event) => {
3638
+ handleImageChange(event, "camera");
3639
+ field.onChange(event.target.files?.[0] || null);
3640
+ },
3641
+ style: { display: "none" }
3642
+ }
3643
+ )
3644
+ )
3645
+ ), /* @__PURE__ */ React26.createElement(
3646
+ "input",
3647
+ {
3648
+ id: "gallery-upload",
3649
+ type: "file",
3650
+ accept: "image/*",
3651
+ onChange: (event) => {
3652
+ handleImageChange(event, "gallery");
3653
+ field.onChange(event.target.files?.[0] || null);
3654
+ },
3655
+ style: { display: "none" }
3656
+ }
3657
+ ), /* @__PURE__ */ React26.createElement(
3658
+ "input",
3659
+ {
3660
+ id: "camera-upload",
3661
+ type: "file",
3662
+ accept: "image/*",
3663
+ capture: "environment",
3664
+ onChange: (event) => {
3665
+ handleImageChange(event, "camera");
3666
+ field.onChange(event.target.files?.[0] || null);
3667
+ },
3668
+ style: { display: "none" }
3669
+ }
3670
+ ), selectedImage && /* @__PURE__ */ React26.createElement(
3671
+ Box17,
3672
+ {
3673
+ sx: { display: "flex", justifyContent: "center", marginTop: 2 }
3674
+ },
3675
+ /* @__PURE__ */ React26.createElement(
3676
+ Button11,
3677
+ {
3678
+ onClick: () => {
3679
+ setSelectedImage(null);
3680
+ setValue(name, null);
3681
+ document.getElementById(
3682
+ "gallery-upload"
3683
+ ).value = "";
3684
+ document.getElementById("camera-upload").value = "";
3685
+ },
3686
+ variant: "outlined",
3687
+ color: "error",
3688
+ sx: {
3689
+ padding: "0.25rem 1rem",
3690
+ fontSize: 14
3691
+ }
3692
+ },
3693
+ "\u062D\u0630\u0641 \u062A\u0635\u0648\u06CC\u0631"
3694
+ )
3695
+ ), errors[name] && /* @__PURE__ */ React26.createElement(Typography12, { color: "error", variant: "body2", sx: { mt: 1.5, ml: 1 } }, String(errors[name]?.message || "")))
3696
+ }
3697
+ );
3698
+ };
3699
+ var upload_image_default = UploadImage;
3700
+
3701
+ // src/accordion/index.tsx
3702
+ import { styled as styled4 } from "@mui/material/styles";
3703
+ import { IoIosArrowForward } from "react-icons/io";
3704
+ import MuiAccordion from "@mui/material/Accordion";
3705
+ import MuiAccordionSummary, {
3706
+ accordionSummaryClasses
3707
+ } from "@mui/material/AccordionSummary";
3708
+ import MuiAccordionDetails from "@mui/material/AccordionDetails";
3709
+ import {
3710
+ Typography as Typography13
3711
+ } from "@mui/material";
3712
+ import { useState as useState11 } from "react";
3713
+ function Page({
3714
+ data
3715
+ }) {
3716
+ const Accordion = styled4((props) => /* @__PURE__ */ React.createElement(MuiAccordion, { disableGutters: true, elevation: 0, square: true, ...props }))(({ theme }) => ({
3717
+ border: `1px solid ${theme.palette.divider}`,
3718
+ "&:not(:last-child)": {
3719
+ borderBottom: 0
3720
+ },
3721
+ "&::before": {
3722
+ display: "none"
3723
+ }
3724
+ }));
3725
+ const AccordionSummary = styled4((props) => /* @__PURE__ */ React.createElement(MuiAccordionSummary, { expandIcon: /* @__PURE__ */ React.createElement(IoIosArrowForward, null), ...props }))(({ theme }) => ({
3726
+ backgroundColor: "rgba(0, 0, 0, .03)",
3727
+ flexDirection: "row-reverse",
3728
+ [`& .${accordionSummaryClasses.expandIconWrapper}.${accordionSummaryClasses.expanded}`]: {
3729
+ transform: "rotate(90deg)"
3730
+ },
3731
+ [`& .${accordionSummaryClasses.content}`]: {
3732
+ marginLeft: theme.spacing(1)
3733
+ },
3734
+ ...theme.applyStyles("dark", {
3735
+ backgroundColor: "rgba(255, 255, 255, .05)"
3736
+ })
3737
+ }));
3738
+ const AccordionDetails = styled4(MuiAccordionDetails)(({ theme }) => ({
3739
+ padding: theme.spacing(2),
3740
+ borderTop: "1px solid rgba(0, 0, 0, .125)"
3741
+ }));
3742
+ const [expanded, setExpanded] = useState11("");
3743
+ const handleChange = (panel) => (event, newExpanded) => {
3744
+ setExpanded(newExpanded ? panel : false);
3745
+ };
3746
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, data.map((item, index) => {
3747
+ const panelId = `panel${index}`;
3748
+ return /* @__PURE__ */ React.createElement(
3749
+ Accordion,
3750
+ {
3751
+ key: panelId,
3752
+ expanded: expanded === panelId,
3753
+ onChange: handleChange(panelId)
3754
+ },
3755
+ /* @__PURE__ */ React.createElement(
3756
+ AccordionSummary,
3757
+ {
3758
+ "aria-controls": `${panelId}-content`,
3759
+ id: `${panelId}-header`,
3760
+ sx: {
3761
+ "& .MuiAccordionSummary-expandIconWrapper": {
3762
+ color: "inherit"
3763
+ }
3764
+ }
3765
+ },
3766
+ /* @__PURE__ */ React.createElement(Typography13, { component: "span" }, item.title)
3767
+ ),
3768
+ /* @__PURE__ */ React.createElement(AccordionDetails, null, item.body)
3769
+ );
3770
+ }));
3771
+ }
3772
+ export {
3773
+ Page as Accordion,
3774
+ AdvancedSearchButton,
3775
+ ConfirmationDialog,
3776
+ CustomCheckbox,
3777
+ CustomTimePicker,
3778
+ DateFilter,
3779
+ DateFilterRange,
3780
+ date_picker_default as DatePicker,
3781
+ date_time_picker_default as DateTimePicker,
3782
+ date_time_range_picker_default as DateTimeRangePicker,
3783
+ number_type_default as FormInputNumber,
3784
+ text_type_default as FormInputText,
3785
+ HorizontalStepper,
3786
+ LicensePlate,
3787
+ Loading,
3788
+ mobile_date_time_picker_default as MobileDateTimePicker,
3789
+ ConfirmationDialog2 as Modal,
3790
+ selector_default as NestedSelectort,
3791
+ NoResult,
3792
+ PaginationList,
3793
+ RadioButton,
3794
+ SearchLicensePlate,
3795
+ MultipleSelectChip as Selector,
3796
+ card_skeleton_default as SkeletonCard,
3797
+ SonarSpinner,
3798
+ switch_button_default as SwitchButton,
3799
+ table_default as Table,
3800
+ upload_image_default as UploadImage
3801
+ };
3802
+ //# sourceMappingURL=index.mjs.map