@mamrp/components 1.2.3 → 1.3.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
@@ -43,6 +43,7 @@ __export(src_exports, {
43
43
  DateTimePicker: () => date_time_picker_default,
44
44
  DateTimeRangePicker: () => date_time_range_picker_default,
45
45
  DraggablePaper: () => DraggablePaper,
46
+ EnhancedUploadImage: () => enhanced_upload_image_default,
46
47
  FormInputNumber: () => number_type_default,
47
48
  FormInputText: () => text_type_default,
48
49
  HorizontalStepper: () => HorizontalStepper,
@@ -4030,14 +4031,562 @@ var UploadImage = ({
4030
4031
  };
4031
4032
  var upload_image_default = UploadImage;
4032
4033
 
4034
+ // src/enhanced-upload-image/index.tsx
4035
+ var import_icons = require("@mamrp/icons");
4036
+ var import_material24 = require("@mui/material");
4037
+ var import_image5 = __toESM(require("next/image"));
4038
+ var import_react27 = __toESM(require("react"));
4039
+ var import_react_hook_form16 = require("react-hook-form");
4040
+ var import_gr2 = require("react-icons/gr");
4041
+ var import_md7 = require("react-icons/md");
4042
+
4043
+ // src/enhanced-upload-image/ImageViewer.tsx
4044
+ var import_material23 = require("@mui/material");
4045
+ var import_image4 = __toESM(require("next/image"));
4046
+ var import_react26 = require("react");
4047
+ var import_md6 = require("react-icons/md");
4048
+ function ImageViewer({
4049
+ open,
4050
+ handleClose,
4051
+ src,
4052
+ isLoading,
4053
+ title = "",
4054
+ noResetBtn = false,
4055
+ noRotate = false,
4056
+ noZoom = false
4057
+ }) {
4058
+ const [zoom, setZoom] = (0, import_react26.useState)(1);
4059
+ const [rotate, setRotate] = (0, import_react26.useState)(0);
4060
+ const [loading, setLoading] = (0, import_react26.useState)(true);
4061
+ const [viewerOpen, setViewerOpen] = (0, import_react26.useState)(false);
4062
+ const [viewerSrc, setViewerSrc] = (0, import_react26.useState)("");
4063
+ const [position, setPosition] = (0, import_react26.useState)({ x: 0, y: 0 });
4064
+ const [dragging, setDragging] = (0, import_react26.useState)(false);
4065
+ const [startMouse, setStartMouse] = (0, import_react26.useState)({ x: 0, y: 0 });
4066
+ const [startOffset, setStartOffset] = (0, import_react26.useState)({ x: 0, y: 0 });
4067
+ const reset = () => {
4068
+ setZoom(1);
4069
+ setRotate(0);
4070
+ setPosition({ x: 0, y: 0 });
4071
+ };
4072
+ const handleWheel = (0, import_react26.useCallback)((e) => {
4073
+ e.preventDefault();
4074
+ const delta = -e.deltaY * 1e-3;
4075
+ setZoom((z) => Math.min(5, Math.max(0.2, z + delta)));
4076
+ }, []);
4077
+ const handleMouseDown = (e) => {
4078
+ setDragging(true);
4079
+ setStartMouse({ x: e.clientX, y: e.clientY });
4080
+ setStartOffset({ ...position });
4081
+ };
4082
+ const handleMouseMove = (e) => {
4083
+ if (!dragging) return;
4084
+ const dx = e.clientX - startMouse.x;
4085
+ const dy = e.clientY - startMouse.y;
4086
+ setPosition({
4087
+ x: startOffset.x - dx,
4088
+ y: startOffset.y + dy
4089
+ });
4090
+ };
4091
+ const handleMouseUp = () => setDragging(false);
4092
+ (0, import_react26.useEffect)(() => {
4093
+ if (dragging) {
4094
+ window.addEventListener("mousemove", handleMouseMove);
4095
+ window.addEventListener("mouseup", handleMouseUp);
4096
+ } else {
4097
+ window.removeEventListener("mousemove", handleMouseMove);
4098
+ window.removeEventListener("mouseup", handleMouseUp);
4099
+ }
4100
+ return () => {
4101
+ window.removeEventListener("mousemove", handleMouseMove);
4102
+ window.removeEventListener("mouseup", handleMouseUp);
4103
+ };
4104
+ }, [dragging, startMouse, startOffset]);
4105
+ (0, import_react26.useEffect)(() => {
4106
+ if (open) reset();
4107
+ }, [open]);
4108
+ return /* @__PURE__ */ React.createElement(
4109
+ import_material23.Dialog,
4110
+ {
4111
+ open,
4112
+ onClose: handleClose,
4113
+ maxWidth: "xl",
4114
+ fullWidth: true,
4115
+ sx: {
4116
+ "& .MuiPaper-root": {
4117
+ borderRadius: 3,
4118
+ backgroundColor: "transparent"
4119
+ }
4120
+ }
4121
+ },
4122
+ /* @__PURE__ */ React.createElement(
4123
+ import_material23.Box,
4124
+ {
4125
+ sx: {
4126
+ position: "relative",
4127
+ width: "100%",
4128
+ height: "90vh",
4129
+ bgcolor: "rgba(17,17,17,0.9)",
4130
+ overflow: "hidden",
4131
+ display: "flex",
4132
+ justifyContent: "center",
4133
+ alignItems: "center"
4134
+ },
4135
+ onWheel: handleWheel
4136
+ },
4137
+ /* @__PURE__ */ React.createElement(
4138
+ import_material23.Box,
4139
+ {
4140
+ sx: {
4141
+ position: "absolute",
4142
+ top: 10,
4143
+ left: 10,
4144
+ zIndex: 20,
4145
+ display: "flex",
4146
+ gap: 1,
4147
+ alignItems: "center"
4148
+ }
4149
+ },
4150
+ /* @__PURE__ */ React.createElement(import_material23.IconButton, { onClick: handleClose }, /* @__PURE__ */ React.createElement(import_md6.MdClose, { color: "white" })),
4151
+ !noResetBtn && /* @__PURE__ */ React.createElement(import_material23.IconButton, { onClick: reset }, /* @__PURE__ */ React.createElement("span", { style: { color: "white", fontSize: "0.9rem" } }, "\u0628\u0627\u0632\u0646\u0634\u0627\u0646\u06CC")),
4152
+ !noRotate && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(import_material23.IconButton, { onClick: () => setRotate((r) => r - 90) }, /* @__PURE__ */ React.createElement(import_md6.MdRotateLeft, { color: "white" })), /* @__PURE__ */ React.createElement(import_material23.IconButton, { onClick: () => setRotate((r) => r + 90) }, /* @__PURE__ */ React.createElement(import_md6.MdRotateRight, { color: "white" }))),
4153
+ !noZoom && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(import_material23.IconButton, { onClick: () => setZoom((z) => z + 0.2) }, /* @__PURE__ */ React.createElement(import_md6.MdZoomIn, { color: "white" })), /* @__PURE__ */ React.createElement(
4154
+ import_material23.IconButton,
4155
+ {
4156
+ onClick: () => setZoom((z) => Math.max(0.2, z - 0.2))
4157
+ },
4158
+ /* @__PURE__ */ React.createElement(import_md6.MdZoomOut, { color: "white" })
4159
+ )),
4160
+ /* @__PURE__ */ React.createElement(import_material23.Typography, { color: "white" }, title)
4161
+ ),
4162
+ (isLoading || loading) && /* @__PURE__ */ React.createElement(
4163
+ import_material23.Box,
4164
+ {
4165
+ sx: {
4166
+ position: "absolute",
4167
+ zIndex: 10,
4168
+ top: "50%",
4169
+ left: "50%",
4170
+ transform: "translate(-50%, -50%)",
4171
+ color: "white"
4172
+ }
4173
+ },
4174
+ /* @__PURE__ */ React.createElement(import_material23.CircularProgress, { color: "inherit" })
4175
+ ),
4176
+ /* @__PURE__ */ React.createElement(
4177
+ import_material23.Box,
4178
+ {
4179
+ onMouseDown: handleMouseDown,
4180
+ sx: {
4181
+ position: "relative",
4182
+ width: "100%",
4183
+ height: "78vh",
4184
+ cursor: dragging ? "grabbing" : "grab",
4185
+ display: "flex",
4186
+ justifyContent: "center",
4187
+ alignItems: "center",
4188
+ overflow: "hidden"
4189
+ }
4190
+ },
4191
+ src && !isLoading && /* @__PURE__ */ React.createElement(
4192
+ import_image4.default,
4193
+ {
4194
+ src,
4195
+ alt: title,
4196
+ fill: true,
4197
+ style: {
4198
+ objectFit: "contain",
4199
+ transform: `translate(${position.x}px, ${position.y}px) scale(${zoom}) rotate(${rotate}deg)`,
4200
+ transition: dragging ? "none" : "transform 0.3s ease"
4201
+ },
4202
+ onLoadingComplete: () => setLoading(false)
4203
+ }
4204
+ )
4205
+ )
4206
+ ),
4207
+ /* @__PURE__ */ React.createElement(
4208
+ ImageViewer,
4209
+ {
4210
+ open: viewerOpen,
4211
+ handleClose: () => setViewerOpen(false),
4212
+ src: src || "",
4213
+ isLoading: false
4214
+ }
4215
+ )
4216
+ );
4217
+ }
4218
+
4219
+ // src/enhanced-upload-image/index.tsx
4220
+ var UploadImage2 = ({
4221
+ placeholder,
4222
+ name,
4223
+ selectedImage,
4224
+ setSelectedImage,
4225
+ control,
4226
+ errors,
4227
+ setValue,
4228
+ height = "280px",
4229
+ allowGallery = false,
4230
+ imageFit = "cover"
4231
+ }) => {
4232
+ const theme2 = (0, import_material24.useTheme)();
4233
+ const [viewerOpen, setViewerOpen] = (0, import_react27.useState)(false);
4234
+ const [viewerSrc, setViewerSrc] = (0, import_react27.useState)("");
4235
+ const compressImage = (file, quality = 0.9, maxWidth = 1600, maxHeight = 1600) => {
4236
+ return new Promise((resolve) => {
4237
+ const reader = new FileReader();
4238
+ reader.readAsDataURL(file);
4239
+ reader.onload = (event) => {
4240
+ const img = new window.Image();
4241
+ img.src = event.target?.result;
4242
+ img.onload = () => {
4243
+ const canvas = document.createElement("canvas");
4244
+ let width = img.width;
4245
+ let height2 = img.height;
4246
+ if (width > maxWidth) {
4247
+ height2 *= maxWidth / width;
4248
+ width = maxWidth;
4249
+ }
4250
+ if (height2 > maxHeight) {
4251
+ width *= maxHeight / height2;
4252
+ height2 = maxHeight;
4253
+ }
4254
+ canvas.width = width;
4255
+ canvas.height = height2;
4256
+ const ctx = canvas.getContext("2d");
4257
+ if (ctx) {
4258
+ ctx.drawImage(img, 0, 0, width, height2);
4259
+ canvas.toBlob(
4260
+ (blob) => {
4261
+ if (blob) {
4262
+ const compressedFile = new File([blob], file.name, {
4263
+ type: "image/jpeg",
4264
+ lastModified: Date.now()
4265
+ });
4266
+ resolve(compressedFile);
4267
+ } else {
4268
+ resolve(null);
4269
+ }
4270
+ },
4271
+ "image/jpeg",
4272
+ quality
4273
+ );
4274
+ } else {
4275
+ resolve(null);
4276
+ }
4277
+ };
4278
+ };
4279
+ });
4280
+ };
4281
+ const handleImageChange = async (event) => {
4282
+ const file = event.target.files?.[0];
4283
+ if (file) {
4284
+ console.log("Original file size (KB):", (file.size / 1024).toFixed(2));
4285
+ const compressedFile = await compressImage(file);
4286
+ if (compressedFile) {
4287
+ console.log(
4288
+ "Compressed file size (KB):",
4289
+ (compressedFile.size / 1024).toFixed(2)
4290
+ );
4291
+ const objectURL = URL.createObjectURL(compressedFile);
4292
+ setSelectedImage(objectURL);
4293
+ setValue(name, compressedFile);
4294
+ }
4295
+ }
4296
+ };
4297
+ const handleRemoveImage = () => {
4298
+ setSelectedImage(null);
4299
+ setValue(name, null);
4300
+ const galleryInput = document.getElementById(
4301
+ "gallery-upload"
4302
+ );
4303
+ const cameraInput = document.getElementById(
4304
+ "camera-upload"
4305
+ );
4306
+ const fileInput = document.getElementById(
4307
+ "file-upload"
4308
+ );
4309
+ if (galleryInput) galleryInput.value = "";
4310
+ if (cameraInput) cameraInput.value = "";
4311
+ if (fileInput) fileInput.value = "";
4312
+ };
4313
+ return /* @__PURE__ */ import_react27.default.createElement(
4314
+ import_react_hook_form16.Controller,
4315
+ {
4316
+ name,
4317
+ control,
4318
+ render: ({ field }) => /* @__PURE__ */ import_react27.default.createElement(import_material24.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react27.default.createElement(
4319
+ import_material24.Box,
4320
+ {
4321
+ sx: {
4322
+ position: "relative",
4323
+ width: "100%",
4324
+ height,
4325
+ borderRadius: 3,
4326
+ overflow: "hidden",
4327
+ backgroundColor: selectedImage ? "transparent" : (0, import_material24.alpha)(theme2.palette.primary.main, 0.02),
4328
+ border: selectedImage ? `2px solid ${(0, import_material24.alpha)(theme2.palette.primary.main, 0.1)}` : `2px dashed ${(0, import_material24.alpha)(theme2.palette.primary.main, 0.2)}`,
4329
+ transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
4330
+ cursor: allowGallery ? "default" : "pointer",
4331
+ "&:hover": {
4332
+ borderColor: selectedImage ? (0, import_material24.alpha)(theme2.palette.primary.main, 0.3) : (0, import_material24.alpha)(theme2.palette.primary.main, 0.4),
4333
+ backgroundColor: selectedImage ? "transparent" : (0, import_material24.alpha)(theme2.palette.primary.main, 0.04)
4334
+ }
4335
+ }
4336
+ },
4337
+ selectedImage ? /* @__PURE__ */ import_react27.default.createElement(import_react27.default.Fragment, null, /* @__PURE__ */ import_react27.default.createElement(
4338
+ import_image5.default,
4339
+ {
4340
+ src: selectedImage,
4341
+ alt: "Preview",
4342
+ width: 900,
4343
+ height: 600,
4344
+ style: {
4345
+ maxWidth: "100%",
4346
+ maxHeight: "250px",
4347
+ borderRadius: "8px",
4348
+ border: "1px solid #ccc",
4349
+ objectFit: "contain",
4350
+ cursor: "pointer"
4351
+ },
4352
+ onClick: () => {
4353
+ setViewerSrc(selectedImage);
4354
+ setViewerOpen(true);
4355
+ }
4356
+ }
4357
+ ), /* @__PURE__ */ import_react27.default.createElement(import_material24.Fade, { in: true }, /* @__PURE__ */ import_react27.default.createElement(import_material24.Tooltip, { title: "\u062D\u0630\u0641" }, /* @__PURE__ */ import_react27.default.createElement(
4358
+ import_material24.IconButton,
4359
+ {
4360
+ onClick: (e) => {
4361
+ e.preventDefault();
4362
+ e.stopPropagation();
4363
+ handleRemoveImage();
4364
+ },
4365
+ sx: {
4366
+ position: "absolute",
4367
+ top: 12,
4368
+ right: 12,
4369
+ backgroundColor: (0, import_material24.alpha)(theme2.palette.error.main, 0.9),
4370
+ color: "white",
4371
+ width: 40,
4372
+ height: 40,
4373
+ "&:hover": {
4374
+ backgroundColor: theme2.palette.error.main,
4375
+ transform: "scale(1.1)"
4376
+ },
4377
+ transition: "all 0.2s ease",
4378
+ boxShadow: `0 4px 12px ${(0, import_material24.alpha)(
4379
+ theme2.palette.error.main,
4380
+ 0.3
4381
+ )}`
4382
+ }
4383
+ },
4384
+ /* @__PURE__ */ import_react27.default.createElement(import_icons.Delete, { size: 18 })
4385
+ )))) : /* @__PURE__ */ import_react27.default.createElement(
4386
+ import_material24.Stack,
4387
+ {
4388
+ spacing: 3,
4389
+ sx: {
4390
+ height: "100%",
4391
+ justifyContent: "center",
4392
+ alignItems: "center",
4393
+ p: 3
4394
+ }
4395
+ },
4396
+ /* @__PURE__ */ import_react27.default.createElement(import_material24.Stack, { spacing: 2, alignItems: "center" }, /* @__PURE__ */ import_react27.default.createElement(
4397
+ import_material24.Box,
4398
+ {
4399
+ sx: {
4400
+ width: 64,
4401
+ height: 64,
4402
+ borderRadius: "50%",
4403
+ backgroundColor: (0, import_material24.alpha)(
4404
+ theme2.palette.successLight.main,
4405
+ 0.1
4406
+ ),
4407
+ display: "flex",
4408
+ alignItems: "center",
4409
+ justifyContent: "center",
4410
+ transition: "all 0.3s ease"
4411
+ }
4412
+ },
4413
+ /* @__PURE__ */ import_react27.default.createElement(
4414
+ import_md7.MdAddPhotoAlternate,
4415
+ {
4416
+ size: 32,
4417
+ color: theme2.palette.successLight.main,
4418
+ style: { opacity: 0.8 }
4419
+ }
4420
+ )
4421
+ ), /* @__PURE__ */ import_react27.default.createElement(
4422
+ import_material24.Typography,
4423
+ {
4424
+ variant: "h6",
4425
+ sx: {
4426
+ color: theme2.palette.text.primary,
4427
+ fontWeight: 500,
4428
+ textAlign: "center",
4429
+ mb: 1
4430
+ }
4431
+ },
4432
+ placeholder
4433
+ ), /* @__PURE__ */ import_react27.default.createElement(
4434
+ import_material24.Typography,
4435
+ {
4436
+ variant: "body2",
4437
+ sx: {
4438
+ color: theme2.palette.text.secondary,
4439
+ textAlign: "center",
4440
+ fontSize: "0.875rem"
4441
+ }
4442
+ },
4443
+ "PNG, JPG \u06CC\u0627 WEBP \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0645\u06CC\u200C\u0634\u0648\u062F"
4444
+ )),
4445
+ allowGallery && /* @__PURE__ */ import_react27.default.createElement(import_material24.Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ import_react27.default.createElement(
4446
+ import_material24.Button,
4447
+ {
4448
+ variant: "contained",
4449
+ startIcon: /* @__PURE__ */ import_react27.default.createElement(import_md7.MdOutlineCameraAlt, { size: 16 }),
4450
+ onClick: (e) => {
4451
+ e.preventDefault();
4452
+ document.getElementById("camera-upload")?.click();
4453
+ },
4454
+ sx: {
4455
+ borderRadius: 2,
4456
+ px: 2.5,
4457
+ textTransform: "none",
4458
+ fontWeight: 600,
4459
+ boxShadow: `0 4px 12px ${(0, import_material24.alpha)(
4460
+ theme2.palette.successLight.main,
4461
+ 0.3
4462
+ )}`,
4463
+ zIndex: 1,
4464
+ transition: "all 0.2s ease",
4465
+ "&:hover": {
4466
+ boxShadow: `0 6px 20px ${(0, import_material24.alpha)(
4467
+ theme2.palette.successLight.main,
4468
+ 0.4
4469
+ )}`,
4470
+ transform: "translateY(-1px)"
4471
+ }
4472
+ },
4473
+ color: "successLight"
4474
+ },
4475
+ "\u062F\u0648\u0631\u0628\u06CC\u0646"
4476
+ ), /* @__PURE__ */ import_react27.default.createElement(
4477
+ import_material24.Button,
4478
+ {
4479
+ variant: "outlined",
4480
+ startIcon: /* @__PURE__ */ import_react27.default.createElement(import_gr2.GrGallery, { size: 16 }),
4481
+ onClick: (e) => {
4482
+ e.preventDefault();
4483
+ document.getElementById("gallery-upload")?.click();
4484
+ },
4485
+ sx: {
4486
+ borderRadius: 2,
4487
+ px: 2.5,
4488
+ textTransform: "none",
4489
+ fontWeight: 600,
4490
+ borderWidth: 2,
4491
+ transition: "all 0.2s ease",
4492
+ "&:hover": {
4493
+ boxShadow: `0 6px 20px ${(0, import_material24.alpha)(
4494
+ theme2.palette.successLight.main,
4495
+ 0.4
4496
+ )}`,
4497
+ transform: "translateY(-1px)"
4498
+ }
4499
+ },
4500
+ color: "successLight"
4501
+ },
4502
+ "\u06AF\u0627\u0644\u0631\u06CC"
4503
+ ))
4504
+ )
4505
+ ), !allowGallery && /* @__PURE__ */ import_react27.default.createElement(
4506
+ "input",
4507
+ {
4508
+ id: "file-upload",
4509
+ type: "file",
4510
+ accept: "image/*",
4511
+ capture: "environment",
4512
+ onChange: (event) => {
4513
+ handleImageChange(event);
4514
+ field.onChange(event.target.files?.[0] || null);
4515
+ },
4516
+ style: { display: "none" }
4517
+ }
4518
+ ), /* @__PURE__ */ import_react27.default.createElement(
4519
+ "input",
4520
+ {
4521
+ id: "gallery-upload",
4522
+ type: "file",
4523
+ accept: "image/*",
4524
+ onChange: (event) => {
4525
+ handleImageChange(event);
4526
+ field.onChange(event.target.files?.[0] || null);
4527
+ },
4528
+ style: { display: "none" }
4529
+ }
4530
+ ), /* @__PURE__ */ import_react27.default.createElement(
4531
+ "input",
4532
+ {
4533
+ id: "camera-upload",
4534
+ type: "file",
4535
+ accept: "image/*",
4536
+ capture: "environment",
4537
+ onChange: (event) => {
4538
+ handleImageChange(event);
4539
+ field.onChange(event.target.files?.[0] || null);
4540
+ },
4541
+ style: { display: "none" }
4542
+ }
4543
+ ), errors[name] && /* @__PURE__ */ import_react27.default.createElement(import_material24.Fade, { in: true }, /* @__PURE__ */ import_react27.default.createElement(
4544
+ import_material24.Box,
4545
+ {
4546
+ sx: {
4547
+ mt: 1.5,
4548
+ p: 1.5,
4549
+ borderRadius: 1,
4550
+ backgroundColor: (0, import_material24.alpha)(theme2.palette.error.main, 0.05),
4551
+ border: `1px solid ${(0, import_material24.alpha)(theme2.palette.error.main, 0.2)}`
4552
+ }
4553
+ },
4554
+ /* @__PURE__ */ import_react27.default.createElement(
4555
+ import_material24.Typography,
4556
+ {
4557
+ color: "error",
4558
+ variant: "body2",
4559
+ sx: {
4560
+ fontWeight: 500,
4561
+ display: "flex",
4562
+ alignItems: "center",
4563
+ gap: 1
4564
+ }
4565
+ },
4566
+ String(errors[name]?.message || "")
4567
+ )
4568
+ )), /* @__PURE__ */ import_react27.default.createElement(
4569
+ ImageViewer,
4570
+ {
4571
+ open: viewerOpen,
4572
+ handleClose: () => setViewerOpen(false),
4573
+ src: viewerSrc,
4574
+ isLoading: false
4575
+ }
4576
+ ))
4577
+ }
4578
+ );
4579
+ };
4580
+ var enhanced_upload_image_default = UploadImage2;
4581
+
4033
4582
  // src/accordion/index.tsx
4034
4583
  var import_styles2 = require("@mui/material/styles");
4035
4584
  var import_io2 = require("react-icons/io");
4036
4585
  var import_Accordion = __toESM(require("@mui/material/Accordion"));
4037
4586
  var import_AccordionSummary = __toESM(require("@mui/material/AccordionSummary"));
4038
4587
  var import_AccordionDetails = __toESM(require("@mui/material/AccordionDetails"));
4039
- var import_material23 = require("@mui/material");
4040
- var import_react26 = require("react");
4588
+ var import_material25 = require("@mui/material");
4589
+ var import_react28 = require("react");
4041
4590
  function Page({
4042
4591
  data
4043
4592
  }) {
@@ -4067,7 +4616,7 @@ function Page({
4067
4616
  padding: theme2.spacing(2),
4068
4617
  borderTop: "1px solid rgba(0, 0, 0, .125)"
4069
4618
  }));
4070
- const [expanded, setExpanded] = (0, import_react26.useState)("");
4619
+ const [expanded, setExpanded] = (0, import_react28.useState)("");
4071
4620
  const handleChange = (panel) => (event, newExpanded) => {
4072
4621
  setExpanded(newExpanded ? panel : false);
4073
4622
  };
@@ -4091,7 +4640,7 @@ function Page({
4091
4640
  }
4092
4641
  }
4093
4642
  },
4094
- /* @__PURE__ */ React.createElement(import_material23.Typography, { component: "span" }, item.title)
4643
+ /* @__PURE__ */ React.createElement(import_material25.Typography, { component: "span" }, item.title)
4095
4644
  ),
4096
4645
  /* @__PURE__ */ React.createElement(AccordionDetails, null, item.body)
4097
4646
  );
@@ -4099,20 +4648,20 @@ function Page({
4099
4648
  }
4100
4649
 
4101
4650
  // src/switch-button/index.tsx
4102
- var import_material24 = require("@mui/material");
4651
+ var import_material26 = require("@mui/material");
4103
4652
  var import_system8 = require("@mui/system");
4104
- var import_react27 = __toESM(require("react"));
4653
+ var import_react29 = __toESM(require("react"));
4105
4654
  var import_pi = require("react-icons/pi");
4106
- var import_material25 = require("@mui/material");
4655
+ var import_material27 = require("@mui/material");
4107
4656
  var SwitchButton = ({
4108
4657
  checked,
4109
4658
  handleChange,
4110
4659
  iconChecked,
4111
4660
  iconUnchecked
4112
4661
  }) => {
4113
- const theme2 = (0, import_material25.useTheme)();
4662
+ const theme2 = (0, import_material27.useTheme)();
4114
4663
  const isDarkMode = theme2.palette.mode === "dark";
4115
- const CustomSwitch = (0, import_system8.styled)(import_material24.Switch)(({ theme: theme3 }) => ({
4664
+ const CustomSwitch = (0, import_system8.styled)(import_material26.Switch)(({ theme: theme3 }) => ({
4116
4665
  "& .MuiSwitch-switchBase.Mui-checked": {
4117
4666
  color: theme3.palette.primary.main
4118
4667
  },
@@ -4125,7 +4674,7 @@ var SwitchButton = ({
4125
4674
  border: isDarkMode ? "2px solid white" : "2px solid rgba(80,80,80, 1)"
4126
4675
  }
4127
4676
  }));
4128
- const BoxContainer = (0, import_system8.styled)(import_material24.Box)(({ theme: theme3 }) => ({
4677
+ const BoxContainer = (0, import_system8.styled)(import_material26.Box)(({ theme: theme3 }) => ({
4129
4678
  display: "flex",
4130
4679
  alignItems: "center",
4131
4680
  backgroundColor: "rgba(188,188,188, 0.1)",
@@ -4140,10 +4689,10 @@ var SwitchButton = ({
4140
4689
  transition: "all 0.2s ease",
4141
4690
  color: isDarkMode ? "rgba(220,220,220, 1)" : "rgba(160,160,160, 1)"
4142
4691
  });
4143
- return /* @__PURE__ */ import_react27.default.createElement(BoxContainer, null, /* @__PURE__ */ import_react27.default.createElement(
4144
- import_material24.FormControlLabel,
4692
+ return /* @__PURE__ */ import_react29.default.createElement(BoxContainer, null, /* @__PURE__ */ import_react29.default.createElement(
4693
+ import_material26.FormControlLabel,
4145
4694
  {
4146
- control: /* @__PURE__ */ import_react27.default.createElement(
4695
+ control: /* @__PURE__ */ import_react29.default.createElement(
4147
4696
  CustomSwitch,
4148
4697
  {
4149
4698
  checked,
@@ -4151,15 +4700,15 @@ var SwitchButton = ({
4151
4700
  name: "switch"
4152
4701
  }
4153
4702
  ),
4154
- label: /* @__PURE__ */ import_react27.default.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ import_react27.default.createElement(import_pi.PiTableDuotone, { size: 30 }) : iconUnchecked ? iconUnchecked : /* @__PURE__ */ import_react27.default.createElement(import_pi.PiCardsDuotone, { size: 30 }))
4703
+ label: /* @__PURE__ */ import_react29.default.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ import_react29.default.createElement(import_pi.PiTableDuotone, { size: 30 }) : iconUnchecked ? iconUnchecked : /* @__PURE__ */ import_react29.default.createElement(import_pi.PiCardsDuotone, { size: 30 }))
4155
4704
  }
4156
4705
  ));
4157
4706
  };
4158
4707
  var switch_button_default = SwitchButton;
4159
4708
 
4160
4709
  // src/bascule-connection-button/index.tsx
4161
- var import_material26 = require("@mui/material");
4162
- var import_react28 = __toESM(require("react"));
4710
+ var import_material28 = require("@mui/material");
4711
+ var import_react30 = __toESM(require("react"));
4163
4712
  var import_react_hot_toast = __toESM(require("react-hot-toast"));
4164
4713
  var import_pi2 = require("react-icons/pi");
4165
4714
  var ConnectToBasculeButton = ({
@@ -4169,8 +4718,8 @@ var ConnectToBasculeButton = ({
4169
4718
  parity = "none",
4170
4719
  flowControl = "none"
4171
4720
  }) => {
4172
- const [connected, setConnected] = (0, import_react28.useState)(false);
4173
- const portRef = (0, import_react28.useRef)(null);
4721
+ const [connected, setConnected] = (0, import_react30.useState)(false);
4722
+ const portRef = (0, import_react30.useRef)(null);
4174
4723
  const connectToBascule = async () => {
4175
4724
  if (!("serial" in navigator)) {
4176
4725
  import_react_hot_toast.default.error("Web Serial API \u062A\u0648\u0633\u0637 \u0627\u06CC\u0646 \u0645\u0631\u0648\u0631\u06AF\u0631 \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0646\u0645\u06CC\u200C\u0634\u0648\u062F.");
@@ -4188,7 +4737,7 @@ var ConnectToBasculeButton = ({
4188
4737
  import_react_hot_toast.default.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.");
4189
4738
  }
4190
4739
  };
4191
- return /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, /* @__PURE__ */ import_react28.default.createElement("style", null, `
4740
+ return /* @__PURE__ */ import_react30.default.createElement(import_react30.default.Fragment, null, /* @__PURE__ */ import_react30.default.createElement("style", null, `
4192
4741
  @keyframes jumpAnimation {
4193
4742
  0% { transform: translateY(1px); }
4194
4743
  12.5% { transform: translateY(-2px); }
@@ -4197,16 +4746,16 @@ var ConnectToBasculeButton = ({
4197
4746
  50% { transform: translateY(0); }
4198
4747
  100% { transform: translateY(0); }
4199
4748
  }
4200
- `), /* @__PURE__ */ import_react28.default.createElement(
4201
- import_material26.Button,
4749
+ `), /* @__PURE__ */ import_react30.default.createElement(
4750
+ import_material28.Button,
4202
4751
  {
4203
4752
  variant: "contained",
4204
4753
  onClick: connectToBascule,
4205
4754
  disabled: connected,
4206
4755
  sx: { minWidth: "11rem" }
4207
4756
  },
4208
- /* @__PURE__ */ import_react28.default.createElement(
4209
- import_material26.Box,
4757
+ /* @__PURE__ */ import_react30.default.createElement(
4758
+ import_material28.Box,
4210
4759
  {
4211
4760
  sx: {
4212
4761
  display: "flex",
@@ -4215,7 +4764,7 @@ var ConnectToBasculeButton = ({
4215
4764
  fontSize: 16
4216
4765
  }
4217
4766
  },
4218
- connected ? /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, "\u0645\u062A\u0635\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ import_react28.default.createElement(import_pi2.PiPlugsConnected, { size: 20 })) : /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, "\u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ import_react28.default.createElement(
4767
+ connected ? /* @__PURE__ */ import_react30.default.createElement(import_react30.default.Fragment, null, "\u0645\u062A\u0635\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ import_react30.default.createElement(import_pi2.PiPlugsConnected, { size: 20 })) : /* @__PURE__ */ import_react30.default.createElement(import_react30.default.Fragment, null, "\u0627\u062A\u0635\u0627\u0644 \u0628\u0647 \u0628\u0627\u0633\u06A9\u0648\u0644", /* @__PURE__ */ import_react30.default.createElement(
4219
4768
  import_pi2.PiPlugs,
4220
4769
  {
4221
4770
  size: 20,
@@ -4230,15 +4779,15 @@ var ConnectToBasculeButton = ({
4230
4779
  var bascule_connection_button_default = ConnectToBasculeButton;
4231
4780
 
4232
4781
  // src/draggable-paper/index.tsx
4233
- var import_material27 = require("@mui/material");
4234
- var import_react29 = require("react");
4782
+ var import_material29 = require("@mui/material");
4783
+ var import_react31 = require("react");
4235
4784
  var import_react_draggable = __toESM(require("react-draggable"));
4236
4785
  function DraggablePaper({
4237
4786
  handle = "#draggable-dialog",
4238
4787
  cancel = '[class*="MuiDialogContent-root"]',
4239
4788
  ...props
4240
4789
  }) {
4241
- const nodeRef = (0, import_react29.useRef)(null);
4790
+ const nodeRef = (0, import_react31.useRef)(null);
4242
4791
  return /* @__PURE__ */ React.createElement(
4243
4792
  import_react_draggable.default,
4244
4793
  {
@@ -4248,7 +4797,7 @@ function DraggablePaper({
4248
4797
  bounds: "parent",
4249
4798
  defaultPosition: { x: 0, y: 0 }
4250
4799
  },
4251
- /* @__PURE__ */ React.createElement(import_material27.Paper, { ref: nodeRef, ...props })
4800
+ /* @__PURE__ */ React.createElement(import_material29.Paper, { ref: nodeRef, ...props })
4252
4801
  );
4253
4802
  }
4254
4803
  // Annotate the CommonJS export names for ESM import in node:
@@ -4266,6 +4815,7 @@ function DraggablePaper({
4266
4815
  DateTimePicker,
4267
4816
  DateTimeRangePicker,
4268
4817
  DraggablePaper,
4818
+ EnhancedUploadImage,
4269
4819
  FormInputNumber,
4270
4820
  FormInputText,
4271
4821
  HorizontalStepper,