@mamrp/components 1.3.0 → 1.3.2

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
@@ -1921,11 +1921,26 @@ import { DatePicker as DatePicker2, LocalizationProvider as LocalizationProvider
1921
1921
  import { AdapterMomentJalaali as AdapterMomentJalaali4 } from "@mui/x-date-pickers/AdapterMomentJalaali";
1922
1922
  import dayjs2 from "dayjs";
1923
1923
  import moment6 from "moment-jalaali";
1924
- import "moment/locale/fa";
1925
- import React12, { useState as useState7 } from "react";
1924
+ import React12 from "react";
1926
1925
  import { Controller as Controller6 } from "react-hook-form";
1927
1926
  moment6.locale("fa");
1928
1927
  moment6.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1928
+ moment6.updateLocale("fa", {
1929
+ months: [
1930
+ "\u0641\u0631\u0648\u0631\u062F\u06CC\u0646",
1931
+ "\u0627\u0631\u062F\u06CC\u0628\u0647\u0634\u062A",
1932
+ "\u062E\u0631\u062F\u0627\u062F",
1933
+ "\u062A\u06CC\u0631",
1934
+ "\u0645\u0631\u062F\u0627\u062F",
1935
+ "\u0634\u0647\u0631\u06CC\u0648\u0631",
1936
+ "\u0645\u0647\u0631",
1937
+ "\u0622\u0628\u0627\u0646",
1938
+ "\u0622\u0630\u0631",
1939
+ "\u062F\u06CC",
1940
+ "\u0628\u0647\u0645\u0646",
1941
+ "\u0627\u0633\u0641\u0646\u062F"
1942
+ ]
1943
+ });
1929
1944
  var DateMonthPicker = ({
1930
1945
  name,
1931
1946
  control,
@@ -1939,7 +1954,6 @@ var DateMonthPicker = ({
1939
1954
  clear = true
1940
1955
  }) => {
1941
1956
  const today = moment6();
1942
- const [open, setOpen] = useState7(false);
1943
1957
  const customLocaleText = {
1944
1958
  cancelButtonLabel: "\u0644\u063A\u0648",
1945
1959
  okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
@@ -4009,6 +4023,578 @@ var UploadImage = ({
4009
4023
  };
4010
4024
  var upload_image_default = UploadImage;
4011
4025
 
4026
+ // src/enhanced-upload-image/index.tsx
4027
+ import { Delete as Delete2 } from "@mamrp/icons";
4028
+ import {
4029
+ alpha,
4030
+ Box as Box20,
4031
+ Button as Button12,
4032
+ Fade,
4033
+ IconButton as IconButton8,
4034
+ Stack as Stack6,
4035
+ Tooltip as Tooltip2,
4036
+ Typography as Typography16,
4037
+ useTheme as useTheme6
4038
+ } from "@mui/material";
4039
+ import Image5 from "next/image";
4040
+ import React27, { useState as useState13 } from "react";
4041
+ import {
4042
+ Controller as Controller13
4043
+ } from "react-hook-form";
4044
+ import { GrGallery as GrGallery2 } from "react-icons/gr";
4045
+ import { MdAddPhotoAlternate, MdOutlineCameraAlt as MdOutlineCameraAlt2 } from "react-icons/md";
4046
+
4047
+ // src/enhanced-upload-image/ImageViewer.tsx
4048
+ import {
4049
+ Box as Box19,
4050
+ CircularProgress as CircularProgress8,
4051
+ Dialog as Dialog6,
4052
+ IconButton as IconButton7,
4053
+ Typography as Typography15
4054
+ } from "@mui/material";
4055
+ import Image4 from "next/image";
4056
+ import { useCallback, useEffect as useEffect9, useState as useState12 } from "react";
4057
+ import {
4058
+ MdClose as MdClose4,
4059
+ MdRotateLeft,
4060
+ MdRotateRight,
4061
+ MdZoomIn,
4062
+ MdZoomOut
4063
+ } from "react-icons/md";
4064
+ function ImageViewer({
4065
+ open,
4066
+ handleClose,
4067
+ src,
4068
+ isLoading,
4069
+ title = "",
4070
+ noResetBtn = false,
4071
+ noRotate = false,
4072
+ noZoom = false
4073
+ }) {
4074
+ const [zoom, setZoom] = useState12(1);
4075
+ const [rotate, setRotate] = useState12(0);
4076
+ const [loading, setLoading] = useState12(true);
4077
+ const [viewerOpen, setViewerOpen] = useState12(false);
4078
+ const [viewerSrc, setViewerSrc] = useState12("");
4079
+ const [position, setPosition] = useState12({ x: 0, y: 0 });
4080
+ const [dragging, setDragging] = useState12(false);
4081
+ const [startMouse, setStartMouse] = useState12({ x: 0, y: 0 });
4082
+ const [startOffset, setStartOffset] = useState12({ x: 0, y: 0 });
4083
+ const reset = () => {
4084
+ setZoom(1);
4085
+ setRotate(0);
4086
+ setPosition({ x: 0, y: 0 });
4087
+ };
4088
+ const handleWheel = useCallback((e) => {
4089
+ e.preventDefault();
4090
+ const delta = -e.deltaY * 1e-3;
4091
+ setZoom((z) => Math.min(5, Math.max(0.2, z + delta)));
4092
+ }, []);
4093
+ const handleMouseDown = (e) => {
4094
+ setDragging(true);
4095
+ setStartMouse({ x: e.clientX, y: e.clientY });
4096
+ setStartOffset({ ...position });
4097
+ };
4098
+ const handleMouseMove = (e) => {
4099
+ if (!dragging) return;
4100
+ const dx = e.clientX - startMouse.x;
4101
+ const dy = e.clientY - startMouse.y;
4102
+ setPosition({
4103
+ x: startOffset.x - dx,
4104
+ y: startOffset.y + dy
4105
+ });
4106
+ };
4107
+ const handleMouseUp = () => setDragging(false);
4108
+ useEffect9(() => {
4109
+ if (dragging) {
4110
+ window.addEventListener("mousemove", handleMouseMove);
4111
+ window.addEventListener("mouseup", handleMouseUp);
4112
+ } else {
4113
+ window.removeEventListener("mousemove", handleMouseMove);
4114
+ window.removeEventListener("mouseup", handleMouseUp);
4115
+ }
4116
+ return () => {
4117
+ window.removeEventListener("mousemove", handleMouseMove);
4118
+ window.removeEventListener("mouseup", handleMouseUp);
4119
+ };
4120
+ }, [dragging, startMouse, startOffset]);
4121
+ useEffect9(() => {
4122
+ if (open) reset();
4123
+ }, [open]);
4124
+ return /* @__PURE__ */ React.createElement(
4125
+ Dialog6,
4126
+ {
4127
+ open,
4128
+ onClose: handleClose,
4129
+ maxWidth: "xl",
4130
+ fullWidth: true,
4131
+ sx: {
4132
+ "& .MuiPaper-root": {
4133
+ borderRadius: 3,
4134
+ backgroundColor: "transparent"
4135
+ }
4136
+ }
4137
+ },
4138
+ /* @__PURE__ */ React.createElement(
4139
+ Box19,
4140
+ {
4141
+ sx: {
4142
+ position: "relative",
4143
+ width: "100%",
4144
+ height: "90vh",
4145
+ bgcolor: "rgba(17,17,17,0.9)",
4146
+ overflow: "hidden",
4147
+ display: "flex",
4148
+ justifyContent: "center",
4149
+ alignItems: "center"
4150
+ },
4151
+ onWheel: handleWheel
4152
+ },
4153
+ /* @__PURE__ */ React.createElement(
4154
+ Box19,
4155
+ {
4156
+ sx: {
4157
+ position: "absolute",
4158
+ top: 10,
4159
+ left: 10,
4160
+ zIndex: 20,
4161
+ display: "flex",
4162
+ gap: 1,
4163
+ alignItems: "center"
4164
+ }
4165
+ },
4166
+ /* @__PURE__ */ React.createElement(IconButton7, { onClick: handleClose }, /* @__PURE__ */ React.createElement(MdClose4, { color: "white" })),
4167
+ !noResetBtn && /* @__PURE__ */ React.createElement(IconButton7, { onClick: reset }, /* @__PURE__ */ React.createElement("span", { style: { color: "white", fontSize: "0.9rem" } }, "\u0628\u0627\u0632\u0646\u0634\u0627\u0646\u06CC")),
4168
+ !noRotate && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(IconButton7, { onClick: () => setRotate((r) => r - 90) }, /* @__PURE__ */ React.createElement(MdRotateLeft, { color: "white" })), /* @__PURE__ */ React.createElement(IconButton7, { onClick: () => setRotate((r) => r + 90) }, /* @__PURE__ */ React.createElement(MdRotateRight, { color: "white" }))),
4169
+ !noZoom && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(IconButton7, { onClick: () => setZoom((z) => z + 0.2) }, /* @__PURE__ */ React.createElement(MdZoomIn, { color: "white" })), /* @__PURE__ */ React.createElement(
4170
+ IconButton7,
4171
+ {
4172
+ onClick: () => setZoom((z) => Math.max(0.2, z - 0.2))
4173
+ },
4174
+ /* @__PURE__ */ React.createElement(MdZoomOut, { color: "white" })
4175
+ )),
4176
+ /* @__PURE__ */ React.createElement(Typography15, { color: "white" }, title)
4177
+ ),
4178
+ (isLoading || loading) && /* @__PURE__ */ React.createElement(
4179
+ Box19,
4180
+ {
4181
+ sx: {
4182
+ position: "absolute",
4183
+ zIndex: 10,
4184
+ top: "50%",
4185
+ left: "50%",
4186
+ transform: "translate(-50%, -50%)",
4187
+ color: "white"
4188
+ }
4189
+ },
4190
+ /* @__PURE__ */ React.createElement(CircularProgress8, { color: "inherit" })
4191
+ ),
4192
+ /* @__PURE__ */ React.createElement(
4193
+ Box19,
4194
+ {
4195
+ onMouseDown: handleMouseDown,
4196
+ sx: {
4197
+ position: "relative",
4198
+ width: "100%",
4199
+ height: "78vh",
4200
+ cursor: dragging ? "grabbing" : "grab",
4201
+ display: "flex",
4202
+ justifyContent: "center",
4203
+ alignItems: "center",
4204
+ overflow: "hidden"
4205
+ }
4206
+ },
4207
+ src && !isLoading && /* @__PURE__ */ React.createElement(
4208
+ Image4,
4209
+ {
4210
+ src,
4211
+ alt: title,
4212
+ fill: true,
4213
+ style: {
4214
+ objectFit: "contain",
4215
+ transform: `translate(${position.x}px, ${position.y}px) scale(${zoom}) rotate(${rotate}deg)`,
4216
+ transition: dragging ? "none" : "transform 0.3s ease"
4217
+ },
4218
+ onLoadingComplete: () => setLoading(false)
4219
+ }
4220
+ )
4221
+ )
4222
+ ),
4223
+ /* @__PURE__ */ React.createElement(
4224
+ ImageViewer,
4225
+ {
4226
+ open: viewerOpen,
4227
+ handleClose: () => setViewerOpen(false),
4228
+ src: src || "",
4229
+ isLoading: false
4230
+ }
4231
+ )
4232
+ );
4233
+ }
4234
+
4235
+ // src/enhanced-upload-image/index.tsx
4236
+ var UploadImage2 = ({
4237
+ placeholder,
4238
+ name,
4239
+ selectedImage,
4240
+ setSelectedImage,
4241
+ control,
4242
+ errors,
4243
+ setValue,
4244
+ height = "280px",
4245
+ allowGallery = false,
4246
+ imageFit = "cover"
4247
+ }) => {
4248
+ const theme2 = useTheme6();
4249
+ const [viewerOpen, setViewerOpen] = useState13(false);
4250
+ const [viewerSrc, setViewerSrc] = useState13("");
4251
+ const compressImage = (file, quality = 0.9, maxWidth = 1600, maxHeight = 1600) => {
4252
+ return new Promise((resolve) => {
4253
+ const reader = new FileReader();
4254
+ reader.readAsDataURL(file);
4255
+ reader.onload = (event) => {
4256
+ const img = new window.Image();
4257
+ img.src = event.target?.result;
4258
+ img.onload = () => {
4259
+ const canvas = document.createElement("canvas");
4260
+ let width = img.width;
4261
+ let height2 = img.height;
4262
+ if (width > maxWidth) {
4263
+ height2 *= maxWidth / width;
4264
+ width = maxWidth;
4265
+ }
4266
+ if (height2 > maxHeight) {
4267
+ width *= maxHeight / height2;
4268
+ height2 = maxHeight;
4269
+ }
4270
+ canvas.width = width;
4271
+ canvas.height = height2;
4272
+ const ctx = canvas.getContext("2d");
4273
+ if (ctx) {
4274
+ ctx.drawImage(img, 0, 0, width, height2);
4275
+ canvas.toBlob(
4276
+ (blob) => {
4277
+ if (blob) {
4278
+ const compressedFile = new File([blob], file.name, {
4279
+ type: "image/jpeg",
4280
+ lastModified: Date.now()
4281
+ });
4282
+ resolve(compressedFile);
4283
+ } else {
4284
+ resolve(null);
4285
+ }
4286
+ },
4287
+ "image/jpeg",
4288
+ quality
4289
+ );
4290
+ } else {
4291
+ resolve(null);
4292
+ }
4293
+ };
4294
+ };
4295
+ });
4296
+ };
4297
+ const handleImageChange = async (event) => {
4298
+ const file = event.target.files?.[0];
4299
+ if (file) {
4300
+ console.log("Original file size (KB):", (file.size / 1024).toFixed(2));
4301
+ const compressedFile = await compressImage(file);
4302
+ if (compressedFile) {
4303
+ console.log(
4304
+ "Compressed file size (KB):",
4305
+ (compressedFile.size / 1024).toFixed(2)
4306
+ );
4307
+ const objectURL = URL.createObjectURL(compressedFile);
4308
+ setSelectedImage(objectURL);
4309
+ setValue(name, compressedFile);
4310
+ }
4311
+ }
4312
+ };
4313
+ const handleRemoveImage = () => {
4314
+ setSelectedImage(null);
4315
+ setValue(name, null);
4316
+ const galleryInput = document.getElementById(
4317
+ "gallery-upload"
4318
+ );
4319
+ const cameraInput = document.getElementById(
4320
+ "camera-upload"
4321
+ );
4322
+ const fileInput = document.getElementById(
4323
+ "file-upload"
4324
+ );
4325
+ if (galleryInput) galleryInput.value = "";
4326
+ if (cameraInput) cameraInput.value = "";
4327
+ if (fileInput) fileInput.value = "";
4328
+ };
4329
+ return /* @__PURE__ */ React27.createElement(
4330
+ Controller13,
4331
+ {
4332
+ name,
4333
+ control,
4334
+ render: ({ field }) => /* @__PURE__ */ React27.createElement(Box20, { sx: { width: "100%" } }, /* @__PURE__ */ React27.createElement(
4335
+ Box20,
4336
+ {
4337
+ sx: {
4338
+ position: "relative",
4339
+ width: "100%",
4340
+ height,
4341
+ borderRadius: 3,
4342
+ overflow: "hidden",
4343
+ backgroundColor: selectedImage ? "transparent" : alpha(theme2.palette.primary.main, 0.02),
4344
+ border: selectedImage ? `2px solid ${alpha(theme2.palette.primary.main, 0.1)}` : `2px dashed ${alpha(theme2.palette.primary.main, 0.2)}`,
4345
+ transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
4346
+ cursor: allowGallery ? "default" : "pointer",
4347
+ "&:hover": {
4348
+ borderColor: selectedImage ? alpha(theme2.palette.primary.main, 0.3) : alpha(theme2.palette.primary.main, 0.4),
4349
+ backgroundColor: selectedImage ? "transparent" : alpha(theme2.palette.primary.main, 0.04)
4350
+ }
4351
+ }
4352
+ },
4353
+ selectedImage ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
4354
+ Image5,
4355
+ {
4356
+ src: selectedImage,
4357
+ alt: "Preview",
4358
+ width: 900,
4359
+ height: 600,
4360
+ style: {
4361
+ maxWidth: "100%",
4362
+ maxHeight: "250px",
4363
+ borderRadius: "8px",
4364
+ border: "1px solid #ccc",
4365
+ objectFit: "contain",
4366
+ cursor: "pointer"
4367
+ },
4368
+ onClick: () => {
4369
+ setViewerSrc(selectedImage);
4370
+ setViewerOpen(true);
4371
+ }
4372
+ }
4373
+ ), /* @__PURE__ */ React27.createElement(Fade, { in: true }, /* @__PURE__ */ React27.createElement(Tooltip2, { title: "\u062D\u0630\u0641" }, /* @__PURE__ */ React27.createElement(
4374
+ IconButton8,
4375
+ {
4376
+ onClick: (e) => {
4377
+ e.preventDefault();
4378
+ e.stopPropagation();
4379
+ handleRemoveImage();
4380
+ },
4381
+ sx: {
4382
+ position: "absolute",
4383
+ top: 12,
4384
+ right: 12,
4385
+ backgroundColor: alpha(theme2.palette.error.main, 0.9),
4386
+ color: "white",
4387
+ width: 40,
4388
+ height: 40,
4389
+ "&:hover": {
4390
+ backgroundColor: theme2.palette.error.main,
4391
+ transform: "scale(1.1)"
4392
+ },
4393
+ transition: "all 0.2s ease",
4394
+ boxShadow: `0 4px 12px ${alpha(
4395
+ theme2.palette.error.main,
4396
+ 0.3
4397
+ )}`
4398
+ }
4399
+ },
4400
+ /* @__PURE__ */ React27.createElement(Delete2, { size: 18 })
4401
+ )))) : /* @__PURE__ */ React27.createElement(
4402
+ Stack6,
4403
+ {
4404
+ spacing: 3,
4405
+ sx: {
4406
+ height: "100%",
4407
+ justifyContent: "center",
4408
+ alignItems: "center",
4409
+ p: 3
4410
+ }
4411
+ },
4412
+ /* @__PURE__ */ React27.createElement(Stack6, { spacing: 2, alignItems: "center" }, /* @__PURE__ */ React27.createElement(
4413
+ Box20,
4414
+ {
4415
+ sx: {
4416
+ width: 64,
4417
+ height: 64,
4418
+ borderRadius: "50%",
4419
+ backgroundColor: alpha(
4420
+ theme2.palette.successLight.main,
4421
+ 0.1
4422
+ ),
4423
+ display: "flex",
4424
+ alignItems: "center",
4425
+ justifyContent: "center",
4426
+ transition: "all 0.3s ease"
4427
+ }
4428
+ },
4429
+ /* @__PURE__ */ React27.createElement(
4430
+ MdAddPhotoAlternate,
4431
+ {
4432
+ size: 32,
4433
+ color: theme2.palette.successLight.main,
4434
+ style: { opacity: 0.8 }
4435
+ }
4436
+ )
4437
+ ), /* @__PURE__ */ React27.createElement(
4438
+ Typography16,
4439
+ {
4440
+ variant: "h6",
4441
+ sx: {
4442
+ color: theme2.palette.text.primary,
4443
+ fontWeight: 500,
4444
+ textAlign: "center",
4445
+ mb: 1
4446
+ }
4447
+ },
4448
+ placeholder
4449
+ ), /* @__PURE__ */ React27.createElement(
4450
+ Typography16,
4451
+ {
4452
+ variant: "body2",
4453
+ sx: {
4454
+ color: theme2.palette.text.secondary,
4455
+ textAlign: "center",
4456
+ fontSize: "0.875rem"
4457
+ }
4458
+ },
4459
+ "PNG, JPG \u06CC\u0627 WEBP \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0645\u06CC\u200C\u0634\u0648\u062F"
4460
+ )),
4461
+ allowGallery && /* @__PURE__ */ React27.createElement(Stack6, { direction: "row", spacing: 2 }, /* @__PURE__ */ React27.createElement(
4462
+ Button12,
4463
+ {
4464
+ variant: "contained",
4465
+ startIcon: /* @__PURE__ */ React27.createElement(MdOutlineCameraAlt2, { size: 16 }),
4466
+ onClick: (e) => {
4467
+ e.preventDefault();
4468
+ document.getElementById("camera-upload")?.click();
4469
+ },
4470
+ sx: {
4471
+ borderRadius: 2,
4472
+ px: 2.5,
4473
+ textTransform: "none",
4474
+ fontWeight: 600,
4475
+ boxShadow: `0 4px 12px ${alpha(
4476
+ theme2.palette.successLight.main,
4477
+ 0.3
4478
+ )}`,
4479
+ zIndex: 1,
4480
+ transition: "all 0.2s ease",
4481
+ "&:hover": {
4482
+ boxShadow: `0 6px 20px ${alpha(
4483
+ theme2.palette.successLight.main,
4484
+ 0.4
4485
+ )}`,
4486
+ transform: "translateY(-1px)"
4487
+ }
4488
+ },
4489
+ color: "successLight"
4490
+ },
4491
+ "\u062F\u0648\u0631\u0628\u06CC\u0646"
4492
+ ), /* @__PURE__ */ React27.createElement(
4493
+ Button12,
4494
+ {
4495
+ variant: "outlined",
4496
+ startIcon: /* @__PURE__ */ React27.createElement(GrGallery2, { size: 16 }),
4497
+ onClick: (e) => {
4498
+ e.preventDefault();
4499
+ document.getElementById("gallery-upload")?.click();
4500
+ },
4501
+ sx: {
4502
+ borderRadius: 2,
4503
+ px: 2.5,
4504
+ textTransform: "none",
4505
+ fontWeight: 600,
4506
+ borderWidth: 2,
4507
+ transition: "all 0.2s ease",
4508
+ "&:hover": {
4509
+ boxShadow: `0 6px 20px ${alpha(
4510
+ theme2.palette.successLight.main,
4511
+ 0.4
4512
+ )}`,
4513
+ transform: "translateY(-1px)"
4514
+ }
4515
+ },
4516
+ color: "successLight"
4517
+ },
4518
+ "\u06AF\u0627\u0644\u0631\u06CC"
4519
+ ))
4520
+ )
4521
+ ), !allowGallery && /* @__PURE__ */ React27.createElement(
4522
+ "input",
4523
+ {
4524
+ id: "file-upload",
4525
+ type: "file",
4526
+ accept: "image/*",
4527
+ capture: "environment",
4528
+ onChange: (event) => {
4529
+ handleImageChange(event);
4530
+ field.onChange(event.target.files?.[0] || null);
4531
+ },
4532
+ style: { display: "none" }
4533
+ }
4534
+ ), /* @__PURE__ */ React27.createElement(
4535
+ "input",
4536
+ {
4537
+ id: "gallery-upload",
4538
+ type: "file",
4539
+ accept: "image/*",
4540
+ onChange: (event) => {
4541
+ handleImageChange(event);
4542
+ field.onChange(event.target.files?.[0] || null);
4543
+ },
4544
+ style: { display: "none" }
4545
+ }
4546
+ ), /* @__PURE__ */ React27.createElement(
4547
+ "input",
4548
+ {
4549
+ id: "camera-upload",
4550
+ type: "file",
4551
+ accept: "image/*",
4552
+ capture: "environment",
4553
+ onChange: (event) => {
4554
+ handleImageChange(event);
4555
+ field.onChange(event.target.files?.[0] || null);
4556
+ },
4557
+ style: { display: "none" }
4558
+ }
4559
+ ), errors[name] && /* @__PURE__ */ React27.createElement(Fade, { in: true }, /* @__PURE__ */ React27.createElement(
4560
+ Box20,
4561
+ {
4562
+ sx: {
4563
+ mt: 1.5,
4564
+ p: 1.5,
4565
+ borderRadius: 1,
4566
+ backgroundColor: alpha(theme2.palette.error.main, 0.05),
4567
+ border: `1px solid ${alpha(theme2.palette.error.main, 0.2)}`
4568
+ }
4569
+ },
4570
+ /* @__PURE__ */ React27.createElement(
4571
+ Typography16,
4572
+ {
4573
+ color: "error",
4574
+ variant: "body2",
4575
+ sx: {
4576
+ fontWeight: 500,
4577
+ display: "flex",
4578
+ alignItems: "center",
4579
+ gap: 1
4580
+ }
4581
+ },
4582
+ String(errors[name]?.message || "")
4583
+ )
4584
+ )), /* @__PURE__ */ React27.createElement(
4585
+ ImageViewer,
4586
+ {
4587
+ open: viewerOpen,
4588
+ handleClose: () => setViewerOpen(false),
4589
+ src: viewerSrc,
4590
+ isLoading: false
4591
+ }
4592
+ ))
4593
+ }
4594
+ );
4595
+ };
4596
+ var enhanced_upload_image_default = UploadImage2;
4597
+
4012
4598
  // src/accordion/index.tsx
4013
4599
  import { styled as styled3 } from "@mui/material/styles";
4014
4600
  import { IoIosArrowForward } from "react-icons/io";
@@ -4018,9 +4604,9 @@ import MuiAccordionSummary, {
4018
4604
  } from "@mui/material/AccordionSummary";
4019
4605
  import MuiAccordionDetails from "@mui/material/AccordionDetails";
4020
4606
  import {
4021
- Typography as Typography15
4607
+ Typography as Typography17
4022
4608
  } from "@mui/material";
4023
- import { useState as useState12 } from "react";
4609
+ import { useState as useState14 } from "react";
4024
4610
  function Page({
4025
4611
  data
4026
4612
  }) {
@@ -4050,7 +4636,7 @@ function Page({
4050
4636
  padding: theme2.spacing(2),
4051
4637
  borderTop: "1px solid rgba(0, 0, 0, .125)"
4052
4638
  }));
4053
- const [expanded, setExpanded] = useState12("");
4639
+ const [expanded, setExpanded] = useState14("");
4054
4640
  const handleChange = (panel) => (event, newExpanded) => {
4055
4641
  setExpanded(newExpanded ? panel : false);
4056
4642
  };
@@ -4074,7 +4660,7 @@ function Page({
4074
4660
  }
4075
4661
  }
4076
4662
  },
4077
- /* @__PURE__ */ React.createElement(Typography15, { component: "span" }, item.title)
4663
+ /* @__PURE__ */ React.createElement(Typography17, { component: "span" }, item.title)
4078
4664
  ),
4079
4665
  /* @__PURE__ */ React.createElement(AccordionDetails, null, item.body)
4080
4666
  );
@@ -4082,18 +4668,18 @@ function Page({
4082
4668
  }
4083
4669
 
4084
4670
  // src/switch-button/index.tsx
4085
- import { Box as Box19, FormControlLabel as FormControlLabel3, Switch } from "@mui/material";
4671
+ import { Box as Box21, FormControlLabel as FormControlLabel3, Switch } from "@mui/material";
4086
4672
  import { styled as styled4 } from "@mui/system";
4087
- import React27 from "react";
4673
+ import React28 from "react";
4088
4674
  import { PiCardsDuotone, PiTableDuotone } from "react-icons/pi";
4089
- import { useTheme as useTheme6 } from "@mui/material";
4675
+ import { useTheme as useTheme7 } from "@mui/material";
4090
4676
  var SwitchButton = ({
4091
4677
  checked,
4092
4678
  handleChange,
4093
4679
  iconChecked,
4094
4680
  iconUnchecked
4095
4681
  }) => {
4096
- const theme2 = useTheme6();
4682
+ const theme2 = useTheme7();
4097
4683
  const isDarkMode = theme2.palette.mode === "dark";
4098
4684
  const CustomSwitch = styled4(Switch)(({ theme: theme3 }) => ({
4099
4685
  "& .MuiSwitch-switchBase.Mui-checked": {
@@ -4108,7 +4694,7 @@ var SwitchButton = ({
4108
4694
  border: isDarkMode ? "2px solid white" : "2px solid rgba(80,80,80, 1)"
4109
4695
  }
4110
4696
  }));
4111
- const BoxContainer = styled4(Box19)(({ theme: theme3 }) => ({
4697
+ const BoxContainer = styled4(Box21)(({ theme: theme3 }) => ({
4112
4698
  display: "flex",
4113
4699
  alignItems: "center",
4114
4700
  backgroundColor: "rgba(188,188,188, 0.1)",
@@ -4123,10 +4709,10 @@ var SwitchButton = ({
4123
4709
  transition: "all 0.2s ease",
4124
4710
  color: isDarkMode ? "rgba(220,220,220, 1)" : "rgba(160,160,160, 1)"
4125
4711
  });
4126
- return /* @__PURE__ */ React27.createElement(BoxContainer, null, /* @__PURE__ */ React27.createElement(
4712
+ return /* @__PURE__ */ React28.createElement(BoxContainer, null, /* @__PURE__ */ React28.createElement(
4127
4713
  FormControlLabel3,
4128
4714
  {
4129
- control: /* @__PURE__ */ React27.createElement(
4715
+ control: /* @__PURE__ */ React28.createElement(
4130
4716
  CustomSwitch,
4131
4717
  {
4132
4718
  checked,
@@ -4134,15 +4720,15 @@ var SwitchButton = ({
4134
4720
  name: "switch"
4135
4721
  }
4136
4722
  ),
4137
- label: /* @__PURE__ */ React27.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ React27.createElement(PiTableDuotone, { size: 30 }) : iconUnchecked ? iconUnchecked : /* @__PURE__ */ React27.createElement(PiCardsDuotone, { size: 30 }))
4723
+ label: /* @__PURE__ */ React28.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ React28.createElement(PiTableDuotone, { size: 30 }) : iconUnchecked ? iconUnchecked : /* @__PURE__ */ React28.createElement(PiCardsDuotone, { size: 30 }))
4138
4724
  }
4139
4725
  ));
4140
4726
  };
4141
4727
  var switch_button_default = SwitchButton;
4142
4728
 
4143
4729
  // src/bascule-connection-button/index.tsx
4144
- import { Box as Box20, Button as Button12 } from "@mui/material";
4145
- import React28, { useRef as useRef4, useState as useState13 } from "react";
4730
+ import { Box as Box22, Button as Button13 } from "@mui/material";
4731
+ import React29, { useRef as useRef4, useState as useState15 } from "react";
4146
4732
  import toast from "react-hot-toast";
4147
4733
  import { PiPlugs, PiPlugsConnected } from "react-icons/pi";
4148
4734
  var ConnectToBasculeButton = ({
@@ -4152,7 +4738,7 @@ var ConnectToBasculeButton = ({
4152
4738
  parity = "none",
4153
4739
  flowControl = "none"
4154
4740
  }) => {
4155
- const [connected, setConnected] = useState13(false);
4741
+ const [connected, setConnected] = useState15(false);
4156
4742
  const portRef = useRef4(null);
4157
4743
  const connectToBascule = async () => {
4158
4744
  if (!("serial" in navigator)) {
@@ -4171,7 +4757,7 @@ var ConnectToBasculeButton = ({
4171
4757
  toast.error("\u062E\u0637\u0627 \u062F\u0631 \u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644. \u0644\u0637\u0641\u0627\u064B \u062F\u0648\u0628\u0627\u0631\u0647 \u062A\u0644\u0627\u0634 \u06A9\u0646\u06CC\u062F.");
4172
4758
  }
4173
4759
  };
4174
- return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement("style", null, `
4760
+ return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement("style", null, `
4175
4761
  @keyframes jumpAnimation {
4176
4762
  0% { transform: translateY(1px); }
4177
4763
  12.5% { transform: translateY(-2px); }
@@ -4180,16 +4766,16 @@ var ConnectToBasculeButton = ({
4180
4766
  50% { transform: translateY(0); }
4181
4767
  100% { transform: translateY(0); }
4182
4768
  }
4183
- `), /* @__PURE__ */ React28.createElement(
4184
- Button12,
4769
+ `), /* @__PURE__ */ React29.createElement(
4770
+ Button13,
4185
4771
  {
4186
4772
  variant: "contained",
4187
4773
  onClick: connectToBascule,
4188
4774
  disabled: connected,
4189
4775
  sx: { minWidth: "11rem" }
4190
4776
  },
4191
- /* @__PURE__ */ React28.createElement(
4192
- Box20,
4777
+ /* @__PURE__ */ React29.createElement(
4778
+ Box22,
4193
4779
  {
4194
4780
  sx: {
4195
4781
  display: "flex",
@@ -4198,7 +4784,7 @@ var ConnectToBasculeButton = ({
4198
4784
  fontSize: 16
4199
4785
  }
4200
4786
  },
4201
- connected ? /* @__PURE__ */ React28.createElement(React28.Fragment, null, "\u0645\u062A\u0635\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ React28.createElement(PiPlugsConnected, { size: 20 })) : /* @__PURE__ */ React28.createElement(React28.Fragment, null, "\u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ React28.createElement(
4787
+ connected ? /* @__PURE__ */ React29.createElement(React29.Fragment, null, "\u0645\u062A\u0635\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ React29.createElement(PiPlugsConnected, { size: 20 })) : /* @__PURE__ */ React29.createElement(React29.Fragment, null, "\u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ React29.createElement(
4202
4788
  PiPlugs,
4203
4789
  {
4204
4790
  size: 20,
@@ -4248,6 +4834,7 @@ export {
4248
4834
  date_time_picker_default as DateTimePicker,
4249
4835
  date_time_range_picker_default as DateTimeRangePicker,
4250
4836
  DraggablePaper,
4837
+ enhanced_upload_image_default as EnhancedUploadImage,
4251
4838
  number_type_default as FormInputNumber,
4252
4839
  text_type_default as FormInputText,
4253
4840
  HorizontalStepper,