@mamrp/components 1.7.60 → 1.7.62

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.d.mts CHANGED
@@ -756,4 +756,18 @@ interface MapPickerProps {
756
756
  }
757
757
  declare function MapLocationPicker({ control, nameLat, nameLong, nameAddress, isLoading, defaultLat, defaultLng, defaultZoom, minZoom, maxZoom, }: MapPickerProps): React$1.JSX.Element;
758
758
 
759
- export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
759
+ declare function CheckBoxGroup({ name, label, options, control, align, disabledBoarder, direction, }: {
760
+ name: string;
761
+ label: string | React$1.ReactNode;
762
+ control: Control<any>;
763
+ options: {
764
+ value: any;
765
+ name: string;
766
+ id: any;
767
+ }[];
768
+ align?: "start" | "center" | "end";
769
+ disabledBoarder?: boolean;
770
+ direction?: "row" | "column";
771
+ }): React$1.JSX.Element;
772
+
773
+ export { Page as Accordion, AdvancedSearchButton, CheckBoxGroup, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
package/dist/index.d.ts CHANGED
@@ -756,4 +756,18 @@ interface MapPickerProps {
756
756
  }
757
757
  declare function MapLocationPicker({ control, nameLat, nameLong, nameAddress, isLoading, defaultLat, defaultLng, defaultZoom, minZoom, maxZoom, }: MapPickerProps): React$1.JSX.Element;
758
758
 
759
- export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
759
+ declare function CheckBoxGroup({ name, label, options, control, align, disabledBoarder, direction, }: {
760
+ name: string;
761
+ label: string | React$1.ReactNode;
762
+ control: Control<any>;
763
+ options: {
764
+ value: any;
765
+ name: string;
766
+ id: any;
767
+ }[];
768
+ align?: "start" | "center" | "end";
769
+ disabledBoarder?: boolean;
770
+ direction?: "row" | "column";
771
+ }): React$1.JSX.Element;
772
+
773
+ export { Page as Accordion, AdvancedSearchButton, CheckBoxGroup, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  Accordion: () => Page,
34
34
  AdvancedSearchButton: () => AdvancedSearchButton,
35
+ CheckBoxGroup: () => CheckBoxGroup,
35
36
  ConfirmationDialog: () => ConfirmationDialog,
36
37
  ConnectToBasculeButton: () => bascule_connection_button_default,
37
38
  CustomCheckbox: () => CustomCheckbox,
@@ -84,8 +85,8 @@ var import_react = require("react");
84
85
  function Page({
85
86
  data
86
87
  }) {
87
- const Accordion = (0, import_styles.styled)((props) => /* @__PURE__ */ React.createElement(import_Accordion.default, { disableGutters: true, elevation: 0, square: true, ...props }))(({ theme: theme3 }) => ({
88
- border: `1px solid ${theme3.palette.divider}`,
88
+ const Accordion = (0, import_styles.styled)((props) => /* @__PURE__ */ React.createElement(import_Accordion.default, { disableGutters: true, elevation: 0, square: true, ...props }))(({ theme: theme4 }) => ({
89
+ border: `1px solid ${theme4.palette.divider}`,
89
90
  "&:not(:last-child)": {
90
91
  borderBottom: 0
91
92
  },
@@ -93,21 +94,21 @@ function Page({
93
94
  display: "none"
94
95
  }
95
96
  }));
96
- const AccordionSummary = (0, import_styles.styled)((props) => /* @__PURE__ */ React.createElement(import_AccordionSummary.default, { expandIcon: /* @__PURE__ */ React.createElement(import_io.IoIosArrowForward, null), ...props }))(({ theme: theme3 }) => ({
97
+ const AccordionSummary = (0, import_styles.styled)((props) => /* @__PURE__ */ React.createElement(import_AccordionSummary.default, { expandIcon: /* @__PURE__ */ React.createElement(import_io.IoIosArrowForward, null), ...props }))(({ theme: theme4 }) => ({
97
98
  backgroundColor: "rgba(0, 0, 0, .03)",
98
99
  flexDirection: "row-reverse",
99
100
  [`& .${import_AccordionSummary.accordionSummaryClasses.expandIconWrapper}.${import_AccordionSummary.accordionSummaryClasses.expanded}`]: {
100
101
  transform: "rotate(90deg)"
101
102
  },
102
103
  [`& .${import_AccordionSummary.accordionSummaryClasses.content}`]: {
103
- marginLeft: theme3.spacing(1)
104
+ marginLeft: theme4.spacing(1)
104
105
  },
105
- ...theme3.applyStyles("dark", {
106
+ ...theme4.applyStyles("dark", {
106
107
  backgroundColor: "rgba(255, 255, 255, .05)"
107
108
  })
108
109
  }));
109
- const AccordionDetails = (0, import_styles.styled)(import_AccordionDetails.default)(({ theme: theme3 }) => ({
110
- padding: theme3.spacing(2),
110
+ const AccordionDetails = (0, import_styles.styled)(import_AccordionDetails.default)(({ theme: theme4 }) => ({
111
+ padding: theme4.spacing(2),
111
112
  borderTop: "1px solid rgba(0, 0, 0, .125)"
112
113
  }));
113
114
  const [expanded, setExpanded] = (0, import_react.useState)("");
@@ -216,7 +217,7 @@ function LicensePlate({
216
217
  readOnly = true,
217
218
  size
218
219
  }) {
219
- const theme3 = (0, import_material2.useTheme)();
220
+ const theme4 = (0, import_material2.useTheme)();
220
221
  const [open, setOpen] = (0, import_react2.useState)(false);
221
222
  const [inputValues, setInputValues] = (0, import_react2.useState)({
222
223
  input1: "",
@@ -268,7 +269,7 @@ function LicensePlate({
268
269
  }
269
270
  };
270
271
  const inputStyle = {
271
- color: theme3.palette.text.primary,
272
+ color: theme4.palette.text.primary,
272
273
  width: "30px",
273
274
  textAlign: "center",
274
275
  backgroundColor: "transparent",
@@ -807,8 +808,8 @@ function AdvancedSearchButton({
807
808
  backgroundColor,
808
809
  border = false
809
810
  }) {
810
- const theme3 = (0, import_material6.useTheme)();
811
- const isDarkMode = theme3.palette.mode === "dark";
811
+ const theme4 = (0, import_material6.useTheme)();
812
+ const isDarkMode = theme4.palette.mode === "dark";
812
813
  return /* @__PURE__ */ import_react5.default.createElement(
813
814
  import_material6.Button,
814
815
  {
@@ -818,7 +819,7 @@ function AdvancedSearchButton({
818
819
  },
819
820
  startIcon: /* @__PURE__ */ import_react5.default.createElement(AnimatedIcon, { isShowFilter }),
820
821
  sx: {
821
- color: theme3.palette.text.primary ?? color,
822
+ color: theme4.palette.text.primary ?? color,
822
823
  borderRadius: borderRadius ?? 2,
823
824
  paddingY,
824
825
  fontSize,
@@ -968,7 +969,7 @@ function ConfirmationDialog({
968
969
  position: "absolute",
969
970
  right: 8,
970
971
  top: 8,
971
- color: (theme3) => theme3.palette.grey[500]
972
+ color: (theme4) => theme4.palette.grey[500]
972
973
  }
973
974
  },
974
975
  /* @__PURE__ */ React8.createElement(import_md.MdClose, null)
@@ -1141,7 +1142,7 @@ var DateTimePickerComponent = ({
1141
1142
  clearable = false,
1142
1143
  variant = "outlined"
1143
1144
  }) => {
1144
- const theme3 = (0, import_material11.useTheme)();
1145
+ const theme4 = (0, import_material11.useTheme)();
1145
1146
  const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
1146
1147
  const [hasUserInteracted, setHasUserInteracted] = (0, import_react9.useState)(false);
1147
1148
  const hourInputRef = (0, import_react9.useRef)(null);
@@ -1714,7 +1715,7 @@ var DateTimePickerComponent = ({
1714
1715
  fontWeight: isSelected(day) ? 700 : 400,
1715
1716
  bgcolor: isSelected(day) ? "primary.main" : isToday(day) ? "primary.lighter" : "transparent",
1716
1717
  color: isSelected(day) ? "primary.contrastText" : isToday(day) ? "primary.main" : index % 7 === 6 ? "error.main" : "text.primary",
1717
- border: isToday(day) && !isSelected(day) ? `2px solid ${theme3.palette.primary.main}` : "none",
1718
+ border: isToday(day) && !isSelected(day) ? `2px solid ${theme4.palette.primary.main}` : "none",
1718
1719
  transition: "all 0.15s ease",
1719
1720
  "&:hover": day ? {
1720
1721
  bgcolor: isSelected(day) ? "primary.dark" : "action.hover"
@@ -1775,7 +1776,7 @@ function CustomDialog({
1775
1776
  {
1776
1777
  alignItems: "center",
1777
1778
  sx: {
1778
- color: iconColor ? (theme3) => {
1779
+ color: iconColor ? (theme4) => {
1779
1780
  const paletteColors = [
1780
1781
  "primary",
1781
1782
  "secondary",
@@ -1794,11 +1795,11 @@ function CustomDialog({
1794
1795
  "customRed"
1795
1796
  ];
1796
1797
  if (paletteColors.includes(iconColor)) {
1797
- const palette = theme3.palette;
1798
+ const palette = theme4.palette;
1798
1799
  return palette[iconColor]?.main || iconColor;
1799
1800
  }
1800
1801
  return iconColor;
1801
- } : (theme3) => theme3.palette.info.main,
1802
+ } : (theme4) => theme4.palette.info.main,
1802
1803
  pr: 0.5
1803
1804
  }
1804
1805
  },
@@ -1814,7 +1815,7 @@ function CustomDialog({
1814
1815
  position: "absolute",
1815
1816
  right: 8,
1816
1817
  top: 8,
1817
- color: (theme3) => theme3.palette.grey[500]
1818
+ color: (theme4) => theme4.palette.grey[500]
1818
1819
  },
1819
1820
  disabled: isSubmiting
1820
1821
  },
@@ -1879,7 +1880,7 @@ var TimePickerComponent = ({
1879
1880
  disabled = false,
1880
1881
  variant = "outlined"
1881
1882
  }) => {
1882
- const theme3 = (0, import_material13.useTheme)();
1883
+ const theme4 = (0, import_material13.useTheme)();
1883
1884
  const initialHour = value ? parseInt(value.split(":")[0]) : null;
1884
1885
  const initialMinute = value ? parseInt(value.split(":")[1]) : null;
1885
1886
  const [isModalOpen, setIsModalOpen] = (0, import_react10.useState)(false);
@@ -1981,7 +1982,7 @@ var TimePickerComponent = ({
1981
1982
  },
1982
1983
  InputProps: {
1983
1984
  ...!disabled && {
1984
- endAdornment: /* @__PURE__ */ React.createElement(import_material13.InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(import_material13.Tooltip, { title: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646" }, /* @__PURE__ */ React.createElement(import_material13.IconButton, { onClick: () => setIsModalOpen(true) }, /* @__PURE__ */ React.createElement(import_common2.Clock, { size: 22, color: theme3.palette.text.primary }))))
1985
+ endAdornment: /* @__PURE__ */ React.createElement(import_material13.InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(import_material13.Tooltip, { title: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646" }, /* @__PURE__ */ React.createElement(import_material13.IconButton, { onClick: () => setIsModalOpen(true) }, /* @__PURE__ */ React.createElement(import_common2.Clock, { size: 22, color: theme4.palette.text.primary }))))
1985
1986
  }
1986
1987
  },
1987
1988
  sx: {
@@ -2048,7 +2049,7 @@ var TimePickerComponent = ({
2048
2049
  position: "absolute",
2049
2050
  right: 8,
2050
2051
  top: 8,
2051
- color: (theme4) => theme4.palette.grey[500]
2052
+ color: (theme5) => theme5.palette.grey[500]
2052
2053
  }
2053
2054
  },
2054
2055
  /* @__PURE__ */ React.createElement(import_md4.MdClose, null)
@@ -3744,6 +3745,23 @@ function ImageViewer({
3744
3745
  }
3745
3746
 
3746
3747
  // src/enhanced-upload-image/index.tsx
3748
+ var import_heic2any = __toESM(require("heic2any"));
3749
+ var isHeic = (file) => file.type === "image/heic" || file.type === "image/heif" || file.name.toLowerCase().endsWith(".heic") || file.name.toLowerCase().endsWith(".heif");
3750
+ var convertHeicToJpeg = async (file) => {
3751
+ const convertedBlob = await (0, import_heic2any.default)({
3752
+ blob: file,
3753
+ toType: "image/jpeg",
3754
+ quality: 0.9
3755
+ });
3756
+ return new File(
3757
+ [convertedBlob],
3758
+ file.name.replace(/\.(heic|heif)$/i, ".jpg"),
3759
+ {
3760
+ type: "image/jpeg",
3761
+ lastModified: Date.now()
3762
+ }
3763
+ );
3764
+ };
3747
3765
  var UploadImage = ({
3748
3766
  placeholder,
3749
3767
  name,
@@ -3805,20 +3823,20 @@ var UploadImage = ({
3805
3823
  });
3806
3824
  };
3807
3825
  const handleImageChange = async (event) => {
3808
- const file = event.target.files?.[0];
3809
- if (file) {
3810
- console.log("Original file size (KB):", (file.size / 1024).toFixed(2));
3811
- const compressedFile = await compressImage(file);
3812
- if (compressedFile) {
3813
- console.log(
3814
- "Compressed file size (KB):",
3815
- (compressedFile.size / 1024).toFixed(2)
3816
- );
3817
- const objectURL = URL.createObjectURL(compressedFile);
3818
- setSelectedImage(objectURL);
3819
- setValue(name, compressedFile);
3826
+ let file = event.target.files?.[0];
3827
+ if (!file) return;
3828
+ if (isHeic(file)) {
3829
+ try {
3830
+ file = await convertHeicToJpeg(file);
3831
+ } catch (e) {
3832
+ return;
3820
3833
  }
3821
3834
  }
3835
+ const compressedFile = await compressImage(file);
3836
+ if (!compressedFile) return;
3837
+ const objectURL = URL.createObjectURL(compressedFile);
3838
+ setSelectedImage(objectURL);
3839
+ setValue(name, compressedFile);
3822
3840
  };
3823
3841
  const handleRemoveImage = () => {
3824
3842
  setSelectedImage(null);
@@ -4308,7 +4326,7 @@ function SearchLicensePlate({
4308
4326
  readOnly = true,
4309
4327
  size = "small"
4310
4328
  }) {
4311
- const theme3 = (0, import_material22.useTheme)();
4329
+ const theme4 = (0, import_material22.useTheme)();
4312
4330
  const [open, setOpen] = (0, import_react21.useState)(false);
4313
4331
  const [inputValues, setInputValues] = (0, import_react21.useState)({
4314
4332
  input1: "",
@@ -4323,7 +4341,7 @@ function SearchLicensePlate({
4323
4341
  input4: (0, import_react21.useRef)(null)
4324
4342
  };
4325
4343
  const inputStyle = {
4326
- color: theme3.palette.text.primary,
4344
+ color: theme4.palette.text.primary,
4327
4345
  width: "30px",
4328
4346
  textAlign: "center",
4329
4347
  backgroundColor: "transparent",
@@ -4861,7 +4879,7 @@ function ConfirmationDialog2({
4861
4879
  position: "absolute",
4862
4880
  right: 8,
4863
4881
  top: 8,
4864
- color: (theme3) => theme3.palette.grey[500]
4882
+ color: (theme4) => theme4.palette.grey[500]
4865
4883
  }
4866
4884
  },
4867
4885
  /* @__PURE__ */ React15.createElement(import_md10.MdClose, null)
@@ -4914,7 +4932,7 @@ function NoResult({
4914
4932
  description,
4915
4933
  sx = {}
4916
4934
  }) {
4917
- const theme3 = (0, import_material25.useTheme)();
4935
+ const theme4 = (0, import_material25.useTheme)();
4918
4936
  return /* @__PURE__ */ import_react23.default.createElement(
4919
4937
  import_material25.Card,
4920
4938
  {
@@ -4922,7 +4940,7 @@ function NoResult({
4922
4940
  width: "100%",
4923
4941
  minWidth: 300,
4924
4942
  borderRadius: "12px",
4925
- border: `1px solid ${theme3.palette.secondary.light}`
4943
+ border: `1px solid ${theme4.palette.secondary.light}`
4926
4944
  }
4927
4945
  },
4928
4946
  /* @__PURE__ */ import_react23.default.createElement(
@@ -5370,11 +5388,11 @@ var SwitchButton = ({
5370
5388
  iconChecked,
5371
5389
  iconUnchecked
5372
5390
  }) => {
5373
- const theme3 = (0, import_material31.useTheme)();
5374
- const isDarkMode = theme3.palette.mode === "dark";
5375
- const CustomSwitch = (0, import_system8.styled)(import_material30.Switch)(({ theme: theme4 }) => ({
5391
+ const theme4 = (0, import_material31.useTheme)();
5392
+ const isDarkMode = theme4.palette.mode === "dark";
5393
+ const CustomSwitch = (0, import_system8.styled)(import_material30.Switch)(({ theme: theme5 }) => ({
5376
5394
  "& .MuiSwitch-switchBase.Mui-checked": {
5377
- color: theme4.palette.primary.main
5395
+ color: theme5.palette.primary.main
5378
5396
  },
5379
5397
  "& .MuiSwitch-switchBase": {
5380
5398
  color: isDarkMode ? "rgba(220,220,220,1)" : "rgba(188,188,188,1)"
@@ -5385,16 +5403,16 @@ var SwitchButton = ({
5385
5403
  border: isDarkMode ? "2px solid white" : "2px solid rgba(80,80,80, 1)"
5386
5404
  }
5387
5405
  }));
5388
- const BoxContainer = (0, import_system8.styled)(import_material30.Box)(({ theme: theme4 }) => ({
5406
+ const BoxContainer = (0, import_system8.styled)(import_material30.Box)(({ theme: theme5 }) => ({
5389
5407
  display: "flex",
5390
5408
  alignItems: "center",
5391
5409
  backgroundColor: "rgba(188,188,188, 0.1)",
5392
5410
  border: "2px solid rgba(200,200,200, 1)",
5393
5411
  borderRadius: 10,
5394
5412
  transition: "all 0.3s ease",
5395
- paddingTop: theme4.spacing(0.1),
5396
- paddingBottom: theme4.spacing(0.1),
5397
- paddingLeft: theme4.spacing(1)
5413
+ paddingTop: theme5.spacing(0.1),
5414
+ paddingBottom: theme5.spacing(0.1),
5415
+ paddingLeft: theme5.spacing(1)
5398
5416
  }));
5399
5417
  const LabelContainer = (0, import_system8.styled)("div")({
5400
5418
  transition: "all 0.2s ease",
@@ -6140,8 +6158,8 @@ function MapLocationPicker({
6140
6158
  minZoom = 10,
6141
6159
  maxZoom = 19
6142
6160
  }) {
6143
- const theme3 = (0, import_material34.useTheme)();
6144
- const isDarkMode = theme3.palette.mode === "dark";
6161
+ const theme4 = (0, import_material34.useTheme)();
6162
+ const isDarkMode = theme4.palette.mode === "dark";
6145
6163
  const { field: latField, fieldState: latState } = (0, import_react_hook_form18.useController)({
6146
6164
  name: nameLat,
6147
6165
  control
@@ -6490,7 +6508,7 @@ function MapLocationPicker({
6490
6508
  onClick: handleClearLocation,
6491
6509
  sx: {
6492
6510
  backgroundColor: isDarkMode ? "#1e1e1e" : "white",
6493
- color: theme3.palette.error.main,
6511
+ color: theme4.palette.error.main,
6494
6512
  boxShadow: 2,
6495
6513
  "&:hover": {
6496
6514
  backgroundColor: isDarkMode ? "#2a2a2a" : "#f5f5f5"
@@ -6530,10 +6548,118 @@ function MapLocationPicker({
6530
6548
  helperText
6531
6549
  ));
6532
6550
  }
6551
+
6552
+ // src/checkbox-group/index.tsx
6553
+ var React28 = __toESM(require("react"));
6554
+ var import_react_hook_form19 = require("react-hook-form");
6555
+ var import_Checkbox = __toESM(require("@mui/material/Checkbox"));
6556
+ var import_FormControlLabel2 = __toESM(require("@mui/material/FormControlLabel"));
6557
+ var import_FormControl2 = __toESM(require("@mui/material/FormControl"));
6558
+ var import_FormLabel2 = __toESM(require("@mui/material/FormLabel"));
6559
+ var import_material35 = require("@mui/material");
6560
+ var import_system9 = require("@mui/system");
6561
+ var import_theme3 = __toESM(require("@mamrp/layout/theme"));
6562
+ function CheckBoxGroup({
6563
+ name,
6564
+ label,
6565
+ options,
6566
+ control,
6567
+ align = "start",
6568
+ disabledBoarder,
6569
+ direction = "row"
6570
+ }) {
6571
+ const normalize = (v) => typeof v === "string" && !isNaN(Number(v)) ? Number(v) : v;
6572
+ return /* @__PURE__ */ React28.createElement(
6573
+ import_FormControl2.default,
6574
+ {
6575
+ sx: {
6576
+ display: "flex",
6577
+ flexDirection: direction,
6578
+ alignItems: "center",
6579
+ justifyContent: "start"
6580
+ }
6581
+ },
6582
+ /* @__PURE__ */ React28.createElement(
6583
+ import_react_hook_form19.Controller,
6584
+ {
6585
+ name,
6586
+ control,
6587
+ defaultValue: [],
6588
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ React28.createElement(import_system9.Box, { display: "flex", width: "100%", flexDirection: "column" }, label && /* @__PURE__ */ React28.createElement(
6589
+ import_FormLabel2.default,
6590
+ {
6591
+ sx: {
6592
+ position: "absolute",
6593
+ top: -10,
6594
+ left: 15,
6595
+ px: 0.5,
6596
+ backgroundColor: "background.paper",
6597
+ color: error?.message ? import_theme3.default.CustomComponents.RadioButton.errorColor : import_theme3.default.CustomComponents.RadioButton.textColor,
6598
+ fontSize: 15,
6599
+ zIndex: 1
6600
+ }
6601
+ },
6602
+ label
6603
+ ), /* @__PURE__ */ React28.createElement(
6604
+ import_system9.Box,
6605
+ {
6606
+ sx: {
6607
+ width: "100%",
6608
+ p: 0.8,
6609
+ px: 1,
6610
+ borderRadius: 3,
6611
+ display: "flex",
6612
+ justifyContent: align,
6613
+ flexDirection: "row",
6614
+ border: disabledBoarder ? "" : `${import_theme3.default.CustomComponents.RadioButton.borderSize}px solid`,
6615
+ borderColor: error?.message ? import_theme3.default.CustomComponents.RadioButton.errorColor : import_theme3.default.CustomComponents.RadioButton.borderColor
6616
+ }
6617
+ },
6618
+ options.map((option) => /* @__PURE__ */ React28.createElement(
6619
+ import_FormControlLabel2.default,
6620
+ {
6621
+ key: option.value,
6622
+ label: option.name,
6623
+ control: /* @__PURE__ */ React28.createElement(
6624
+ import_Checkbox.default,
6625
+ {
6626
+ checked: Array.isArray(field.value) && field.value.includes(normalize(option.value)),
6627
+ onChange: (e) => {
6628
+ const checked = e.target.checked;
6629
+ const value = normalize(option.value);
6630
+ const currentValue = Array.isArray(field.value) ? field.value.map(normalize) : [];
6631
+ if (checked) {
6632
+ if (!currentValue.includes(value)) {
6633
+ field.onChange([...currentValue, value]);
6634
+ }
6635
+ } else {
6636
+ field.onChange(
6637
+ currentValue.filter((v) => v !== value)
6638
+ );
6639
+ }
6640
+ }
6641
+ }
6642
+ )
6643
+ }
6644
+ ))
6645
+ ), error?.message && /* @__PURE__ */ React28.createElement(
6646
+ import_material35.Typography,
6647
+ {
6648
+ color: "error",
6649
+ fontSize: import_theme3.default.CustomComponents.RadioButton.errorFontSize,
6650
+ ml: 2
6651
+ },
6652
+ error?.message
6653
+ ))
6654
+ }
6655
+ )
6656
+ );
6657
+ }
6533
6658
  // Annotate the CommonJS export names for ESM import in node:
6534
6659
  0 && (module.exports = {
6535
6660
  Accordion,
6536
6661
  AdvancedSearchButton,
6662
+ CheckBoxGroup,
6537
6663
  ConfirmationDialog,
6538
6664
  ConnectToBasculeButton,
6539
6665
  CustomCheckbox,