componentes-sinco 1.0.3 → 1.0.5

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.
Files changed (113) hide show
  1. package/dist/create-KZGO2OZA.svg +18 -0
  2. package/dist/empty-3NEKE7WO.svg +13 -0
  3. package/dist/error-RUCZUXDN.svg +5 -0
  4. package/dist/index.cjs +1555 -1101
  5. package/dist/index.cjs.map +1 -0
  6. package/dist/index.css +1 -0
  7. package/dist/index.css.map +1 -0
  8. package/dist/index.d.cts +216 -148
  9. package/dist/index.d.ts +216 -148
  10. package/dist/index.js +1536 -1086
  11. package/dist/index.js.map +1 -0
  12. package/dist/search-OKSCVF2W.svg +12 -0
  13. package/package.json +24 -17
  14. package/dist/componentes-sinco.css +0 -1
  15. package/dist/my-react-lib.es.js +0 -105856
  16. package/dist/my-react-lib.umd.js +0 -454
  17. package/dist/src/App.d.ts +0 -4
  18. package/dist/src/Components/Adjuntar/Adjuntar.d.ts +0 -4
  19. package/dist/src/Components/Adjuntar/Model.d.ts +0 -17
  20. package/dist/src/Components/Adjuntar/index.d.ts +0 -1
  21. package/dist/src/Components/Calendario/Calendario.d.ts +0 -3
  22. package/dist/src/Components/Drawer/Helpers/Model.d.ts +0 -55
  23. package/dist/src/Components/Drawer/Helpers/Utils.d.ts +0 -4
  24. package/dist/src/Components/Drawer/Helpers/index.d.ts +0 -3
  25. package/dist/src/Components/Drawer/Helpers/validateInput.d.ts +0 -3
  26. package/dist/src/Components/Drawer/SCDrawer.d.ts +0 -5
  27. package/dist/src/Components/Drawer/SCDrawer.test.d.ts +0 -1
  28. package/dist/src/Components/Drawer/index.d.ts +0 -1
  29. package/dist/src/Components/FooterAction/FooterAction.d.ts +0 -4
  30. package/dist/src/Components/FooterAction/Model.d.ts +0 -6
  31. package/dist/src/Components/FooterAction/index.d.ts +0 -2
  32. package/dist/src/Components/Hooks/useWindowDimensions.d.ts +0 -4
  33. package/dist/src/Components/Modal/Helpers/Data.d.ts +0 -19
  34. package/dist/src/Components/Modal/Helpers/Model.d.ts +0 -26
  35. package/dist/src/Components/Modal/Helpers/Utils.d.ts +0 -3
  36. package/dist/src/Components/Modal/Helpers/index.d.ts +0 -3
  37. package/dist/src/Components/Modal/SCModal.d.ts +0 -4
  38. package/dist/src/Components/Modal/SCModal.test.d.ts +0 -1
  39. package/dist/src/Components/Modal/index.d.ts +0 -2
  40. package/dist/src/Components/MultiSelect/MultiSelect.test.d.ts +0 -1
  41. package/dist/src/Components/MultiSelect/SCMultiSelect.d.ts +0 -4
  42. package/dist/src/Components/MultiSelect/example.d.ts +0 -3
  43. package/dist/src/Components/MultiSelect/helpers/Model.d.ts +0 -24
  44. package/dist/src/Components/MultiSelect/helpers/Utils.d.ts +0 -3
  45. package/dist/src/Components/MultiSelect/helpers/index.d.ts +0 -4
  46. package/dist/src/Components/MultiSelect/helpers/useFilteredItems.d.ts +0 -4
  47. package/dist/src/Components/MultiSelect/helpers/useHandlers.d.ts +0 -12
  48. package/dist/src/Components/MultiSelect/index.d.ts +0 -2
  49. package/dist/src/Components/PageHeader/Model.d.ts +0 -8
  50. package/dist/src/Components/PageHeader/PageHeader.d.ts +0 -4
  51. package/dist/src/Components/PageHeader/PageHeader.test.d.ts +0 -1
  52. package/dist/src/Components/PageHeader/index.d.ts +0 -2
  53. package/dist/src/Components/SCAutocomplete.d.ts +0 -26
  54. package/dist/src/Components/SCCalendarSwipeable.d.ts +0 -9
  55. package/dist/src/Components/SCDataGrid.d.ts +0 -19
  56. package/dist/src/Components/SCDialog.d.ts +0 -32
  57. package/dist/src/Components/SCMenu.d.ts +0 -20
  58. package/dist/src/Components/SCTabs.d.ts +0 -22
  59. package/dist/src/Components/TextArea/Helpers/Model.d.ts +0 -23
  60. package/dist/src/Components/TextArea/Helpers/index.d.ts +0 -2
  61. package/dist/src/Components/TextArea/Helpers/validateIcon.d.ts +0 -3
  62. package/dist/src/Components/TextArea/SCTextArea.d.ts +0 -4
  63. package/dist/src/Components/TextArea/index.d.ts +0 -2
  64. package/dist/src/Components/Textfield/Helpers/index.d.ts +0 -3
  65. package/dist/src/Components/Textfield/Helpers/validateIcon.d.ts +0 -4
  66. package/dist/src/Components/Textfield/Helpers/validateKeyDown.d.ts +0 -1
  67. package/dist/src/Components/Textfield/Helpers/validateOnBlur.d.ts +0 -10
  68. package/dist/src/Components/Textfield/Model.d.ts +0 -32
  69. package/dist/src/Components/Textfield/SCTextField.d.ts +0 -4
  70. package/dist/src/Components/Textfield/Textfield.test.d.ts +0 -1
  71. package/dist/src/Components/Textfield/index.d.ts +0 -2
  72. package/dist/src/Components/ToastNotification/Model.d.ts +0 -14
  73. package/dist/src/Components/ToastNotification/SCToastNotification.d.ts +0 -4
  74. package/dist/src/Components/ToastNotification/index.d.ts +0 -3
  75. package/dist/src/Components/ToastNotification/useProgress.d.ts +0 -6
  76. package/dist/src/Components/index.d.ts +0 -14
  77. package/dist/src/Pages/PruebasDavid/Test.d.ts +0 -3
  78. package/dist/src/Pages/PruebasNataly/PruebaPag1.d.ts +0 -4
  79. package/dist/src/Pages/PruebasNataly/PruebaPag2.d.ts +0 -3
  80. package/dist/src/Pages/PruebasNataly/TestNataly.d.ts +0 -3
  81. package/dist/src/Theme/breakpoints.d.ts +0 -3
  82. package/dist/src/Theme/components.d.ts +0 -3
  83. package/dist/src/Theme/index.d.ts +0 -3
  84. package/dist/src/Theme/mixins.d.ts +0 -3
  85. package/dist/src/Theme/module.d.ts +0 -69
  86. package/dist/src/Theme/palette.d.ts +0 -6
  87. package/dist/src/Theme/shadows.d.ts +0 -3
  88. package/dist/src/Theme/theme.d.ts +0 -5
  89. package/dist/src/Theme/typography.d.ts +0 -3
  90. package/dist/src/generales/capitalize.d.ts +0 -1
  91. package/dist/src/generales/index.d.ts +0 -2
  92. package/dist/src/generales/types.d.ts +0 -4
  93. package/dist/src/index.d.ts +0 -5
  94. package/dist/src/main.d.ts +0 -1
  95. package/dist/src/stories/Autocomplete/Autocomplete.stories.d.ts +0 -7
  96. package/dist/src/stories/CalendarSwipeable/CalendarSwipeable.stories.d.ts +0 -7
  97. package/dist/src/stories/DataGrid/DataGrid.stories.d.ts +0 -7
  98. package/dist/src/stories/Dialog/Dialog.stories.d.ts +0 -7
  99. package/dist/src/stories/Drawer/Drawer.stories.d.ts +0 -7
  100. package/dist/src/stories/FooterAction/Footer.stories.d.ts +0 -7
  101. package/dist/src/stories/Generales/Typography.d.ts +0 -1
  102. package/dist/src/stories/Generales/index.d.ts +0 -2
  103. package/dist/src/stories/Generales/types.d.ts +0 -3
  104. package/dist/src/stories/Menu/Menu.stories.d.ts +0 -7
  105. package/dist/src/stories/Modal/Modal.stories.d.ts +0 -7
  106. package/dist/src/stories/MultiSelect/MultiSelect.stories.d.ts +0 -7
  107. package/dist/src/stories/PageHeader/Header.stories.d.ts +0 -7
  108. package/dist/src/stories/Tabs/Tabs.stories.d.ts +0 -7
  109. package/dist/src/stories/TextArea/TextArea.stories.d.ts +0 -7
  110. package/dist/src/stories/Textfield/textfield.stories.d.ts +0 -7
  111. package/dist/src/stories/ToastNotification/toastNotification.stories.d.ts +0 -27
  112. package/dist/vite.svg +0 -1
  113. package/dist/vitest.setup.d.ts +0 -1
package/dist/index.cjs CHANGED
@@ -61,16 +61,20 @@ var src_exports = {};
61
61
  __export(src_exports, {
62
62
  ADCSincoTheme: () => ADCSincoTheme,
63
63
  AdproSincoTheme: () => AdproSincoTheme,
64
+ EmptyState: () => EmptyState,
64
65
  FooterAction: () => FooterAction,
66
+ MultiSelect: () => MultiSelect,
65
67
  PageHeader: () => PageHeader,
66
68
  SCAutocomplete: () => SCAutocomplete,
67
69
  SCCalendarSwipeable: () => SCCalendarSwipeable,
68
70
  SCDataGrid: () => SCDataGrid,
71
+ SCDataGridInitial: () => SCDataGridInitial,
72
+ SCDateRange: () => SCDateRange,
69
73
  SCDialog: () => SCDialog,
70
74
  SCDrawer: () => SCDrawer,
71
75
  SCMenu: () => SCMenu,
72
76
  SCModal: () => SCModal,
73
- SCMultiSelect: () => SCMultiSelect,
77
+ SCSelect: () => SCSelect,
74
78
  SCTabs: () => SCTabs,
75
79
  SCTextArea: () => SCTextArea,
76
80
  SCTextField: () => SCTextField,
@@ -91,9 +95,9 @@ __export(src_exports, {
91
95
  module.exports = __toCommonJS(src_exports);
92
96
 
93
97
  // src/Components/Drawer/SCDrawer.tsx
94
- var import_react5 = __toESM(require("react"), 1);
95
- var import_material4 = require("@mui/material");
96
- var import_Grid22 = __toESM(require("@mui/material/Grid2"), 1);
98
+ var import_react8 = __toESM(require("react"), 1);
99
+ var import_material7 = require("@mui/material");
100
+ var import_Grid23 = __toESM(require("@mui/material/Grid2"), 1);
97
101
  var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
98
102
 
99
103
  // src/Components/Textfield/SCTextField.tsx
@@ -135,12 +139,12 @@ function validateKeyDown(event2, format2) {
135
139
 
136
140
  // src/Components/Textfield/Helpers/validateOnBlur.tsx
137
141
  var validateOnBlurField = ({
138
- value,
142
+ state,
139
143
  required = false,
140
144
  setError,
141
145
  onBlur
142
146
  }) => (event2) => {
143
- const isError = !value.trim() && required;
147
+ const isError = !state.trim() && required;
144
148
  setError(isError);
145
149
  if (onBlur) {
146
150
  onBlur(event2);
@@ -169,8 +173,8 @@ var SCTextField = ({
169
173
  color,
170
174
  background,
171
175
  //Funcionales
176
+ setState,
172
177
  state,
173
- value,
174
178
  onChange,
175
179
  onBlur,
176
180
  onKeyDown
@@ -221,15 +225,15 @@ var SCTextField = ({
221
225
  const handleInputChange = (event2) => {
222
226
  let valueMax = maxLength ? maxLength + 1 : 50;
223
227
  if (event2.target.value.length < valueMax) {
224
- if (state) {
225
- state(event2.target.value);
228
+ if (setState) {
229
+ setState(event2.target.value);
226
230
  }
227
231
  if (onChange) {
228
232
  onChange(event2);
229
233
  }
230
234
  }
231
235
  };
232
- const handleBlur = validateOnBlurField({ value, required, setError, onBlur });
236
+ const handleBlur = validateOnBlurField({ state, required, setError, onBlur });
233
237
  const handleOpenInfoTitle = (event2) => {
234
238
  setAnchorInfoTitle(event2.currentTarget);
235
239
  };
@@ -304,7 +308,7 @@ var SCTextField = ({
304
308
  {
305
309
  size: size ? size : "medium",
306
310
  fullWidth: true,
307
- value,
311
+ value: state,
308
312
  error,
309
313
  id: label == null ? void 0 : label.replace(/\s+/g, ""),
310
314
  disabled: disabled != null ? disabled : false,
@@ -619,8 +623,8 @@ var SCTextArea = ({
619
623
  colorTitle,
620
624
  background,
621
625
  //funcionales
626
+ setState,
622
627
  state,
623
- value,
624
628
  onBlur
625
629
  }) => {
626
630
  const [helperCount, setHelperCount] = (0, import_react4.useState)(0);
@@ -628,11 +632,11 @@ var SCTextArea = ({
628
632
  const [anchorInfoTitle, setAnchorInfoTitle] = import_react4.default.useState(null);
629
633
  const openInfoTitle = Boolean(anchorInfoTitle);
630
634
  (0, import_react4.useEffect)(() => {
631
- setHelperCount(value == null ? void 0 : value.length);
632
- }, [value]);
635
+ setHelperCount(state == null ? void 0 : state.length);
636
+ }, [state]);
633
637
  const IconTitle = getIcon(iconTitle);
634
638
  const handleBlur = (event2) => {
635
- if (required && value.trim() === "") {
639
+ if (required && state.trim() === "") {
636
640
  setStateError(true);
637
641
  setTimeout(() => {
638
642
  setStateError(false);
@@ -649,7 +653,7 @@ var SCTextArea = ({
649
653
  const handleCloseInfoTitle = () => {
650
654
  setAnchorInfoTitle(null);
651
655
  };
652
- return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_material3.Box, { sx: { width } }, /* @__PURE__ */ import_react4.default.createElement(import_material3.Grid2, { container: true, sx: { alignItems: "center" }, gap: 0.5 }, iconTitle && IconTitle && /* @__PURE__ */ import_react4.default.createElement(import_material3.SvgIcon, { color: "action", fontSize: "small", component: IconTitle }), title && /* @__PURE__ */ import_react4.default.createElement(import_material3.Typography, { color: colorTitle || "text.secondary", variant: "subtitle2" }, title), infoTitle ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, infoTitle.component === "popover" ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
656
+ return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(import_material3.Box, { sx: { width } }, /* @__PURE__ */ import_react4.default.createElement(import_material3.Grid, { container: true, sx: { alignItems: "center" }, gap: 0.5 }, iconTitle && IconTitle && /* @__PURE__ */ import_react4.default.createElement(import_material3.SvgIcon, { color: "action", fontSize: "small", component: IconTitle }), title && /* @__PURE__ */ import_react4.default.createElement(import_material3.Typography, { color: colorTitle || "text.secondary", variant: "subtitle2" }, title), infoTitle ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, infoTitle.component === "popover" ? /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
653
657
  import_icons_material3.InfoOutlined,
654
658
  {
655
659
  color: "action",
@@ -694,11 +698,11 @@ var SCTextArea = ({
694
698
  multiline: true,
695
699
  disabled,
696
700
  rows,
697
- value,
701
+ value: state,
698
702
  onBlur: handleBlur,
699
703
  onChange: (e) => {
700
- if (state) {
701
- state(e.target.value.substring(0, maxLength));
704
+ if (setState) {
705
+ setState(e.target.value.substring(0, maxLength));
702
706
  }
703
707
  },
704
708
  autoComplete: "off"
@@ -716,736 +720,776 @@ var SCTextArea = ({
716
720
  ))));
717
721
  };
718
722
 
719
- // src/Components/Drawer/Helpers/Utils.tsx
723
+ // src/Components/SCSelect.tsx
724
+ var import_react5 = __toESM(require("react"), 1);
725
+ var import_material4 = require("@mui/material");
726
+ var import_Select = __toESM(require("@mui/material/Select"), 1);
720
727
  var Muicon2 = __toESM(require("@mui/icons-material"), 1);
721
- var import_icons_material4 = require("@mui/icons-material");
722
- var getIcon2 = (iconName) => {
723
- if (iconName && iconName in Muicon2) {
724
- return Muicon2[iconName];
725
- }
726
- return import_icons_material4.FilterListOutlined;
727
- };
728
- var cleanInputs = (arrayElements) => {
729
- var _a, _b;
730
- for (let i = 0; i < arrayElements.length; i++) {
731
- if (arrayElements[i].component === void 0) {
732
- (_b = (_a = arrayElements[i]).state) == null ? void 0 : _b.call(_a, "");
728
+ function SCSelect({
729
+ label = "",
730
+ data,
731
+ getItemValue,
732
+ width = "100%",
733
+ size = "small",
734
+ variant = "outlined",
735
+ deleteType = "button",
736
+ required,
737
+ disabled,
738
+ background,
739
+ fnAplicar,
740
+ setState,
741
+ state
742
+ }) {
743
+ const labelContent = `<span style="color: red;">* </span>` + label;
744
+ const [prevData, setPrevData] = import_react5.default.useState(data);
745
+ const [error, setError] = import_react5.default.useState(false);
746
+ (0, import_react5.useEffect)(() => {
747
+ if (error) {
748
+ setTimeout(() => {
749
+ setError(false);
750
+ }, 1e3);
733
751
  }
734
- }
735
- };
736
-
737
- // src/Components/Drawer/Helpers/validateInput.tsx
738
- var validateInputs = (arrayElements, onError, onSuccess) => {
739
- var _a;
740
- let requiredValues = 0;
741
- let filledValues = 0;
742
- for (let i = 0; i < arrayElements.length; i++) {
743
- if (arrayElements[i].component === void 0) {
744
- if (arrayElements[i].required) {
745
- requiredValues++;
746
- }
747
- if (arrayElements[i].required && ((_a = arrayElements[i].value) == null ? void 0 : _a.trim()) !== "") {
748
- filledValues++;
752
+ }, [error]);
753
+ (0, import_react5.useEffect)(() => {
754
+ let dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
755
+ if (dataChangeValidation == false) {
756
+ setState({ hiddenValue: "", textValue: "" });
757
+ setPrevData(data);
758
+ }
759
+ }, [data]);
760
+ data.map(function(option, index, array) {
761
+ if (option == null ? void 0 : option.icon) {
762
+ if ((option == null ? void 0 : option.icon.type) == void 0) {
763
+ option.icon = Muicon2[option == null ? void 0 : option.icon];
764
+ } else {
765
+ option;
749
766
  }
750
767
  }
751
- }
752
- if (requiredValues === filledValues) {
753
- onSuccess();
754
- } else {
755
- onError({
756
- type: "error",
757
- title: "Algunos campos son requeridos",
758
- time: 10
759
- });
760
- }
761
- };
762
-
763
- // src/generales/capitalize.tsx
764
- function capitalize(text) {
765
- return text.charAt(0).toUpperCase() + text.slice(1);
766
- }
767
-
768
- // src/Components/Drawer/SCDrawer.tsx
769
- var SCDrawer = ({
770
- //informativas
771
- title,
772
- arrayElements = [],
773
- actions,
774
- buttonDrawer,
775
- //Apariencia
776
- colorTitle,
777
- anchor = "left",
778
- width,
779
- //Funcionales
780
- open
781
- }) => {
782
- var _a;
783
- const [drawerOpen, setDrawerOpen] = import_react5.default.useState(open);
784
- const [toast, setToast] = import_react5.default.useState(null);
785
- const handleDrawerClose = () => {
786
- setDrawerOpen(false);
787
- };
788
- const toggleDrawer = (newOpen) => () => {
789
- setDrawerOpen(newOpen);
768
+ });
769
+ const handleBlur = () => {
770
+ const currentValue = Array.isArray(state.hiddenValue) ? state.hiddenValue[0] : state.hiddenValue;
771
+ const isError = !currentValue && !!required;
772
+ setError(Boolean(isError));
790
773
  };
791
- const ButtonIcon = getIcon2(buttonDrawer == null ? void 0 : buttonDrawer.icon);
792
- const setToastWithDelay = (toastContent) => {
793
- setToast(null);
794
- setTimeout(() => {
795
- setToast(toastContent);
796
- }, 10);
774
+ const handleChange = (event2) => {
775
+ const selectedValue = event2.target.value;
776
+ if (selectedValue) {
777
+ const selectedOption = data.find((item) => getItemValue(item).value === selectedValue);
778
+ if (selectedOption) {
779
+ const itemValue = getItemValue(selectedOption);
780
+ setState({
781
+ hiddenValue: itemValue.value,
782
+ textValue: itemValue.text
783
+ });
784
+ }
785
+ }
797
786
  };
798
- const inputValidation = () => validateInputs(arrayElements, setToastWithDelay, handleDrawerClose);
799
- const clean = () => cleanInputs(arrayElements);
800
- actions = actions != null ? actions : [{ text: "Limpiar", fn: clean }, { text: "Consultar", fn: inputValidation }];
801
- return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, toast && /* @__PURE__ */ import_react5.default.createElement(SCToastNotification, __spreadValues({}, toast)), /* @__PURE__ */ import_react5.default.createElement(
802
- import_material4.Button,
803
- {
804
- "data-testid": "test-buttonDrawer",
805
- sx: { textTransform: "capitalize" },
806
- color: buttonDrawer == null ? void 0 : buttonDrawer.color,
807
- onClick: toggleDrawer(true),
808
- size: "small",
809
- variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) != void 0 ? buttonDrawer == null ? void 0 : buttonDrawer.variant : "text",
810
- startIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" || !(buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) ? /* @__PURE__ */ import_react5.default.createElement(ButtonIcon, { color: (buttonDrawer == null ? void 0 : buttonDrawer.color) != void 0 ? buttonDrawer == null ? void 0 : buttonDrawer.color : "primary" }) : null,
811
- endIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" ? /* @__PURE__ */ import_react5.default.createElement(ButtonIcon, { color: (buttonDrawer == null ? void 0 : buttonDrawer.color) != void 0 ? buttonDrawer == null ? void 0 : buttonDrawer.color : "primary" }) : null
812
- },
813
- capitalize((_a = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _a : "Drawer")
814
- ), /* @__PURE__ */ import_react5.default.createElement(
815
- import_material4.Drawer,
787
+ return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, data && /* @__PURE__ */ import_react5.default.createElement(import_material4.Box, { sx: { width } }, /* @__PURE__ */ import_react5.default.createElement(
788
+ import_material4.FormControl,
816
789
  {
817
- open: drawerOpen,
818
- onClose: toggleDrawer(false),
819
- anchor: anchor != null ? anchor : "left",
820
- sx: {
821
- "& .MuiDrawer-paper": {
822
- width: width != null ? width : "450px",
823
- boxSizing: "border-box",
824
- borderRadius: anchor !== "right" ? "0px 4px 4px 0px" : "4px 0px 0px 4px"
825
- }
826
- }
790
+ fullWidth: true,
791
+ size: size ? size : "medium",
792
+ variant
827
793
  },
828
- /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react5.default.createElement(import_Grid22.default, { container: true, sx: { backgroundColor: "secondary.main", alignItems: "center", height: "42px", textAlign: "left", padding: "10px 12px 10px 12px", justifyContent: "space-between", alignContent: "center" } }, /* @__PURE__ */ import_react5.default.createElement(import_material4.Typography, { variant: "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda"), /* @__PURE__ */ import_react5.default.createElement(import_material4.IconButton, { onClick: handleDrawerClose }, /* @__PURE__ */ import_react5.default.createElement(import_Close.default, { color: "action", "data-testid": "test-button-close" }))), /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { alignItems: "flex-start", height: "100%", gap: "16px", flex: 1, overflow: "auto", padding: "12px 16px 12px 16px" }, arrayElements == null ? void 0 : arrayElements.map((arrayElement, index) => {
829
- var _a2, _b;
830
- return /* @__PURE__ */ import_react5.default.createElement(
831
- import_material4.Box,
832
- {
833
- key: `Stack_${(_a2 = arrayElement.type) != null ? _a2 : ""} ${(_b = arrayElement.label) != null ? _b : ""}${index}`,
834
- sx: { width: "100%" }
835
- },
836
- arrayElement.component ? /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { direction: "row", alignItems: "left", gap: 1 }, arrayElement.component) : arrayElement.type === "textField" ? /* @__PURE__ */ import_react5.default.createElement(
837
- SCTextField,
838
- {
839
- title: arrayElement.title,
840
- iconTitle: arrayElement.iconTitle,
841
- infoTitle: arrayElement.infoTitle,
842
- label: arrayElement.label,
843
- placeholder: arrayElement.placeholder,
844
- infoElement: arrayElement.infoElement,
845
- iconInputStart: arrayElement.iconInputStart,
846
- iconInputEnd: arrayElement.iconInputEnd,
847
- maxLength: arrayElement.maxLength,
848
- variant: arrayElement.variant,
849
- format: arrayElement.format,
850
- disabled: arrayElement.disabled,
851
- required: arrayElement.required,
852
- size: arrayElement.size,
853
- width: arrayElement.width,
854
- color: arrayElement.color,
855
- background: arrayElement.background,
856
- state: arrayElement.state,
857
- value: arrayElement.value || "",
858
- onChange: arrayElement.onChange,
859
- onBlur: arrayElement.onBlur,
860
- onKeyDown: arrayElement.onKeyDown
861
- }
862
- ) : arrayElement.type === "textArea" ? /* @__PURE__ */ import_react5.default.createElement(
863
- SCTextArea,
864
- {
865
- title: arrayElement.title,
866
- iconTitle: arrayElement.iconTitle,
867
- infoTitle: arrayElement.infoTitle,
868
- label: arrayElement.label,
869
- placeholder: arrayElement.placeholder,
870
- maxLength: arrayElement.maxLength,
871
- variant: arrayElement.variant,
872
- disabled: arrayElement.disabled,
873
- required: arrayElement.required,
874
- width: arrayElement.width,
875
- rows: arrayElement.rows,
876
- background: arrayElement.background,
877
- state: arrayElement.state,
878
- value: arrayElement.value || "",
879
- onBlur: arrayElement.onBlur
880
- }
881
- ) : null
882
- );
883
- })), actions != void 0 && actions.length > 0 ? /* @__PURE__ */ import_react5.default.createElement(
884
- import_Grid22.default,
794
+ /* @__PURE__ */ import_react5.default.createElement(
795
+ import_material4.InputLabel,
885
796
  {
886
- container: true,
887
- bgcolor: "background.default",
888
- gap: 2,
889
- padding: "9px 16px 9px 16px",
890
- height: "42px",
891
- alignItems: "center",
892
- justifyContent: actions.length > 1 ? "space-between" : !anchor && anchor != "right" ? "flex-end" : "flex-start",
893
- flexDirection: anchor != "right" ? "row-reverse" : "row"
797
+ error
894
798
  },
895
- actions.map((btn, index) => /* @__PURE__ */ import_react5.default.createElement(
896
- import_material4.Button,
897
- {
898
- key: index,
899
- variant: index === 0 || actions && actions.length < 2 ? "contained" : "text",
900
- color: "primary",
901
- onClick: btn.fn,
902
- disabled: btn.disabled || false,
903
- size: "small"
904
- },
905
- btn.text
906
- ))
907
- ) : "")
908
- ));
909
- };
910
-
911
- // src/Components/MultiSelect/SCMultiSelect.tsx
912
- var import_react8 = __toESM(require("react"), 1);
913
- var import_material5 = require("@mui/material");
914
- var import_icons_material6 = require("@mui/icons-material");
915
-
916
- // src/Components/MultiSelect/helpers/useHandlers.tsx
917
- var import_react6 = require("react");
918
- function useMultiSelectHandlers() {
919
- const [anchorEl, setAnchorEl] = (0, import_react6.useState)(null);
920
- const [open, setOpen] = (0, import_react6.useState)(false);
921
- const [selectedItems, setSelectedItems] = (0, import_react6.useState)([]);
922
- const [filterValue, setFilterValue] = (0, import_react6.useState)("");
923
- const handleOpen = (0, import_react6.useCallback)((e) => {
924
- setAnchorEl(e.currentTarget);
925
- setOpen(true);
926
- }, []);
927
- const handleClose = (0, import_react6.useCallback)(() => {
928
- setAnchorEl(null);
929
- setOpen(false);
930
- }, []);
931
- const handleFilterChange = (0, import_react6.useCallback)(
932
- (e) => {
933
- setFilterValue(e.target.value);
934
- },
935
- []
936
- );
937
- const handleCheckboxToggle = (0, import_react6.useCallback)((item) => {
938
- setSelectedItems(
939
- (prev) => prev.includes(item) ? prev.filter((i) => i !== item) : [...prev, item]
940
- );
941
- }, []);
942
- return {
943
- anchorEl,
944
- open,
945
- selectedItems,
946
- filterValue,
947
- setSelectedItems,
948
- handleOpen,
949
- handleClose,
950
- handleFilterChange,
951
- handleCheckboxToggle,
952
- setOpen
953
- };
954
- }
955
-
956
- // src/Components/MultiSelect/helpers/Utils.tsx
957
- var MuiIcons2 = __toESM(require("@mui/icons-material"), 1);
958
- var import_icons_material5 = require("@mui/icons-material");
959
- function getIconMultiSelect(name) {
960
- return name in MuiIcons2 ? MuiIcons2[name] : import_icons_material5.FilterListOutlined;
961
- }
962
-
963
- // src/Components/MultiSelect/helpers/useFilteredItems.tsx
964
- var import_react7 = require("react");
965
- function useFilteredItems(items, filterValue, getItemLabel, selectedItems) {
966
- const filteredItems = (0, import_react7.useMemo)(
967
- () => items.filter(
968
- (item) => getItemLabel(item).toLowerCase().includes(filterValue.toLowerCase())
799
+ required ? /* @__PURE__ */ import_react5.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label
969
800
  ),
970
- [items, filterValue, getItemLabel]
971
- );
972
- const sortedItems = (0, import_react7.useMemo)(() => {
973
- return [
974
- ...filteredItems.filter((item) => selectedItems.includes(item)),
975
- ...filteredItems.filter((item) => !selectedItems.includes(item))
976
- ];
977
- }, [filteredItems, selectedItems]);
978
- return { filteredItems, sortedItems };
801
+ /* @__PURE__ */ import_react5.default.createElement(
802
+ import_Select.default,
803
+ {
804
+ value: Array.isArray(state.hiddenValue) ? state.hiddenValue[0] || "" : state.hiddenValue != "-1" ? state.hiddenValue : "",
805
+ label: required ? /* @__PURE__ */ import_react5.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
806
+ onChange: handleChange,
807
+ onBlur: handleBlur,
808
+ variant,
809
+ disabled: disabled || false,
810
+ error,
811
+ MenuProps: {
812
+ PaperProps: {
813
+ sx: {
814
+ left: "0px !important"
815
+ }
816
+ },
817
+ sx: {
818
+ "& .MuiPaper-root": {
819
+ left: "0px !important"
820
+ }
821
+ }
822
+ }
823
+ },
824
+ data.map((option, index) => {
825
+ return /* @__PURE__ */ import_react5.default.createElement(import_material4.MenuItem, { key: index, value: getItemValue(option).value }, getItemValue(option).icon != void 0 ? /* @__PURE__ */ import_react5.default.createElement(import_material4.ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ import_react5.default.createElement(import_material4.SvgIcon, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "", /* @__PURE__ */ import_react5.default.createElement(import_material4.ListItemText, { primary: getItemValue(option).text, color: "text.primary" }));
826
+ })
827
+ )
828
+ )));
979
829
  }
980
830
 
981
- // src/Components/MultiSelect/SCMultiSelect.tsx
982
- function SCMultiSelect({
983
- textButton,
984
- button,
985
- items,
986
- topPanel,
987
- actions,
988
- dense = false,
989
- open,
990
- selectAll = false,
991
- getItemLabel
831
+ // src/Components/SCAutocomplete.tsx
832
+ var import_react6 = __toESM(require("react"), 1);
833
+ var import_material5 = require("@mui/material");
834
+ var import_Grid22 = __toESM(require("@mui/material/Grid2"), 1);
835
+ var import_icons_material4 = require("@mui/icons-material");
836
+ var Muicon3 = __toESM(require("@mui/icons-material"), 1);
837
+ function SCAutocomplete({
838
+ label = "",
839
+ data,
840
+ columnGroup,
841
+ getItemValue,
842
+ typeFormat = "normal",
843
+ checkMassive = false,
844
+ deleteType = "button",
845
+ fnAplicar,
846
+ required,
847
+ disabled,
848
+ background,
849
+ setState,
850
+ state,
851
+ inputChange,
852
+ maxCheck
853
+ // Agregar el parámetro maxCheck
992
854
  }) {
993
- var _a, _b;
994
- const {
995
- anchorEl,
996
- open: openMultiselect,
997
- selectedItems,
998
- filterValue,
999
- setSelectedItems,
1000
- handleOpen,
1001
- handleClose,
1002
- handleFilterChange,
1003
- handleCheckboxToggle,
1004
- setOpen
1005
- } = useMultiSelectHandlers();
1006
- (0, import_react8.useEffect)(() => {
1007
- if (open !== void 0) {
1008
- setOpen(open);
855
+ const labelContent = `<span style="color: red;">* </span>` + label;
856
+ let group = "";
857
+ let isSelected = false;
858
+ const [selectedOptions, setSelectedOptions] = import_react6.default.useState([]);
859
+ const [prevData, setPrevData] = import_react6.default.useState(data);
860
+ const [originalData, setOriginalData] = import_react6.default.useState(data);
861
+ const [inputValue, setInputValue] = import_react6.default.useState("");
862
+ const [isUserTyping, setIsUserTyping] = import_react6.default.useState(false);
863
+ (0, import_react6.useEffect)(() => {
864
+ const dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
865
+ if (!dataChangeValidation && !isUserTyping) {
866
+ setState({ hiddenValue: "-1", textValue: "" });
867
+ setSelectedOptions([]);
868
+ setOriginalData(data);
869
+ } else if (!isUserTyping) {
870
+ setOriginalData(data);
1009
871
  }
1010
- }, [open, setOpen]);
1011
- (0, import_react8.useEffect)(() => {
1012
- setSelectedItems([]);
1013
- }, [items, setSelectedItems]);
1014
- const { filteredItems, sortedItems } = useFilteredItems(items, filterValue, getItemLabel, selectedItems);
1015
- const Icon = (0, import_react8.useMemo)(() => {
1016
- var _a2;
1017
- return getIconMultiSelect((_a2 = button == null ? void 0 : button.icon) != null ? _a2 : "FilterListOutlined");
1018
- }, [button == null ? void 0 : button.icon]);
1019
- const handleSelectAll = () => {
1020
- const allSelected2 = selectedItems.length === filteredItems.length;
1021
- setSelectedItems(allSelected2 ? [] : filteredItems);
1022
- };
1023
- const allSelected = filteredItems.length > 0 && selectedItems.length === filteredItems.length;
1024
- const resolvedActions = actions != null ? actions : [
1025
- { text: "Limpiar", fn: handleClose },
1026
- { text: "Aplicar", fn: () => {
1027
- } }
1028
- ];
1029
- return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement(
1030
- import_material5.Button,
1031
- {
1032
- "test-id": "multiselect-button",
1033
- color: (_a = button == null ? void 0 : button.color) != null ? _a : "primary",
1034
- onClick: handleOpen,
1035
- variant: (_b = button == null ? void 0 : button.variant) != null ? _b : "text",
1036
- size: "small",
1037
- startIcon: (button == null ? void 0 : button.iconPosition) === "left" || !(button == null ? void 0 : button.iconPosition) ? /* @__PURE__ */ import_react8.default.createElement(Icon, null) : null,
1038
- endIcon: (button == null ? void 0 : button.iconPosition) === "right" ? /* @__PURE__ */ import_react8.default.createElement(Icon, null) : null
1039
- },
1040
- capitalize(textButton != null ? textButton : "MultiSelect")
1041
- ), /* @__PURE__ */ import_react8.default.createElement(
1042
- import_material5.Popover,
1043
- {
1044
- elevation: 8,
1045
- anchorEl,
1046
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
1047
- open: openMultiselect,
1048
- onClose: () => setOpen(false)
1049
- },
1050
- /* @__PURE__ */ import_react8.default.createElement(import_material5.Stack, { minWidth: "320px", "data-testid": "multiselect-container", bgcolor: "white", boxShadow: 3, borderRadius: 1 }, /* @__PURE__ */ import_react8.default.createElement(import_material5.Stack, { py: 1, px: 2 }, topPanel != null ? topPanel : /* @__PURE__ */ import_react8.default.createElement(import_material5.FormControl, { fullWidth: true, size: "small" }, /* @__PURE__ */ import_react8.default.createElement(
1051
- import_material5.TextField,
1052
- {
1053
- "data-testid": "multiselect-input",
1054
- fullWidth: true,
1055
- size: "small",
1056
- variant: "outlined",
1057
- placeholder: "Buscar",
1058
- value: filterValue,
1059
- onChange: handleFilterChange,
1060
- slotProps: {
1061
- input: {
1062
- endAdornment: /* @__PURE__ */ import_react8.default.createElement(import_material5.InputAdornment, { position: "end" }, /* @__PURE__ */ import_react8.default.createElement(import_icons_material6.SearchOutlined, { fontSize: "small" }))
1063
- }
1064
- }
872
+ setPrevData(data);
873
+ }, [data, isUserTyping]);
874
+ (0, import_react6.useEffect)(() => {
875
+ if (typeFormat == "multiselect") {
876
+ if (state.hiddenValue != "-1" && Array.isArray(state.hiddenValue)) {
877
+ const newSelectedOptions = originalData.filter(
878
+ (item) => state.hiddenValue.includes(getItemValue(item).value)
879
+ );
880
+ setSelectedOptions(newSelectedOptions);
1065
881
  }
1066
- ))), /* @__PURE__ */ import_react8.default.createElement(import_material5.Stack, { maxHeight: "300px", overflow: "auto" }, selectAll && /* @__PURE__ */ import_react8.default.createElement(import_material5.MenuItem, { dense, onClick: handleSelectAll }, /* @__PURE__ */ import_react8.default.createElement(import_material5.ListItemIcon, null, /* @__PURE__ */ import_react8.default.createElement(import_material5.Checkbox, { checked: allSelected, color: "primary" })), "Todos los items"), sortedItems.length > 0 ? sortedItems.map((item) => /* @__PURE__ */ import_react8.default.createElement(
1067
- import_material5.MenuItem,
1068
- {
1069
- key: getItemLabel(item),
1070
- dense,
1071
- onClick: () => handleCheckboxToggle(item)
1072
- },
1073
- /* @__PURE__ */ import_react8.default.createElement(import_material5.ListItemIcon, null, /* @__PURE__ */ import_react8.default.createElement(
1074
- import_material5.Checkbox,
1075
- {
1076
- checked: selectedItems.includes(item),
1077
- color: "primary"
1078
- }
1079
- )),
1080
- getItemLabel(item)
1081
- )) : /* @__PURE__ */ import_react8.default.createElement(import_material5.MenuItem, { disabled: true }, "No se encontraron resultados")), /* @__PURE__ */ import_react8.default.createElement(import_material5.Stack, { direction: "row", gap: 1, p: 1, justifyContent: "space-between", bgcolor: "grey.50" }, resolvedActions.map((button2, index) => {
1082
- var _a2;
1083
- return /* @__PURE__ */ import_react8.default.createElement(
1084
- import_material5.Button,
1085
- {
1086
- key: index,
1087
- variant: index === 0 || resolvedActions.length < 2 ? "text" : "contained",
1088
- onClick: button2.fn,
1089
- disabled: (_a2 = button2.disabled) != null ? _a2 : false,
1090
- size: "small"
1091
- },
1092
- capitalize(button2.text)
1093
- );
1094
- })))
1095
- ));
1096
- }
1097
-
1098
- // src/Components/SCDialog.tsx
1099
- var import_react9 = __toESM(require("react"), 1);
1100
- var import_material6 = require("@mui/material");
1101
- var import_Grid23 = __toESM(require("@mui/material/Grid2"), 1);
1102
- var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
1103
- var Muicon3 = __toESM(require("@mui/icons-material"), 1);
1104
- var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, disableClose, dividers, widthContent, heightContent, background, setShow, show }) => {
1105
- let i = 0;
1106
- let iconTitleValidation = "";
1107
- let IconTitle;
1108
- let ButtonIcon;
1109
- const [open, setOpen] = (0, import_react9.useState)(show);
1110
- (0, import_react9.useEffect)(() => {
1111
- if (show) {
1112
- handleOpen();
1113
882
  }
1114
- }, [show]);
1115
- if ((buttonDialog == null ? void 0 : buttonDialog.icon) != void 0) {
1116
- if (Muicon3[buttonDialog == null ? void 0 : buttonDialog.icon] == void 0) {
1117
- ButtonIcon = buttonDialog == null ? void 0 : buttonDialog.icon;
1118
- } else {
1119
- ButtonIcon = Muicon3[buttonDialog == null ? void 0 : buttonDialog.icon];
883
+ }, [state.hiddenValue, originalData, typeFormat]);
884
+ (0, import_react6.useEffect)(() => {
885
+ if (inputValue === "") {
886
+ setIsUserTyping(false);
1120
887
  }
1121
- }
1122
- if (iconTitle) {
1123
- if (Muicon3[iconTitle] == void 0) {
1124
- if (iconTitle && import_react9.default.isValidElement(iconTitle) && iconTitle.type == void 0) {
1125
- iconTitleValidation = "image";
1126
- IconTitle = iconTitle;
888
+ }, [inputValue]);
889
+ data.map(function(option) {
890
+ if (option == null ? void 0 : option.icon) {
891
+ if ((option == null ? void 0 : option.icon.type) == void 0) {
892
+ option.icon = Muicon3[option == null ? void 0 : option.icon];
1127
893
  } else {
1128
- iconTitleValidation = "icon";
1129
- IconTitle = iconTitle;
894
+ option;
1130
895
  }
896
+ }
897
+ });
898
+ const cleanOptions = (event2) => {
899
+ setState({ hiddenValue: "-1", textValue: "" });
900
+ setSelectedOptions([]);
901
+ setInputValue("");
902
+ setIsUserTyping(false);
903
+ };
904
+ const handleCheckAll = (event2) => {
905
+ if (event2.target.checked) {
906
+ const itemsToSelect = maxCheck ? data.slice(0, maxCheck) : data;
907
+ setSelectedOptions(itemsToSelect);
908
+ setState({
909
+ hiddenValue: itemsToSelect.map((item) => getItemValue(item).value),
910
+ textValue: itemsToSelect.map((item) => getItemValue(item).text)
911
+ });
1131
912
  } else {
1132
- iconTitleValidation = "icon";
1133
- IconTitle = Muicon3[iconTitle];
913
+ setSelectedOptions([]);
914
+ setState({ hiddenValue: "-1", textValue: "" });
915
+ setInputValue("");
916
+ setIsUserTyping(false);
1134
917
  }
1135
- }
1136
- const handleOpen = () => setOpen(true);
1137
- const handleClose = () => {
1138
- setOpen(false);
1139
- if (setShow) {
1140
- setShow(false);
918
+ };
919
+ const allSelected = data.length > 0 && selectedOptions.length === data.length;
920
+ const handleChange = (event2, value) => {
921
+ if (typeFormat === "multiselect") {
922
+ if (maxCheck && value.length > maxCheck) {
923
+ value = value.slice(0, maxCheck);
924
+ }
925
+ const ids = value.map((v) => getItemValue ? getItemValue(v).value : "");
926
+ const texts = value.map((v) => getItemValue ? getItemValue(v).text : "");
927
+ setSelectedOptions(value);
928
+ setState({
929
+ hiddenValue: ids,
930
+ textValue: texts
931
+ });
932
+ } else {
933
+ setState({
934
+ hiddenValue: getItemValue(value).value,
935
+ textValue: getItemValue(value).text
936
+ });
1141
937
  }
1142
938
  };
1143
- const dialogActions = actions != null ? actions : [{ text: "Cerrar", fn: handleClose }];
1144
- content = content != null ? content : { component: /* @__PURE__ */ import_react9.default.createElement(import_material6.Box, null, " Aqui va el contenido ") };
1145
- return /* @__PURE__ */ import_react9.default.createElement("div", null, buttonDialog ? /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, buttonDialog.text != void 0 ? /* @__PURE__ */ import_react9.default.createElement(import_material6.Tooltip, { placement: "bottom-start", title: buttonDialog.tooltip != void 0 ? buttonDialog.tooltip : "", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ import_react9.default.createElement(import_material6.Button, { size: "small", color: buttonDialog.color != void 0 ? buttonDialog.color : "primary", variant: (buttonDialog == null ? void 0 : buttonDialog.variant) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.variant : "text", startIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "left" || !(buttonDialog == null ? void 0 : buttonDialog.iconPosition) ? /* @__PURE__ */ import_react9.default.createElement(ButtonIcon, { color: buttonDialog.color != void 0 ? buttonDialog.color : "primary" }) : "", endIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "right" ? /* @__PURE__ */ import_react9.default.createElement(ButtonIcon, { color: buttonDialog.color != void 0 ? buttonDialog.color : "primary" }) : "", onClick: handleOpen }, " ", (buttonDialog == null ? void 0 : buttonDialog.text) != void 0 ? buttonDialog.text : "", " ")) : /* @__PURE__ */ import_react9.default.createElement(import_material6.IconButton, { style: { cursor: "pointer" }, onClick: handleOpen }, /* @__PURE__ */ import_react9.default.createElement(import_material6.SvgIcon, { fontSize: "small", color: (buttonDialog == null ? void 0 : buttonDialog.color) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.color : "action", component: ButtonIcon }))) : "", /* @__PURE__ */ import_react9.default.createElement(import_material6.Modal, { open: open || false, onClose: handleClose }, /* @__PURE__ */ import_react9.default.createElement(
1146
- import_material6.Dialog,
939
+ const selectedValue = typeFormat === "multiselect" ? selectedOptions : originalData.find(
940
+ (item) => getItemValue(item).value === state.hiddenValue
941
+ ) || null;
942
+ return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, data && /* @__PURE__ */ import_react6.default.createElement(
943
+ import_material5.Autocomplete,
1147
944
  {
1148
- open: open || false,
1149
- onClose: disableClose ? void 0 : handleClose,
1150
- maxWidth: "xl",
945
+ multiple: typeFormat === "multiselect",
946
+ clearOnEscape: true,
947
+ disabled,
948
+ options: data,
949
+ isOptionEqualToValue: (option, value) => getItemValue(option).value === getItemValue(value).value,
950
+ onInputChange: (event2, value) => {
951
+ setInputValue(value);
952
+ setIsUserTyping(value.length > 0);
953
+ if (inputChange) {
954
+ inputChange(value);
955
+ }
956
+ },
957
+ onChange: handleChange,
958
+ getOptionLabel: (option) => getItemValue(option).text,
959
+ value: selectedValue,
1151
960
  sx: {
1152
- width: "100% !important",
1153
- "& .MuiBackdrop-root": {
1154
- backdropFilter: "blur(0px) !important"
961
+ background: background || "transparent",
962
+ width: "100%",
963
+ maxWidth: "100%"
964
+ },
965
+ limitTags: 2,
966
+ renderTags: (value, getTagProps) => {
967
+ const limit = 2;
968
+ return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, value.slice(0, limit).map((option, index) => {
969
+ const _a = getTagProps({ index }), { key } = _a, chipProps = __objRest(_a, ["key"]);
970
+ return /* @__PURE__ */ import_react6.default.createElement(
971
+ import_material5.Chip,
972
+ __spreadProps(__spreadValues({
973
+ key,
974
+ color: "default",
975
+ size: "small",
976
+ variant: "filled",
977
+ label: getItemValue(option).text
978
+ }, chipProps), {
979
+ style: { maxWidth: 120, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
980
+ })
981
+ );
982
+ }), value.length > limit && /* @__PURE__ */ import_react6.default.createElement(import_material5.Box, { sx: { ml: 0.5, fontSize: 13, color: "#666", display: "flex", alignItems: "center" } }, `+${value.length - limit}`));
983
+ },
984
+ renderOption: (props, option) => {
985
+ const _a = props, { key } = _a, optionProps = __objRest(_a, ["key"]);
986
+ let isValid;
987
+ let isDisabled = false;
988
+ if (typeFormat == "multiselect") {
989
+ isSelected = selectedOptions.some(
990
+ (selected) => getItemValue(selected).value === getItemValue(option).value
991
+ );
992
+ if (maxCheck && selectedOptions.length >= maxCheck && !isSelected) {
993
+ isDisabled = true;
994
+ }
1155
995
  }
1156
- }
1157
- },
1158
- title && /* @__PURE__ */ import_react9.default.createElement(import_material6.DialogTitle, { sx: { m: 0, padding: "8px 16px 8px 16px" }, id: "dialog-title" }, /* @__PURE__ */ import_react9.default.createElement(import_Grid23.default, { container: true, size: 12, sx: { justifyContent: "space-between" } }, /* @__PURE__ */ import_react9.default.createElement(import_Grid23.default, { container: true, size: 11, sx: { alignItems: "center" } }, iconTitle ? iconTitleValidation == "image" ? /* @__PURE__ */ import_react9.default.createElement(import_material6.Box, { sx: { marginRight: "16px", width: "44px", height: "44px", borderRadius: "1px" } }, /* @__PURE__ */ import_react9.default.createElement("img", { src: IconTitle, width: "44px", height: "44px" })) : /* @__PURE__ */ import_react9.default.createElement(import_material6.SvgIcon, { color: "action", fontSize: "small", component: IconTitle, sx: { marginRight: "16px" } }) : "", /* @__PURE__ */ import_react9.default.createElement(import_Grid23.default, null, /* @__PURE__ */ import_react9.default.createElement(import_material6.Typography, { color: "text.primary", variant: "h6", gutterBottom: true }, title ? title : ""), /* @__PURE__ */ import_react9.default.createElement(import_material6.Typography, { color: "text.secondary", variant: "body2", gutterBottom: true }, subtitle ? subtitle : ""))), disableClose != true ? /* @__PURE__ */ import_react9.default.createElement(import_material6.IconButton, { onClick: handleClose, size: "small", color: "default", sx: { height: 22, width: 22 } }, /* @__PURE__ */ import_react9.default.createElement(import_Close2.default, null)) : "")),
1159
- /* @__PURE__ */ import_react9.default.createElement(
1160
- import_material6.DialogContent,
1161
- {
1162
- dividers: dividers ? dividers : false,
1163
- sx: {
1164
- m: 0,
1165
- padding: "12px 16px 8px 16px",
1166
- background: background ? background : "white",
1167
- height: !heightContent ? "508px" : heightContent,
1168
- width: widthContent == "extra-small" ? "444px" : widthContent == "small" ? "600px" : widthContent == "medium" ? "900px" : widthContent == "large" ? "1200px" : widthContent == "extra-large" ? "1536px" : "900px"
996
+ if (columnGroup) {
997
+ isValid = group == option[columnGroup];
998
+ group = option[columnGroup];
1169
999
  }
1000
+ return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, { key }, columnGroup ? !isValid ? /* @__PURE__ */ import_react6.default.createElement(import_material5.Typography, { color: "text.secondary", sx: { margin: "7px 16px !important", fontSize: "13px !important" } }, option[columnGroup]) : "" : "", /* @__PURE__ */ import_react6.default.createElement(
1001
+ import_material5.MenuItem,
1002
+ __spreadProps(__spreadValues({}, optionProps), {
1003
+ disabled: isDisabled,
1004
+ style: {
1005
+ background: typeFormat != "multiselect" ? state.hiddenValue == getItemValue(option).value ? "#dfe6ec" : "white" : "white",
1006
+ padding: "7px 16px",
1007
+ opacity: isDisabled ? 0.5 : 1
1008
+ }
1009
+ }),
1010
+ typeFormat != "multiselect" && getItemValue(option).icon != void 0 ? /* @__PURE__ */ import_react6.default.createElement(import_material5.ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ import_react6.default.createElement(import_material5.SvgIcon, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "",
1011
+ typeFormat == "multiselect" ? /* @__PURE__ */ import_react6.default.createElement(
1012
+ import_material5.Checkbox,
1013
+ {
1014
+ checked: isSelected,
1015
+ disabled: isDisabled,
1016
+ value: getItemValue(option).text,
1017
+ color: "primary"
1018
+ }
1019
+ ) : "",
1020
+ /* @__PURE__ */ import_react6.default.createElement(import_material5.ListItemText, { primary: getItemValue(option).text, color: "text.primary" }),
1021
+ getItemValue(option).component != void 0 ? getItemValue(option).component : ""
1022
+ )));
1023
+ },
1024
+ renderInput: (params) => /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(
1025
+ import_material5.TextField,
1026
+ __spreadProps(__spreadValues({}, params), {
1027
+ label: required ? /* @__PURE__ */ import_react6.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
1028
+ placeholder: selectedOptions.length == 0 ? "B\xFAsqueda" : "",
1029
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
1030
+ endAdornment: /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, deleteType == "icon" && (state.hiddenValue.toString() != "-1" && state.hiddenValue.toString() != "") ? /* @__PURE__ */ import_react6.default.createElement(import_material5.IconButton, { size: "small", onClick: cleanOptions, sx: { marginLeft: "auto", textAlign: "right", padding: "0px" } }, /* @__PURE__ */ import_react6.default.createElement(import_icons_material4.Clear, { fontSize: "small" })) : "", /* @__PURE__ */ import_react6.default.createElement(import_material5.InputAdornment, { style: { zIndex: 1, position: "relative" }, position: "end" }, /* @__PURE__ */ import_react6.default.createElement(import_icons_material4.Search, { fontSize: "small", color: "action", style: { cursor: "pointer" } })))
1031
+ })
1032
+ })
1033
+ )),
1034
+ slotProps: {
1035
+ listbox: {
1036
+ component: import_react6.default.forwardRef(function ListboxComponent(props, ref) {
1037
+ return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(
1038
+ import_material5.Box,
1039
+ __spreadProps(__spreadValues({
1040
+ ref
1041
+ }, props), {
1042
+ sx: __spreadValues({
1043
+ position: "relative",
1044
+ paddingBottom: "56px",
1045
+ backgroundColor: "white"
1046
+ }, props.sx)
1047
+ }),
1048
+ checkMassive && typeFormat == "multiselect" ? /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(import_material5.FormControlLabel, { control: /* @__PURE__ */ import_react6.default.createElement(import_material5.Checkbox, { checked: allSelected, indeterminate: selectedOptions.length > 0 && selectedOptions.length < data.length, onChange: handleCheckAll, color: "primary" }), label: "Todos los items", sx: { marginLeft: "0px !important", marginRight: "0px !important", padding: "7px 16px" } }), /* @__PURE__ */ import_react6.default.createElement(import_material5.Divider, null)) : "",
1049
+ props.children,
1050
+ deleteType == "button" || fnAplicar ? /* @__PURE__ */ import_react6.default.createElement(
1051
+ import_Grid22.default,
1052
+ {
1053
+ container: true,
1054
+ sx: {
1055
+ position: "sticky",
1056
+ bottom: -8,
1057
+ left: 0,
1058
+ width: "100%",
1059
+ backgroundColor: "grey.50",
1060
+ padding: "8px 16px",
1061
+ textAlign: "left",
1062
+ justifyContent: "space-between"
1063
+ }
1064
+ },
1065
+ deleteType == "button" ? /* @__PURE__ */ import_react6.default.createElement(
1066
+ import_material5.Button,
1067
+ {
1068
+ variant: "text",
1069
+ color: "primary",
1070
+ size: "small",
1071
+ onClick: (event2) => {
1072
+ event2.stopPropagation();
1073
+ cleanOptions(event2);
1074
+ }
1075
+ },
1076
+ "Limpiar"
1077
+ ) : "",
1078
+ fnAplicar && /* @__PURE__ */ import_react6.default.createElement(
1079
+ import_material5.Button,
1080
+ {
1081
+ variant: "contained",
1082
+ color: "primary",
1083
+ size: "small",
1084
+ onClick: fnAplicar
1085
+ },
1086
+ "Aplicar"
1087
+ )
1088
+ ) : ""
1089
+ ));
1090
+ })
1091
+ }
1092
+ }
1093
+ }
1094
+ ));
1095
+ }
1096
+
1097
+ // src/Components/SCDateRange.tsx
1098
+ var import_react7 = __toESM(require("react"), 1);
1099
+ var import_material6 = require("@mui/material");
1100
+ var import_LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
1101
+ var import_AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
1102
+ var import_DateRangePicker = require("@mui/x-date-pickers-pro/DateRangePicker");
1103
+ var import_MultiInputDateRangeField = require("@mui/x-date-pickers-pro/MultiInputDateRangeField");
1104
+ var import_dayjs = __toESM(require("dayjs"), 1);
1105
+ var import_es = require("dayjs/locale/es");
1106
+ var import_x_license_pro = require("@mui/x-license-pro");
1107
+ var import_Event = __toESM(require("@mui/icons-material/Event"), 1);
1108
+ var SCDateRange = ({
1109
+ labelDateInitial = "Fecha inicial",
1110
+ labelDateFinal = "Fecha final",
1111
+ required = false,
1112
+ disabled = false,
1113
+ background = "transparent",
1114
+ state,
1115
+ setState
1116
+ }) => {
1117
+ import_x_license_pro.LicenseInfo.setLicenseKey(
1118
+ "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
1119
+ );
1120
+ const isStartEmpty = required && !state[0];
1121
+ const isEndEmpty = required && !state[1];
1122
+ const hasError = isStartEmpty || isEndEmpty;
1123
+ const handleDateChange = (newValue) => {
1124
+ const convertedValue = [
1125
+ newValue[0] ? (0, import_dayjs.default)(newValue[0]) : null,
1126
+ newValue[1] ? (0, import_dayjs.default)(newValue[1]) : null
1127
+ ];
1128
+ setState(convertedValue);
1129
+ };
1130
+ return /* @__PURE__ */ import_react7.default.createElement(import_LocalizationProvider.LocalizationProvider, { dateAdapter: import_AdapterDayjs.AdapterDayjs, adapterLocale: "es" }, /* @__PURE__ */ import_react7.default.createElement(import_material6.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react7.default.createElement(
1131
+ import_DateRangePicker.DateRangePicker,
1132
+ {
1133
+ value: state,
1134
+ onChange: handleDateChange,
1135
+ disabled,
1136
+ slots: {
1137
+ field: import_MultiInputDateRangeField.MultiInputDateRangeField
1170
1138
  },
1171
- content.url ? /* @__PURE__ */ import_react9.default.createElement(
1172
- "iframe",
1173
- {
1174
- style: { border: "none", minWidth: "100%", minHeight: "100%" },
1175
- id: "inlineFrameExample",
1176
- title: "Inline Frame Example",
1177
- src: content.url
1139
+ slotProps: {
1140
+ field: {
1141
+ slotProps: {
1142
+ textField: ({ position }) => ({
1143
+ label: position === "start" ? labelDateInitial : labelDateFinal,
1144
+ size: "small",
1145
+ variant: "outlined",
1146
+ required,
1147
+ error: position === "start" ? isStartEmpty : isEndEmpty,
1148
+ InputProps: {
1149
+ endAdornment: /* @__PURE__ */ import_react7.default.createElement(import_material6.InputAdornment, { position: "end" }, /* @__PURE__ */ import_react7.default.createElement(
1150
+ import_Event.default,
1151
+ {
1152
+ color: hasError ? "error" : "action",
1153
+ fontSize: "small"
1154
+ }
1155
+ ))
1156
+ },
1157
+ sx: {
1158
+ mr: position === "start" ? 1 : 0,
1159
+ "& .MuiOutlinedInput-root": {
1160
+ backgroundColor: background === "transparent" ? "transparent" : background
1161
+ },
1162
+ "& .MuiInputLabel-asterisk": {
1163
+ color: "error.main"
1164
+ },
1165
+ background: background != null ? background : "transparent"
1166
+ }
1167
+ })
1168
+ }
1178
1169
  }
1179
- ) : content.component
1180
- ),
1181
- dialogActions.length > 0 ? /* @__PURE__ */ import_react9.default.createElement(import_material6.DialogActions, { sx: { gap: 1, m: 0, padding: "12px 16px 12px 16px" } }, dialogActions.map((boton) => /* @__PURE__ */ import_react9.default.createElement(
1182
- import_material6.Button,
1183
- {
1184
- key: i = i + 1,
1185
- autoFocus: true,
1186
- variant: i == 1 || dialogActions.length < 2 ? "contained" : "text",
1187
- color: "primary",
1188
- size: "small",
1189
- onClick: boton.fn,
1190
- disabled: boton.disabled || false
1191
1170
  },
1192
- boton.text
1193
- ))) : ""
1171
+ sx: {
1172
+ display: "flex",
1173
+ gap: 1,
1174
+ width: "100%"
1175
+ }
1176
+ }
1194
1177
  )));
1195
1178
  };
1196
1179
 
1197
- // src/Components/SCMenu.tsx
1198
- var import_react11 = __toESM(require("react"), 1);
1199
- var import_material7 = require("@mui/material");
1200
- var import_Grid24 = __toESM(require("@mui/material/Grid2"), 1);
1201
-
1202
- // src/Components/Hooks/useWindowDimensions.ts
1203
- var import_react10 = require("react");
1204
- function getWindowDimensions() {
1205
- const { innerWidth: width, innerHeight: height } = window;
1206
- return {
1207
- width,
1208
- height
1209
- };
1210
- }
1211
- function useWindowDimensions() {
1212
- const [windowDimensions, setWindowDimensions] = (0, import_react10.useState)(getWindowDimensions());
1213
- (0, import_react10.useEffect)(() => {
1214
- function handleResize() {
1215
- setWindowDimensions(getWindowDimensions());
1216
- }
1217
- window.addEventListener("resize", handleResize);
1218
- return () => window.removeEventListener("resize", handleResize);
1219
- }, []);
1220
- return windowDimensions;
1221
- }
1222
-
1223
- // src/Components/SCMenu.tsx
1180
+ // src/Components/Drawer/Helpers/Utils.tsx
1224
1181
  var Muicon4 = __toESM(require("@mui/icons-material"), 1);
1225
- var SCMenu = ({ header, options, defaultOption, disable, widthMenu, heightMenu, widthPage }) => {
1226
- const { height, width } = useWindowDimensions();
1227
- const menuSize = widthMenu ? parseInt(widthMenu) : 284;
1228
- const pageSize = widthPage ? parseInt(widthPage) : width - menuSize;
1229
- const widthContainer = menuSize + pageSize;
1230
- let heightContainer = heightMenu ? parseInt(heightMenu) : height - 76;
1231
- const [selectedIndex, setSelectedIndex] = import_react11.default.useState("1");
1232
- const [value, setValue] = import_react11.default.useState("1");
1233
- import_react11.default.useEffect(() => {
1234
- heightContainer = heightMenu ? parseInt(heightMenu) : height - 76;
1235
- }, [height]);
1236
- import_react11.default.useEffect(() => {
1237
- if (defaultOption) {
1238
- handleClickMenusItem(event, void 0);
1239
- }
1240
- }, [defaultOption]);
1241
- options.map(function(option, index, array) {
1242
- if (option == null ? void 0 : option.iconLeft) {
1243
- if ((option == null ? void 0 : option.iconLeft.type) == void 0) {
1244
- option.iconLeft = Muicon4[option == null ? void 0 : option.iconLeft];
1245
- } else {
1246
- option;
1182
+ var getIcon2 = (iconName) => {
1183
+ if (iconName && iconName in Muicon4) {
1184
+ return Muicon4[iconName];
1185
+ }
1186
+ return null;
1187
+ };
1188
+
1189
+ // src/Components/Drawer/Helpers/validateInput.tsx
1190
+ var validateInputs = (arrayElements, onError, onSuccess) => {
1191
+ var _a;
1192
+ let requiredValues = 0;
1193
+ let filledValues = 0;
1194
+ for (let i = 0; i < arrayElements.length; i++) {
1195
+ if (arrayElements[i].component === void 0) {
1196
+ if (arrayElements[i].required) {
1197
+ requiredValues++;
1247
1198
  }
1248
- }
1249
- if (option == null ? void 0 : option.iconRight) {
1250
- if ((option == null ? void 0 : option.iconRight.type) == void 0) {
1251
- option.iconRight = Muicon4[option == null ? void 0 : option.iconRight];
1252
- } else {
1253
- option;
1199
+ if (arrayElements[i].required && ((_a = arrayElements[i].state) == null ? void 0 : _a.trim()) !== "") {
1200
+ filledValues++;
1254
1201
  }
1255
1202
  }
1256
- });
1257
- const handleClickMenusItem = (event2, index) => {
1258
- if (defaultOption && index == void 0) {
1259
- setSelectedIndex(defaultOption);
1260
- setValue(defaultOption);
1261
- } else if (index != void 0) {
1262
- setSelectedIndex(String(index + 1));
1263
- setValue(String(index + 1));
1264
- }
1265
- };
1266
- return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(import_Grid24.default, { container: true, sx: { height: heightContainer, width: widthContainer, flexDirection: "column" } }, /* @__PURE__ */ import_react11.default.createElement(import_material7.Paper, { sx: { width: menuSize, height: heightContainer, overflow: "auto" } }, header && header.component, /* @__PURE__ */ import_react11.default.createElement(import_material7.MenuList, { sx: { height: options.length * 45, padding: "8px 0px" } }, options.map((option, index) => /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(
1267
- import_material7.MenuItem,
1268
- {
1269
- disabled: disable == true ? true : false,
1270
- key: index,
1271
- selected: String(index + 1) === selectedIndex,
1272
- onClick: (event2) => handleClickMenusItem(event2, index)
1273
- },
1274
- option.iconLeft ? /* @__PURE__ */ import_react11.default.createElement(import_material7.ListItemIcon, { sx: { color: String(index + 1) === selectedIndex ? "primary" : "active" } }, /* @__PURE__ */ import_react11.default.createElement(import_material7.SvgIcon, { fontSize: "small", color: String(index + 1) === selectedIndex ? "primary" : "action", component: option.iconLeft })) : "",
1275
- /* @__PURE__ */ import_react11.default.createElement(import_Grid24.default, { container: true, size: 12, sx: { maxWidth: 220, flexWrap: "noWrap", alignItems: "center" } }, /* @__PURE__ */ import_react11.default.createElement(import_material7.Typography, { noWrap: true, variant: "caption", color: String(index + 1) === selectedIndex ? "primary" : "active" }, option.name), option.iconRight ? /* @__PURE__ */ import_react11.default.createElement(import_material7.ListItemIcon, { sx: { minWidth: "0px !important", color: String(index + 1) === selectedIndex ? "primary" : "active" } }, /* @__PURE__ */ import_react11.default.createElement(import_material7.SvgIcon, { fontSize: "small", color: String(index + 1) === selectedIndex ? "primary" : "action", component: option.iconRight })) : "")
1276
- ), option.divider == true ? /* @__PURE__ */ import_react11.default.createElement(import_material7.Divider, null) : "")))), /* @__PURE__ */ import_react11.default.createElement(import_Grid24.default, { container: true }, options.map((option, index) => option.page ? String(index + 1) == value ? /* @__PURE__ */ import_react11.default.createElement(import_material7.Box, { sx: { padding: "16px", width: pageSize, height: heightContainer }, key: index }, option.page) : "" : /* @__PURE__ */ import_react11.default.createElement(import_material7.Typography, { color: "error" }, "No se ha configurado el componente a visualizar")))));
1203
+ }
1204
+ if (requiredValues === filledValues) {
1205
+ onSuccess();
1206
+ } else {
1207
+ onError({
1208
+ type: "error",
1209
+ title: "Algunos campos son requeridos",
1210
+ time: 10
1211
+ });
1212
+ }
1277
1213
  };
1278
1214
 
1279
- // src/Components/SCTabs.tsx
1280
- var import_react12 = __toESM(require("react"), 1);
1281
- var import_material8 = require("@mui/material");
1282
- var import_TabPanel = __toESM(require("@mui/lab/TabPanel"), 1);
1283
- var import_TabContext = __toESM(require("@mui/lab/TabContext"), 1);
1284
- var Muicon5 = __toESM(require("@mui/icons-material"), 1);
1285
- var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colorTab, orientation, variant, scrollButtons, children }) => {
1286
- const [toast, setToast] = import_react12.default.useState(null);
1287
- let i = 0;
1288
- let j = 0;
1289
- let k = 0;
1290
- let l = 0;
1291
- let validateTypeIcon = true;
1292
- const [value, setValue] = import_react12.default.useState("1");
1293
- (0, import_react12.useEffect)(() => {
1294
- if (defaultOption) {
1295
- handleChange(event, void 0);
1296
- }
1297
- }, [defaultOption]);
1298
- options.map(function(option) {
1299
- const optionsLength = options.length;
1300
- if (option == null ? void 0 : option.iconOrBadge) {
1301
- if (typeIcon == "icon") {
1302
- if ((option == null ? void 0 : option.iconOrBadge) in Muicon5 == true) {
1303
- validateTypeIcon = true;
1304
- option.iconOrBadge = Muicon5[option == null ? void 0 : option.iconOrBadge];
1305
- } else {
1306
- validateTypeIcon = false;
1307
- setTimeout(() => {
1308
- setToast({
1309
- type: "error",
1310
- title: "Componente SCTabs",
1311
- subtitle: "En Option todos los iconOrBadge deben ser iconos de MUI, por favor verificar.",
1312
- time: 50
1313
- });
1314
- }, 10);
1315
- return;
1316
- }
1317
- } else if (typeIcon == "badge") {
1318
- if ((option == null ? void 0 : option.iconOrBadge) in Muicon5 == false) {
1319
- validateTypeIcon = true;
1320
- option;
1215
+ // src/Components/Drawer/SCDrawer.tsx
1216
+ function SCDrawer({
1217
+ //informativas
1218
+ title,
1219
+ arrayElements = [],
1220
+ actions,
1221
+ buttonDrawer,
1222
+ //Apariencia
1223
+ colorTitle,
1224
+ anchor = "left",
1225
+ width,
1226
+ //Funcionales
1227
+ open
1228
+ }) {
1229
+ var _a, _b;
1230
+ const [drawerOpen, setDrawerOpen] = import_react8.default.useState(open);
1231
+ const [toast, setToast] = import_react8.default.useState(null);
1232
+ const handleDrawerClose = () => {
1233
+ setDrawerOpen(false);
1234
+ };
1235
+ const toggleDrawer = (newOpen) => () => {
1236
+ setDrawerOpen(newOpen);
1237
+ };
1238
+ const ButtonIcon = getIcon2(buttonDrawer == null ? void 0 : buttonDrawer.icon);
1239
+ const setToastWithDelay = (toastContent) => {
1240
+ setToast(null);
1241
+ setTimeout(() => {
1242
+ setToast(toastContent);
1243
+ }, 10);
1244
+ };
1245
+ const inputValidation = () => validateInputs(arrayElements, setToastWithDelay, handleDrawerClose);
1246
+ const clean = () => {
1247
+ arrayElements.forEach((element, index) => {
1248
+ if (element.setState) {
1249
+ if (element.type === "textField" || element.type === "textArea") {
1250
+ element.setState("");
1251
+ } else if (element.type === "dateRange") {
1252
+ element.setState([null, null]);
1321
1253
  } else {
1322
- validateTypeIcon = false;
1323
- setTimeout(() => {
1324
- setToast({
1325
- type: "error",
1326
- title: "Componente SCTabs",
1327
- subtitle: "En Option todos los iconOrBadge deben ser numeros para el badge, por favor verificar.",
1328
- time: 10
1329
- });
1330
- }, 10);
1331
- return;
1254
+ if (element.type == "autocomplete" && element.typeFormat == "multiselect") {
1255
+ element.setState({ hiddenValue: [], textValue: [] });
1256
+ } else {
1257
+ element.setState({ hiddenValue: "-1", textValue: "" });
1258
+ }
1332
1259
  }
1333
1260
  }
1334
- }
1335
- });
1336
- const handleChange = (event2, newValue) => {
1337
- if (defaultOption && newValue == void 0) {
1338
- setValue(defaultOption);
1339
- } else if (newValue != void 0) {
1340
- setValue(newValue);
1341
- }
1261
+ });
1342
1262
  };
1343
- return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, validateTypeIcon == true ? /* @__PURE__ */ import_react12.default.createElement(import_material8.Box, { sx: { height: orientation == "vertical" ? "100%" : "auto", display: "flex", flexDirection: orientation == "vertical" ? "row" : "column" }, id: "tabsitos" }, /* @__PURE__ */ import_react12.default.createElement(import_TabContext.default, { value }, /* @__PURE__ */ import_react12.default.createElement(
1344
- import_material8.Tabs,
1263
+ const actionsA = actions == false ? false : actions != void 0 ? actions : [{ text: "Aplicar filtros", fn: inputValidation }, { text: "Limpiar filtros", fn: clean }];
1264
+ return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, toast && /* @__PURE__ */ import_react8.default.createElement(SCToastNotification, __spreadValues({}, toast)), (buttonDrawer == null ? void 0 : buttonDrawer.type) == "chip" ? /* @__PURE__ */ import_react8.default.createElement(
1265
+ import_material7.Chip,
1266
+ __spreadProps(__spreadValues({
1267
+ onClick: toggleDrawer(true),
1268
+ color: buttonDrawer == null ? void 0 : buttonDrawer.color,
1269
+ variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) == "contained" ? "filled" : "outlined",
1270
+ label: (_a = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _a : "",
1271
+ icon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" && ButtonIcon ? /* @__PURE__ */ import_react8.default.createElement(ButtonIcon, { fontSize: "small" }) : void 0,
1272
+ deleteIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ import_react8.default.createElement(ButtonIcon, { fontSize: "small" }) : void 0
1273
+ }, (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? { onDelete: () => {
1274
+ } } : {}), {
1275
+ sx: {
1276
+ "& .MuiChip-icon": {
1277
+ color: "inherit"
1278
+ },
1279
+ textTransform: "capitalize"
1280
+ }
1281
+ })
1282
+ ) : /* @__PURE__ */ import_react8.default.createElement(
1283
+ import_material7.Button,
1345
1284
  {
1346
- value,
1347
- onChange: handleChange,
1348
- variant: variant ? orientation == "vertical" && variant == "fullWidth" ? "standard" : variant : "standard",
1349
- scrollButtons: scrollButtons == false ? false : true,
1350
- visibleScrollbar: scrollButtons == false ? true : false,
1351
- textColor: colorTab,
1352
- indicatorColor: colorTab,
1353
- orientation: orientation || "horizontal",
1354
- sx: { borderBottom: orientation == "vertical" ? 0 : 1, borderRight: orientation == "vertical" ? 1 : 0, borderColor: "divider", background: background || "" }
1285
+ "data-testid": "test-buttonDrawer",
1286
+ sx: { textTransform: "capitalize" },
1287
+ color: buttonDrawer == null ? void 0 : buttonDrawer.color,
1288
+ onClick: toggleDrawer(true),
1289
+ size: "small",
1290
+ variant: (buttonDrawer == null ? void 0 : buttonDrawer.variant) != void 0 ? buttonDrawer == null ? void 0 : buttonDrawer.variant : "text",
1291
+ startIcon: ((buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "left" || !(buttonDrawer == null ? void 0 : buttonDrawer.iconPosition)) && ButtonIcon ? /* @__PURE__ */ import_react8.default.createElement(ButtonIcon, { fontSize: "small" }) : null,
1292
+ endIcon: (buttonDrawer == null ? void 0 : buttonDrawer.iconPosition) === "right" && ButtonIcon ? /* @__PURE__ */ import_react8.default.createElement(ButtonIcon, { fontSize: "small" }) : null
1355
1293
  },
1356
- options.map((option) => /* @__PURE__ */ import_react12.default.createElement(
1357
- import_material8.Tab,
1358
- {
1359
- value: String(i = i + 1),
1360
- key: j = j + 1,
1361
- label: option.name || "",
1362
- disabled: option.disabled || false,
1363
- iconPosition: iconPosition || "end",
1364
- icon: typeIcon == "badge" ? /* @__PURE__ */ import_react12.default.createElement(
1365
- import_material8.Badge,
1294
+ (_b = buttonDrawer == null ? void 0 : buttonDrawer.text) != null ? _b : ""
1295
+ ), /* @__PURE__ */ import_react8.default.createElement(
1296
+ import_material7.Drawer,
1297
+ {
1298
+ open: drawerOpen,
1299
+ onClose: toggleDrawer(false),
1300
+ anchor: anchor != null ? anchor : "left",
1301
+ sx: {
1302
+ "& .MuiDrawer-paper": {
1303
+ width: width != null ? width : "450px",
1304
+ boxSizing: "border-box",
1305
+ borderRadius: anchor !== "right" ? "0px 4px 4px 0px" : "4px 0px 0px 4px"
1306
+ }
1307
+ }
1308
+ },
1309
+ /* @__PURE__ */ import_react8.default.createElement(import_material7.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react8.default.createElement(import_Grid23.default, { container: true, sx: { backgroundColor: "primary.50", alignItems: "center", height: "42px", textAlign: "left", padding: "8px 12px", justifyContent: "space-between", alignContent: "center" } }, /* @__PURE__ */ import_react8.default.createElement(import_material7.Typography, { variant: "h6", color: colorTitle || "text.primary" }, title != null ? title : "Personaliza tu b\xFAsqueda"), /* @__PURE__ */ import_react8.default.createElement(import_material7.IconButton, { onClick: handleDrawerClose }, /* @__PURE__ */ import_react8.default.createElement(import_Close.default, { "data-testid": "test-button-close", sx: { color: "text.primary" } }))), /* @__PURE__ */ import_react8.default.createElement(import_material7.Stack, { alignItems: "flex-start", height: "100%", gap: "16px", flex: 1, overflow: "auto", padding: "16px" }, arrayElements == null ? void 0 : arrayElements.map((arrayElement, index) => {
1310
+ var _a2, _b2, _c, _d, _e, _f;
1311
+ return /* @__PURE__ */ import_react8.default.createElement(
1312
+ import_material7.Box,
1313
+ {
1314
+ key: `Stack_${(_a2 = arrayElement.type) != null ? _a2 : ""} ${(_b2 = arrayElement.label) != null ? _b2 : ""}${index}`,
1315
+ sx: { width: "100%" }
1316
+ },
1317
+ arrayElement.component ? /* @__PURE__ */ import_react8.default.createElement(import_material7.Stack, { direction: "row", alignItems: "left", gap: 1 }, arrayElement.component) : arrayElement.type === "textField" ? /* @__PURE__ */ import_react8.default.createElement(
1318
+ SCTextField,
1319
+ {
1320
+ title: arrayElement.title,
1321
+ iconTitle: arrayElement.iconTitle,
1322
+ infoTitle: arrayElement.infoTitle,
1323
+ label: arrayElement.label,
1324
+ placeholder: arrayElement.placeholder,
1325
+ infoElement: arrayElement.infoElement,
1326
+ iconInputStart: arrayElement.iconInputStart,
1327
+ iconInputEnd: arrayElement.iconInputEnd,
1328
+ maxLength: arrayElement.maxLength,
1329
+ variant: arrayElement.variant,
1330
+ format: arrayElement.format,
1331
+ disabled: arrayElement.disabled,
1332
+ required: arrayElement.required,
1333
+ size: arrayElement.size,
1334
+ width: arrayElement.width,
1335
+ color: arrayElement.color,
1336
+ background: arrayElement.background,
1337
+ setState: arrayElement.setState,
1338
+ state: arrayElement.state || "",
1339
+ onChange: arrayElement.onChange,
1340
+ onBlur: arrayElement.onBlur,
1341
+ onKeyDown: arrayElement.onKeyDown
1342
+ }
1343
+ ) : arrayElement.type === "textArea" ? /* @__PURE__ */ import_react8.default.createElement(
1344
+ SCTextArea,
1366
1345
  {
1367
- sx: {
1368
- width: "20px",
1369
- height: "20px",
1370
- "& .MuiBadge-badge": {
1371
- top: "10px",
1372
- right: "10px"
1373
- }
1374
- },
1375
- variant: "standard",
1376
- badgeContent: option.iconOrBadge,
1377
- color: value == String(i) ? colorTab ? colorTab : "primary" : "default"
1346
+ title: arrayElement.title,
1347
+ iconTitle: arrayElement.iconTitle,
1348
+ infoTitle: arrayElement.infoTitle,
1349
+ label: arrayElement.label,
1350
+ placeholder: arrayElement.placeholder,
1351
+ maxLength: arrayElement.maxLength,
1352
+ variant: arrayElement.variant,
1353
+ disabled: arrayElement.disabled,
1354
+ required: arrayElement.required,
1355
+ width: arrayElement.width,
1356
+ rows: arrayElement.rows,
1357
+ background: arrayElement.background,
1358
+ setState: arrayElement.setState,
1359
+ state: arrayElement.state || "",
1360
+ onBlur: arrayElement.onBlur
1378
1361
  }
1379
- ) : typeIcon == "icon" ? /* @__PURE__ */ import_react12.default.createElement(import_material8.SvgIcon, { fontSize: "small", component: option.iconOrBadge, color: value == String(i) ? colorTab ? colorTab : "primary" : "action", sx: { width: "20px", height: "20px" } }) : "",
1380
- sx: { "& .MuiTab-icon": { margin: "0px !important" }, padding: "10px 16px", gap: "4px" }
1381
- }
1382
- ))
1383
- ), children, options.map((option) => /* @__PURE__ */ import_react12.default.createElement(
1384
- import_TabPanel.default,
1385
- {
1386
- key: k = k + 1,
1387
- value: String(l = l + 1),
1388
- sx: { padding: "16px" }
1389
- },
1390
- option.page ? option.page : /* @__PURE__ */ import_react12.default.createElement(import_material8.Typography, null, "No se ha configurado el componente a visualizar ")
1391
- )))) : /* @__PURE__ */ import_react12.default.createElement(import_material8.Box, { sx: { height: "200px" } }, toast && /* @__PURE__ */ import_react12.default.createElement(SCToastNotification, __spreadValues({}, toast))));
1392
- };
1362
+ ) : arrayElement.type === "autocomplete" ? /* @__PURE__ */ import_react8.default.createElement(
1363
+ SCAutocomplete,
1364
+ {
1365
+ label: arrayElement.label,
1366
+ data: (_c = arrayElement.data) != null ? _c : [],
1367
+ columnGroup: arrayElement.columnGroup,
1368
+ getItemValue: (_d = arrayElement.getItemValue) != null ? _d : () => ({ text: "", value: "" }),
1369
+ typeFormat: arrayElement.typeFormat,
1370
+ checkMassive: arrayElement.checkMassive,
1371
+ deleteType: arrayElement.deleteType,
1372
+ required: arrayElement.required,
1373
+ disabled: arrayElement.disabled,
1374
+ background: arrayElement.background,
1375
+ fnAplicar: arrayElement.fnAplicar,
1376
+ setState: arrayElement.setState,
1377
+ state: arrayElement.state || "",
1378
+ inputChange: arrayElement.inputChange
1379
+ }
1380
+ ) : arrayElement.type === "select" ? /* @__PURE__ */ import_react8.default.createElement(
1381
+ SCSelect,
1382
+ {
1383
+ label: arrayElement.label,
1384
+ data: (_e = arrayElement.data) != null ? _e : [],
1385
+ getItemValue: (_f = arrayElement.getItemValue) != null ? _f : () => ({ text: "", value: "" }),
1386
+ width: arrayElement.width,
1387
+ size: arrayElement.size,
1388
+ variant: arrayElement.variant,
1389
+ deleteType: arrayElement.deleteType,
1390
+ required: arrayElement.required,
1391
+ disabled: arrayElement.disabled,
1392
+ background: arrayElement.background,
1393
+ fnAplicar: arrayElement.fnAplicar,
1394
+ setState: arrayElement.setState,
1395
+ state: arrayElement.state || ""
1396
+ }
1397
+ ) : arrayElement.type === "dateRange" ? /* @__PURE__ */ import_react8.default.createElement(
1398
+ SCDateRange,
1399
+ {
1400
+ labelDateInitial: arrayElement.labelDateInitial,
1401
+ labelDateFinal: arrayElement.labelDateFinal,
1402
+ required: arrayElement.required,
1403
+ disabled: arrayElement.disabled,
1404
+ background: arrayElement.background,
1405
+ state: arrayElement.state || [],
1406
+ setState: arrayElement.setState
1407
+ }
1408
+ ) : null
1409
+ );
1410
+ })), actionsA != void 0 && actionsA != false ? Array.isArray(actionsA) && (actionsA == null ? void 0 : actionsA.length) > 0 ? /* @__PURE__ */ import_react8.default.createElement(
1411
+ import_Grid23.default,
1412
+ {
1413
+ sx: { borderTop: 1, borderColor: "#1018403B" },
1414
+ container: true,
1415
+ gap: 2,
1416
+ padding: "8px 12px",
1417
+ height: "42px",
1418
+ alignItems: "center",
1419
+ justifyContent: actionsA.length > 1 ? "space-between" : !anchor && anchor != "right" ? "flex-end" : "flex-start",
1420
+ flexDirection: anchor != "right" ? "row-reverse" : "row"
1421
+ },
1422
+ actionsA.map((btn, index) => /* @__PURE__ */ import_react8.default.createElement(
1423
+ import_material7.Button,
1424
+ {
1425
+ key: index,
1426
+ variant: index === 0 || actionsA.length < 2 ? "contained" : "text",
1427
+ color: "primary",
1428
+ onClick: btn.fn,
1429
+ disabled: btn.disabled || false,
1430
+ size: "small"
1431
+ },
1432
+ btn.text
1433
+ ))
1434
+ ) : "" : "")
1435
+ ));
1436
+ }
1393
1437
 
1394
1438
  // src/Components/FooterAction/FooterAction.tsx
1395
- var import_react13 = __toESM(require("react"), 1);
1396
- var import_material9 = require("@mui/material");
1439
+ var import_react9 = __toESM(require("react"), 1);
1440
+ var import_material8 = require("@mui/material");
1397
1441
  var FooterAction = ({
1398
1442
  leftContent,
1399
1443
  rightContent,
1400
1444
  label,
1401
1445
  variant
1402
1446
  }) => {
1403
- return /* @__PURE__ */ import_react13.default.createElement(
1404
- import_material9.AppBar,
1447
+ return /* @__PURE__ */ import_react9.default.createElement(
1448
+ import_material8.AppBar,
1405
1449
  {
1406
1450
  color: "inherit",
1407
1451
  sx: { position: variant == "float" ? "relative" : "fixed", left: 0, right: "auto", width: "100%", top: "auto", bottom: 0 }
1408
1452
  },
1409
- /* @__PURE__ */ import_react13.default.createElement(
1410
- import_material9.Toolbar,
1453
+ /* @__PURE__ */ import_react9.default.createElement(
1454
+ import_material8.Toolbar,
1411
1455
  {
1412
1456
  id: "footer-toolbar",
1413
1457
  sx: { gap: 1.5, minHeight: "50px !important" }
1414
1458
  },
1415
1459
  leftContent,
1416
- /* @__PURE__ */ import_react13.default.createElement(import_material9.Box, { flexGrow: 1 }),
1417
- label && /* @__PURE__ */ import_react13.default.createElement(import_material9.Typography, { variant: "body2", color: "text.secondary" }, label),
1460
+ /* @__PURE__ */ import_react9.default.createElement(import_material8.Box, { flexGrow: 1 }),
1461
+ label && /* @__PURE__ */ import_react9.default.createElement(import_material8.Typography, { variant: "body2", color: "text.secondary" }, label),
1418
1462
  rightContent
1419
1463
  )
1420
1464
  );
1421
1465
  };
1422
1466
 
1423
1467
  // src/Components/Modal/Helpers/Data.tsx
1424
- var import_react14 = __toESM(require("react"), 1);
1425
- var import_icons_material7 = require("@mui/icons-material");
1468
+ var import_react10 = __toESM(require("react"), 1);
1469
+ var import_icons_material5 = require("@mui/icons-material");
1426
1470
  var modalStateConfig = {
1427
1471
  info: {
1428
1472
  color: "info",
1429
1473
  defaultDescription: "Se [sincronizar\xE1n] los datos trabajados en modo offline y se [subir\xE1n] a los servidores.",
1430
- icon: /* @__PURE__ */ import_react14.default.createElement(import_icons_material7.Info, { color: "info", fontSize: "medium" })
1474
+ icon: /* @__PURE__ */ import_react10.default.createElement(import_icons_material5.Info, { color: "info", fontSize: "medium" })
1431
1475
  },
1432
1476
  delete: {
1433
1477
  color: "delete",
1434
1478
  defaultDescription: "[Elemento espec\xEDfico] [dejar\xE1 de existir en todos los lugares donde est\xE9 en uso]. Esta acci\xF3n es irreversible.",
1435
- icon: /* @__PURE__ */ import_react14.default.createElement(import_icons_material7.Info, { color: "error", fontSize: "medium" })
1479
+ icon: /* @__PURE__ */ import_react10.default.createElement(import_icons_material5.Info, { color: "error", fontSize: "medium" })
1436
1480
  },
1437
1481
  warning: {
1438
1482
  color: "warning",
1439
1483
  defaultDescription: "Se descartar\xE1 la [creaci\xF3n] y los cambios se perder\xE1n.",
1440
- icon: /* @__PURE__ */ import_react14.default.createElement(import_icons_material7.Warning, { color: "warning", fontSize: "medium" })
1484
+ icon: /* @__PURE__ */ import_react10.default.createElement(import_icons_material5.Warning, { color: "warning", fontSize: "medium" })
1441
1485
  }
1442
1486
  };
1443
1487
 
1444
1488
  // src/Components/Modal/Helpers/Utils.tsx
1445
- var MuiIcons3 = __toESM(require("@mui/icons-material"), 1);
1446
- var import_icons_material8 = require("@mui/icons-material");
1489
+ var MuiIcons2 = __toESM(require("@mui/icons-material"), 1);
1490
+ var import_icons_material6 = require("@mui/icons-material");
1447
1491
  var getIconComponent2 = (iconName) => {
1448
- return iconName && MuiIcons3[iconName] ? MuiIcons3[iconName] : import_icons_material8.FilterListOutlined;
1492
+ return iconName && MuiIcons2[iconName] ? MuiIcons2[iconName] : import_icons_material6.FilterListOutlined;
1449
1493
  };
1450
1494
  var getModalColor = (state) => {
1451
1495
  var _a;
@@ -1467,9 +1511,16 @@ var getButtonColor = (state) => {
1467
1511
  };
1468
1512
 
1469
1513
  // src/Components/Modal/SCModal.tsx
1470
- var import_react15 = __toESM(require("react"), 1);
1471
- var import_material10 = require("@mui/material");
1472
- var import_icons_material9 = require("@mui/icons-material");
1514
+ var import_react11 = __toESM(require("react"), 1);
1515
+ var import_material9 = require("@mui/material");
1516
+ var import_icons_material7 = require("@mui/icons-material");
1517
+
1518
+ // src/generales/capitalize.tsx
1519
+ function capitalize(text) {
1520
+ return text.charAt(0).toUpperCase() + text.slice(1);
1521
+ }
1522
+
1523
+ // src/Components/Modal/SCModal.tsx
1473
1524
  var SCModal = ({
1474
1525
  buttonModal,
1475
1526
  state = "info",
@@ -1479,35 +1530,35 @@ var SCModal = ({
1479
1530
  action
1480
1531
  }) => {
1481
1532
  var _a, _b, _c, _d, _e;
1482
- const [openModal, setOpenModal] = (0, import_react15.useState)(open != null ? open : false);
1483
- (0, import_react15.useEffect)(() => {
1533
+ const [openModal, setOpenModal] = (0, import_react11.useState)(open != null ? open : false);
1534
+ (0, import_react11.useEffect)(() => {
1484
1535
  if (open !== void 0) {
1485
1536
  setOpenModal(open);
1486
1537
  }
1487
1538
  }, [open]);
1488
- const Icon = (0, import_react15.useMemo)(() => getIconComponent2(buttonModal == null ? void 0 : buttonModal.icon), [buttonModal == null ? void 0 : buttonModal.icon]);
1489
- const handleClose = (0, import_react15.useCallback)(() => setOpenModal(false), []);
1539
+ const Icon = (0, import_react11.useMemo)(() => getIconComponent2(buttonModal == null ? void 0 : buttonModal.icon), [buttonModal == null ? void 0 : buttonModal.icon]);
1540
+ const handleClose = (0, import_react11.useCallback)(() => setOpenModal(false), []);
1490
1541
  const toggleModal = (newOpen) => () => setOpenModal(newOpen);
1491
- const prevAction = (0, import_react15.useMemo)(
1542
+ const prevAction = (0, import_react11.useMemo)(
1492
1543
  () => action != null ? action : [{ text: "Cancelar", fn: handleClose }, { text: "Consultar", fn: () => {
1493
1544
  } }],
1494
1545
  [action, handleClose]
1495
1546
  );
1496
1547
  const { icon, defaultDescription } = modalStateConfig[state];
1497
- return /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(
1498
- import_material10.Button,
1548
+ return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(
1549
+ import_material9.Button,
1499
1550
  {
1500
1551
  "data-testid": "test-buttonModal",
1501
1552
  color: (_a = buttonModal == null ? void 0 : buttonModal.color) != null ? _a : "primary",
1502
1553
  onClick: toggleModal(true),
1503
1554
  variant: (_b = buttonModal == null ? void 0 : buttonModal.variant) != null ? _b : "text",
1504
1555
  size: (_c = buttonModal == null ? void 0 : buttonModal.size) != null ? _c : "small",
1505
- startIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "left" && /* @__PURE__ */ import_react15.default.createElement(Icon, null),
1506
- endIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "right" && /* @__PURE__ */ import_react15.default.createElement(Icon, null)
1556
+ startIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "left" && /* @__PURE__ */ import_react11.default.createElement(Icon, null),
1557
+ endIcon: (buttonModal == null ? void 0 : buttonModal.iconPosition) === "right" && /* @__PURE__ */ import_react11.default.createElement(Icon, null)
1507
1558
  },
1508
1559
  capitalize((_d = buttonModal == null ? void 0 : buttonModal.text) != null ? _d : "filtrar")
1509
- ), /* @__PURE__ */ import_react15.default.createElement(import_material10.Modal, { open: openModal, onClose: toggleModal(false), sx: { boxShadow: 8 } }, /* @__PURE__ */ import_react15.default.createElement(
1510
- import_material10.Box,
1560
+ ), /* @__PURE__ */ import_react11.default.createElement(import_material9.Modal, { open: openModal, onClose: toggleModal(false), sx: { boxShadow: 8 } }, /* @__PURE__ */ import_react11.default.createElement(
1561
+ import_material9.Box,
1511
1562
  {
1512
1563
  sx: {
1513
1564
  position: "absolute",
@@ -1520,10 +1571,10 @@ var SCModal = ({
1520
1571
  boxShadow: 24
1521
1572
  }
1522
1573
  },
1523
- /* @__PURE__ */ import_react15.default.createElement(import_material10.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ import_react15.default.createElement(import_material10.Stack, { direction: "row", alignItems: "center", p: 1, gap: 1.5 }, /* @__PURE__ */ import_react15.default.createElement(import_material10.Box, { display: "flex", justifyContent: "center", alignItems: "center", borderRadius: "50%", height: 36, width: 36, bgcolor: getModalColor(state) }, icon), /* @__PURE__ */ import_react15.default.createElement(import_material10.Typography, { variant: "h6", color: "text.primary" }, title)), /* @__PURE__ */ import_react15.default.createElement(import_material10.IconButton, { onClick: toggleModal(false), "data-testid": "test-buttonClose" }, /* @__PURE__ */ import_react15.default.createElement(import_icons_material9.Close, { color: "action" }))),
1524
- /* @__PURE__ */ import_react15.default.createElement(import_material10.Stack, { py: 1, px: 3, gap: 1.5 }, /* @__PURE__ */ import_react15.default.createElement(import_material10.Typography, { variant: "body1" }, description || defaultDescription)),
1525
- action && /* @__PURE__ */ import_react15.default.createElement(
1526
- import_material10.Stack,
1574
+ /* @__PURE__ */ import_react11.default.createElement(import_material9.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ import_react11.default.createElement(import_material9.Stack, { direction: "row", alignItems: "center", p: 1, gap: 1.5 }, /* @__PURE__ */ import_react11.default.createElement(import_material9.Box, { display: "flex", justifyContent: "center", alignItems: "center", borderRadius: "50%", height: 36, width: 36, bgcolor: getModalColor(state) }, icon), /* @__PURE__ */ import_react11.default.createElement(import_material9.Typography, { variant: "h6", color: "text.primary" }, title)), /* @__PURE__ */ import_react11.default.createElement(import_material9.IconButton, { onClick: toggleModal(false), "data-testid": "test-buttonClose" }, /* @__PURE__ */ import_react11.default.createElement(import_icons_material7.Close, { color: "action" }))),
1575
+ /* @__PURE__ */ import_react11.default.createElement(import_material9.Stack, { py: 1, px: 3, gap: 1.5 }, /* @__PURE__ */ import_react11.default.createElement(import_material9.Typography, { variant: "body1" }, description || defaultDescription)),
1576
+ action && /* @__PURE__ */ import_react11.default.createElement(
1577
+ import_material9.Stack,
1527
1578
  {
1528
1579
  id: "Action",
1529
1580
  direction: "row",
@@ -1533,8 +1584,8 @@ var SCModal = ({
1533
1584
  bgcolor: "grey.50",
1534
1585
  sx: { borderRadius: 1 }
1535
1586
  },
1536
- /* @__PURE__ */ import_react15.default.createElement(
1537
- import_material10.Button,
1587
+ /* @__PURE__ */ import_react11.default.createElement(
1588
+ import_material9.Button,
1538
1589
  {
1539
1590
  color: "inherit",
1540
1591
  variant: "text",
@@ -1543,8 +1594,8 @@ var SCModal = ({
1543
1594
  },
1544
1595
  capitalize("cancelar")
1545
1596
  ),
1546
- /* @__PURE__ */ import_react15.default.createElement(
1547
- import_material10.Button,
1597
+ /* @__PURE__ */ import_react11.default.createElement(
1598
+ import_material9.Button,
1548
1599
  {
1549
1600
  "data-testid": "test-aceptar",
1550
1601
  color: getButtonColor(state),
@@ -1553,14 +1604,201 @@ var SCModal = ({
1553
1604
  disabled: false,
1554
1605
  size: "small"
1555
1606
  },
1556
- capitalize(action[0].text)
1557
- )
1558
- )
1559
- )));
1560
- };
1607
+ capitalize(action[0].text)
1608
+ )
1609
+ )
1610
+ )));
1611
+ };
1612
+
1613
+ // src/Components/MultiSelect/MultiSelect.tsx
1614
+ var import_react14 = __toESM(require("react"), 1);
1615
+ var import_material10 = require("@mui/material");
1616
+ var import_icons_material9 = require("@mui/icons-material");
1617
+
1618
+ // src/Components/MultiSelect/helpers/useHandlers.tsx
1619
+ var import_react12 = require("react");
1620
+ function useMultiSelectHandlers() {
1621
+ const [anchorEl, setAnchorEl] = (0, import_react12.useState)(null);
1622
+ const [open, setOpen] = (0, import_react12.useState)(false);
1623
+ const [selectedItems, setSelectedItems] = (0, import_react12.useState)([]);
1624
+ const [filterValue, setFilterValue] = (0, import_react12.useState)("");
1625
+ const handleOpen = (0, import_react12.useCallback)((e) => {
1626
+ setAnchorEl(e.currentTarget);
1627
+ setOpen(true);
1628
+ }, []);
1629
+ const handleClose = (0, import_react12.useCallback)(() => {
1630
+ setAnchorEl(null);
1631
+ setOpen(false);
1632
+ }, []);
1633
+ const handleFilterChange = (0, import_react12.useCallback)(
1634
+ (e) => {
1635
+ setFilterValue(e.target.value);
1636
+ },
1637
+ []
1638
+ );
1639
+ const handleCheckboxToggle = (0, import_react12.useCallback)((item) => {
1640
+ setSelectedItems(
1641
+ (prev) => prev.includes(item) ? prev.filter((i) => i !== item) : [...prev, item]
1642
+ );
1643
+ }, []);
1644
+ return {
1645
+ anchorEl,
1646
+ open,
1647
+ selectedItems,
1648
+ filterValue,
1649
+ setSelectedItems,
1650
+ handleOpen,
1651
+ handleClose,
1652
+ handleFilterChange,
1653
+ handleCheckboxToggle,
1654
+ setOpen
1655
+ };
1656
+ }
1657
+
1658
+ // src/Components/MultiSelect/helpers/Utils.tsx
1659
+ var MuiIcons3 = __toESM(require("@mui/icons-material"), 1);
1660
+ var import_icons_material8 = require("@mui/icons-material");
1661
+ function getIconMultiSelect(name) {
1662
+ return name in MuiIcons3 ? MuiIcons3[name] : import_icons_material8.FilterListOutlined;
1663
+ }
1664
+
1665
+ // src/Components/MultiSelect/helpers/useFilteredItems.tsx
1666
+ var import_react13 = require("react");
1667
+ function useFilteredItems(items, filterValue, getItemLabel, selectedItems) {
1668
+ const filteredItems = (0, import_react13.useMemo)(
1669
+ () => items.filter(
1670
+ (item) => getItemLabel(item).toLowerCase().includes(filterValue.toLowerCase())
1671
+ ),
1672
+ [items, filterValue, getItemLabel]
1673
+ );
1674
+ const sortedItems = (0, import_react13.useMemo)(() => {
1675
+ return [
1676
+ ...filteredItems.filter((item) => selectedItems.includes(item)),
1677
+ ...filteredItems.filter((item) => !selectedItems.includes(item))
1678
+ ];
1679
+ }, [filteredItems, selectedItems]);
1680
+ return { filteredItems, sortedItems };
1681
+ }
1682
+
1683
+ // src/Components/MultiSelect/MultiSelect.tsx
1684
+ function MultiSelect({
1685
+ textButton,
1686
+ button,
1687
+ items,
1688
+ topPanel,
1689
+ actions,
1690
+ dense = false,
1691
+ open,
1692
+ selectAll = false,
1693
+ getItemLabel
1694
+ }) {
1695
+ var _a, _b;
1696
+ const {
1697
+ anchorEl,
1698
+ open: openMultiselect,
1699
+ selectedItems,
1700
+ filterValue,
1701
+ setSelectedItems,
1702
+ handleOpen,
1703
+ handleClose,
1704
+ handleFilterChange,
1705
+ handleCheckboxToggle,
1706
+ setOpen
1707
+ } = useMultiSelectHandlers();
1708
+ (0, import_react14.useEffect)(() => {
1709
+ if (open !== void 0) {
1710
+ setOpen(open);
1711
+ }
1712
+ }, [open, setOpen]);
1713
+ (0, import_react14.useEffect)(() => {
1714
+ setSelectedItems([]);
1715
+ }, [items, setSelectedItems]);
1716
+ const { filteredItems, sortedItems } = useFilteredItems(items, filterValue, getItemLabel, selectedItems);
1717
+ const Icon = (0, import_react14.useMemo)(() => {
1718
+ var _a2;
1719
+ return getIconMultiSelect((_a2 = button == null ? void 0 : button.icon) != null ? _a2 : "FilterListOutlined");
1720
+ }, [button == null ? void 0 : button.icon]);
1721
+ const handleSelectAll = () => {
1722
+ const allSelected2 = selectedItems.length === filteredItems.length;
1723
+ setSelectedItems(allSelected2 ? [] : filteredItems);
1724
+ };
1725
+ const allSelected = filteredItems.length > 0 && selectedItems.length === filteredItems.length;
1726
+ const resolvedActions = actions != null ? actions : [
1727
+ { text: "Limpiar", fn: handleClose },
1728
+ { text: "Aplicar", fn: () => {
1729
+ } }
1730
+ ];
1731
+ return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(
1732
+ import_material10.Button,
1733
+ {
1734
+ "test-id": "multiselect-button",
1735
+ color: (_a = button == null ? void 0 : button.color) != null ? _a : "primary",
1736
+ onClick: handleOpen,
1737
+ variant: (_b = button == null ? void 0 : button.variant) != null ? _b : "text",
1738
+ size: "small",
1739
+ startIcon: (button == null ? void 0 : button.iconPosition) === "left" || !(button == null ? void 0 : button.iconPosition) ? /* @__PURE__ */ import_react14.default.createElement(Icon, null) : null,
1740
+ endIcon: (button == null ? void 0 : button.iconPosition) === "right" ? /* @__PURE__ */ import_react14.default.createElement(Icon, null) : null
1741
+ },
1742
+ capitalize(textButton != null ? textButton : "MultiSelect")
1743
+ ), /* @__PURE__ */ import_react14.default.createElement(
1744
+ import_material10.Popover,
1745
+ {
1746
+ elevation: 8,
1747
+ anchorEl,
1748
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
1749
+ open: openMultiselect,
1750
+ onClose: () => setOpen(false)
1751
+ },
1752
+ /* @__PURE__ */ import_react14.default.createElement(import_material10.Stack, { minWidth: "320px", "data-testid": "multiselect-container", bgcolor: "white", boxShadow: 3, borderRadius: 1 }, /* @__PURE__ */ import_react14.default.createElement(import_material10.Stack, { py: 1, px: 2 }, topPanel != null ? topPanel : /* @__PURE__ */ import_react14.default.createElement(import_material10.FormControl, { fullWidth: true, size: "small" }, /* @__PURE__ */ import_react14.default.createElement(
1753
+ import_material10.TextField,
1754
+ {
1755
+ "data-testid": "multiselect-input",
1756
+ fullWidth: true,
1757
+ size: "small",
1758
+ variant: "outlined",
1759
+ placeholder: "Buscar",
1760
+ value: filterValue,
1761
+ onChange: handleFilterChange,
1762
+ slotProps: {
1763
+ input: {
1764
+ endAdornment: /* @__PURE__ */ import_react14.default.createElement(import_material10.InputAdornment, { position: "end" }, /* @__PURE__ */ import_react14.default.createElement(import_icons_material9.SearchOutlined, { fontSize: "small" }))
1765
+ }
1766
+ }
1767
+ }
1768
+ ))), /* @__PURE__ */ import_react14.default.createElement(import_material10.Stack, { maxHeight: "300px", overflow: "auto" }, selectAll && /* @__PURE__ */ import_react14.default.createElement(import_material10.MenuItem, { dense, onClick: handleSelectAll }, /* @__PURE__ */ import_react14.default.createElement(import_material10.ListItemIcon, null, /* @__PURE__ */ import_react14.default.createElement(import_material10.Checkbox, { checked: allSelected, color: "primary" })), "Todos los items"), sortedItems.length > 0 ? sortedItems.map((item) => /* @__PURE__ */ import_react14.default.createElement(
1769
+ import_material10.MenuItem,
1770
+ {
1771
+ key: getItemLabel(item),
1772
+ dense,
1773
+ onClick: () => handleCheckboxToggle(item)
1774
+ },
1775
+ /* @__PURE__ */ import_react14.default.createElement(import_material10.ListItemIcon, null, /* @__PURE__ */ import_react14.default.createElement(
1776
+ import_material10.Checkbox,
1777
+ {
1778
+ checked: selectedItems.includes(item),
1779
+ color: "primary"
1780
+ }
1781
+ )),
1782
+ getItemLabel(item)
1783
+ )) : /* @__PURE__ */ import_react14.default.createElement(import_material10.MenuItem, { disabled: true }, "No se encontraron resultados")), /* @__PURE__ */ import_react14.default.createElement(import_material10.Stack, { direction: "row", gap: 1, p: 1, justifyContent: "space-between", bgcolor: "grey.50" }, resolvedActions.map((button2, index) => {
1784
+ var _a2;
1785
+ return /* @__PURE__ */ import_react14.default.createElement(
1786
+ import_material10.Button,
1787
+ {
1788
+ key: index,
1789
+ variant: index === 0 || resolvedActions.length < 2 ? "text" : "contained",
1790
+ onClick: button2.fn,
1791
+ disabled: (_a2 = button2.disabled) != null ? _a2 : false,
1792
+ size: "small"
1793
+ },
1794
+ capitalize(button2.text)
1795
+ );
1796
+ })))
1797
+ ));
1798
+ }
1561
1799
 
1562
1800
  // src/Components/PageHeader/PageHeader.tsx
1563
- var import_react16 = __toESM(require("react"), 1);
1801
+ var import_react15 = __toESM(require("react"), 1);
1564
1802
  var import_material11 = require("@mui/material");
1565
1803
  var PageHeader = ({
1566
1804
  title,
@@ -1570,7 +1808,7 @@ var PageHeader = ({
1570
1808
  fixed,
1571
1809
  shadow = true
1572
1810
  }) => {
1573
- return /* @__PURE__ */ import_react16.default.createElement(
1811
+ return /* @__PURE__ */ import_react15.default.createElement(
1574
1812
  import_material11.Stack,
1575
1813
  {
1576
1814
  "data-testid": "main-container",
@@ -1582,16 +1820,16 @@ var PageHeader = ({
1582
1820
  zIndex: 10,
1583
1821
  sx: { boxShadow: shadow ? (theme) => theme.shadows[1] : "none" }
1584
1822
  },
1585
- /* @__PURE__ */ import_react16.default.createElement(import_material11.Stack, { "data-testid": "page-header-content", height: 40, px: 3, pl: buttonBack ? 1 : 3, direction: "row", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ import_react16.default.createElement(import_material11.Stack, { id: "left-section", direction: "row", alignItems: "center", gap: 1 }, buttonBack, /* @__PURE__ */ import_react16.default.createElement(import_material11.Stack, { id: "text-section", gap: 0.5 }, /* @__PURE__ */ import_react16.default.createElement(import_material11.Typography, { "data-testid": "page-header-title", variant: "h6", color: "text.primary" }, title), subtitle && /* @__PURE__ */ import_react16.default.createElement(import_material11.Typography, { "data-testid": "page-header-subtitle", variant: "caption", color: "text.primary" }, subtitle))), actions && /* @__PURE__ */ import_react16.default.createElement(import_material11.Stack, { id: "right-actions", direction: "row", alignItems: "center", gap: 1 }, actions))
1823
+ /* @__PURE__ */ import_react15.default.createElement(import_material11.Stack, { "data-testid": "page-header-content", height: 40, px: 3, pl: buttonBack ? 1 : 3, direction: "row", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ import_react15.default.createElement(import_material11.Stack, { id: "left-section", direction: "row", alignItems: "center", gap: 1 }, buttonBack, /* @__PURE__ */ import_react15.default.createElement(import_material11.Stack, { id: "text-section", gap: 0.5 }, /* @__PURE__ */ import_react15.default.createElement(import_material11.Typography, { "data-testid": "page-header-title", variant: "h6", color: "text.primary" }, title), subtitle && /* @__PURE__ */ import_react15.default.createElement(import_material11.Typography, { "data-testid": "page-header-subtitle", variant: "caption", color: "text.primary" }, subtitle))), actions && /* @__PURE__ */ import_react15.default.createElement(import_material11.Stack, { id: "right-actions", direction: "row", alignItems: "center", gap: 1 }, actions))
1586
1824
  );
1587
1825
  };
1588
1826
 
1589
1827
  // src/Components/SCCalendarSwipeable.tsx
1590
- var import_react17 = __toESM(require("react"), 1);
1828
+ var import_react16 = __toESM(require("react"), 1);
1591
1829
  var import_material12 = require("@mui/material");
1592
- var import_Grid25 = __toESM(require("@mui/material/Grid2"), 1);
1830
+ var import_Grid24 = __toESM(require("@mui/material/Grid2"), 1);
1593
1831
  var import_AdapterDateFns = require("@mui/x-date-pickers/AdapterDateFns");
1594
- var import_LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
1832
+ var import_LocalizationProvider2 = require("@mui/x-date-pickers/LocalizationProvider");
1595
1833
  var import_StaticDatePicker = require("@mui/x-date-pickers/StaticDatePicker");
1596
1834
  var import_locale = require("date-fns/locale");
1597
1835
  var import_date_fns = require("date-fns");
@@ -1606,14 +1844,14 @@ var SCCalendarSwipeable = ({
1606
1844
  state
1607
1845
  }) => {
1608
1846
  let convertFecha;
1609
- const [fecha, setFecha] = (0, import_react17.useState)(/* @__PURE__ */ new Date());
1610
- const [fechaSeleccionada, setFechaSeleccionada] = (0, import_react17.useState)();
1611
- const [stateVal, setstateVal] = import_react17.default.useState(/* @__PURE__ */ new Date());
1612
- const [openCalendar, setOpenCalendar] = import_react17.default.useState(false);
1847
+ const [fecha, setFecha] = (0, import_react16.useState)(/* @__PURE__ */ new Date());
1848
+ const [fechaSeleccionada, setFechaSeleccionada] = (0, import_react16.useState)();
1849
+ const [stateVal, setstateVal] = import_react16.default.useState(/* @__PURE__ */ new Date());
1850
+ const [openCalendar, setOpenCalendar] = import_react16.default.useState(false);
1613
1851
  const hoy = /* @__PURE__ */ new Date();
1614
1852
  const inicioSemana = (0, import_date_fns.startOfWeek)(fecha, { weekStartsOn: 0 });
1615
1853
  const diasSemana = Array.from({ length: 7 }, (_, i) => (0, import_date_fns.addDays)(inicioSemana, i));
1616
- import_react17.default.useEffect(() => {
1854
+ import_react16.default.useEffect(() => {
1617
1855
  if (fecha != null) {
1618
1856
  handleConvertFecha(fecha);
1619
1857
  }
@@ -1632,11 +1870,11 @@ var SCCalendarSwipeable = ({
1632
1870
  setOpenCalendar(newOpen);
1633
1871
  };
1634
1872
  const locale = __spreadValues({}, import_locale.es);
1635
- return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement(import_LocalizationProvider.LocalizationProvider, { dateAdapter: import_AdapterDateFns.AdapterDateFns, adapterLocale: locale }, openCalendar == false ? /* @__PURE__ */ import_react17.default.createElement(import_material12.Box, { "data-testid": "calendar-mobile", sx: { width: "100%", background: background ? background : "white", display: "flex", flexDirection: "column", alignItems: "center" } }, /* @__PURE__ */ import_react17.default.createElement(import_material12.Box, { sx: { width: "100%", maxWidth: "320px", background: "transparent" } }, /* @__PURE__ */ import_react17.default.createElement(import_Grid25.default, { container: true, gap: 0.5, sx: {
1873
+ return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_LocalizationProvider2.LocalizationProvider, { dateAdapter: import_AdapterDateFns.AdapterDateFns, adapterLocale: locale }, openCalendar == false ? /* @__PURE__ */ import_react16.default.createElement(import_material12.Box, { "data-testid": "calendar-mobile", sx: { width: "100%", background: background ? background : "white", display: "flex", flexDirection: "column", alignItems: "center" } }, /* @__PURE__ */ import_react16.default.createElement(import_material12.Box, { sx: { width: "100%", maxWidth: "320px", background: "transparent" } }, /* @__PURE__ */ import_react16.default.createElement(import_Grid24.default, { container: true, gap: 0.5, sx: {
1636
1874
  justifyContent: "space-between",
1637
1875
  padding: "12px 0px",
1638
1876
  background: "transparent"
1639
- } }, diasSemana.map((dia) => /* @__PURE__ */ import_react17.default.createElement(import_Grid25.default, { sx: { width: "36px" }, key: dia.toString() }, /* @__PURE__ */ import_react17.default.createElement(import_material12.Box, { sx: { width: "36px", height: "40px", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ import_react17.default.createElement(import_material12.Typography, { sx: { fontSize: "12px !important", color: "#10184099" } }, (0, import_date_fns.format)(dia, "EEEE", { locale: import_locale.es }).charAt(0).toUpperCase())), /* @__PURE__ */ import_react17.default.createElement(
1877
+ } }, diasSemana.map((dia) => /* @__PURE__ */ import_react16.default.createElement(import_Grid24.default, { sx: { width: "36px" }, key: dia.toString() }, /* @__PURE__ */ import_react16.default.createElement(import_material12.Box, { sx: { width: "36px", height: "40px", display: "flex", alignItems: "center", justifyContent: "center" } }, /* @__PURE__ */ import_react16.default.createElement(import_material12.Typography, { sx: { fontSize: "12px !important", color: "#10184099" } }, (0, import_date_fns.format)(dia, "EEEE", { locale: import_locale.es }).charAt(0).toUpperCase())), /* @__PURE__ */ import_react16.default.createElement(
1640
1878
  import_material12.Box,
1641
1879
  {
1642
1880
  onClick: () => setFecha(dia),
@@ -1652,8 +1890,8 @@ var SCCalendarSwipeable = ({
1652
1890
  //height: '36px',
1653
1891
  }
1654
1892
  },
1655
- /* @__PURE__ */ import_react17.default.createElement(import_material12.Typography, { sx: { fontSize: "12px !important", color: (0, import_date_fns.isSameDay)(dia, fecha) ? "white" : "#101840DE" } }, (0, import_date_fns.format)(dia, "d"))
1656
- )))), /* @__PURE__ */ import_react17.default.createElement(import_Grid25.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react17.default.createElement(import_material12.IconButton, { "data-testid": "open-calendar-button", onClick: toggleCalendar(true) }, /* @__PURE__ */ import_react17.default.createElement(import_KeyboardDoubleArrowDown.default, null))))) : /* @__PURE__ */ import_react17.default.createElement(import_material12.Box, { sx: { width: "100%", background: "white" } }, /* @__PURE__ */ import_react17.default.createElement(
1893
+ /* @__PURE__ */ import_react16.default.createElement(import_material12.Typography, { sx: { fontSize: "12px !important", color: (0, import_date_fns.isSameDay)(dia, fecha) ? "white" : "#101840DE" } }, (0, import_date_fns.format)(dia, "d"))
1894
+ )))), /* @__PURE__ */ import_react16.default.createElement(import_Grid24.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react16.default.createElement(import_material12.IconButton, { "data-testid": "open-calendar-button", onClick: toggleCalendar(true) }, /* @__PURE__ */ import_react16.default.createElement(import_KeyboardDoubleArrowDown.default, null))))) : /* @__PURE__ */ import_react16.default.createElement(import_material12.Box, { sx: { width: "100%", background: "white" } }, /* @__PURE__ */ import_react16.default.createElement(
1657
1895
  import_StaticDatePicker.StaticDatePicker,
1658
1896
  {
1659
1897
  orientation: "landscape",
@@ -1663,107 +1901,157 @@ var SCCalendarSwipeable = ({
1663
1901
  sx: { fontSize: "12px !important", height: "300px !important", background: background ? background : "white", "& .MuiDayCalendar-header": { justifyContent: "space-between" }, "& .MuiDayCalendar-weekContainer": { justifyContent: "space-between" }, "& .MuiPickersCalendarHeader-root": { paddingLeft: "0px", paddingRight: "0px", color: "#10184099" }, "& .MuiPickersDay-root": { fontSize: "12px !important" }, "& .MuiDayCalendar-weekDayLabel": { fontSize: "12px !important" } },
1664
1902
  onChange: (newValue) => setFecha(newValue)
1665
1903
  }
1666
- ), /* @__PURE__ */ import_react17.default.createElement(import_Grid25.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react17.default.createElement(import_material12.IconButton, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ import_react17.default.createElement(import_KeyboardDoubleArrowUp.default, null))))));
1904
+ ), /* @__PURE__ */ import_react16.default.createElement(import_Grid24.default, { container: true, justifyContent: "center" }, /* @__PURE__ */ import_react16.default.createElement(import_material12.IconButton, { "data-testid": "close-calendar-button", onClick: toggleCalendar(false) }, /* @__PURE__ */ import_react16.default.createElement(import_KeyboardDoubleArrowUp.default, null))))));
1667
1905
  };
1668
1906
 
1669
1907
  // src/Components/SCDataGrid.tsx
1670
- var import_react18 = __toESM(require("react"), 1);
1908
+ var import_react17 = __toESM(require("react"), 1);
1671
1909
  var import_x_data_grid_pro = require("@mui/x-data-grid-pro");
1672
- var import_x_license_pro = require("@mui/x-license-pro");
1673
- var import_styles = require("@mui/styles");
1674
- var useStyles = (0, import_styles.makeStyles)({
1675
- root: {
1676
- "& .MuiDataGrid-filler": {
1677
- display: "none !important"
1678
- },
1679
- "& .MuiDataGrid-footerContainer": {
1680
- minHeight: "26px !important",
1681
- height: "26px !important"
1682
- },
1683
- "& .MuiTablePagination-toolbar": {
1684
- minHeight: "25px !important",
1685
- height: "25px !important"
1686
- },
1687
- "& .MuiTablePagination-actions .MuiIconButton-root": {
1688
- padding: "0px !important"
1689
- },
1690
- "&.MuiDataGrid-root": {
1691
- "--DataGrid-topContainerHeight": "0px !important"
1692
- /* Cambia este valor según tus necesidades */
1693
- },
1694
- "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
1695
- "--height": "0px !important",
1696
- "minHeight": "0px !important",
1697
- "maxHeight": "0px !important"
1698
- },
1699
- "& .MuiDataGrid-cell": {
1700
- padding: "0 !important"
1701
- }
1702
- }
1703
- });
1704
- var SCDataGrid = (_a) => {
1705
- var _b = _a, { data, columns, rowsTable, checkboxSelection, width, height, maxHeight, density, agrupacion, groupingColDef, getTreeDataPath } = _b, props = __objRest(_b, ["data", "columns", "rowsTable", "checkboxSelection", "width", "height", "maxHeight", "density", "agrupacion", "groupingColDef", "getTreeDataPath"]);
1706
- const apiRef = (0, import_x_data_grid_pro.useGridApiRef)();
1707
- const classes = useStyles();
1708
- import_x_license_pro.LicenseInfo.setLicenseKey(
1910
+ var import_x_license_pro2 = require("@mui/x-license-pro");
1911
+ var import_KeyboardArrowDown = __toESM(require("@mui/icons-material/KeyboardArrowDown"), 1);
1912
+ var import_KeyboardArrowUp = __toESM(require("@mui/icons-material/KeyboardArrowUp"), 1);
1913
+ var import_styles = require("@mui/material/styles");
1914
+ var SCDataGridInitial = ({ data, columns, groupColumns, rowsTable, checkboxSelection, width, maxHeight, density }) => {
1915
+ import_x_license_pro2.LicenseInfo.setLicenseKey(
1709
1916
  "77d49a57fbc5f4af35ddb05c5f1742e0Tz0xMTI3MjgsRT0xNzc4MzcxMTk5MDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI="
1710
1917
  );
1711
- let validationTreeData = getTreeDataPath ? true : false;
1712
- let paginalion = 10;
1713
- let valor = 80;
1714
- let alto = 345;
1715
- let estilot = "compact";
1716
- let tamanoEncabezado = density == "compact" ? 24 : density == "standard" ? 36 : density == "comfortable" ? 52 : 24;
1717
- let tamanoCelda = density == "compact" ? 22 : density == "standard" ? 28 : density == "comfortable" ? 48 : 22;
1718
- let dataConvert = [];
1719
- const [groupDataLenght, setGroupDataLengh] = (0, import_react18.useState)(0);
1720
- checkboxSelection = checkboxSelection || false;
1721
- const rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length) : data.length < 10 ? parseInt(data.length) : 10;
1722
- width = width || "100%";
1723
- density = density || "compact";
1724
- agrupacion = agrupacion || false;
1725
- groupingColDef = groupingColDef || {};
1726
- getTreeDataPath = getTreeDataPath || void 0;
1727
- const [pageSize, setPageSize] = (0, import_react18.useState)(rows);
1728
- const [arrayRows, setArrayRows] = (0, import_react18.useState)([]);
1729
- const [heightTable, setHeightTable] = (0, import_react18.useState)(height || 0);
1730
- (0, import_react18.useEffect)(() => {
1918
+ const theme = (0, import_styles.useTheme)();
1919
+ const apiRef = (0, import_x_data_grid_pro.useGridApiRef)();
1920
+ const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
1921
+ function generateRandomId() {
1922
+ return Math.floor(Math.random() * 1e6);
1923
+ }
1924
+ const getTreeDataPaths = (row) => {
1925
+ return [
1926
+ row[groupColumns[0].split("[")[1].split("]")[0].trim()],
1927
+ ...groupColumns.length > 2 ? [row[groupColumns[1].split("[")[1].split("]")[0].trim()]] : [],
1928
+ `${row[groupColumns[groupColumns.length - 1].split("[")[1].split("]")[0].trim()].toString()}/${generateRandomId()}`
1929
+ ];
1930
+ };
1931
+ const groupingColDefs = {
1932
+ field: "grouping",
1933
+ headerName: groupColumns != void 0 ? groupColumns[groupColumns.length - 1].split("[").length == 2 ? groupColumns[groupColumns.length - 1].split("[")[0].trim() : "Agrupador" : "",
1934
+ renderCell: (params) => {
1935
+ var _a;
1936
+ let label = params.value.toString().includes("/") ? params.value.split("/")[0].toString() : params.value.toString();
1937
+ const maxDepth = groupColumns ? groupColumns.length - 2 : 0;
1938
+ if (groupColumns != void 0) {
1939
+ if (params.rowNode.depth === 0) {
1940
+ const textBegin = groupColumns[0] ? groupColumns[0].split("[")[0].trim() : "";
1941
+ const textEnd = groupColumns[0] ? groupColumns[0].split("]")[1].trim() : "";
1942
+ const labelGrouping1 = `${textBegin} ${label} ${textEnd}`;
1943
+ const fieldGrouping1 = groupColumns[0].split("[")[1].split("]")[0].trim();
1944
+ const fieldGrouping2 = groupColumns[1].split("[")[1].split("]")[0].trim();
1945
+ const subgroup1 = arrayRows.filter((r) => r[fieldGrouping1].toString() === label).map((r) => r[fieldGrouping2]);
1946
+ const groupedDataLength1 = subgroup1.filter((valor, indiceActual, arreglo) => arreglo.indexOf(valor) === indiceActual);
1947
+ label = `${labelGrouping1} (${groupedDataLength1.length})`;
1948
+ } else if (groupColumns.length > 2 && params.rowNode.depth === 1) {
1949
+ const labelGrouping1 = (_a = params.api.getRowNode(params.rowNode.parent)) == null ? void 0 : _a.groupingKey;
1950
+ const textBegin = groupColumns[1] ? groupColumns[1].split("[")[0] : "";
1951
+ const textEnd = groupColumns[1] ? groupColumns[1].split("]")[1].trim() : "";
1952
+ const labelGrouping2 = `${textBegin} ${label} ${textEnd}`;
1953
+ const fieldGrouping1 = groupColumns[0].split("[")[1].split("]")[0].trim();
1954
+ const fieldGrouping2 = groupColumns[1].split("[")[1].split("]")[0].trim();
1955
+ const groupedDataLength2 = arrayRows.filter(
1956
+ (r) => r[fieldGrouping1] === labelGrouping1 && r[fieldGrouping2] === label
1957
+ ).length;
1958
+ label = `${labelGrouping2} (${groupedDataLength2})`;
1959
+ } else {
1960
+ label = label;
1961
+ }
1962
+ }
1963
+ return /* @__PURE__ */ import_react17.default.createElement(
1964
+ "div",
1965
+ {
1966
+ style: {
1967
+ width: "100%",
1968
+ boxSizing: "border-box",
1969
+ overflow: "hidden",
1970
+ textOverflow: "ellipsis",
1971
+ whiteSpace: "nowrap",
1972
+ color: "#101840DE",
1973
+ display: "flex",
1974
+ alignItems: "center",
1975
+ paddingLeft: params.rowNode.depth == 0 ? "5px" : params.rowNode.depth == 1 ? "15px" : "25px",
1976
+ backgroundColor: params.rowNode.type === "group" ? theme.palette.grey[100 + (maxDepth - params.rowNode.depth) * 100] : "#FFFFFF",
1977
+ fontWeight: params.rowNode.type == "group" ? "400" : "300"
1978
+ }
1979
+ },
1980
+ params.rowNode.type === "group" && /* @__PURE__ */ import_react17.default.createElement(
1981
+ "span",
1982
+ {
1983
+ style: {
1984
+ cursor: "pointer",
1985
+ marginRight: 8,
1986
+ userSelect: "none"
1987
+ },
1988
+ onClick: (e) => {
1989
+ e.stopPropagation();
1990
+ params.api.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
1991
+ }
1992
+ },
1993
+ params.rowNode.childrenExpanded ? /* @__PURE__ */ import_react17.default.createElement(import_KeyboardArrowUp.default, { fontSize: "small", color: "action" }) : /* @__PURE__ */ import_react17.default.createElement(import_KeyboardArrowDown.default, { fontSize: "small", color: "action" })
1994
+ ),
1995
+ label
1996
+ );
1997
+ },
1998
+ colSpan: (params) => {
1999
+ const value = String(params);
2000
+ const fieldGrouping1 = groupColumns[0].split("[")[1].split("]")[0].trim();
2001
+ const fieldGrouping2 = groupColumns.length > 2 ? groupColumns[1].split("[")[1].split("]")[0].trim() : void 0;
2002
+ let agrupado1 = false;
2003
+ let agrupado2 = false;
2004
+ if (fieldGrouping1 != void 0) {
2005
+ agrupado1 = arrayRows.some(
2006
+ (row) => String(row[fieldGrouping1]) === value
2007
+ );
2008
+ }
2009
+ if (fieldGrouping2 != void 0) {
2010
+ agrupado2 = arrayRows.some(
2011
+ (row) => String(row[fieldGrouping2]) === value
2012
+ );
2013
+ }
2014
+ if (agrupado1 || agrupado2) {
2015
+ return columns.length + 1;
2016
+ } else {
2017
+ return 1;
2018
+ }
2019
+ }
2020
+ };
2021
+ let validationTreeData = groupColumns ? true : false;
2022
+ let validationCheckboxSelection = checkboxSelection || false;
2023
+ let styleDensity = density || "compact";
2024
+ let styleTopContainerHeight = styleDensity === "compact" ? "26px" : styleDensity === "standard" ? "38px" : styleDensity === "comfortable" ? "60px" : "27px";
2025
+ let styleRowHeight = density == "compact" ? 32 : density == "standard" ? 28 : density == "comfortable" ? 36 : 32;
2026
+ let rows = rowsTable ? rowsTable : validationTreeData != false ? parseInt(data.length.toString()) : data.length < 10 ? parseInt(data.length.toString()) : 10;
2027
+ let validationGroupingColDef = groupingColDefs || {};
2028
+ const [groupDataLenght, setGroupDataLengh] = (0, import_react17.useState)(0);
2029
+ const [pageSize, setPageSize] = (0, import_react17.useState)(rows);
2030
+ const [arrayRows, setArrayRows] = (0, import_react17.useState)([]);
2031
+ const [selectionModel, setSelectionModel] = (0, import_react17.useState)([]);
2032
+ (0, import_react17.useEffect)(() => {
1731
2033
  if ((data == null ? void 0 : data.length) > 0) {
1732
2034
  dataConvertRows(data, void 0);
1733
- if (validationTreeData) {
1734
- countGroupedElements(data, getTreeDataPath);
1735
- }
1736
2035
  }
1737
2036
  }, [data]);
1738
- (0, import_react18.useEffect)(() => {
1739
- if (groupDataLenght > 0 && validationTreeData == true) {
1740
- setHeightTable(heightTable ? heightTable : groupDataLenght * tamanoCelda + tamanoEncabezado + 27);
1741
- } else if (groupDataLenght <= 0 && validationTreeData == false) {
1742
- setHeightTable(heightTable ? heightTable : rows * tamanoCelda + tamanoEncabezado + 27);
1743
- }
1744
- }, [groupDataLenght]);
1745
2037
  const dataConvertRows = (data2, columnId) => {
1746
- let dataConvert2 = [];
2038
+ let dataConvert = [];
1747
2039
  if ((data2 == null ? void 0 : data2.length) > 0) {
1748
2040
  const dataKeys = Object.keys(data2[0]);
1749
2041
  data2.map((item) => {
1750
2042
  const newKeys = {};
1751
2043
  let i = 0;
1752
- let id = dataConvert2.length + 1;
2044
+ let id = dataConvert.length + 1;
1753
2045
  for (i = 0; i < dataKeys.length; i++) {
1754
2046
  newKeys[dataKeys[i]] = item[dataKeys[i]];
1755
2047
  }
1756
2048
  newKeys.id = columnId ? item[columnId] : id;
1757
- dataConvert2 = [...dataConvert2, newKeys];
2049
+ dataConvert = [...dataConvert, newKeys];
1758
2050
  });
1759
2051
  }
1760
- setArrayRows(dataConvert2);
2052
+ setArrayRows(dataConvert);
1761
2053
  };
1762
- const isRowSelectable = (params) => params.row.bloqueoChecked == false ? false : true;
1763
- const [selectionModel, setSelectionModel] = (0, import_react18.useState)([]);
1764
2054
  const handleSelectionChange = (newSelection) => {
1765
- console.log(data);
1766
- console.log(arrayRows);
1767
2055
  if (groupDataLenght > 0 && validationTreeData == true) {
1768
2056
  let numberGrouped = 0;
1769
2057
  let idsRowSelectBefore = [];
@@ -1797,41 +2085,27 @@ var SCDataGrid = (_a) => {
1797
2085
  setSelectionModel([...newSelection]);
1798
2086
  }
1799
2087
  };
1800
- const countGroupedElements = (row, getTreeDataPath2) => {
1801
- const groupedCounts = {};
1802
- data.forEach((row2) => {
1803
- const path = getTreeDataPath2(row2) || [];
1804
- const key = path[0];
1805
- if (!groupedCounts[key]) {
1806
- groupedCounts[key] = 0;
1807
- }
1808
- groupedCounts[key]++;
1809
- });
1810
- setGroupDataLengh(Object.keys(groupedCounts).length);
1811
- return groupedCounts;
1812
- };
1813
- const virtualScrollerHeight = validationTreeData ? groupDataLenght * tamanoCelda + 10 : rows * tamanoCelda;
1814
- return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, heightTable > 0 ? /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { style: { display: "flex", flexDirection: "column", width, maxHeight } }, /* @__PURE__ */ import_react18.default.createElement(
2088
+ return /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, data && /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, /* @__PURE__ */ import_react17.default.createElement("div", { style: { width: width || "100%", maxHeight: maxHeight ? `${maxHeight}px` : "none" } }, /* @__PURE__ */ import_react17.default.createElement(
1815
2089
  import_x_data_grid_pro.DataGridPro,
1816
- __spreadProps(__spreadValues({
1817
- apiRef
1818
- }, props), {
2090
+ {
2091
+ apiRef,
2092
+ rowHeight: styleRowHeight,
1819
2093
  rows: arrayRows,
1820
2094
  columns,
1821
- density,
2095
+ density: styleDensity,
1822
2096
  treeData: validationTreeData,
1823
- getTreeDataPath,
1824
- groupingColDef: validationTreeData == true ? groupingColDef : false,
2097
+ getTreeDataPath: validationTreeData == true ? getTreeDataPaths : void 0,
2098
+ groupingColDef: validationTreeData == true ? validationGroupingColDef : void 0,
1825
2099
  pagination: true,
1826
2100
  initialState: {
1827
2101
  pagination: { paginationModel: { pageSize: rows } }
1828
2102
  },
1829
- checkboxSelection,
2103
+ checkboxSelection: validationCheckboxSelection,
1830
2104
  rowSelectionModel: selectionModel,
1831
2105
  onRowSelectionModelChange: (newSelection) => handleSelectionChange(newSelection),
1832
2106
  isRowSelectable,
1833
2107
  disableRowSelectionOnClick: true,
1834
- className: classes.root,
2108
+ hideFooter: validationTreeData == true ? true : false,
1835
2109
  localeText: {
1836
2110
  noRowsLabel: "No hay filas",
1837
2111
  columnMenuLabel: "Men\xFA de columna",
@@ -1842,234 +2116,497 @@ var SCDataGrid = (_a) => {
1842
2116
  labelRowsPerPage: "Filas por p\xE1gina:",
1843
2117
  labelDisplayedRows: ({ from, to, count }) => `${from}\u2013${to} de ${count !== -1 ? count : `m\xE1s de ${to}`}`
1844
2118
  }
2119
+ },
2120
+ sx: {
2121
+ maxHeight: maxHeight ? `${maxHeight}px` : "none",
2122
+ //overflow: 'auto',
2123
+ "& .MuiDataGrid-filler": {
2124
+ display: "none !important"
2125
+ },
2126
+ "& .MuiDataGrid-footerContainer": {
2127
+ minHeight: "26px !important",
2128
+ height: "26px !important"
2129
+ },
2130
+ "& .MuiTablePagination-toolbar": {
2131
+ minHeight: "25px !important",
2132
+ height: "25px !important"
2133
+ },
2134
+ "& .MuiTablePagination-actions .MuiIconButton-root": {
2135
+ padding: "0px !important"
2136
+ },
2137
+ "&.MuiDataGrid-root": {
2138
+ [`--DataGrid-topContainerHeight`]: `${styleTopContainerHeight} !important`
2139
+ },
2140
+ "MuiDataGrid-root .MuiDataGrid-virtualScrollerContent .MuiDataGrid-row": {
2141
+ "--height": "0px !important",
2142
+ "minHeight": "0px !important",
2143
+ "maxHeight": "0px !important"
2144
+ },
2145
+ "& .MuiDataGrid-cell": {
2146
+ padding: "0 !important",
2147
+ background: "white"
2148
+ }
1845
2149
  }
1846
- })
1847
- ))) : "");
2150
+ }
2151
+ ))));
1848
2152
  };
2153
+ var SCDataGrid = import_react17.default.memo(SCDataGridInitial, (prevProps, nextProps) => {
2154
+ const isEqual = prevProps.data === nextProps.data && prevProps.columns === nextProps.columns && prevProps.groupColumns === nextProps.groupColumns && prevProps.rowsTable === nextProps.rowsTable && prevProps.checkboxSelection === nextProps.checkboxSelection && prevProps.width === nextProps.width && prevProps.maxHeight === nextProps.maxHeight && prevProps.density === nextProps.density;
2155
+ return isEqual;
2156
+ });
1849
2157
 
1850
- // src/Components/SCAutocomplete.tsx
1851
- var import_react19 = __toESM(require("react"), 1);
2158
+ // src/Components/EmptyState/EmptyState.tsx
2159
+ var import_react18 = __toESM(require("react"), 1);
1852
2160
  var import_material13 = require("@mui/material");
2161
+
2162
+ // src/assets/ImgEmptyState/create.svg
2163
+ var create_default = "./create-KZGO2OZA.svg";
2164
+
2165
+ // src/assets/ImgEmptyState/error.svg
2166
+ var error_default = "./error-RUCZUXDN.svg";
2167
+
2168
+ // src/assets/ImgEmptyState/empty.svg
2169
+ var empty_default = "./empty-3NEKE7WO.svg";
2170
+
2171
+ // src/assets/ImgEmptyState/search.svg
2172
+ var search_default = "./search-OKSCVF2W.svg";
2173
+
2174
+ // src/Components/EmptyState/EmptyState.tsx
2175
+ var EmptyStateImageUrls = {
2176
+ create: create_default,
2177
+ error: error_default,
2178
+ noResult: empty_default,
2179
+ search: search_default
2180
+ };
2181
+ var DefaultIcon = ({
2182
+ state = "create",
2183
+ size = "large"
2184
+ }) => {
2185
+ const imageUrl = EmptyStateImageUrls[state];
2186
+ const iconSize = size === "small" ? { width: "40px", height: "40px" } : { width: "60px", height: "60px" };
2187
+ return /* @__PURE__ */ import_react18.default.createElement("img", { src: imageUrl, alt: state, style: iconSize });
2188
+ };
2189
+ var EmptyState = ({
2190
+ state = "create",
2191
+ size = "large",
2192
+ title,
2193
+ subtitle,
2194
+ actions,
2195
+ containerHeight = "100vh",
2196
+ icon = /* @__PURE__ */ import_react18.default.createElement(DefaultIcon, { state, size })
2197
+ }) => {
2198
+ const titleVariant = size === "small" ? "subtitle2" : "h6";
2199
+ const subtitleVariant = size === "small" ? "caption" : "body1";
2200
+ return /* @__PURE__ */ import_react18.default.createElement(
2201
+ import_material13.Stack,
2202
+ {
2203
+ alignItems: "center",
2204
+ justifyContent: "center",
2205
+ spacing: 2,
2206
+ height: containerHeight,
2207
+ "data-testid": "empty-state-container"
2208
+ },
2209
+ icon && /* @__PURE__ */ import_react18.default.createElement(import_material13.Stack, null, icon),
2210
+ /* @__PURE__ */ import_react18.default.createElement(import_material13.Stack, { gap: 0.5 }, /* @__PURE__ */ import_react18.default.createElement(import_material13.Typography, { color: "text.primary", variant: titleVariant, textAlign: "center" }, title), subtitle && /* @__PURE__ */ import_react18.default.createElement(
2211
+ import_material13.Typography,
2212
+ {
2213
+ variant: subtitleVariant,
2214
+ textAlign: "center",
2215
+ color: "text.secondary"
2216
+ },
2217
+ subtitle
2218
+ ), actions && (actions == null ? void 0 : actions.length) > 0 && /* @__PURE__ */ import_react18.default.createElement(
2219
+ import_material13.Stack,
2220
+ {
2221
+ direction: "row",
2222
+ spacing: 2,
2223
+ alignItems: "center",
2224
+ justifyContent: "center"
2225
+ },
2226
+ actions.map((action, index) => {
2227
+ var _a, _b, _c, _d;
2228
+ return /* @__PURE__ */ import_react18.default.createElement(
2229
+ import_material13.Button,
2230
+ {
2231
+ key: index,
2232
+ color: (_a = action.color) != null ? _a : "primary",
2233
+ variant: (_b = action.variant) != null ? _b : "text",
2234
+ size: (_c = action.size) != null ? _c : "small",
2235
+ startIcon: action.icon && action.iconPosition === "left" ? /* @__PURE__ */ import_react18.default.createElement("img", { src: action.icon, alt: "icon" }) : void 0,
2236
+ endIcon: action.icon && action.iconPosition === "right" ? /* @__PURE__ */ import_react18.default.createElement("img", { src: action.icon, alt: "icon" }) : void 0,
2237
+ onClick: action.onClick
2238
+ },
2239
+ capitalize((_d = action.text) != null ? _d : "action")
2240
+ );
2241
+ })
2242
+ ))
2243
+ );
2244
+ };
2245
+
2246
+ // src/Components/SCDialog.tsx
2247
+ var import_react19 = __toESM(require("react"), 1);
2248
+ var import_material14 = require("@mui/material");
2249
+ var import_Grid25 = __toESM(require("@mui/material/Grid2"), 1);
2250
+ var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
2251
+ var Muicon5 = __toESM(require("@mui/icons-material"), 1);
2252
+ var SCDialog = ({ title, iconTitle, subtitle, content, actions, buttonDialog, disableClose, dividers, widthContent, heightContent, background, setShow, show }) => {
2253
+ let i = 0;
2254
+ let iconTitleValidation = "";
2255
+ let IconTitle;
2256
+ let ButtonIcon;
2257
+ const [open, setOpen] = (0, import_react19.useState)(show);
2258
+ (0, import_react19.useEffect)(() => {
2259
+ if (show) {
2260
+ handleOpen();
2261
+ } else {
2262
+ handleClose();
2263
+ }
2264
+ }, [show]);
2265
+ if ((buttonDialog == null ? void 0 : buttonDialog.icon) != void 0) {
2266
+ if (Muicon5[buttonDialog == null ? void 0 : buttonDialog.icon] == void 0) {
2267
+ ButtonIcon = buttonDialog == null ? void 0 : buttonDialog.icon;
2268
+ } else {
2269
+ ButtonIcon = Muicon5[buttonDialog == null ? void 0 : buttonDialog.icon];
2270
+ }
2271
+ }
2272
+ actions == null ? void 0 : actions.map(function(option, index, array) {
2273
+ if (option == null ? void 0 : option.icon) {
2274
+ if ((option == null ? void 0 : option.icon.type) == void 0) {
2275
+ option.icon = Muicon5[option == null ? void 0 : option.icon];
2276
+ } else {
2277
+ option;
2278
+ }
2279
+ }
2280
+ });
2281
+ if (iconTitle) {
2282
+ if (Muicon5[iconTitle] == void 0) {
2283
+ if (iconTitle && import_react19.default.isValidElement(iconTitle) && iconTitle.type == void 0) {
2284
+ iconTitleValidation = "image";
2285
+ IconTitle = iconTitle;
2286
+ } else {
2287
+ iconTitleValidation = "icon";
2288
+ IconTitle = iconTitle;
2289
+ }
2290
+ } else {
2291
+ iconTitleValidation = "icon";
2292
+ IconTitle = Muicon5[iconTitle];
2293
+ }
2294
+ }
2295
+ const handleOpen = () => {
2296
+ setOpen(true);
2297
+ if (setShow) {
2298
+ setShow(true);
2299
+ }
2300
+ };
2301
+ const handleClose = () => {
2302
+ setOpen(false);
2303
+ if (setShow) {
2304
+ setShow(false);
2305
+ }
2306
+ };
2307
+ const dialogActions = actions != null ? actions : [{ text: "Cerrar", fn: handleClose }];
2308
+ content = content != null ? content : { component: /* @__PURE__ */ import_react19.default.createElement(import_material14.Box, null, " Aqui va el contenido ") };
2309
+ return /* @__PURE__ */ import_react19.default.createElement("div", null, buttonDialog ? /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, buttonDialog.text != void 0 ? /* @__PURE__ */ import_react19.default.createElement(import_material14.Tooltip, { placement: "bottom-start", title: buttonDialog.tooltip != void 0 ? buttonDialog.tooltip : "", slotProps: { popper: { modifiers: [{ name: "offset", options: { offset: [0, -14] } }] } } }, /* @__PURE__ */ import_react19.default.createElement(import_material14.Button, { size: "small", color: buttonDialog.color != void 0 ? buttonDialog.color : "primary", variant: (buttonDialog == null ? void 0 : buttonDialog.variant) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.variant : "text", startIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) != void 0 ? (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "left" ? /* @__PURE__ */ import_react19.default.createElement(ButtonIcon, { color: buttonDialog.color != void 0 ? buttonDialog.color : "primary" }) : "" : "", endIcon: (buttonDialog == null ? void 0 : buttonDialog.iconPosition) != void 0 ? (buttonDialog == null ? void 0 : buttonDialog.iconPosition) == "right" ? /* @__PURE__ */ import_react19.default.createElement(ButtonIcon, { color: buttonDialog.color != void 0 ? buttonDialog.color : "primary" }) : "" : "", onClick: handleOpen }, " ", (buttonDialog == null ? void 0 : buttonDialog.text) != void 0 ? buttonDialog.text : "", " ")) : /* @__PURE__ */ import_react19.default.createElement(import_material14.IconButton, { style: { cursor: "pointer" }, onClick: handleOpen }, /* @__PURE__ */ import_react19.default.createElement(import_material14.SvgIcon, { fontSize: "small", color: (buttonDialog == null ? void 0 : buttonDialog.color) != void 0 ? buttonDialog == null ? void 0 : buttonDialog.color : "action", component: ButtonIcon }))) : "", /* @__PURE__ */ import_react19.default.createElement(import_material14.Modal, { open: open || false, onClose: handleClose }, /* @__PURE__ */ import_react19.default.createElement(
2310
+ import_material14.Dialog,
2311
+ {
2312
+ "data-testid": "dialog-element",
2313
+ open: open || false,
2314
+ onClose: disableClose ? void 0 : handleClose,
2315
+ maxWidth: "xl",
2316
+ sx: {
2317
+ width: "100% !important",
2318
+ "& .MuiBackdrop-root": {
2319
+ backdropFilter: "blur(0px) !important"
2320
+ }
2321
+ }
2322
+ },
2323
+ title && /* @__PURE__ */ import_react19.default.createElement(import_material14.DialogTitle, { sx: { m: 0, padding: "8px 16px 8px 16px" }, "data-testid": "dialog-icon-title" }, /* @__PURE__ */ import_react19.default.createElement(import_Grid25.default, { container: true, size: 12, sx: { justifyContent: "space-between", flexWrap: "nowrap" } }, /* @__PURE__ */ import_react19.default.createElement(import_Grid25.default, { container: true, size: 11, sx: { alignItems: "center" } }, iconTitle ? iconTitleValidation == "image" ? /* @__PURE__ */ import_react19.default.createElement(import_material14.Box, { sx: { marginRight: "16px", width: "44px", height: "44px", borderRadius: "1px" } }, /* @__PURE__ */ import_react19.default.createElement("img", { src: IconTitle, width: "44px", height: "44px" })) : /* @__PURE__ */ import_react19.default.createElement(import_material14.SvgIcon, { color: "action", fontSize: "small", component: IconTitle, sx: { marginRight: "16px" } }) : "", /* @__PURE__ */ import_react19.default.createElement(import_Grid25.default, null, /* @__PURE__ */ import_react19.default.createElement(import_material14.Typography, { color: "text.primary", variant: "h6", gutterBottom: true }, title ? title : ""), /* @__PURE__ */ import_react19.default.createElement(import_material14.Typography, { color: "text.secondary", variant: "body2", gutterBottom: true }, subtitle ? subtitle : ""))), disableClose != true ? /* @__PURE__ */ import_react19.default.createElement(import_material14.IconButton, { "data-testid": "close-dialog-button", onClick: handleClose, size: "small", color: "default", sx: { height: 22, width: 22 } }, /* @__PURE__ */ import_react19.default.createElement(import_Close2.default, null)) : "")),
2324
+ /* @__PURE__ */ import_react19.default.createElement(
2325
+ import_material14.DialogContent,
2326
+ {
2327
+ "data-testid": "dialog-content",
2328
+ dividers: dividers ? dividers : false,
2329
+ sx: {
2330
+ m: 0,
2331
+ padding: "12px 16px 8px 16px",
2332
+ background: background ? background : "white",
2333
+ height: !heightContent ? { xs: "60vh", sm: "70vh", md: "508px" } : heightContent,
2334
+ width: () => {
2335
+ switch (widthContent) {
2336
+ case "extra-small":
2337
+ return { xs: "48vw", md: "33vw" };
2338
+ case "small":
2339
+ return { xs: "54vw", md: "39vw" };
2340
+ case "medium":
2341
+ return { xs: "64vw", md: "56vw" };
2342
+ case "large":
2343
+ return { xs: "74vw", md: "78vw" };
2344
+ case "extra-large":
2345
+ return { xs: "84vw", md: "93vw" };
2346
+ default:
2347
+ return { xs: "64vw", md: "56vw" };
2348
+ }
2349
+ }
2350
+ }
2351
+ },
2352
+ content.url ? /* @__PURE__ */ import_react19.default.createElement(
2353
+ "iframe",
2354
+ {
2355
+ style: { border: "none", minWidth: "100%", minHeight: "100%" },
2356
+ id: "inlineFrameExample",
2357
+ title: "Inline Frame Example",
2358
+ src: content.url
2359
+ }
2360
+ ) : content.component
2361
+ ),
2362
+ dialogActions.length > 0 ? /* @__PURE__ */ import_react19.default.createElement(import_material14.DialogActions, { sx: { gap: 1, m: 0, padding: "12px 16px 12px 16px", justifyContent: dialogActions.length >= 3 ? "space-between" : "flex-end" } }, dialogActions.length >= 3 ? /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
2363
+ import_material14.Button,
2364
+ {
2365
+ variant: "text",
2366
+ color: dialogActions[0].color || "primary",
2367
+ size: "small",
2368
+ onClick: dialogActions[0].fn,
2369
+ disabled: dialogActions[0].disabled || false,
2370
+ startIcon: dialogActions[0].icon ? /* @__PURE__ */ import_react19.default.createElement(import_material14.SvgIcon, { fontSize: "small", component: dialogActions[0].icon }) : void 0
2371
+ },
2372
+ dialogActions[0].text
2373
+ ), /* @__PURE__ */ import_react19.default.createElement(import_material14.Box, { sx: { display: "flex", gap: 1 } }, dialogActions.slice(1).map((boton, index) => {
2374
+ return /* @__PURE__ */ import_react19.default.createElement(
2375
+ import_material14.Button,
2376
+ {
2377
+ key: index + 1,
2378
+ variant: index === dialogActions.length - 2 ? "contained" : "text",
2379
+ color: boton.color || "primary",
2380
+ size: "small",
2381
+ onClick: boton.fn,
2382
+ disabled: boton.disabled || false,
2383
+ startIcon: boton.icon ? /* @__PURE__ */ import_react19.default.createElement(import_material14.SvgIcon, { fontSize: "small", component: boton.icon }) : void 0
2384
+ },
2385
+ boton.text
2386
+ );
2387
+ }))) : dialogActions.map((boton, index) => {
2388
+ return /* @__PURE__ */ import_react19.default.createElement(
2389
+ import_material14.Button,
2390
+ {
2391
+ key: index,
2392
+ variant: index === dialogActions.length - 1 ? "contained" : "text",
2393
+ color: boton.color || "primary",
2394
+ size: "small",
2395
+ onClick: boton.fn,
2396
+ disabled: boton.disabled || false,
2397
+ startIcon: boton.icon ? /* @__PURE__ */ import_react19.default.createElement(import_material14.SvgIcon, { fontSize: "small", component: boton.icon }) : void 0
2398
+ },
2399
+ boton.text
2400
+ );
2401
+ })) : ""
2402
+ )));
2403
+ };
2404
+
2405
+ // src/Components/SCMenu.tsx
2406
+ var import_react21 = __toESM(require("react"), 1);
2407
+ var import_material15 = require("@mui/material");
1853
2408
  var import_Grid26 = __toESM(require("@mui/material/Grid2"), 1);
1854
- var import_icons_material10 = require("@mui/icons-material");
2409
+
2410
+ // src/Components/Hooks/useWindowDimensions.ts
2411
+ var import_react20 = require("react");
2412
+ function getWindowDimensions() {
2413
+ const { innerWidth: width, innerHeight: height } = window;
2414
+ return {
2415
+ width,
2416
+ height
2417
+ };
2418
+ }
2419
+ function useWindowDimensions() {
2420
+ const [windowDimensions, setWindowDimensions] = (0, import_react20.useState)(getWindowDimensions());
2421
+ (0, import_react20.useEffect)(() => {
2422
+ function handleResize() {
2423
+ setWindowDimensions(getWindowDimensions());
2424
+ }
2425
+ window.addEventListener("resize", handleResize);
2426
+ return () => window.removeEventListener("resize", handleResize);
2427
+ }, []);
2428
+ return windowDimensions;
2429
+ }
2430
+
2431
+ // src/Components/SCMenu.tsx
1855
2432
  var Muicon6 = __toESM(require("@mui/icons-material"), 1);
1856
- function SCAutocomplete({
1857
- label = "",
1858
- data,
1859
- columnGroup,
1860
- getItemValue,
1861
- type = "normal",
1862
- checkMassive = false,
1863
- deleteType = "button",
1864
- fnAplicar,
1865
- required,
1866
- disabled,
1867
- background,
1868
- setState,
1869
- state
1870
- }) {
1871
- const labelContent = `<span class="red-asterisk">* </span>` + label;
1872
- let group = "";
1873
- let isSelected = false;
1874
- const [selectedOptions, setSelectedOptions] = import_react19.default.useState([]);
1875
- const [prevData, setPrevData] = import_react19.default.useState(data);
1876
- (0, import_react19.useEffect)(() => {
1877
- let dataChangeValidation = JSON.stringify(prevData) === JSON.stringify(data);
1878
- if (dataChangeValidation == false) {
1879
- setState({ hiddenValue: "-1", textValue: "" });
1880
- setSelectedOptions([]);
1881
- setPrevData(data);
2433
+ var SCMenu = ({ header, options, defaultOption, disable, widthMenu, heightMenu, widthPage }) => {
2434
+ const { height, width } = useWindowDimensions();
2435
+ const menuSize = widthMenu ? parseInt(widthMenu) : 284;
2436
+ const pageSize = widthPage ? parseInt(widthPage) : width - menuSize;
2437
+ const widthContainer = menuSize + pageSize;
2438
+ let heightContainer = heightMenu ? parseInt(heightMenu) : height - 76;
2439
+ const [selectedIndex, setSelectedIndex] = import_react21.default.useState("1");
2440
+ const [value, setValue] = import_react21.default.useState("1");
2441
+ import_react21.default.useEffect(() => {
2442
+ heightContainer = heightMenu ? parseInt(heightMenu) : height - 76;
2443
+ }, [height]);
2444
+ import_react21.default.useEffect(() => {
2445
+ if (defaultOption) {
2446
+ handleClickMenusItem(event, void 0);
1882
2447
  }
1883
- }, [data]);
1884
- (0, import_react19.useEffect)(() => {
1885
- if (type == "multiselect") {
1886
- if (state.hiddenValue != "-1") {
1887
- setSelectedOptions(data.filter(
1888
- (item) => Array.isArray(state.hiddenValue) ? state.hiddenValue.includes(getItemValue(item).value) : getItemValue(item).value === state.hiddenValue
1889
- ));
2448
+ }, [defaultOption]);
2449
+ options.map(function(option, index, array) {
2450
+ if (option == null ? void 0 : option.iconLeft) {
2451
+ if ((option == null ? void 0 : option.iconLeft.type) == void 0) {
2452
+ option.iconLeft = Muicon6[option == null ? void 0 : option.iconLeft];
2453
+ } else {
2454
+ option;
1890
2455
  }
1891
2456
  }
1892
- }, [state.hiddenValue]);
1893
- data.map(function(option, index, array) {
1894
- if (option == null ? void 0 : option.icon) {
1895
- if ((option == null ? void 0 : option.icon.type) == void 0) {
1896
- option.icon = Muicon6[option == null ? void 0 : option.icon];
2457
+ if (option == null ? void 0 : option.iconRight) {
2458
+ if ((option == null ? void 0 : option.iconRight.type) == void 0) {
2459
+ option.iconRight = Muicon6[option == null ? void 0 : option.iconRight];
1897
2460
  } else {
1898
2461
  option;
1899
2462
  }
1900
2463
  }
1901
2464
  });
1902
- const cleanOptions = (event2) => {
1903
- setState({ hiddenValue: "-1", textValue: "" });
1904
- setSelectedOptions([]);
1905
- };
1906
- const handleCheckAll = (event2) => {
1907
- if (event2.target.checked) {
1908
- setSelectedOptions(data);
1909
- setState({
1910
- hiddenValue: data.map((item) => getItemValue(item).value),
1911
- textValue: data.map((item) => getItemValue(item).text)
1912
- });
1913
- } else {
1914
- setSelectedOptions([]);
1915
- setState({ hiddenValue: "-1", textValue: "" });
1916
- }
1917
- };
1918
- const allSelected = data.length > 0 && selectedOptions.length === data.length;
1919
- const handleChange = (event2, value) => {
1920
- if (type === "multiselect") {
1921
- const ids = value.map((v) => getItemValue ? getItemValue(v).value : "");
1922
- const texts = value.map((v) => getItemValue ? getItemValue(v).text : "");
1923
- setSelectedOptions(value);
1924
- setState({
1925
- hiddenValue: ids,
1926
- textValue: texts
1927
- });
1928
- } else {
1929
- setState({
1930
- hiddenValue: getItemValue(value).value,
1931
- textValue: getItemValue(value).text
1932
- });
2465
+ const handleClickMenusItem = (event2, index) => {
2466
+ if (defaultOption && index == void 0) {
2467
+ setSelectedIndex(defaultOption);
2468
+ setValue(defaultOption);
2469
+ } else if (index != void 0) {
2470
+ setSelectedIndex(String(index + 1));
2471
+ setValue(String(index + 1));
1933
2472
  }
1934
2473
  };
1935
- const selectedValue = type === "multiselect" ? data.filter(
1936
- (item) => state.hiddenValue.includes(getItemValue(item).value)
1937
- ) : data.find(
1938
- (item) => getItemValue(item).value === state.hiddenValue
1939
- ) || null;
1940
- return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, data && /* @__PURE__ */ import_react19.default.createElement(
1941
- import_material13.Autocomplete,
2474
+ return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(import_Grid26.default, { container: true, sx: { height: heightContainer, width: widthContainer, flexDirection: "column" } }, /* @__PURE__ */ import_react21.default.createElement(import_material15.Paper, { "data-testid": "menu-content", sx: { width: menuSize, height: heightContainer, overflow: "auto" } }, header && header.component, /* @__PURE__ */ import_react21.default.createElement(import_material15.MenuList, { sx: { height: options.length * 45, padding: "8px 0px" } }, options.map((option, index) => /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(
2475
+ import_material15.MenuItem,
1942
2476
  {
1943
- multiple: type === "multiselect",
1944
- clearOnEscape: true,
1945
- disabled,
1946
- options: data,
1947
- onChange: handleChange,
1948
- getOptionLabel: (option) => getItemValue(option).text,
1949
- value: selectedValue,
1950
- sx: {
1951
- background: background || "transparent",
1952
- width: "100%",
1953
- maxWidth: "100%",
1954
- "& .MuiAutocomplete-tag": {
1955
- maxWidth: 120,
1956
- overflow: "hidden",
1957
- textOverflow: "ellipsis",
1958
- whiteSpace: "nowrap"
1959
- },
1960
- "& .MuiAutocomplete-inputRoot": {
1961
- flexWrap: "nowrap !important",
1962
- overflowX: "auto"
1963
- }
1964
- },
1965
- limitTags: 2,
1966
- renderTags: (value, getTagProps) => {
1967
- const limit = 2;
1968
- return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, value.slice(0, limit).map((option, index) => /* @__PURE__ */ import_react19.default.createElement(
1969
- import_material13.Chip,
1970
- __spreadProps(__spreadValues({
1971
- color: "default",
1972
- size: "small",
1973
- variant: "filled",
1974
- label: getItemValue(option).text
1975
- }, getTagProps({ index })), {
1976
- style: { maxWidth: 120, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
1977
- })
1978
- )), value.length > limit && /* @__PURE__ */ import_react19.default.createElement(import_material13.Box, { sx: { ml: 0.5, fontSize: 13, color: "#666", display: "flex", alignItems: "center" } }, `+${value.length - limit}`));
1979
- },
1980
- renderOption: (props, option) => {
1981
- const _a = props, { key } = _a, optionProps = __objRest(_a, ["key"]);
1982
- let isValid;
1983
- if (type == "multiselect") {
1984
- isSelected = selectedOptions.some(
1985
- (selected) => getItemValue(selected).value === getItemValue(option).value
1986
- );
1987
- }
1988
- if (columnGroup) {
1989
- isValid = group == option[columnGroup];
1990
- group = option[columnGroup];
2477
+ disabled: disable == true ? true : false,
2478
+ key: index,
2479
+ selected: String(index + 1) === selectedIndex,
2480
+ onClick: (event2) => handleClickMenusItem(event2, index)
2481
+ },
2482
+ option.iconLeft ? /* @__PURE__ */ import_react21.default.createElement(import_material15.ListItemIcon, { sx: { color: String(index + 1) === selectedIndex ? "primary" : "active" } }, /* @__PURE__ */ import_react21.default.createElement(import_material15.SvgIcon, { fontSize: "small", color: String(index + 1) === selectedIndex ? "primary" : "action", component: option.iconLeft })) : "",
2483
+ /* @__PURE__ */ import_react21.default.createElement(import_Grid26.default, { container: true, size: 12, sx: { maxWidth: 220, flexWrap: "noWrap", alignItems: "center" } }, /* @__PURE__ */ import_react21.default.createElement(import_material15.Typography, { noWrap: true, variant: "caption", color: String(index + 1) === selectedIndex ? "primary" : "active" }, option.name), option.iconRight ? /* @__PURE__ */ import_react21.default.createElement(import_material15.ListItemIcon, { sx: { minWidth: "0px !important", color: String(index + 1) === selectedIndex ? "primary" : "active" } }, /* @__PURE__ */ import_react21.default.createElement(import_material15.SvgIcon, { fontSize: "small", color: String(index + 1) === selectedIndex ? "primary" : "action", component: option.iconRight })) : "")
2484
+ ), option.divider == true ? /* @__PURE__ */ import_react21.default.createElement(import_material15.Divider, null) : "")))), /* @__PURE__ */ import_react21.default.createElement(import_Grid26.default, { container: true }, options.map((option, index) => option.page ? String(index + 1) == value ? /* @__PURE__ */ import_react21.default.createElement(import_material15.Box, { "data-testid": "menu-page-content", sx: { padding: "16px", width: pageSize, height: heightContainer }, key: index }, option.page) : "" : /* @__PURE__ */ import_react21.default.createElement(import_material15.Typography, { color: "error" }, "No se ha configurado el componente a visualizar")))));
2485
+ };
2486
+
2487
+ // src/Components/SCTabs.tsx
2488
+ var import_react22 = __toESM(require("react"), 1);
2489
+ var import_material16 = require("@mui/material");
2490
+ var import_TabPanel = __toESM(require("@mui/lab/TabPanel"), 1);
2491
+ var import_TabContext = __toESM(require("@mui/lab/TabContext"), 1);
2492
+ var Muicon7 = __toESM(require("@mui/icons-material"), 1);
2493
+ var SCTabs = ({ options, defaultOption, typeIcon, background, iconPosition, colorTab, orientation, variant, scrollButtons, children }) => {
2494
+ const [toast, setToast] = import_react22.default.useState(null);
2495
+ let i = 0;
2496
+ let j = 0;
2497
+ let k = 0;
2498
+ let l = 0;
2499
+ let validateTypeIcon = true;
2500
+ const [value, setValue] = import_react22.default.useState("1");
2501
+ (0, import_react22.useEffect)(() => {
2502
+ if (defaultOption) {
2503
+ handleChange(event, void 0);
2504
+ }
2505
+ }, [defaultOption]);
2506
+ options.map(function(option) {
2507
+ const optionsLength = options.length;
2508
+ if (option == null ? void 0 : option.iconOrBadge) {
2509
+ if (typeIcon == "icon") {
2510
+ if ((option == null ? void 0 : option.iconOrBadge) in Muicon7 == true) {
2511
+ validateTypeIcon = true;
2512
+ option.iconOrBadge = Muicon7[option == null ? void 0 : option.iconOrBadge];
2513
+ } else {
2514
+ validateTypeIcon = false;
2515
+ setTimeout(() => {
2516
+ setToast({
2517
+ type: "error",
2518
+ title: "Componente SCTabs",
2519
+ subtitle: "En Option todos los iconOrBadge deben ser iconos de MUI, por favor verificar.",
2520
+ time: 50
2521
+ });
2522
+ }, 10);
2523
+ return;
1991
2524
  }
1992
- return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, { key }, columnGroup ? !isValid ? /* @__PURE__ */ import_react19.default.createElement(import_material13.Typography, { color: "text.secondary", sx: { margin: "7px 16px !important", fontSize: "13px !important" } }, option[columnGroup]) : "" : "", /* @__PURE__ */ import_react19.default.createElement(import_material13.MenuItem, __spreadProps(__spreadValues({}, optionProps), { style: { background: type != "multiselect" ? state.hiddenValue == getItemValue(option).value ? "#dfe6ec" : "white" : "white", padding: "7px 16px" } }), type != "multiselect" && getItemValue(option).icon != void 0 ? /* @__PURE__ */ import_react19.default.createElement(import_material13.ListItemIcon, { sx: { minWidth: "10px !important" } }, /* @__PURE__ */ import_react19.default.createElement(import_material13.SvgIcon, { fontSize: "small", color: "action", component: getItemValue(option).icon })) : "", type == "multiselect" ? /* @__PURE__ */ import_react19.default.createElement(import_material13.Checkbox, { checked: isSelected, value: getItemValue(option).text, color: "primary" }) : "", /* @__PURE__ */ import_react19.default.createElement(import_material13.ListItemText, { primary: getItemValue(option).text, color: "text.primary" }))));
1993
- },
1994
- renderInput: (params) => /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
1995
- import_material13.TextField,
1996
- __spreadProps(__spreadValues({}, params), {
1997
- label: required ? /* @__PURE__ */ import_react19.default.createElement("span", { dangerouslySetInnerHTML: { __html: labelContent } }) : label,
1998
- placeholder: selectedOptions.length == 0 ? "B\xFAsqueda" : "",
1999
- InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
2000
- endAdornment: /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, deleteType == "icon" && state.hiddenValue != "-1" ? /* @__PURE__ */ import_react19.default.createElement(import_material13.IconButton, { size: "small", onClick: cleanOptions, sx: { marginLeft: "auto", textAlign: "right", padding: "0px" } }, /* @__PURE__ */ import_react19.default.createElement(import_icons_material10.Clear, { fontSize: "small" })) : "", /* @__PURE__ */ import_react19.default.createElement(import_material13.InputAdornment, { style: { zIndex: 1, position: "relative" }, position: "end" }, /* @__PURE__ */ import_react19.default.createElement(import_icons_material10.Search, { fontSize: "small", color: "action", style: { cursor: "pointer" } })))
2001
- })
2002
- })
2003
- )),
2004
- slotProps: {
2005
- listbox: {
2006
- component: import_react19.default.forwardRef(function ListboxComponent(props, ref) {
2007
- return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
2008
- import_material13.Box,
2009
- __spreadProps(__spreadValues({
2010
- ref
2011
- }, props), {
2012
- sx: __spreadValues({
2013
- position: "relative",
2014
- paddingBottom: "56px",
2015
- backgroundColor: "white"
2016
- }, props.sx)
2017
- }),
2018
- checkMassive && type == "multiselect" ? /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(import_material13.FormControlLabel, { control: /* @__PURE__ */ import_react19.default.createElement(import_material13.Checkbox, { checked: allSelected, indeterminate: selectedOptions.length > 0 && selectedOptions.length < data.length, onChange: handleCheckAll, color: "primary" }), label: "Todos los item", sx: { marginLeft: "0px !important", marginRight: "0px !important", padding: "7px 16px" } }), /* @__PURE__ */ import_react19.default.createElement(import_material13.Divider, null)) : "",
2019
- props.children,
2020
- deleteType == "button" || fnAplicar ? /* @__PURE__ */ import_react19.default.createElement(
2021
- import_Grid26.default,
2022
- {
2023
- container: true,
2024
- sx: {
2025
- position: "sticky",
2026
- bottom: -8,
2027
- left: 0,
2028
- width: "100%",
2029
- backgroundColor: "grey.50",
2030
- padding: "8px 16px",
2031
- textAlign: "left",
2032
- justifyContent: "space-between"
2033
- }
2034
- },
2035
- deleteType == "button" ? /* @__PURE__ */ import_react19.default.createElement(
2036
- import_material13.Button,
2037
- {
2038
- variant: "text",
2039
- color: "primary",
2040
- size: "small",
2041
- onClick: (event2) => {
2042
- event2.stopPropagation();
2043
- cleanOptions(event2);
2044
- }
2045
- },
2046
- "Limpiar"
2047
- ) : "",
2048
- fnAplicar && /* @__PURE__ */ import_react19.default.createElement(
2049
- import_material13.Button,
2050
- {
2051
- variant: "contained",
2052
- color: "primary",
2053
- size: "small",
2054
- onClick: fnAplicar
2055
- },
2056
- "Aplicar"
2057
- )
2058
- ) : ""
2059
- ));
2060
- })
2525
+ } else if (typeIcon == "badge") {
2526
+ if ((option == null ? void 0 : option.iconOrBadge) in Muicon7 == false) {
2527
+ validateTypeIcon = true;
2528
+ option;
2529
+ } else {
2530
+ validateTypeIcon = false;
2531
+ setTimeout(() => {
2532
+ setToast({
2533
+ type: "error",
2534
+ title: "Componente SCTabs",
2535
+ subtitle: "En Option todos los iconOrBadge deben ser numeros para el badge, por favor verificar.",
2536
+ time: 10
2537
+ });
2538
+ }, 10);
2539
+ return;
2061
2540
  }
2062
2541
  }
2063
2542
  }
2064
- ));
2065
- }
2543
+ });
2544
+ const handleChange = (event2, newValue) => {
2545
+ if (defaultOption && newValue == void 0) {
2546
+ setValue(defaultOption);
2547
+ } else if (newValue != void 0) {
2548
+ setValue(newValue);
2549
+ }
2550
+ };
2551
+ return /* @__PURE__ */ import_react22.default.createElement(import_react22.default.Fragment, null, validateTypeIcon == true ? /* @__PURE__ */ import_react22.default.createElement(import_material16.Box, { sx: { height: orientation == "vertical" ? "100%" : "auto", display: "flex", flexDirection: orientation == "vertical" ? "row" : "column" }, id: "tabsitos" }, /* @__PURE__ */ import_react22.default.createElement(import_TabContext.default, { value }, /* @__PURE__ */ import_react22.default.createElement(
2552
+ import_material16.Tabs,
2553
+ {
2554
+ "data-testid": "tab-container",
2555
+ value,
2556
+ onChange: handleChange,
2557
+ variant: variant ? orientation == "vertical" && variant == "fullWidth" ? "standard" : variant : "standard",
2558
+ scrollButtons: scrollButtons == false ? false : true,
2559
+ visibleScrollbar: scrollButtons == false ? true : false,
2560
+ textColor: colorTab,
2561
+ indicatorColor: colorTab,
2562
+ orientation: orientation || "horizontal",
2563
+ sx: { borderBottom: orientation == "vertical" ? 0 : 1, borderRight: orientation == "vertical" ? 1 : 0, borderColor: "divider", background: background || "" }
2564
+ },
2565
+ options.map((option) => /* @__PURE__ */ import_react22.default.createElement(
2566
+ import_material16.Tab,
2567
+ {
2568
+ "data-testid": "tab-item",
2569
+ value: String(i = i + 1),
2570
+ key: j = j + 1,
2571
+ label: option.name || "",
2572
+ disabled: option.disabled || false,
2573
+ iconPosition: iconPosition || "end",
2574
+ icon: typeIcon == "badge" ? /* @__PURE__ */ import_react22.default.createElement(
2575
+ import_material16.Badge,
2576
+ {
2577
+ sx: {
2578
+ width: "20px",
2579
+ height: "20px",
2580
+ "& .MuiBadge-badge": {
2581
+ top: "10px",
2582
+ right: "10px"
2583
+ }
2584
+ },
2585
+ variant: "standard",
2586
+ badgeContent: option.iconOrBadge,
2587
+ color: value == String(i) ? colorTab ? colorTab : "primary" : "default"
2588
+ }
2589
+ ) : typeIcon == "icon" ? /* @__PURE__ */ import_react22.default.createElement(import_material16.SvgIcon, { fontSize: "small", component: option.iconOrBadge, color: value == String(i) ? colorTab ? colorTab : "primary" : "action", sx: { width: "20px", height: "20px" } }) : "",
2590
+ sx: { "& .MuiTab-icon": { margin: "0px !important" }, padding: "10px 16px", gap: "4px" }
2591
+ }
2592
+ ))
2593
+ ), children, options.map((option) => /* @__PURE__ */ import_react22.default.createElement(
2594
+ import_TabPanel.default,
2595
+ {
2596
+ key: k = k + 1,
2597
+ value: String(l = l + 1),
2598
+ sx: { padding: "16px" }
2599
+ },
2600
+ option.page ? option.page : /* @__PURE__ */ import_react22.default.createElement(import_material16.Typography, null, "No se ha configurado el componente a visualizar ")
2601
+ )))) : /* @__PURE__ */ import_react22.default.createElement(import_material16.Box, { sx: { height: "200px" } }, toast && /* @__PURE__ */ import_react22.default.createElement(SCToastNotification, __spreadValues({ "data-testid": "error-tab-message" }, toast))));
2602
+ };
2066
2603
 
2067
2604
  // src/Theme/index.ts
2068
2605
  var import_styles3 = require("@mui/material/styles");
2069
2606
 
2070
2607
  // src/Theme/components.ts
2071
- var import_react20 = __toESM(require("react"), 1);
2072
- var import_icons_material11 = require("@mui/icons-material");
2608
+ var import_react23 = __toESM(require("react"), 1);
2609
+ var import_icons_material10 = require("@mui/icons-material");
2073
2610
  var components = {
2074
2611
  MuiSelect: {
2075
2612
  styleOverrides: {
@@ -2428,7 +2965,7 @@ var components = {
2428
2965
  MuiBackdrop: {
2429
2966
  styleOverrides: {
2430
2967
  root: {
2431
- backgroundColor: "#00000047"
2968
+ backgroundColor: "transparent"
2432
2969
  }
2433
2970
  }
2434
2971
  },
@@ -2766,10 +3303,10 @@ var components = {
2766
3303
  MuiAlert: {
2767
3304
  defaultProps: {
2768
3305
  iconMapping: {
2769
- success: import_react20.default.createElement(import_icons_material11.CheckCircleRounded),
2770
- error: import_react20.default.createElement(import_icons_material11.ErrorRounded),
2771
- warning: import_react20.default.createElement(import_icons_material11.WarningRounded),
2772
- info: import_react20.default.createElement(import_icons_material11.InfoRounded)
3306
+ success: import_react23.default.createElement(import_icons_material10.CheckCircleRounded),
3307
+ error: import_react23.default.createElement(import_icons_material10.ErrorRounded),
3308
+ warning: import_react23.default.createElement(import_icons_material10.WarningRounded),
3309
+ info: import_react23.default.createElement(import_icons_material10.InfoRounded)
2773
3310
  }
2774
3311
  },
2775
3312
  variants: [
@@ -3606,86 +4143,9 @@ var paletteADC = __spreadValues({
3606
4143
  }
3607
4144
  }, BasicPalette);
3608
4145
 
3609
- // node_modules/@mui/system/esm/createBreakpoints/createBreakpoints.js
3610
- var sortBreakpointsValues = (values) => {
3611
- const breakpointsAsArray = Object.keys(values).map((key) => ({
3612
- key,
3613
- val: values[key]
3614
- })) || [];
3615
- breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
3616
- return breakpointsAsArray.reduce((acc, obj) => {
3617
- return __spreadProps(__spreadValues({}, acc), {
3618
- [obj.key]: obj.val
3619
- });
3620
- }, {});
3621
- };
3622
- function createBreakpoints(breakpoints2) {
3623
- const _a = breakpoints2, {
3624
- values: values = {
3625
- xs: 0,
3626
- // phone
3627
- sm: 600,
3628
- // tablet
3629
- md: 900,
3630
- // small laptop
3631
- lg: 1200,
3632
- // desktop
3633
- xl: 1536
3634
- // large screen
3635
- },
3636
- unit = "px",
3637
- step = 5
3638
- } = _a, other = __objRest(_a, [
3639
- // The breakpoint **start** at this value.
3640
- // For instance with the first breakpoint xs: [xs, sm).
3641
- "values",
3642
- "unit",
3643
- "step"
3644
- ]);
3645
- const sortedValues = sortBreakpointsValues(values);
3646
- const keys = Object.keys(sortedValues);
3647
- function up(key) {
3648
- const value = typeof values[key] === "number" ? values[key] : key;
3649
- return `@media (min-width:${value}${unit})`;
3650
- }
3651
- function down(key) {
3652
- const value = typeof values[key] === "number" ? values[key] : key;
3653
- return `@media (max-width:${value - step / 100}${unit})`;
3654
- }
3655
- function between(start, end) {
3656
- const endIndex = keys.indexOf(end);
3657
- return `@media (min-width:${typeof values[start] === "number" ? values[start] : start}${unit}) and (max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === "number" ? values[keys[endIndex]] : end) - step / 100}${unit})`;
3658
- }
3659
- function only(key) {
3660
- if (keys.indexOf(key) + 1 < keys.length) {
3661
- return between(key, keys[keys.indexOf(key) + 1]);
3662
- }
3663
- return up(key);
3664
- }
3665
- function not(key) {
3666
- const keyIndex = keys.indexOf(key);
3667
- if (keyIndex === 0) {
3668
- return up(keys[1]);
3669
- }
3670
- if (keyIndex === keys.length - 1) {
3671
- return down(keys[keyIndex]);
3672
- }
3673
- return between(key, keys[keys.indexOf(key) + 1]).replace("@media", "@media not all and");
3674
- }
3675
- return __spreadValues({
3676
- keys,
3677
- values: sortedValues,
3678
- up,
3679
- down,
3680
- between,
3681
- only,
3682
- not,
3683
- unit
3684
- }, other);
3685
- }
3686
-
3687
4146
  // src/Theme/breakpoints.ts
3688
- var breakpoints = createBreakpoints({
4147
+ var import_system = require("@mui/system");
4148
+ var breakpoints = (0, import_system.createBreakpoints)({
3689
4149
  values: {
3690
4150
  xs: 0,
3691
4151
  sm: 600,
@@ -3888,16 +4348,20 @@ var ADCSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADCTheme)
3888
4348
  0 && (module.exports = {
3889
4349
  ADCSincoTheme,
3890
4350
  AdproSincoTheme,
4351
+ EmptyState,
3891
4352
  FooterAction,
4353
+ MultiSelect,
3892
4354
  PageHeader,
3893
4355
  SCAutocomplete,
3894
4356
  SCCalendarSwipeable,
3895
4357
  SCDataGrid,
4358
+ SCDataGridInitial,
4359
+ SCDateRange,
3896
4360
  SCDialog,
3897
4361
  SCDrawer,
3898
4362
  SCMenu,
3899
4363
  SCModal,
3900
- SCMultiSelect,
4364
+ SCSelect,
3901
4365
  SCTabs,
3902
4366
  SCTextArea,
3903
4367
  SCTextField,
@@ -3915,14 +4379,4 @@ var ADCSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADCTheme)
3915
4379
  useMultiSelectHandlers,
3916
4380
  useProgress
3917
4381
  });
3918
- /*! Bundled license information:
3919
-
3920
- @mui/system/esm/index.js:
3921
- (**
3922
- * @mui/system v7.1.1
3923
- *
3924
- * @license MIT
3925
- * This source code is licensed under the MIT license found in the
3926
- * LICENSE file in the root directory of this source tree.
3927
- *)
3928
- */
4382
+ //# sourceMappingURL=index.cjs.map