@mamrp/components 1.4.10 → 1.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -638,6 +638,7 @@ function MultipleSelectChip({
638
638
  inputRef: ref,
639
639
  variant,
640
640
  placeholder,
641
+ InputLabelProps: { shrink: true },
641
642
  InputProps: {
642
643
  ...params.InputProps,
643
644
  endAdornment: /* @__PURE__ */ React3.createElement(React3.Fragment, null, isLoading ? /* @__PURE__ */ React3.createElement(CircularProgress, { color: "primary", size: 20 }) : null, params.InputProps.endAdornment)
@@ -1187,8 +1188,7 @@ var JalaliDatePicker = ({
1187
1188
  maxDate,
1188
1189
  minDate,
1189
1190
  clear = true,
1190
- views,
1191
- showArrows = false
1191
+ views
1192
1192
  }) => {
1193
1193
  const today = moment();
1194
1194
  const customLocaleText = {
@@ -1199,7 +1199,21 @@ var JalaliDatePicker = ({
1199
1199
  start: "\u0634\u0631\u0648\u0639",
1200
1200
  end: "\u067E\u0627\u06CC\u0627\u0646",
1201
1201
  previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
1202
- nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F"
1202
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
1203
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
1204
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
1205
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1206
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1207
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1208
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1209
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
1210
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
1211
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
1212
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
1213
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
1214
+ calendarWeekNumberHeaderText: "#",
1215
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
1216
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
1203
1217
  };
1204
1218
  return /* @__PURE__ */ React8.createElement(
1205
1219
  LocalizationProvider,
@@ -1218,8 +1232,9 @@ var JalaliDatePicker = ({
1218
1232
  e.stopPropagation();
1219
1233
  const currentValue = field.value ? moment(field.value) : moment();
1220
1234
  const previousDate = currentValue.clone().subtract(1, "day");
1221
- if (minDate && previousDate.isBefore(moment(minDate), "day"))
1235
+ if (minDate && previousDate.isBefore(moment(minDate), "day")) {
1222
1236
  return;
1237
+ }
1223
1238
  const nowUTC3 = /* @__PURE__ */ new Date();
1224
1239
  const iranHour = nowUTC3.getUTCHours();
1225
1240
  const iranMinute = nowUTC3.getUTCMinutes();
@@ -1231,7 +1246,9 @@ var JalaliDatePicker = ({
1231
1246
  const currentValue = field.value ? moment(field.value) : moment();
1232
1247
  const nextDate = currentValue.clone().add(1, "day");
1233
1248
  const maxDateValue = maxDate ? maxDate : today;
1234
- if (nextDate.isAfter(moment(maxDateValue), "day")) return;
1249
+ if (nextDate.isAfter(moment(maxDateValue), "day")) {
1250
+ return;
1251
+ }
1235
1252
  const nowUTC3 = /* @__PURE__ */ new Date();
1236
1253
  const iranHour = nowUTC3.getUTCHours();
1237
1254
  const iranMinute = nowUTC3.getUTCMinutes();
@@ -1252,6 +1269,22 @@ var JalaliDatePicker = ({
1252
1269
  value: field.value ? moment(field.value) : null,
1253
1270
  slotProps: {
1254
1271
  ...clear && !disabled ? { field: { clearable: true } } : {},
1272
+ popper: {
1273
+ modifiers: [
1274
+ {
1275
+ name: "preventOverflow",
1276
+ options: {
1277
+ boundary: "window"
1278
+ }
1279
+ },
1280
+ {
1281
+ name: "flip",
1282
+ options: {
1283
+ fallbackPlacements: ["right", "left", "top"]
1284
+ }
1285
+ }
1286
+ ]
1287
+ },
1255
1288
  textField: {
1256
1289
  size,
1257
1290
  placeholder: field.value || isLoading ? "" : "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ",
@@ -1265,7 +1298,7 @@ var JalaliDatePicker = ({
1265
1298
  style: { cursor: "pointer" }
1266
1299
  },
1267
1300
  InputProps: {
1268
- startAdornment: showArrows && !isLoading ? /* @__PURE__ */ React8.createElement(
1301
+ startAdornment: !isLoading && /* @__PURE__ */ React8.createElement(
1269
1302
  Box7,
1270
1303
  {
1271
1304
  sx: {
@@ -1280,12 +1313,14 @@ var JalaliDatePicker = ({
1280
1313
  {
1281
1314
  onClick: handlePreviousDate,
1282
1315
  disabled: isLoading || disabled,
1283
- sx: { padding: "2px" }
1316
+ sx: {
1317
+ padding: "2px"
1318
+ }
1284
1319
  },
1285
1320
  /* @__PURE__ */ React8.createElement(MdChevronRight, { size: 26 })
1286
1321
  ))
1287
- ) : null,
1288
- endAdornment: isLoading ? /* @__PURE__ */ React8.createElement(CircularProgress3, { color: "secondary", size: 20 }) : showArrows && !disabled ? /* @__PURE__ */ React8.createElement(
1322
+ ),
1323
+ endAdornment: isLoading ? /* @__PURE__ */ React8.createElement(CircularProgress3, { color: "secondary", size: 20 }) : disabled ? null : /* @__PURE__ */ React8.createElement(
1289
1324
  Box7,
1290
1325
  {
1291
1326
  sx: { display: "flex", alignItems: "center", ml: 1 }
@@ -1295,11 +1330,13 @@ var JalaliDatePicker = ({
1295
1330
  {
1296
1331
  onClick: handleNextDate,
1297
1332
  disabled: isLoading || disabled,
1298
- sx: { padding: "2px" }
1333
+ sx: {
1334
+ padding: "2px"
1335
+ }
1299
1336
  },
1300
1337
  /* @__PURE__ */ React8.createElement(MdChevronLeft, { size: 26 })
1301
1338
  ))
1302
- ) : null,
1339
+ ),
1303
1340
  ...field.value && {
1304
1341
  value: persian ? `${moment(field.value).format(
1305
1342
  "dddd - jDD/jMMMM/jYYYY"
@@ -1313,17 +1350,22 @@ var JalaliDatePicker = ({
1313
1350
  }
1314
1351
  }
1315
1352
  }
1353
+ },
1354
+ actionBar: {
1355
+ actions: ["cancel", "accept"]
1316
1356
  }
1317
1357
  },
1318
1358
  onChange: (value) => {
1319
- if (value == null) field.onChange(null);
1359
+ if (value == null) {
1360
+ field.onChange(null);
1361
+ }
1320
1362
  },
1321
1363
  onAccept: (newValue) => {
1322
1364
  if (newValue) {
1323
1365
  const currentDate = dayjs(newValue);
1324
1366
  const nowUTC3 = /* @__PURE__ */ new Date();
1325
- const iranHour = nowUTC3.getUTCHours();
1326
- const iranMinute = nowUTC3.getUTCMinutes();
1367
+ let iranHour = nowUTC3.getUTCHours();
1368
+ let iranMinute = nowUTC3.getUTCMinutes();
1327
1369
  const dateTimeWithIranTime4 = currentDate.hour(iranHour).minute(iranMinute).second(nowUTC3.getUTCSeconds());
1328
1370
  field.onChange(
1329
1371
  dateTimeWithIranTime4.format("YYYY-MM-DDTHH:mm:ss")
@@ -1334,13 +1376,61 @@ var JalaliDatePicker = ({
1334
1376
  },
1335
1377
  sx: {
1336
1378
  width: "100%",
1379
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
1337
1380
  "& .MuiOutlinedInput-notchedOutline": {
1338
1381
  borderColor: error ? "#D32F2F" : "#C4C4C4"
1339
1382
  },
1340
1383
  "& .MuiInputBase-root": {
1341
1384
  height: size === "small" ? 40 : 56
1342
1385
  }
1343
- }
1386
+ },
1387
+ slots: {
1388
+ ...!clear && {
1389
+ clearButton: React8.Fragment,
1390
+ clearIcon: React8.Fragment
1391
+ },
1392
+ toolbar: () => {
1393
+ const currentDate = moment(field.value);
1394
+ const formattedDate = currentDate.format("dddd, jDD jMMMM");
1395
+ return /* @__PURE__ */ React8.createElement(
1396
+ Box7,
1397
+ {
1398
+ sx: {
1399
+ my: 2,
1400
+ mx: 4
1401
+ }
1402
+ },
1403
+ /* @__PURE__ */ React8.createElement(Typography3, { variant: "overline", color: "primary" }, "\u062A\u0627\u0631\u06CC\u062E \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F"),
1404
+ /* @__PURE__ */ React8.createElement(Typography3, { variant: "h4" }, formattedDate == "Invalid date" ? "" : formattedDate)
1405
+ );
1406
+ },
1407
+ monthButton: (props) => {
1408
+ return /* @__PURE__ */ React8.createElement(
1409
+ "button",
1410
+ {
1411
+ className: `${props.className}`,
1412
+ style: {
1413
+ width: "80%",
1414
+ padding: "10px",
1415
+ marginBottom: "20px",
1416
+ border: "1px solid #ccc",
1417
+ borderRadius: "12px",
1418
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
1419
+ fontSize: "14px",
1420
+ cursor: props.disabled ? "default" : "pointer"
1421
+ },
1422
+ disabled: props.disabled,
1423
+ onFocus: props.onFocus,
1424
+ onBlur: props.onBlur,
1425
+ onClick: props.onClick,
1426
+ ref: props.ref
1427
+ },
1428
+ props["aria-label"]
1429
+ );
1430
+ }
1431
+ },
1432
+ minDate: minDate ? minDate : null,
1433
+ maxDate: maxDate ? maxDate : today
1344
1434
  }
1345
1435
  ), error && /* @__PURE__ */ React8.createElement(Typography3, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message));
1346
1436
  }