@arquimedes.co/eureka-forms 1.4.0-test → 1.4.2-test
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/@Types/Form.d.ts +1 -1
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +1 -1
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +5 -2
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -1
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.d.ts +1 -1
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +1 -1
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +1 -1
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +5 -1
- package/dist/shared/RoundedSelect/RoundedSelect.js +8 -2
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +63 -0
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +182 -0
- package/dist/shared/RoundedTextField/RoundedTextField.js +3 -2
- package/package.json +1 -1
package/dist/@Types/Form.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ function CheckBoxStep(_a) {
|
|
|
21
21
|
? '100%'
|
|
22
22
|
: calcStepWidth(step.size, form),
|
|
23
23
|
minHeight: step.description || step.required ? '55px' : '43px',
|
|
24
|
-
} }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }), void 0), _jsx(Controller, { name: step.id, control: control, defaultValue: false, rules: {
|
|
24
|
+
} }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }), void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: false, rules: {
|
|
25
25
|
required: step.required
|
|
26
26
|
? 'Este campo es obligatorio'
|
|
27
27
|
: undefined,
|
|
@@ -63,7 +63,10 @@ function ClassifierSelector(_a) {
|
|
|
63
63
|
return ((_a = step.options[classifier._id]) === null || _a === void 0 ? void 0 : _a.type) !==
|
|
64
64
|
ClassifierOptionTypes.HIDE;
|
|
65
65
|
})
|
|
66
|
-
.map(function (classifier) {
|
|
66
|
+
.map(function (classifier) {
|
|
67
|
+
var _a;
|
|
68
|
+
return typeof classifier === 'string' ? (_jsx(MenuItem, __assign({ value: classifier, style: { whiteSpace: 'normal' } }, { children: (_a = form.classifiers[classifier]) === null || _a === void 0 ? void 0 : _a.name }), classifier)) : (_jsx(MenuItem, __assign({ value: classifier._id, style: { whiteSpace: 'normal' } }, { children: classifier.name }), classifier._id));
|
|
69
|
+
})] }), void 0) }), step.id));
|
|
67
70
|
};
|
|
68
71
|
var mapNestedOption = function () {
|
|
69
72
|
if (value) {
|
|
@@ -85,7 +88,7 @@ function ClassifierSelector(_a) {
|
|
|
85
88
|
: 'fit-content',
|
|
86
89
|
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
87
90
|
width: fillerSize,
|
|
88
|
-
} },
|
|
91
|
+
} }, "SEPARATOR"))] }), void 0));
|
|
89
92
|
}
|
|
90
93
|
else {
|
|
91
94
|
return (_jsxs(React.Fragment, { children: [renderSelect(), mapNestedOption(), level === 0 && _jsx("div", { className: styles.separator }, void 0)] }, void 0));
|
|
@@ -13,6 +13,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import styles from './MaterialTitleStep.module.css';
|
|
14
14
|
function TitleStep(_a) {
|
|
15
15
|
var step = _a.step, formStyle = _a.formStyle;
|
|
16
|
-
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.title }), void 0), step.description && (_jsx("p", __assign({ className: styles.descriptionPar
|
|
16
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.title }), void 0), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
|
|
17
|
+
marginTop: step.title ? '15px' : '0px',
|
|
18
|
+
} }, { children: step.description }), void 0))] }), void 0));
|
|
17
19
|
}
|
|
18
20
|
export default TitleStep;
|
|
@@ -71,7 +71,7 @@ var useCheckBoxStyles = function (props) {
|
|
|
71
71
|
* Generic rounded checkbox
|
|
72
72
|
*/
|
|
73
73
|
function CustomCheckBox(_a) {
|
|
74
|
-
var _b = _a.padding, padding = _b === void 0 ? '9px' : _b, onChange = _a.onChange, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? '1.5rem' : _d, _e = _a.
|
|
74
|
+
var _b = _a.padding, padding = _b === void 0 ? '9px' : _b, onChange = _a.onChange, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? '1.5rem' : _d, _e = _a.checkedColor, checkedColor = _e === void 0 ? '#3d5a7f' : _e, _f = _a.uncheckedColor, uncheckedColor = _f === void 0 ? '#787878' : _f, _g = _a.disabledColor, disabledColor = _g === void 0 ? '#A0A0A0' : _g, _h = _a.errorColor, errorColor = _h === void 0 ? '#cc2936' : _h, _j = _a.cantEdit, cantEdit = _j === void 0 ? false : _j, checked = _a.checked, others = __rest(_a, ["padding", "onChange", "error", "size", "checkedColor", "uncheckedColor", "disabledColor", "errorColor", "cantEdit", "checked"]);
|
|
75
75
|
var classes = useCheckBoxStyles({
|
|
76
76
|
size: size,
|
|
77
77
|
error: error,
|
|
@@ -101,8 +101,8 @@ var useDatePickerLabelStyles = function (props) {
|
|
|
101
101
|
whiteSpace: 'nowrap',
|
|
102
102
|
overflow: 'hidden',
|
|
103
103
|
maxWidth: 'calc(100% - 50px)',
|
|
104
|
-
textOverflow: 'ellipsis',
|
|
105
104
|
marginTop: '-4px',
|
|
105
|
+
textOverflow: 'ellipsis',
|
|
106
106
|
fontSize: props.fontSize,
|
|
107
107
|
'&.Mui-focused': {
|
|
108
108
|
color: props.focusColor,
|
|
@@ -15,6 +15,8 @@ interface ColorProps {
|
|
|
15
15
|
height?: string;
|
|
16
16
|
/** The color of the text in the form */
|
|
17
17
|
color?: string;
|
|
18
|
+
/** If custom iconComponent exists */
|
|
19
|
+
showIcon?: boolean;
|
|
18
20
|
}
|
|
19
21
|
interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
20
22
|
/** children to display in the options */
|
|
@@ -22,7 +24,7 @@ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
|
22
24
|
/** Currently selected value */
|
|
23
25
|
value: any;
|
|
24
26
|
/** function called when value changes */
|
|
25
|
-
handleUpdate
|
|
27
|
+
handleUpdate?: (event: React.ChangeEvent<{
|
|
26
28
|
name?: string | undefined;
|
|
27
29
|
value: any;
|
|
28
30
|
}>, child?: React.ReactNode) => void;
|
|
@@ -38,6 +40,8 @@ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
|
38
40
|
helperText?: string;
|
|
39
41
|
/** the margin around the selector */
|
|
40
42
|
containerMargin?: string;
|
|
43
|
+
/** The icon to display */
|
|
44
|
+
iconComponent?: any;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -85,6 +85,9 @@ var useOutlinedInputStyles = function (props) {
|
|
|
85
85
|
'& .EF-MuiSelect-icon.Mui-disabled': {
|
|
86
86
|
color: props.outlineColor,
|
|
87
87
|
},
|
|
88
|
+
'& .EF-MuiSelect-iconOpen': {
|
|
89
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
90
|
+
},
|
|
88
91
|
borderRadius: 10,
|
|
89
92
|
color: props.color,
|
|
90
93
|
},
|
|
@@ -127,7 +130,7 @@ var useHelperTextStyles = function (props) {
|
|
|
127
130
|
}); });
|
|
128
131
|
};
|
|
129
132
|
function CustomSelect(_a) {
|
|
130
|
-
var children = _a.children, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _b = _a.color, color = _b === void 0 ? '#293241' : _b, _c = _a.errorColor, errorColor = _c === void 0 ? '#cc2936' : _c, _d = _a.focusColor, focusColor = _d === void 0 ? '#3d5a7f' : _d, _e = _a.outlineColor, outlineColor = _e === void 0 ? '#0000003b' : _e, _f = _a.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.cantEdit, cantEdit = _g === void 0 ? false : _g, _h = _a.containerMargin, containerMargin =
|
|
133
|
+
var children = _a.children, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _b = _a.color, color = _b === void 0 ? '#293241' : _b, _c = _a.errorColor, errorColor = _c === void 0 ? '#cc2936' : _c, _d = _a.focusColor, focusColor = _d === void 0 ? '#3d5a7f' : _d, _e = _a.outlineColor, outlineColor = _e === void 0 ? '#0000003b' : _e, _f = _a.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.cantEdit, cantEdit = _g === void 0 ? false : _g, _h = _a.showIcon, showIcon = _h === void 0 ? true : _h, _j = _a.containerMargin, containerMargin = _j === void 0 ? '8px' : _j, _k = _a.height, height = _k === void 0 ? '40px' : _k, required = _a.required, iconComponent = _a.iconComponent, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "cantEdit", "showIcon", "containerMargin", "height", "required", "iconComponent", "error"]);
|
|
131
134
|
var classes = useStyles();
|
|
132
135
|
var outlinedInputClasses = useOutlinedInputStyles({
|
|
133
136
|
helperTextColor: helperTextColor,
|
|
@@ -137,6 +140,7 @@ function CustomSelect(_a) {
|
|
|
137
140
|
cantEdit: cantEdit,
|
|
138
141
|
height: height,
|
|
139
142
|
color: color,
|
|
143
|
+
showIcon: showIcon && iconComponent !== undefined,
|
|
140
144
|
})();
|
|
141
145
|
var labelClasses = useLabelInputStyles({
|
|
142
146
|
helperTextColor: helperTextColor,
|
|
@@ -160,7 +164,9 @@ function CustomSelect(_a) {
|
|
|
160
164
|
? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
|
|
161
165
|
: {
|
|
162
166
|
margin: containerMargin,
|
|
163
|
-
}, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate
|
|
167
|
+
}, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate }, (showIcon && iconComponent
|
|
168
|
+
? { IconComponent: iconComponent }
|
|
169
|
+
: {}), { input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label + (required ? ' *' : ''), classes: outlinedInputClasses }, void 0) }, { children: children }), void 0), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText }), void 0))] }), void 0));
|
|
164
170
|
}
|
|
165
171
|
/**
|
|
166
172
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextFieldProps } from '@material-ui/core';
|
|
3
|
+
interface StyleProps {
|
|
4
|
+
/** The color of the outline when selected and hovered on */
|
|
5
|
+
focusColor?: string;
|
|
6
|
+
/** The color of the outline when it is not selected */
|
|
7
|
+
outlineColor?: string;
|
|
8
|
+
/** The color of the background */
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
/** The color of the error to display */
|
|
11
|
+
errorColor?: string;
|
|
12
|
+
/** If the style should change on hover */
|
|
13
|
+
cantEdit?: boolean;
|
|
14
|
+
/** The hight of the container */
|
|
15
|
+
height?: string;
|
|
16
|
+
/** The color of the text in the form */
|
|
17
|
+
color?: string;
|
|
18
|
+
/** The fontsize of the content */
|
|
19
|
+
fontSize?: string;
|
|
20
|
+
/** The color of the inner input */
|
|
21
|
+
innerBackgroundColor?: string;
|
|
22
|
+
/** The borderRadius of the input */
|
|
23
|
+
borderRadius?: number;
|
|
24
|
+
/** If input is readOnly */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
/** The weight of the font of the value and the placeholder */
|
|
27
|
+
fontWeight?: number | string;
|
|
28
|
+
/** The color of the helper text when not error */
|
|
29
|
+
helperTextColor?: string;
|
|
30
|
+
/** If custom iconComponent exists */
|
|
31
|
+
showIcon?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color'>, StyleProps {
|
|
34
|
+
/** Currently selected value */
|
|
35
|
+
value: any;
|
|
36
|
+
/** The array of options to display */
|
|
37
|
+
options?: any[];
|
|
38
|
+
/** If the input is loading */
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
/** Function to call to fetch data if none is found */
|
|
41
|
+
fetchData?: () => Promise<void>;
|
|
42
|
+
/** function called when value changes */
|
|
43
|
+
handleUpdate?: (event: React.ChangeEvent<{
|
|
44
|
+
name?: string | undefined;
|
|
45
|
+
value: any;
|
|
46
|
+
}>, child?: React.ReactNode) => void;
|
|
47
|
+
/** Strig to place in the label */
|
|
48
|
+
label: string;
|
|
49
|
+
/** Minimum width in px of the component */
|
|
50
|
+
minWidth?: number;
|
|
51
|
+
/** The helper Text to display */
|
|
52
|
+
helperText?: string;
|
|
53
|
+
/** The margin around the selector */
|
|
54
|
+
containerMargin?: string;
|
|
55
|
+
/** The icon to display */
|
|
56
|
+
icon?: React.ReactNode;
|
|
57
|
+
/** The iconComponent to display in the selector */
|
|
58
|
+
iconComponent?: any;
|
|
59
|
+
/** If the options are searchable */
|
|
60
|
+
searchable?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export default function RoundedSmartSelect({ options, value, handleUpdate, label, fetchData, color, errorColor, focusColor, helperTextColor, outlineColor, backgroundColor, cantEdit, loading, height, fontSize, required, error, innerBackgroundColor, helperText, readOnly, borderRadius, fontWeight, icon, iconComponent, searchable, containerMargin, showIcon, }: RoundedSmartSelectProps): JSX.Element;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import Autocomplete, { createFilterOptions, } from '@material-ui/lab/Autocomplete';
|
|
25
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
26
|
+
import TextField from '@material-ui/core/TextField';
|
|
27
|
+
import { Popper } from '@material-ui/core';
|
|
28
|
+
import RoundedSelect from '../RoundedSelect/RoundedSelect';
|
|
29
|
+
var filter = createFilterOptions();
|
|
30
|
+
var useStyles = makeStyles(function (theme) { return ({
|
|
31
|
+
root: {
|
|
32
|
+
'& > * + *': {
|
|
33
|
+
marginTop: theme.spacing(3),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}); });
|
|
37
|
+
var useTextfieldStyles = function (props) {
|
|
38
|
+
return makeStyles(function () { return ({
|
|
39
|
+
root: {
|
|
40
|
+
borderRadius: props.borderRadius,
|
|
41
|
+
backgroundColor: props.backgroundColor,
|
|
42
|
+
'& input, textarea': {
|
|
43
|
+
cursor: props.cantEdit ? 'default' : 'text',
|
|
44
|
+
padding: '6px 12px',
|
|
45
|
+
fontWeight: props.fontWeight,
|
|
46
|
+
color: props.color,
|
|
47
|
+
fontSize: props.fontSize,
|
|
48
|
+
'&::placeholder': {
|
|
49
|
+
fontSize: props.fontSize,
|
|
50
|
+
},
|
|
51
|
+
backgroundColor: props.innerBackgroundColor,
|
|
52
|
+
borderRadius: props.borderRadius,
|
|
53
|
+
height: props.height,
|
|
54
|
+
},
|
|
55
|
+
'& label': {
|
|
56
|
+
marginTop: '-4px',
|
|
57
|
+
fontSize: props.fontSize,
|
|
58
|
+
whiteSpace: 'nowrap',
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
textOverflow: 'ellipsis',
|
|
61
|
+
maxWidth: 'calc(100% - 22px)',
|
|
62
|
+
},
|
|
63
|
+
'& label.EF-MuiInputLabel-shrink': {
|
|
64
|
+
marginTop: '0px',
|
|
65
|
+
maxWidth: 'calc(100% - 5px)',
|
|
66
|
+
},
|
|
67
|
+
'& input + fieldset': {
|
|
68
|
+
borderRadius: props.borderRadius,
|
|
69
|
+
},
|
|
70
|
+
'& .EF-MuiInput-underline:after': {
|
|
71
|
+
borderBottomColor: props.outlineColor,
|
|
72
|
+
},
|
|
73
|
+
'& .EF-MuiOutlinedInput-root': {
|
|
74
|
+
borderRadius: props.borderRadius,
|
|
75
|
+
'&.Mui-focused fieldset': {
|
|
76
|
+
borderColor: props.focusColor,
|
|
77
|
+
borderWidth: props.readOnly ? 1 : 2,
|
|
78
|
+
},
|
|
79
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
80
|
+
borderColor: props.outlineColor,
|
|
81
|
+
},
|
|
82
|
+
height: props.height,
|
|
83
|
+
'& .EF-MuiAutocomplete-input': {
|
|
84
|
+
height: props.height,
|
|
85
|
+
marginTop: -10,
|
|
86
|
+
},
|
|
87
|
+
'& .EF-MuiAutocomplete-input::placeholder': {
|
|
88
|
+
color: 'var(--greyFont)',
|
|
89
|
+
opacity: 1,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
'& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
|
|
93
|
+
borderColor: props.cantEdit
|
|
94
|
+
? props.outlineColor
|
|
95
|
+
: props.focusColor,
|
|
96
|
+
},
|
|
97
|
+
'& label.Mui-focused': {
|
|
98
|
+
color: props.focusColor,
|
|
99
|
+
},
|
|
100
|
+
'& .Mui-error': {
|
|
101
|
+
color: props.errorColor,
|
|
102
|
+
},
|
|
103
|
+
'& .EF-MuiFormHelperText-root': {
|
|
104
|
+
color: props.helperTextColor,
|
|
105
|
+
},
|
|
106
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
107
|
+
borderColor: '#0000003b',
|
|
108
|
+
},
|
|
109
|
+
'.EF-MuiAutocomplete-popupIndicator': {
|
|
110
|
+
padding: 0,
|
|
111
|
+
},
|
|
112
|
+
'& .EF-MuiAutocomplete-popupIndicatorOpen': {
|
|
113
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}); });
|
|
117
|
+
};
|
|
118
|
+
export default function RoundedSmartSelect(_a) {
|
|
119
|
+
var _b = _a.options, options = _b === void 0 ? [] : _b, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, fetchData = _a.fetchData, _c = _a.color, color = _c === void 0 ? '#293241' : _c, _d = _a.errorColor, errorColor = _d === void 0 ? '#cc2936' : _d, _e = _a.focusColor, focusColor = _e === void 0 ? '#3d5a7f' : _e, _f = _a.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.outlineColor, outlineColor = _g === void 0 ? '#b8b8b8' : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? '#ffffff' : _h, _j = _a.cantEdit, cantEdit = _j === void 0 ? false : _j, _k = _a.loading, loading = _k === void 0 ? false : _k, _l = _a.height, height = _l === void 0 ? '31px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, required = _a.required, error = _a.error, innerBackgroundColor = _a.innerBackgroundColor, helperText = _a.helperText, _o = _a.readOnly, readOnly = _o === void 0 ? false : _o, _p = _a.borderRadius, borderRadius = _p === void 0 ? 10 : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '400' : _q, icon = _a.icon, iconComponent = _a.iconComponent, _r = _a.searchable, searchable = _r === void 0 ? false : _r, _s = _a.containerMargin, containerMargin = _s === void 0 ? '0px' : _s, _t = _a.showIcon, showIcon = _t === void 0 ? true : _t;
|
|
120
|
+
var props = {
|
|
121
|
+
color: color,
|
|
122
|
+
height: height,
|
|
123
|
+
errorColor: errorColor,
|
|
124
|
+
focusColor: focusColor,
|
|
125
|
+
outlineColor: outlineColor,
|
|
126
|
+
innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
|
|
127
|
+
helperTextColor: helperTextColor,
|
|
128
|
+
backgroundColor: backgroundColor,
|
|
129
|
+
borderRadius: borderRadius,
|
|
130
|
+
readOnly: readOnly,
|
|
131
|
+
fontSize: fontSize,
|
|
132
|
+
fontWeight: fontWeight,
|
|
133
|
+
cantEdit: cantEdit,
|
|
134
|
+
showIcon: showIcon && icon !== undefined,
|
|
135
|
+
};
|
|
136
|
+
// const fetchAreas = async (): Promise<void> => {
|
|
137
|
+
// const response = await axiosInstance.get('agents/areas');
|
|
138
|
+
// setLoading(false);
|
|
139
|
+
// setOptions(response.data.map((option: string) => ({ label: option })));
|
|
140
|
+
// };
|
|
141
|
+
var classes = useStyles();
|
|
142
|
+
var textFieldClasses = useTextfieldStyles(props)();
|
|
143
|
+
if (searchable) {
|
|
144
|
+
return (_jsx("div", __assign({ className: classes.root }, { children: _jsx(Autocomplete, { size: "small", fullWidth: true, popupIcon: showIcon && icon ? icon : undefined, onOpen: function () {
|
|
145
|
+
if (options.length === 0 && fetchData) {
|
|
146
|
+
fetchData();
|
|
147
|
+
}
|
|
148
|
+
}, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
|
|
149
|
+
// Value selected with enter, right from the input
|
|
150
|
+
if (typeof option === 'string') {
|
|
151
|
+
return option;
|
|
152
|
+
}
|
|
153
|
+
else if (option.inputValue) {
|
|
154
|
+
return option.inputValue;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
// Regular option
|
|
158
|
+
return option.label;
|
|
159
|
+
}
|
|
160
|
+
}, PopperComponent: function (_a) {
|
|
161
|
+
var style = _a.style, props = __rest(_a, ["style"]);
|
|
162
|
+
return (_jsx(Popper, __assign({}, props, { style: __assign(__assign({}, style), { zIndex: 1305 }) }), void 0));
|
|
163
|
+
}, value: value !== null && value !== void 0 ? value : '', onChange: function (event, newValue) {
|
|
164
|
+
if (typeof newValue === 'string') {
|
|
165
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue === null || newValue === void 0 ? void 0 : newValue.label);
|
|
169
|
+
}
|
|
170
|
+
}, filterOptions: function (options, params) {
|
|
171
|
+
var filtered = filter(options, params);
|
|
172
|
+
return filtered;
|
|
173
|
+
}, renderOption: function (option) { return option.label; }, renderInput: function (params) { return (_jsx(TextField, __assign({ classes: textFieldClasses }, params, { variant: "outlined", label: label, required: required, error: error, helperText: helperText }), void 0)); }, noOptionsText: "No hay opciones" }, void 0) }), void 0));
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return (_jsx(RoundedSelect, { fullWidth: true, handleUpdate: handleUpdate, onOpen: function () {
|
|
177
|
+
if (options.length === 0 && fetchData) {
|
|
178
|
+
fetchData();
|
|
179
|
+
}
|
|
180
|
+
}, value: value, color: color, errorColor: errorColor, focusColor: focusColor, helperTextColor: helperTextColor, outlineColor: outlineColor, cantEdit: cantEdit, label: label, required: required, readOnly: readOnly, helperText: helperText, containerMargin: containerMargin, height: height, error: error, iconComponent: iconComponent, showIcon: showIcon }, void 0));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -102,7 +102,7 @@ var useTextfieldStyles = function (props) {
|
|
|
102
102
|
}); });
|
|
103
103
|
};
|
|
104
104
|
function CustomTextfield(_a) {
|
|
105
|
-
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.helperTextColor, helperTextColor = _c === void 0 ? '#989898' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.borderRadius, borderRadius = _h === void 0 ? 10 : _h, _j = _a.padding, padding = _j === void 0 ? '6px 12px' : _j, _k = _a.fontSize, fontSize = _k === void 0 ? '1rem' : _k, _l = _a.shrunkenFontSize, shrunkenFontSize = _l === void 0 ? '1rem' : _l, _m = _a.errorColor, errorColor = _m === void 0 ? '#cc2936' : _m, _o = _a.fontWeight, fontWeight = _o === void 0 ? '300' : _o, _p = _a.multiline, multiline = _p === void 0 ? false : _p, _q = _a.cantEdit, cantEdit = _q === void 0 ? false : _q, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit"]);
|
|
105
|
+
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.helperTextColor, helperTextColor = _c === void 0 ? '#989898' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.borderRadius, borderRadius = _h === void 0 ? 10 : _h, _j = _a.padding, padding = _j === void 0 ? '6px 12px' : _j, _k = _a.fontSize, fontSize = _k === void 0 ? '1rem' : _k, _l = _a.shrunkenFontSize, shrunkenFontSize = _l === void 0 ? '1rem' : _l, _m = _a.errorColor, errorColor = _m === void 0 ? '#cc2936' : _m, _o = _a.fontWeight, fontWeight = _o === void 0 ? '300' : _o, _p = _a.multiline, multiline = _p === void 0 ? false : _p, _q = _a.cantEdit, cantEdit = _q === void 0 ? false : _q, inputProps = _a.inputProps, value = _a.value, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit", "inputProps", "value"]);
|
|
106
106
|
var classes = useTextfieldStyles({
|
|
107
107
|
padding: padding,
|
|
108
108
|
textColor: textColor,
|
|
@@ -120,9 +120,10 @@ function CustomTextfield(_a) {
|
|
|
120
120
|
multiline: multiline,
|
|
121
121
|
cantEdit: cantEdit,
|
|
122
122
|
})();
|
|
123
|
-
return (_jsx(TextField, __assign({ classes: classes }, others, { multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: {
|
|
123
|
+
return (_jsx(TextField, __assign({ classes: classes }, others, { value: value !== null && value !== void 0 ? value : '', multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: {
|
|
124
124
|
readOnly: readOnly,
|
|
125
125
|
disabled: cantEdit,
|
|
126
|
+
inputProps: inputProps,
|
|
126
127
|
} }), void 0));
|
|
127
128
|
}
|
|
128
129
|
/**
|
package/package.json
CHANGED