@mamrp/components 1.3.2 → 1.4.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.
@@ -0,0 +1,752 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/date-pickers/index.ts
31
+ var date_pickers_exports = {};
32
+ __export(date_pickers_exports, {
33
+ DateRangePicker: () => date_range_picker_default
34
+ });
35
+ module.exports = __toCommonJS(date_pickers_exports);
36
+
37
+ // react-shim.js
38
+ var React = __toESM(require("react"));
39
+
40
+ // src/date-pickers/date-range-picker/index.tsx
41
+ var import_react = __toESM(require("react"));
42
+ var import_material = require("@mui/material");
43
+ var import_md = require("react-icons/md");
44
+ var import_react_hook_form = require("react-hook-form");
45
+ var import_x_date_pickers = require("@mui/x-date-pickers");
46
+ var import_AdapterMomentJalaali = require("@mui/x-date-pickers/AdapterMomentJalaali");
47
+ var import_moment_jalaali = __toESM(require("moment-jalaali"));
48
+ import_moment_jalaali.default.locale("fa");
49
+ import_moment_jalaali.default.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
50
+ var DateRangePicker = ({
51
+ fromDate,
52
+ toDate,
53
+ fromViews = ["year", "month", "day"],
54
+ fromOpenTo = "day",
55
+ toViews = ["year", "month", "day"],
56
+ toOpenTo = "day",
57
+ control,
58
+ label = "\u0627\u0646\u062A\u062E\u0627\u0628 \u0628\u0627\u0632\u0647",
59
+ size = "medium",
60
+ disabled = false,
61
+ persian = true,
62
+ align = "left",
63
+ isLoading = false,
64
+ minDate,
65
+ maxDate,
66
+ clear = true,
67
+ singleCalendar = false,
68
+ // Default to dual calendars on desktop
69
+ useMobilePickers = false,
70
+ // Default to calendar popup style
71
+ dualCalendar = false
72
+ // Default to single calendar with smart tabs
73
+ }) => {
74
+ const [open, setOpen] = (0, import_react.useState)(false);
75
+ const [anchorEl, setAnchorEl] = (0, import_react.useState)(null);
76
+ const [tempStartDate, setTempStartDate] = (0, import_react.useState)(null);
77
+ const [tempEndDate, setTempEndDate] = (0, import_react.useState)(null);
78
+ const [secondCalendarMonth, setSecondCalendarMonth] = (0, import_react.useState)((0, import_moment_jalaali.default)());
79
+ const [activeTab, setActiveTab] = (0, import_react.useState)("from");
80
+ const [autoSelectMode, setAutoSelectMode] = (0, import_react.useState)(true);
81
+ const isMobile = (0, import_material.useMediaQuery)("(max-width:700px)");
82
+ const showSingleCalendar = isMobile || singleCalendar || !dualCalendar;
83
+ const {
84
+ field: fieldFrom,
85
+ fieldState: { error: errorFrom }
86
+ } = (0, import_react_hook_form.useController)({ name: fromDate, control });
87
+ const {
88
+ field: fieldTo,
89
+ fieldState: { error: errorTo }
90
+ } = (0, import_react_hook_form.useController)({ name: toDate, control });
91
+ const handleOpen = (event) => {
92
+ if (!disabled && !isLoading) {
93
+ setAnchorEl(event.currentTarget);
94
+ setOpen(true);
95
+ }
96
+ };
97
+ const handleClose = () => {
98
+ setOpen(false);
99
+ setTempStartDate(null);
100
+ setTempEndDate(null);
101
+ };
102
+ (0, import_react.useEffect)(() => {
103
+ if (open) {
104
+ if (fieldFrom.value) {
105
+ setTempStartDate((0, import_moment_jalaali.default)(fieldFrom.value));
106
+ setSecondCalendarMonth((0, import_moment_jalaali.default)(fieldFrom.value));
107
+ } else {
108
+ setSecondCalendarMonth((0, import_moment_jalaali.default)());
109
+ }
110
+ if (fieldTo.value) {
111
+ setTempEndDate((0, import_moment_jalaali.default)(fieldTo.value));
112
+ }
113
+ }
114
+ }, [open, fieldFrom.value, fieldTo.value]);
115
+ const handleDaySelect = (day, calendarSide) => {
116
+ if (!dualCalendar && showSingleCalendar) {
117
+ if (autoSelectMode) {
118
+ if (!tempStartDate && !tempEndDate) {
119
+ setTempStartDate(day);
120
+ setActiveTab("to");
121
+ } else if (tempStartDate && !tempEndDate) {
122
+ if (day.isBefore(tempStartDate)) {
123
+ setTempEndDate(tempStartDate);
124
+ setTempStartDate(day);
125
+ } else {
126
+ setTempEndDate(day);
127
+ }
128
+ } else if (!tempStartDate && tempEndDate) {
129
+ if (day.isAfter(tempEndDate)) {
130
+ setTempStartDate(tempEndDate);
131
+ setTempEndDate(day);
132
+ } else {
133
+ setTempStartDate(day);
134
+ }
135
+ } else {
136
+ setTempStartDate(day);
137
+ setTempEndDate(null);
138
+ setActiveTab("to");
139
+ }
140
+ } else {
141
+ if (activeTab === "from") {
142
+ setTempStartDate(day);
143
+ setActiveTab("to");
144
+ } else {
145
+ setTempEndDate(day);
146
+ setActiveTab("from");
147
+ }
148
+ }
149
+ } else {
150
+ if (!tempStartDate && !tempEndDate) {
151
+ if (calendarSide === "right") {
152
+ setTempStartDate(day);
153
+ } else {
154
+ setTempEndDate(day);
155
+ }
156
+ } else if (tempStartDate && tempEndDate) {
157
+ setTempStartDate(day);
158
+ setTempEndDate(null);
159
+ } else if (tempStartDate && !tempEndDate) {
160
+ if (day.isBefore(tempStartDate)) {
161
+ setTempEndDate(tempStartDate);
162
+ setTempStartDate(day);
163
+ } else {
164
+ setTempEndDate(day);
165
+ }
166
+ } else if (!tempStartDate && tempEndDate) {
167
+ if (day.isAfter(tempEndDate)) {
168
+ setTempStartDate(tempEndDate);
169
+ setTempEndDate(day);
170
+ } else {
171
+ setTempStartDate(day);
172
+ }
173
+ }
174
+ }
175
+ };
176
+ const handleConfirm = () => {
177
+ if (tempStartDate) {
178
+ fieldFrom.onChange(tempStartDate.locale("en").format("YYYY-MM-DD"));
179
+ }
180
+ if (tempEndDate) {
181
+ fieldTo.onChange(tempEndDate.locale("en").format("YYYY-MM-DD"));
182
+ }
183
+ setOpen(false);
184
+ setTempStartDate(null);
185
+ setTempEndDate(null);
186
+ };
187
+ const handleClear = () => {
188
+ fieldFrom.onChange(null);
189
+ fieldTo.onChange(null);
190
+ setTempStartDate(null);
191
+ setTempEndDate(null);
192
+ setActiveTab("from");
193
+ };
194
+ const handleInputClear = (event) => {
195
+ event.stopPropagation();
196
+ fieldFrom.onChange(null);
197
+ fieldTo.onChange(null);
198
+ setTempStartDate(null);
199
+ setTempEndDate(null);
200
+ setActiveTab("from");
201
+ };
202
+ const displayValue = () => {
203
+ const start = fieldFrom.value ? (0, import_moment_jalaali.default)(fieldFrom.value) : null;
204
+ const end = fieldTo.value ? (0, import_moment_jalaali.default)(fieldTo.value) : null;
205
+ if (start && end) {
206
+ return persian ? `${end.format("jYYYY/jMM/jDD")} - ${start.format("jYYYY/jMM/jDD")}` : `${end.format("YYYY/MM/DD")} - ${start.format("YYYY/MM/DD")}`;
207
+ } else if (start) {
208
+ return persian ? "\u0627\u0632 \u062A\u0627\u0631\u06CC\u062E " + start.format("jYYYY/jMM/jDD") : start.format("YYYY/MM/DD");
209
+ } else if (end) {
210
+ return persian ? "\u062A\u0627 \u062A\u0627\u0631\u06CC\u062E " + end.format("jYYYY/jMM/jDD") : end.format("YYYY/MM/DD");
211
+ }
212
+ return "";
213
+ };
214
+ const error = errorFrom || errorTo;
215
+ const customLocaleText = {
216
+ cancelButtonLabel: "\u0644\u063A\u0648",
217
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
218
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
219
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646"
220
+ };
221
+ return /* @__PURE__ */ import_react.default.createElement(
222
+ import_x_date_pickers.LocalizationProvider,
223
+ {
224
+ dateAdapter: import_AdapterMomentJalaali.AdapterMomentJalaali,
225
+ localeText: customLocaleText
226
+ },
227
+ /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react.default.createElement(
228
+ import_material.TextField,
229
+ {
230
+ label,
231
+ size,
232
+ fullWidth: true,
233
+ value: displayValue(),
234
+ onClick: handleOpen,
235
+ disabled: disabled || isLoading,
236
+ placeholder: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0628\u0627\u0632\u0647 \u062A\u0627\u0631\u06CC\u062E",
237
+ error: !!error,
238
+ InputLabelProps: {
239
+ shrink: true
240
+ },
241
+ InputProps: {
242
+ readOnly: true,
243
+ sx: {
244
+ textAlign: align,
245
+ direction: "ltr",
246
+ cursor: disabled ? "default" : "pointer",
247
+ "& input": {
248
+ textAlign: align
249
+ }
250
+ },
251
+ endAdornment: /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, (fieldFrom.value || fieldTo.value) && !disabled && !isLoading && /* @__PURE__ */ import_react.default.createElement(
252
+ import_material.IconButton,
253
+ {
254
+ size: "small",
255
+ onClick: handleInputClear,
256
+ sx: {
257
+ padding: "4px",
258
+ color: "text.secondary",
259
+ "&:hover": {
260
+ color: "error.main",
261
+ backgroundColor: "rgba(244, 67, 54, 0.08)"
262
+ }
263
+ }
264
+ },
265
+ /* @__PURE__ */ import_react.default.createElement(import_md.MdClear, { size: 16 })
266
+ ), isLoading && /* @__PURE__ */ import_react.default.createElement(import_material.CircularProgress, { size: 20, color: "secondary" }))
267
+ },
268
+ sx: {
269
+ "& .MuiOutlinedInput-root": {
270
+ height: size === "small" ? 40 : 56
271
+ }
272
+ }
273
+ }
274
+ ), error && /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message), /* @__PURE__ */ import_react.default.createElement(
275
+ import_material.Popover,
276
+ {
277
+ open,
278
+ anchorEl,
279
+ onClose: handleClose,
280
+ anchorOrigin: {
281
+ vertical: "bottom",
282
+ horizontal: "left"
283
+ },
284
+ transformOrigin: {
285
+ vertical: "top",
286
+ horizontal: "left"
287
+ },
288
+ slotProps: {
289
+ paper: {
290
+ sx: {
291
+ mt: 1,
292
+ maxWidth: isMobile ? "95vw" : "auto",
293
+ width: isMobile ? "auto" : "auto",
294
+ maxHeight: isMobile ? "90vh" : "auto",
295
+ overflow: isMobile ? "auto" : "visible"
296
+ }
297
+ }
298
+ }
299
+ },
300
+ /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { p: isMobile ? 1 : 2 } }, /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { mb: 2 } }, /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "overline", color: "primary" }, "\u0627\u0646\u062A\u062E\u0627\u0628 \u0628\u0627\u0632\u0647 \u062A\u0627\u0631\u06CC\u062E"), /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "body2", color: "text.secondary" }, tempStartDate && tempEndDate ? `${tempStartDate.format("jDD jMMMM")} \u062A\u0627 ${tempEndDate.format("jDD jMMMM")}` : tempStartDate ? `\u0627\u0632 ${tempStartDate.format("jDD jMMMM")}` : "\u062A\u0627\u0631\u06CC\u062E \u0634\u0631\u0648\u0639 \u0648 \u067E\u0627\u06CC\u0627\u0646 \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F")), useMobilePickers ? (
301
+ // Mobile-style: Use DatePicker inputs
302
+ /* @__PURE__ */ import_react.default.createElement(
303
+ import_material.Box,
304
+ {
305
+ sx: {
306
+ display: "flex",
307
+ flexDirection: "column",
308
+ gap: 2,
309
+ alignItems: "center",
310
+ width: "100%"
311
+ }
312
+ },
313
+ /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "body2", sx: { mb: 1, fontWeight: 500 } }, "\u062A\u0627\u0631\u06CC\u062E \u0634\u0631\u0648\u0639 (\u0627\u0632):"), /* @__PURE__ */ import_react.default.createElement(
314
+ import_x_date_pickers.DatePicker,
315
+ {
316
+ value: tempStartDate,
317
+ onChange: (day) => {
318
+ setTempStartDate(day);
319
+ },
320
+ openTo: fromOpenTo,
321
+ views: fromViews,
322
+ minDate,
323
+ maxDate: maxDate || (0, import_moment_jalaali.default)(),
324
+ slotProps: {
325
+ textField: {
326
+ fullWidth: true,
327
+ size: "small",
328
+ placeholder: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0634\u0631\u0648\u0639"
329
+ }
330
+ }
331
+ }
332
+ )),
333
+ /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "body2", sx: { mb: 1, fontWeight: 500 } }, "\u062A\u0627\u0631\u06CC\u062E \u067E\u0627\u06CC\u0627\u0646 (\u062A\u0627):"), /* @__PURE__ */ import_react.default.createElement(
334
+ import_x_date_pickers.DatePicker,
335
+ {
336
+ value: tempEndDate,
337
+ onChange: (day) => {
338
+ setTempEndDate(day);
339
+ },
340
+ openTo: toOpenTo,
341
+ views: toViews,
342
+ minDate: tempStartDate || minDate,
343
+ maxDate: maxDate || (0, import_moment_jalaali.default)(),
344
+ slotProps: {
345
+ textField: {
346
+ fullWidth: true,
347
+ size: "small",
348
+ placeholder: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u067E\u0627\u06CC\u0627\u0646"
349
+ }
350
+ }
351
+ }
352
+ ))
353
+ )
354
+ ) : (
355
+ // Calendar popup style: Use StaticDatePicker(s)
356
+ /* @__PURE__ */ import_react.default.createElement(
357
+ import_material.Box,
358
+ {
359
+ sx: {
360
+ display: "flex",
361
+ gap: showSingleCalendar ? 0 : 2,
362
+ flexDirection: showSingleCalendar ? "column" : "row",
363
+ alignItems: "center"
364
+ }
365
+ },
366
+ !dualCalendar && showSingleCalendar && /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { width: "100%", mb: 2 } }, /* @__PURE__ */ import_react.default.createElement(
367
+ import_material.Box,
368
+ {
369
+ sx: { display: "flex", justifyContent: "center", mb: 1 }
370
+ },
371
+ /* @__PURE__ */ import_react.default.createElement(
372
+ import_material.Button,
373
+ {
374
+ size: "small",
375
+ variant: autoSelectMode ? "contained" : "outlined",
376
+ onClick: () => setAutoSelectMode(!autoSelectMode),
377
+ sx: { fontSize: "12px", minWidth: "120px" }
378
+ },
379
+ /* @__PURE__ */ import_react.default.createElement(
380
+ import_material.Box,
381
+ {
382
+ sx: {
383
+ display: "flex",
384
+ alignItems: "center",
385
+ gap: 0.5
386
+ }
387
+ },
388
+ autoSelectMode ? /* @__PURE__ */ import_react.default.createElement(import_md.MdTipsAndUpdates, { size: 16 }) : /* @__PURE__ */ import_react.default.createElement(import_md.MdPerson, { size: 16 }),
389
+ autoSelectMode ? "\u0647\u0648\u0634\u0645\u0646\u062F" : "\u062F\u0633\u062A\u06CC"
390
+ )
391
+ )
392
+ ), !autoSelectMode && /* @__PURE__ */ import_react.default.createElement(
393
+ import_material.Box,
394
+ {
395
+ sx: {
396
+ display: "flex",
397
+ justifyContent: "center",
398
+ gap: 1,
399
+ mb: 2,
400
+ borderBottom: 1,
401
+ borderColor: "divider",
402
+ pb: 1
403
+ }
404
+ },
405
+ /* @__PURE__ */ import_react.default.createElement(
406
+ import_material.Button,
407
+ {
408
+ size: "small",
409
+ variant: activeTab === "from" ? "contained" : "outlined",
410
+ onClick: () => setActiveTab("from"),
411
+ sx: {
412
+ minWidth: "140px",
413
+ fontSize: "13px",
414
+ backgroundColor: activeTab === "from" ? "primary.main" : "transparent",
415
+ color: activeTab === "from" ? "white" : "primary.main"
416
+ }
417
+ },
418
+ /* @__PURE__ */ import_react.default.createElement(
419
+ import_material.Box,
420
+ {
421
+ sx: {
422
+ display: "flex",
423
+ alignItems: "center",
424
+ gap: 0.5,
425
+ flexDirection: "column"
426
+ }
427
+ },
428
+ /* @__PURE__ */ import_react.default.createElement(
429
+ import_material.Box,
430
+ {
431
+ sx: {
432
+ display: "flex",
433
+ alignItems: "center",
434
+ gap: 0.5
435
+ }
436
+ },
437
+ /* @__PURE__ */ import_react.default.createElement(import_md.MdDateRange, { size: 16 }),
438
+ "\u0627\u0632 \u062A\u0627\u0631\u06CC\u062E"
439
+ ),
440
+ tempStartDate && /* @__PURE__ */ import_react.default.createElement(
441
+ import_material.Typography,
442
+ {
443
+ variant: "caption",
444
+ sx: { fontSize: "10px" }
445
+ },
446
+ tempStartDate.format("jYYYY/jMM/jDD")
447
+ )
448
+ )
449
+ ),
450
+ /* @__PURE__ */ import_react.default.createElement(
451
+ import_material.Button,
452
+ {
453
+ size: "small",
454
+ variant: activeTab === "to" ? "contained" : "outlined",
455
+ onClick: () => setActiveTab("to"),
456
+ sx: {
457
+ minWidth: "140px",
458
+ fontSize: "13px",
459
+ backgroundColor: activeTab === "to" ? "primary.main" : "transparent",
460
+ color: activeTab === "to" ? "white" : "primary.main"
461
+ }
462
+ },
463
+ /* @__PURE__ */ import_react.default.createElement(
464
+ import_material.Box,
465
+ {
466
+ sx: {
467
+ display: "flex",
468
+ alignItems: "center",
469
+ gap: 0.5,
470
+ flexDirection: "column"
471
+ }
472
+ },
473
+ /* @__PURE__ */ import_react.default.createElement(
474
+ import_material.Box,
475
+ {
476
+ sx: {
477
+ display: "flex",
478
+ alignItems: "center",
479
+ gap: 0.5
480
+ }
481
+ },
482
+ /* @__PURE__ */ import_react.default.createElement(import_md.MdEvent, { size: 16 }),
483
+ "\u062A\u0627 \u062A\u0627\u0631\u06CC\u062E"
484
+ ),
485
+ tempEndDate && /* @__PURE__ */ import_react.default.createElement(
486
+ import_material.Typography,
487
+ {
488
+ variant: "caption",
489
+ sx: { fontSize: "10px" }
490
+ },
491
+ tempEndDate.format("jYYYY/jMM/jDD")
492
+ )
493
+ )
494
+ )
495
+ ), autoSelectMode && /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { textAlign: "center", mb: 2 } }, /* @__PURE__ */ import_react.default.createElement(
496
+ import_material.Typography,
497
+ {
498
+ variant: "caption",
499
+ color: "text.secondary",
500
+ sx: {
501
+ display: "flex",
502
+ alignItems: "center",
503
+ justifyContent: "center",
504
+ gap: 0.5
505
+ }
506
+ },
507
+ !tempStartDate && !tempEndDate ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_md.MdGpsFixed, { size: 14 }), "\u0627\u0648\u0644\u06CC\u0646 \u062A\u0627\u0631\u06CC\u062E \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F") : tempStartDate && !tempEndDate ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_md.MdGpsFixed, { size: 14 }), "\u062A\u0627\u0631\u06CC\u062E \u067E\u0627\u06CC\u0627\u0646 \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F") : tempStartDate && tempEndDate ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_md.MdCheckCircle, { size: 14 }), "\u0628\u0627\u0632\u0647 \u0627\u0646\u062A\u062E\u0627\u0628 \u0634\u062F\u0647 - \u062A\u0627\u0631\u06CC\u062E \u062C\u062F\u06CC\u062F \u0628\u0631\u0627\u06CC \u0634\u0631\u0648\u0639 \u0645\u062C\u062F\u062F") : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_md.MdGpsFixed, { size: 14 }), "\u062A\u0627\u0631\u06CC\u062E \u0634\u0631\u0648\u0639 \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F")
508
+ ))),
509
+ /* @__PURE__ */ import_react.default.createElement(
510
+ import_x_date_pickers.StaticDatePicker,
511
+ {
512
+ value: tempStartDate || (fieldFrom.value ? (0, import_moment_jalaali.default)(fieldFrom.value) : null),
513
+ onChange: (day) => {
514
+ if (day) handleDaySelect(day, "right");
515
+ },
516
+ openTo: fromOpenTo,
517
+ views: fromViews,
518
+ slots: {
519
+ day: (props) => CustomDay({
520
+ ...props,
521
+ startDate: tempStartDate,
522
+ endDate: tempEndDate
523
+ }),
524
+ actionBar: () => null,
525
+ monthButton: (props) => {
526
+ return /* @__PURE__ */ import_react.default.createElement(
527
+ "button",
528
+ {
529
+ className: `${props.className}`,
530
+ style: {
531
+ width: "100%",
532
+ padding: "15px 8px",
533
+ border: "1px solid #ccc",
534
+ borderRadius: "8px",
535
+ backgroundColor: props.disabled ? "#f0f0f0" : "#ffffff",
536
+ fontSize: "17px",
537
+ cursor: props.disabled ? "default" : "pointer",
538
+ textAlign: "center",
539
+ boxSizing: "border-box"
540
+ },
541
+ disabled: props.disabled,
542
+ onFocus: props.onFocus,
543
+ onBlur: props.onBlur,
544
+ onClick: props.onClick,
545
+ ref: props.ref
546
+ },
547
+ props["aria-label"]
548
+ );
549
+ }
550
+ },
551
+ minDate,
552
+ maxDate: maxDate || (0, import_moment_jalaali.default)(),
553
+ slotProps: {
554
+ toolbar: { hidden: true },
555
+ layout: {
556
+ sx: {
557
+ "& .MuiPickersCalendarHeader-root": {
558
+ minHeight: "40px",
559
+ maxHeight: "40px"
560
+ },
561
+ "& .MuiDayCalendar-header": {
562
+ justifyContent: "space-around"
563
+ },
564
+ "& .MuiDayCalendar-weekContainer": {
565
+ justifyContent: "space-around"
566
+ },
567
+ "& .MuiPickersDay-root": {
568
+ fontSize: "0.875rem"
569
+ },
570
+ "& .MuiMonthCalendar-root": {
571
+ display: "grid",
572
+ gridTemplateColumns: "repeat(3, 1fr)",
573
+ gap: "8px",
574
+ width: "100%"
575
+ }
576
+ }
577
+ }
578
+ },
579
+ sx: {
580
+ "& .MuiPickersLayout-contentWrapper": {
581
+ minWidth: showSingleCalendar ? "300px" : "280px",
582
+ maxWidth: showSingleCalendar ? "350px" : "320px"
583
+ }
584
+ }
585
+ }
586
+ ),
587
+ dualCalendar && !showSingleCalendar && /* @__PURE__ */ import_react.default.createElement(
588
+ import_x_date_pickers.StaticDatePicker,
589
+ {
590
+ value: secondCalendarMonth,
591
+ onChange: (day) => {
592
+ if (day) handleDaySelect(day, "left");
593
+ },
594
+ openTo: toOpenTo,
595
+ views: toViews,
596
+ slots: {
597
+ day: (props) => CustomDay({
598
+ ...props,
599
+ startDate: tempStartDate,
600
+ endDate: tempEndDate
601
+ }),
602
+ actionBar: () => null,
603
+ monthButton: (props) => {
604
+ return /* @__PURE__ */ import_react.default.createElement(
605
+ "button",
606
+ {
607
+ className: `${props.className}`,
608
+ style: {
609
+ width: "100%",
610
+ padding: "15px 8px",
611
+ border: "1px solid #ccc",
612
+ borderRadius: "8px",
613
+ backgroundColor: props.disabled ? "#f0f0f0" : "#ffffff",
614
+ fontSize: "17px",
615
+ cursor: props.disabled ? "default" : "pointer",
616
+ textAlign: "center",
617
+ boxSizing: "border-box"
618
+ },
619
+ disabled: props.disabled,
620
+ onFocus: props.onFocus,
621
+ onBlur: props.onBlur,
622
+ onClick: props.onClick,
623
+ ref: props.ref
624
+ },
625
+ props["aria-label"]
626
+ );
627
+ }
628
+ },
629
+ minDate,
630
+ maxDate: maxDate || (0, import_moment_jalaali.default)(),
631
+ slotProps: {
632
+ toolbar: { hidden: true },
633
+ layout: {
634
+ sx: {
635
+ "& .MuiPickersCalendarHeader-root": {
636
+ minHeight: "40px",
637
+ maxHeight: "40px"
638
+ },
639
+ "& .MuiDayCalendar-header": {
640
+ justifyContent: "space-around"
641
+ },
642
+ "& .MuiDayCalendar-weekContainer": {
643
+ justifyContent: "space-around"
644
+ },
645
+ "& .MuiPickersDay-root": {
646
+ fontSize: "0.875rem"
647
+ },
648
+ "& .MuiMonthCalendar-root": {
649
+ display: "grid",
650
+ gridTemplateColumns: "repeat(3, 1fr)",
651
+ gap: "8px",
652
+ width: "100%"
653
+ }
654
+ }
655
+ }
656
+ },
657
+ sx: {
658
+ "& .MuiPickersLayout-contentWrapper": {
659
+ minWidth: "280px",
660
+ maxWidth: "320px"
661
+ }
662
+ },
663
+ onMonthChange: (newMonth) => {
664
+ setSecondCalendarMonth(newMonth);
665
+ }
666
+ }
667
+ )
668
+ )
669
+ ), /* @__PURE__ */ import_react.default.createElement(
670
+ import_material.Box,
671
+ {
672
+ sx: {
673
+ display: "flex",
674
+ justifyContent: "space-between",
675
+ gap: 1,
676
+ mt: 2,
677
+ pt: 2,
678
+ borderTop: 1,
679
+ borderColor: "divider"
680
+ }
681
+ },
682
+ /* @__PURE__ */ import_react.default.createElement(import_material.Box, null, clear && /* @__PURE__ */ import_react.default.createElement(
683
+ import_material.Button,
684
+ {
685
+ size: "small",
686
+ onClick: handleClear,
687
+ disabled: !fieldFrom.value && !fieldTo.value
688
+ },
689
+ "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646"
690
+ )),
691
+ /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { display: "flex", gap: 1 } }, /* @__PURE__ */ import_react.default.createElement(import_material.Button, { size: "small", onClick: handleClose }, "\u0644\u063A\u0648"), /* @__PURE__ */ import_react.default.createElement(
692
+ import_material.Button,
693
+ {
694
+ variant: "contained",
695
+ size: "small",
696
+ onClick: handleConfirm,
697
+ disabled: !tempStartDate && !tempEndDate
698
+ },
699
+ "\u062A\u0623\u06CC\u06CC\u062F"
700
+ ))
701
+ ))
702
+ ))
703
+ );
704
+ };
705
+ function CustomDay(props) {
706
+ const { day, outsideCurrentMonth, startDate, endDate, ...other } = props;
707
+ const isToday = (0, import_moment_jalaali.default)(day).isSame((0, import_moment_jalaali.default)(), "day");
708
+ const isFriday = (0, import_moment_jalaali.default)(day).day() === 5;
709
+ let inRange = false;
710
+ if (startDate && endDate) {
711
+ inRange = day.isAfter(startDate, "day") && day.isBefore(endDate, "day");
712
+ }
713
+ const isStart = startDate && day.isSame(startDate, "day");
714
+ const isEnd = endDate && day.isSame(endDate, "day");
715
+ const isSelected = isStart || isEnd;
716
+ return /* @__PURE__ */ import_react.default.createElement(
717
+ import_x_date_pickers.PickersDay,
718
+ {
719
+ ...other,
720
+ day,
721
+ outsideCurrentMonth,
722
+ selected: false,
723
+ sx: {
724
+ borderRadius: isSelected ? "50%" : inRange ? "100%" : "50%",
725
+ fontSize: "0.9rem",
726
+ width: 34,
727
+ height: 34,
728
+ my: 0.2,
729
+ bgcolor: isSelected ? "primary.main" : inRange ? "rgba(25,118,210,0.12)" : isToday ? "rgba(25,118,210,0.08)" : "transparent",
730
+ color: isSelected ? "#fff" : isFriday ? "error.main" : isToday ? "primary.main" : outsideCurrentMonth ? "text.disabled" : "text.primary",
731
+ fontWeight: isSelected ? 600 : isToday ? 500 : 400,
732
+ "&:hover": {
733
+ bgcolor: isSelected ? "primary.dark" : inRange ? "rgba(25,118,210,0.2)" : "rgba(0,0,0,0.04)"
734
+ },
735
+ ...isStart && endDate && {
736
+ borderTopRightRadius: "50%",
737
+ borderBottomRightRadius: "50%"
738
+ },
739
+ ...isEnd && startDate && {
740
+ borderTopLeftRadius: "50%",
741
+ borderBottomLeftRadius: "50%"
742
+ }
743
+ }
744
+ }
745
+ );
746
+ }
747
+ var date_range_picker_default = DateRangePicker;
748
+ // Annotate the CommonJS export names for ESM import in node:
749
+ 0 && (module.exports = {
750
+ DateRangePicker
751
+ });
752
+ //# sourceMappingURL=index.js.map