componentes-sinco 1.0.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,735 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ SCDrawer: () => SCDrawer,
34
+ SCTextArea: () => SCTextArea,
35
+ SCTextField: () => SCTextField
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+
39
+ // src/Components/SCTextField.tsx
40
+ var import_react = __toESM(require("react"));
41
+ var import_material = require("@mui/material");
42
+ var import_Grid2 = __toESM(require("@mui/material/Grid2"));
43
+ var Muicon = __toESM(require("@mui/icons-material"));
44
+ var import_icons_material = require("@mui/icons-material");
45
+ var SCTextField = ({
46
+ label = "",
47
+ placeholder = "",
48
+ width = "100%",
49
+ variant = "outlined",
50
+ color,
51
+ disabled,
52
+ required,
53
+ maxLength,
54
+ background,
55
+ size,
56
+ format,
57
+ title,
58
+ iconTitle,
59
+ infoTitle,
60
+ iconInputStart,
61
+ iconInputEnd,
62
+ infoElement,
63
+ value,
64
+ state,
65
+ onChange,
66
+ onBlur,
67
+ onKeyDown
68
+ }) => {
69
+ const [showPassword, setShowPassword] = (0, import_react.useState)(false);
70
+ const [error, setError] = (0, import_react.useState)(false);
71
+ const [anchorInfoTitle, setAnchorInfoTitle] = (0, import_react.useState)(null);
72
+ const openInfoTitle = Boolean(anchorInfoTitle);
73
+ const [anchorInfoElement, setAnchorInfoElement] = (0, import_react.useState)(null);
74
+ const openInfoElement = Boolean(anchorInfoElement);
75
+ const inputComponents = {
76
+ outlined: import_material.OutlinedInput,
77
+ filled: import_material.FilledInput,
78
+ standard: import_material.Input
79
+ };
80
+ const InputComponent = inputComponents[variant] || import_material.OutlinedInput;
81
+ let IconInputStartValidation;
82
+ let IconInputEndValidation;
83
+ let IconInputStart;
84
+ let IconInputEnd;
85
+ let IconTitle;
86
+ if (iconInputStart) {
87
+ if (!(iconInputStart in Muicon)) {
88
+ if (iconInputStart.type === void 0) {
89
+ IconInputStartValidation = "text";
90
+ } else {
91
+ IconInputStartValidation = "icon";
92
+ }
93
+ } else {
94
+ IconInputStartValidation = "icon";
95
+ IconInputStart = Muicon[iconInputStart];
96
+ }
97
+ }
98
+ if (iconInputEnd) {
99
+ if (!(iconInputEnd in Muicon)) {
100
+ if (iconInputEnd.type === void 0) {
101
+ IconInputEndValidation = "text";
102
+ } else {
103
+ IconInputEndValidation = "icon";
104
+ }
105
+ } else {
106
+ IconInputEndValidation = "icon";
107
+ IconInputEnd = Muicon[iconInputEnd];
108
+ }
109
+ }
110
+ if (iconTitle) {
111
+ if (!(iconTitle in Muicon)) {
112
+ IconTitle = iconInputStart;
113
+ } else {
114
+ IconTitle = Muicon[iconTitle];
115
+ }
116
+ }
117
+ (0, import_react.useEffect)(() => {
118
+ if (state) {
119
+ state(value);
120
+ }
121
+ }, [value]);
122
+ (0, import_react.useEffect)(() => {
123
+ if (error) {
124
+ setTimeout(() => {
125
+ setError(false);
126
+ }, 1e3);
127
+ }
128
+ }, [error]);
129
+ const handleClickShowPassword = () => setShowPassword((show) => !show);
130
+ const handleMouseDownPassword = (event) => {
131
+ event.preventDefault();
132
+ };
133
+ const handleKeyPress = (event) => {
134
+ const target = event.target;
135
+ const key = event.key;
136
+ if (format === "int") {
137
+ if (!/^[0-9]$/.test(key)) {
138
+ event.preventDefault();
139
+ }
140
+ ;
141
+ }
142
+ if (format === "decimal") {
143
+ if (target.value === "" && key === "." || key === "-" || key === "+") {
144
+ event.preventDefault();
145
+ }
146
+ }
147
+ if (target.type === "text") {
148
+ const regex = /^[a-zA-ZáéíóúÁÉÍÓÚñÑ0-9\s_\-.,@]+$/;
149
+ if (!regex.test(key)) {
150
+ event.preventDefault();
151
+ }
152
+ }
153
+ if (onKeyDown) {
154
+ onKeyDown(event);
155
+ }
156
+ };
157
+ const handleChange = (event) => {
158
+ let valueMax = maxLength ? maxLength + 1 : 50;
159
+ if (event.target.value.length < valueMax) {
160
+ if (state) {
161
+ state(event.target.value);
162
+ }
163
+ if (onChange) {
164
+ onChange(event);
165
+ }
166
+ }
167
+ };
168
+ const handleBlur = (event) => {
169
+ const error2 = !value.trim() && required ? true : false;
170
+ setError(error2 ? true : false);
171
+ if (onBlur) {
172
+ onBlur(event);
173
+ }
174
+ };
175
+ const handleClickInfoTitle = (event) => {
176
+ setAnchorInfoTitle(event.currentTarget);
177
+ };
178
+ const handleCloseInfoTitle = () => {
179
+ setAnchorInfoTitle(null);
180
+ };
181
+ const handleClickInfoElement = (event) => {
182
+ setAnchorInfoElement(event.currentTarget);
183
+ };
184
+ const handleCloseInfoElement = () => {
185
+ setAnchorInfoElement(null);
186
+ };
187
+ return /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { width } }, /* @__PURE__ */ import_react.default.createElement(import_Grid2.default, { container: true, alignItems: "center", mb: 1.25, gap: 0.5 }, iconTitle && IconTitle ? /* @__PURE__ */ import_react.default.createElement(import_material.SvgIcon, { color: "action", fontSize: "small", component: IconTitle }) : "", title ? /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { mx: 0.5, variant: "subtitle2", color: "text.secondary" }, title) : "", infoTitle ? /* @__PURE__ */ import_react.default.createElement(import_material.Tooltip, { title: infoTitle, placement: "top-end" }, /* @__PURE__ */ import_react.default.createElement(
188
+ import_icons_material.InfoOutlined,
189
+ {
190
+ color: "action",
191
+ fontSize: "small",
192
+ onMouseEnter: (event) => handleClickInfoTitle(event),
193
+ onMouseLeave: () => handleCloseInfoTitle()
194
+ }
195
+ )) : ""), /* @__PURE__ */ import_react.default.createElement(import_Grid2.default, { container: true, sx: { flexWrap: "nowrap", alignItems: "center" } }, /* @__PURE__ */ import_react.default.createElement(
196
+ import_material.FormControl,
197
+ {
198
+ color,
199
+ fullWidth: true,
200
+ size: size ? size : "medium",
201
+ variant,
202
+ sx: { background: background || "transparent", borderRadius: "4px" }
203
+ },
204
+ /* @__PURE__ */ import_react.default.createElement(
205
+ import_material.InputLabel,
206
+ {
207
+ htmlFor: "",
208
+ required: required && label !== "" ? true : false,
209
+ error,
210
+ disabled: disabled || false
211
+ },
212
+ label ? label : ""
213
+ ),
214
+ /* @__PURE__ */ import_react.default.createElement(
215
+ InputComponent,
216
+ {
217
+ size: size ? size : "medium",
218
+ fullWidth: true,
219
+ value,
220
+ error,
221
+ id: label == null ? void 0 : label.replace(/\s+/g, ""),
222
+ disabled: disabled || false,
223
+ onKeyUp: handleKeyPress,
224
+ onChange: handleChange,
225
+ onBlur: handleBlur,
226
+ inputProps: { maxLength: maxLength ? maxLength : 50 },
227
+ type: !showPassword && format === "password" ? "password" : (format || "text").toUpperCase() === "INT" || (format || "text").toUpperCase() === "DECIMAL" ? "number" : "text",
228
+ className: format === "password" && !showPassword ? "" : "",
229
+ placeholder,
230
+ startAdornment: iconInputStart ? /* @__PURE__ */ import_react.default.createElement(import_material.InputAdornment, { position: "start" }, IconInputStartValidation === "text" ? iconInputStart : IconInputStart ? /* @__PURE__ */ import_react.default.createElement(IconInputStart, { fontSize: "small" }) : null) : "",
231
+ endAdornment: /* @__PURE__ */ import_react.default.createElement(import_material.InputAdornment, { position: "end" }, format === "password" ? /* @__PURE__ */ import_react.default.createElement(
232
+ import_material.IconButton,
233
+ {
234
+ onClick: handleClickShowPassword,
235
+ onMouseDown: handleMouseDownPassword,
236
+ edge: "end"
237
+ },
238
+ showPassword ? /* @__PURE__ */ import_react.default.createElement(import_icons_material.VisibilityOff, null) : /* @__PURE__ */ import_react.default.createElement(import_icons_material.Visibility, null)
239
+ ) : iconInputEnd === void 0 && infoElement !== void 0 ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
240
+ import_icons_material.InfoOutlined,
241
+ {
242
+ sx: { ml: 0.5 },
243
+ color: "action",
244
+ fontSize: "small",
245
+ component: "svg",
246
+ onMouseEnter: (event) => handleClickInfoElement(event),
247
+ onMouseLeave: () => handleCloseInfoElement()
248
+ }
249
+ ), /* @__PURE__ */ import_react.default.createElement(
250
+ import_material.Popover,
251
+ {
252
+ sx: { pointerEvents: "none" },
253
+ open: openInfoElement,
254
+ anchorEl: anchorInfoElement,
255
+ onClose: handleCloseInfoElement,
256
+ anchorOrigin: {
257
+ vertical: "bottom",
258
+ horizontal: "left"
259
+ },
260
+ transformOrigin: {
261
+ vertical: "top",
262
+ horizontal: "left"
263
+ },
264
+ disableRestoreFocus: true
265
+ },
266
+ /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { p: 2 }, infoElement)
267
+ )) : iconInputEnd !== void 0 ? IconInputEndValidation === "text" ? iconInputEnd : IconInputEnd ? /* @__PURE__ */ import_react.default.createElement(IconInputEnd, { fontSize: "small" }) : null : ""),
268
+ label: label ? label + (format === "password" && !showPassword ? "" : "") : "",
269
+ autoComplete: format === "password" ? "new-password" : "off"
270
+ }
271
+ )
272
+ ), (iconInputEnd !== void 0 || format === "password") && infoElement ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
273
+ import_icons_material.InfoOutlined,
274
+ {
275
+ sx: { marginLeft: "4px" },
276
+ color: "action",
277
+ fontSize: "small",
278
+ onMouseEnter: (event) => handleClickInfoElement(event),
279
+ onMouseLeave: handleCloseInfoElement
280
+ }
281
+ ), /* @__PURE__ */ import_react.default.createElement(
282
+ import_material.Popover,
283
+ {
284
+ sx: { pointerEvents: "none" },
285
+ open: openInfoElement,
286
+ anchorEl: anchorInfoElement,
287
+ onClose: handleCloseInfoElement,
288
+ anchorOrigin: {
289
+ vertical: "bottom",
290
+ horizontal: "left"
291
+ },
292
+ transformOrigin: {
293
+ vertical: "top",
294
+ horizontal: "left"
295
+ },
296
+ disableRestoreFocus: true
297
+ },
298
+ /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { p: 2 }, infoElement)
299
+ )) : ""));
300
+ };
301
+
302
+ // src/Components/Drawer/SCDrawer.tsx
303
+ var import_react5 = __toESM(require("react"));
304
+ var import_material4 = require("@mui/material");
305
+ var import_Grid23 = __toESM(require("@mui/material/Grid2"));
306
+ var Muicon3 = __toESM(require("@mui/icons-material"));
307
+ var import_icons_material4 = require("@mui/icons-material");
308
+ var import_Close = __toESM(require("@mui/icons-material/Close"));
309
+
310
+ // src/Components/ToastNotification/SCToastNotification.tsx
311
+ var import_react3 = __toESM(require("react"));
312
+ var import_material2 = require("@mui/material");
313
+ var import_icons_material2 = require("@mui/icons-material");
314
+
315
+ // src/Components/ToastNotification/useProgress.ts
316
+ var import_react2 = require("react");
317
+ var useProgress = (timeProgress, lote) => {
318
+ const [progress, setProgress] = (0, import_react2.useState)(0);
319
+ (0, import_react2.useEffect)(() => {
320
+ const interval = setInterval(() => {
321
+ setProgress((prev) => {
322
+ if (prev >= 100) {
323
+ clearInterval(interval);
324
+ }
325
+ if (lote) {
326
+ const nextProgress = prev + lote;
327
+ return nextProgress <= 100 ? nextProgress : 100;
328
+ } else {
329
+ return prev + 1;
330
+ }
331
+ });
332
+ }, timeProgress * 10);
333
+ return () => {
334
+ clearInterval(interval);
335
+ };
336
+ }, [timeProgress, lote]);
337
+ return {
338
+ progress
339
+ };
340
+ };
341
+
342
+ // src/Components/ToastNotification/SCToastNotification.tsx
343
+ var SCToastNotification = (toast) => {
344
+ var _a;
345
+ const [stateOptions, setStateOptions] = (0, import_react3.useState)(true);
346
+ const [stateToast, setStateToast] = (0, import_react3.useState)(true);
347
+ const timeProgress = toast.time || 10;
348
+ const { progress } = useProgress(timeProgress);
349
+ const toastColorConfig = toast.type || "info";
350
+ const toastIconOption = {
351
+ success: /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.CheckCircleRounded, { color: "success" }),
352
+ error: /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.ErrorRounded, { color: "error" }),
353
+ warning: /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.WarningRounded, { color: "warning" }),
354
+ info: /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.InfoRounded, { color: "info" })
355
+ };
356
+ toast.actions = (_a = toast.actions) != null ? _a : [{ text: "Action", fn: () => {
357
+ alert("");
358
+ } }, { text: "Consultar", fn: () => {
359
+ } }];
360
+ const ToastIconConfig = toastIconOption[toast.type];
361
+ const closeToast = () => {
362
+ setStateToast(false);
363
+ };
364
+ const toggleToastOptions = () => {
365
+ setStateOptions((prevShowOptions) => !prevShowOptions);
366
+ };
367
+ (0, import_react3.useEffect)(() => {
368
+ progress >= 100 && setStateToast(false);
369
+ }, [progress]);
370
+ return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, stateToast && /* @__PURE__ */ import_react3.default.createElement(
371
+ import_material2.Stack,
372
+ {
373
+ position: "fixed",
374
+ zIndex: 1400,
375
+ right: 16,
376
+ top: 16,
377
+ width: 370,
378
+ sx: {
379
+ boxShadow: (theme) => theme.shadows[8]
380
+ }
381
+ },
382
+ /* @__PURE__ */ import_react3.default.createElement(
383
+ import_material2.Box,
384
+ {
385
+ padding: 1.5,
386
+ gap: 1.5,
387
+ display: "flex",
388
+ alignItems: "center",
389
+ sx: {
390
+ backgroundColor: {
391
+ success: "success.50",
392
+ error: "error.50",
393
+ warning: "warning.50",
394
+ info: "info.50"
395
+ }[toastColorConfig]
396
+ }
397
+ },
398
+ /* @__PURE__ */ import_react3.default.createElement(
399
+ import_material2.Stack,
400
+ {
401
+ p: 1,
402
+ gap: 1,
403
+ borderRadius: 50,
404
+ bgcolor: {
405
+ success: "success.100",
406
+ error: "error.100",
407
+ warning: "warning.100",
408
+ info: "info.100"
409
+ }[toast.type || "info"]
410
+ },
411
+ /* @__PURE__ */ import_react3.default.createElement(import_material2.Stack, null, ToastIconConfig)
412
+ ),
413
+ /* @__PURE__ */ import_react3.default.createElement(import_material2.Divider, { orientation: "vertical", flexItem: true }),
414
+ /* @__PURE__ */ import_react3.default.createElement(import_material2.Stack, { width: 285 }, /* @__PURE__ */ import_react3.default.createElement(
415
+ import_material2.Stack,
416
+ {
417
+ justifyContent: "space-between",
418
+ flexDirection: "row",
419
+ alignItems: "center"
420
+ },
421
+ /* @__PURE__ */ import_react3.default.createElement(import_material2.Typography, { variant: "subtitle2", color: "text.primary" }, toast.title),
422
+ /* @__PURE__ */ import_react3.default.createElement(
423
+ import_material2.IconButton,
424
+ {
425
+ size: "small",
426
+ "data-testid": "close-icon",
427
+ onClick: closeToast
428
+ },
429
+ /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.Close, { fontSize: "small" })
430
+ )
431
+ ), /* @__PURE__ */ import_react3.default.createElement(import_material2.Stack, { gap: 0.5 }, /* @__PURE__ */ import_react3.default.createElement(import_material2.Typography, { color: "text.primary", variant: "body2" }, toast.subtitle), !stateOptions && toast.listITems && toast.listITems.length > 0 && /* @__PURE__ */ import_react3.default.createElement(import_material2.Stack, null, toast.listITems.map((element, i) => /* @__PURE__ */ import_react3.default.createElement(import_material2.Typography, { variant: "caption", key: i }, "\u2022 ", element)))), /* @__PURE__ */ import_react3.default.createElement(import_material2.Stack, { justifyContent: "flex-end", flexDirection: "row" }, toast.actions && toast.actions.length > 0 && /* @__PURE__ */ import_react3.default.createElement(import_material2.Stack, { flexDirection: "row", gap: 1 }, toast.actions.map((button, index) => /* @__PURE__ */ import_react3.default.createElement(
432
+ import_material2.Button,
433
+ {
434
+ key: index,
435
+ sx: { textTransform: "capitalize" },
436
+ color: index === 0 ? "info" : toast.type === "success" ? "success" : toast.type === "error" ? "error" : toast.type === "warning" ? "warning" : "info",
437
+ variant: "text",
438
+ onClick: button.fn,
439
+ disabled: button.disabled || false,
440
+ size: "small"
441
+ },
442
+ button.text
443
+ ))), toast.seeMore && /* @__PURE__ */ import_react3.default.createElement(
444
+ import_material2.Button,
445
+ {
446
+ onClick: toggleToastOptions,
447
+ size: "small",
448
+ variant: "text",
449
+ color: toastColorConfig
450
+ },
451
+ stateOptions ? "Ver m\xE1s" : "Ver menos",
452
+ stateOptions ? /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.KeyboardArrowDown, null) : /* @__PURE__ */ import_react3.default.createElement(import_icons_material2.KeyboardArrowUp, null)
453
+ )))
454
+ ),
455
+ /* @__PURE__ */ import_react3.default.createElement(
456
+ import_material2.LinearProgress,
457
+ {
458
+ sx: {
459
+ ".MuiLinearProgress-bar": {
460
+ transition: "0.1s linear !important",
461
+ transform: "scaleX(-1)"
462
+ }
463
+ },
464
+ color: toastColorConfig,
465
+ variant: "determinate",
466
+ value: 100 - progress
467
+ }
468
+ )
469
+ ));
470
+ };
471
+
472
+ // src/Components/SCTextArea.tsx
473
+ var import_react4 = __toESM(require("react"));
474
+ var import_material3 = require("@mui/material");
475
+ var import_Grid22 = __toESM(require("@mui/material/Grid2"));
476
+ var Muicon2 = __toESM(require("@mui/icons-material"));
477
+ var import_icons_material3 = require("@mui/icons-material");
478
+ var SCTextArea = ({
479
+ title,
480
+ infoTitle,
481
+ colorTitle,
482
+ iconTitle,
483
+ placeholder,
484
+ label = "",
485
+ variant,
486
+ required,
487
+ disabled,
488
+ width = "100%",
489
+ rows = 3,
490
+ maxLength = 200,
491
+ value,
492
+ state,
493
+ onBlur
494
+ }) => {
495
+ const [helperCount, setHelperCount] = (0, import_react4.useState)(0);
496
+ const [stateError, setStateError] = (0, import_react4.useState)(false);
497
+ const [anchorInfoTitle, setAnchorInfoTitle] = import_react4.default.useState(null);
498
+ const openInfoTitle = Boolean(anchorInfoTitle);
499
+ (0, import_react4.useEffect)(() => {
500
+ setHelperCount(value.length);
501
+ }, [value]);
502
+ let IconTitle = null;
503
+ if (iconTitle) {
504
+ if (Muicon2[iconTitle] === void 0) {
505
+ IconTitle = null;
506
+ } else {
507
+ IconTitle = Muicon2[iconTitle];
508
+ }
509
+ }
510
+ const handleBlur = (event) => {
511
+ if (required && value.trim() === "") {
512
+ setStateError(true);
513
+ setTimeout(() => {
514
+ setStateError(false);
515
+ }, 1e3);
516
+ return;
517
+ }
518
+ if (onBlur) {
519
+ onBlur(event);
520
+ }
521
+ };
522
+ 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_Grid22.default, { container: true, sx: { alignItems: "center" } }, iconTitle && IconTitle && /* @__PURE__ */ import_react4.default.createElement(IconTitle, { color: "action", sx: { mr: "4px" } }), title && /* @__PURE__ */ import_react4.default.createElement(import_material3.Typography, { color: colorTitle || "text.secondary", variant: "body1" }, title), infoTitle && /* @__PURE__ */ import_react4.default.createElement(import_material3.Tooltip, { title: infoTitle, placement: "top-end" }, /* @__PURE__ */ import_react4.default.createElement(import_material3.IconButton, { size: "small" }, /* @__PURE__ */ import_react4.default.createElement(
523
+ import_icons_material3.InfoOutlined,
524
+ {
525
+ color: "action",
526
+ fontSize: "small"
527
+ }
528
+ )))), /* @__PURE__ */ import_react4.default.createElement(import_material3.Stack, null, /* @__PURE__ */ import_react4.default.createElement(
529
+ import_material3.TextField,
530
+ {
531
+ required,
532
+ placeholder,
533
+ error: stateError,
534
+ variant,
535
+ sx: { mt: "10px" },
536
+ id: "outlined-multiline-static",
537
+ label,
538
+ multiline: true,
539
+ disabled,
540
+ rows,
541
+ value,
542
+ onBlur: handleBlur,
543
+ onChange: (e) => {
544
+ if (state) {
545
+ state(e.target.value.substring(0, maxLength));
546
+ }
547
+ },
548
+ autoComplete: "off"
549
+ }
550
+ )), /* @__PURE__ */ import_react4.default.createElement(import_material3.Stack, null, /* @__PURE__ */ import_react4.default.createElement(
551
+ import_material3.Typography,
552
+ {
553
+ variant: "caption",
554
+ color: "text.secondary",
555
+ mr: 1,
556
+ mt: 1,
557
+ align: "right"
558
+ },
559
+ helperCount + "/" + maxLength
560
+ ))));
561
+ };
562
+
563
+ // src/Components/Drawer/SCDrawer.tsx
564
+ var SCDrawer = ({
565
+ title,
566
+ colorTitle,
567
+ textButton,
568
+ iconButton,
569
+ buttonColor,
570
+ anchor = "left",
571
+ iconPosition,
572
+ width,
573
+ open,
574
+ arrayElements = [],
575
+ actions
576
+ }) => {
577
+ const [drawerOpen, setDrawerOpen] = import_react5.default.useState(open);
578
+ let IconBoton;
579
+ if (iconButton && iconButton in Muicon3) {
580
+ IconBoton = Muicon3[iconButton];
581
+ } else {
582
+ IconBoton = import_icons_material4.FilterListOutlined;
583
+ }
584
+ import_react5.default.useEffect(() => {
585
+ if (open !== void 0) {
586
+ setDrawerOpen(open);
587
+ }
588
+ }, [open]);
589
+ const handleDrawerClose = () => {
590
+ setDrawerOpen(false);
591
+ };
592
+ const toggleDrawer = (newOpen) => () => {
593
+ setDrawerOpen(newOpen);
594
+ };
595
+ const inputValidation = () => {
596
+ var _a;
597
+ let requiredValues = 0;
598
+ let filledValues = 0;
599
+ for (let i = 0; i < arrayElements.length; i++) {
600
+ if (arrayElements[i].component === void 0) {
601
+ if (arrayElements[i].required) {
602
+ requiredValues++;
603
+ }
604
+ if (arrayElements[i].required && ((_a = arrayElements[i].value) == null ? void 0 : _a.trim()) !== "") {
605
+ filledValues++;
606
+ }
607
+ }
608
+ }
609
+ if (requiredValues === filledValues) {
610
+ handleDrawerClose();
611
+ } else {
612
+ SCToastNotification({
613
+ type: "error",
614
+ title: "Algunos campos son requeridos",
615
+ time: 3e3
616
+ });
617
+ return;
618
+ }
619
+ };
620
+ const clean = () => {
621
+ var _a, _b;
622
+ for (let i = 0; i < arrayElements.length; i++) {
623
+ if (arrayElements[i].component === void 0) {
624
+ (_b = (_a = arrayElements[i]).state) == null ? void 0 : _b.call(_a, "");
625
+ }
626
+ }
627
+ };
628
+ actions = actions != null ? actions : [{ text: "Limpiar", fn: clean }, { text: "Consultar", fn: inputValidation }];
629
+ return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(
630
+ import_material4.Button,
631
+ {
632
+ sx: { textTransform: "capitalize" },
633
+ color: buttonColor,
634
+ onClick: toggleDrawer(true),
635
+ size: "small",
636
+ startIcon: iconPosition === "left" || !iconPosition ? /* @__PURE__ */ import_react5.default.createElement(import_material4.IconButton, null) : null,
637
+ endIcon: iconPosition === "right" ? /* @__PURE__ */ import_react5.default.createElement(import_material4.IconButton, null) : null
638
+ },
639
+ textButton || "Filtrar"
640
+ ), /* @__PURE__ */ import_react5.default.createElement(
641
+ import_material4.Drawer,
642
+ {
643
+ open: drawerOpen,
644
+ onClose: toggleDrawer(false),
645
+ anchor: anchor || "left",
646
+ sx: {
647
+ "& .MuiDrawer-paper": {
648
+ width: width || "450px",
649
+ boxSizing: "border-box",
650
+ borderRadius: anchor !== "right" ? "0px 4px 4px 0px" : "4px 0px 0px 4px"
651
+ }
652
+ }
653
+ },
654
+ /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { flexDirection: "column", height: "100%" }, /* @__PURE__ */ import_react5.default.createElement(import_Grid23.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 || "Personaliza tu b\xFAsqueda"), /* @__PURE__ */ import_react5.default.createElement(import_material4.IconButton, { onClick: handleDrawerClose }, /* @__PURE__ */ import_react5.default.createElement(import_Close.default, { color: "action" }))), /* @__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) => /* @__PURE__ */ import_react5.default.createElement(
655
+ import_material4.Box,
656
+ {
657
+ key: `Stack_${arrayElement.type || ""} ${arrayElement.name || ""}${index}`,
658
+ sx: { width: "100%" }
659
+ },
660
+ arrayElement.component ? /* @__PURE__ */ import_react5.default.createElement(import_material4.Stack, { direction: "row", alignItems: "left", gap: 1 }, arrayElement.component) : arrayElement.type === "text" ? /* @__PURE__ */ import_react5.default.createElement(
661
+ SCTextField,
662
+ {
663
+ title: arrayElement.title,
664
+ label: arrayElement.name,
665
+ placeholder: arrayElement.placeholder,
666
+ infoTitle: arrayElement.infoTitle,
667
+ iconTitle: arrayElement.iconTitle,
668
+ infoElement: arrayElement.infoElement,
669
+ iconInputEnd: arrayElement.iconInputEnd,
670
+ iconInputStart: arrayElement.iconInputStart,
671
+ width: arrayElement.width,
672
+ maxLength: arrayElement.maxLength,
673
+ background: arrayElement.background,
674
+ size: arrayElement.size,
675
+ variant: arrayElement.variant,
676
+ disabled: arrayElement.disabled,
677
+ required: arrayElement.required,
678
+ value: arrayElement.value,
679
+ onChange: arrayElement.onChange,
680
+ onBlur: arrayElement.onBlur,
681
+ state: arrayElement.state
682
+ }
683
+ ) : arrayElement.type === "textArea" ? /* @__PURE__ */ import_react5.default.createElement(
684
+ SCTextArea,
685
+ {
686
+ label: arrayElement.name,
687
+ placeholder: arrayElement.placeholder,
688
+ title: arrayElement.title,
689
+ infoTitle: arrayElement.infoTitle,
690
+ iconTitle: arrayElement.iconTitle,
691
+ width: arrayElement.width,
692
+ maxLength: arrayElement.maxLength,
693
+ background: arrayElement.background,
694
+ rows: arrayElement.rows,
695
+ variant: arrayElement.variant,
696
+ disabled: arrayElement.disabled,
697
+ required: arrayElement.required,
698
+ value: arrayElement.value || " ",
699
+ onBlur: arrayElement.onBlur,
700
+ state: arrayElement.state
701
+ }
702
+ ) : null
703
+ ))), (actions == null ? void 0 : actions.length) > 0 && /* @__PURE__ */ import_react5.default.createElement(
704
+ import_Grid23.default,
705
+ {
706
+ container: true,
707
+ bgcolor: "background.default",
708
+ gap: 2,
709
+ padding: "9px 16px 9px 16px",
710
+ height: "42px",
711
+ alignItems: "center",
712
+ justifyContent: actions.length > 1 ? "space-between" : "flex-end",
713
+ flexDirection: "row"
714
+ },
715
+ actions.map((button, index) => /* @__PURE__ */ import_react5.default.createElement(
716
+ import_material4.Button,
717
+ {
718
+ key: index,
719
+ variant: index === 0 || actions && actions.length < 2 ? "contained" : "text",
720
+ color: "primary",
721
+ onClick: button.fn,
722
+ disabled: button.disabled || false,
723
+ size: "small"
724
+ },
725
+ button.text
726
+ ))
727
+ ))
728
+ ));
729
+ };
730
+ // Annotate the CommonJS export names for ESM import in node:
731
+ 0 && (module.exports = {
732
+ SCDrawer,
733
+ SCTextArea,
734
+ SCTextField
735
+ });