@mamrp/components 1.6.9 → 1.7.1

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.js CHANGED
@@ -1357,7 +1357,7 @@ var JalaliDatePicker = ({
1357
1357
  display: "flex",
1358
1358
  alignItems: "center",
1359
1359
  gap: "2px",
1360
- ...clear && { mr: 4.5 }
1360
+ ...clear && field.value && { mr: 4.5 }
1361
1361
  }
1362
1362
  },
1363
1363
  /* @__PURE__ */ import_react7.default.createElement(import_material9.Tooltip, { title: "\u0631\u0648\u0632 \u0642\u0628\u0644" }, /* @__PURE__ */ import_react7.default.createElement(
@@ -1463,6 +1463,10 @@ var JalaliDatePicker = ({
1463
1463
  },
1464
1464
  "& .MuiInputBase-root": {
1465
1465
  height: size === "small" ? 40 : 56
1466
+ },
1467
+ // Fix for extra 'ا' in calendar header month name
1468
+ "& .MuiPickersCalendarHeader-label": {
1469
+ fontSize: "1rem"
1466
1470
  }
1467
1471
  },
1468
1472
  slots: {
@@ -1470,6 +1474,77 @@ var JalaliDatePicker = ({
1470
1474
  clearButton: import_react7.default.Fragment,
1471
1475
  clearIcon: import_react7.default.Fragment
1472
1476
  },
1477
+ calendarHeader: (props) => {
1478
+ let labelText = props.currentMonth.format("jMMMM jYYYY");
1479
+ const persianMonths = [
1480
+ "\u0641\u0631\u0648\u0631\u062F\u06CC\u0646",
1481
+ "\u0627\u0631\u062F\u06CC\u0628\u0647\u0634\u062A",
1482
+ "\u062E\u0631\u062F\u0627\u062F",
1483
+ "\u062A\u06CC\u0631",
1484
+ "\u0645\u0631\u062F\u0627\u062F",
1485
+ "\u0634\u0647\u0631\u06CC\u0648\u0631",
1486
+ "\u0645\u0647\u0631",
1487
+ "\u0622\u0628\u0627\u0646",
1488
+ "\u0622\u0630\u0631",
1489
+ "\u062F\u06CC",
1490
+ "\u0628\u0647\u0645\u0646",
1491
+ "\u0627\u0633\u0641\u0646\u062F"
1492
+ ];
1493
+ const parts = labelText.split(" ");
1494
+ if (parts.length > 0 && parts[0].startsWith("\u0627")) {
1495
+ const withoutAlef = parts[0].substring(1);
1496
+ if (persianMonths.includes(withoutAlef)) {
1497
+ parts[0] = withoutAlef;
1498
+ labelText = parts.join(" ");
1499
+ }
1500
+ }
1501
+ return /* @__PURE__ */ import_react7.default.createElement(
1502
+ import_material9.Box,
1503
+ {
1504
+ sx: {
1505
+ display: "flex",
1506
+ alignItems: "center",
1507
+ justifyContent: "space-between",
1508
+ padding: "8px 16px",
1509
+ minHeight: "40px"
1510
+ }
1511
+ },
1512
+ /* @__PURE__ */ import_react7.default.createElement(
1513
+ import_material9.IconButton,
1514
+ {
1515
+ onClick: () => props.onMonthChange(
1516
+ props.currentMonth.clone().subtract(1, "month"),
1517
+ "left"
1518
+ ),
1519
+ title: "\u0645\u0627\u0647 \u0642\u0628\u0644"
1520
+ },
1521
+ /* @__PURE__ */ import_react7.default.createElement(import_md3.MdChevronRight, null)
1522
+ ),
1523
+ /* @__PURE__ */ import_react7.default.createElement(
1524
+ import_material9.Typography,
1525
+ {
1526
+ variant: "body1",
1527
+ onClick: props.onViewChange ? () => props.onViewChange?.("year") : void 0,
1528
+ sx: {
1529
+ cursor: props.onViewChange ? "pointer" : "default",
1530
+ fontWeight: 500
1531
+ }
1532
+ },
1533
+ labelText
1534
+ ),
1535
+ /* @__PURE__ */ import_react7.default.createElement(
1536
+ import_material9.IconButton,
1537
+ {
1538
+ onClick: () => props.onMonthChange(
1539
+ props.currentMonth.clone().add(1, "month"),
1540
+ "right"
1541
+ ),
1542
+ title: "\u0645\u0627\u0647 \u0628\u0639\u062F"
1543
+ },
1544
+ /* @__PURE__ */ import_react7.default.createElement(import_md3.MdChevronLeft, null)
1545
+ )
1546
+ );
1547
+ },
1473
1548
  toolbar: () => {
1474
1549
  const currentDate = (0, import_moment_jalaali.default)(field.value);
1475
1550
  let formattedDate = currentDate.format("dddd, jDD jMMMM");