@arquimedes.co/eureka-forms 1.9.16-test → 1.9.17-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.
Files changed (64) hide show
  1. package/dist/App.js +98 -205
  2. package/dist/AxiosAPI.js +3 -3
  3. package/dist/AxiosWidget.js +4 -4
  4. package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +104 -207
  5. package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -17
  6. package/dist/FormComponents/Form/Form.js +29 -56
  7. package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
  8. package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +7 -30
  9. package/dist/FormComponents/Section/Section.js +2 -13
  10. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
  11. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +9 -32
  12. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +47 -64
  13. package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +41 -102
  14. package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +37 -92
  15. package/dist/FormComponents/Step/AYFStepMapper.js +23 -75
  16. package/dist/FormComponents/Step/CBRStepMapper.js +56 -144
  17. package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +3 -26
  18. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +6 -21
  19. package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +3 -26
  20. package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +32 -65
  21. package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +2 -13
  22. package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +6 -21
  23. package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +2 -13
  24. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +27 -88
  25. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +81 -171
  26. package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -41
  27. package/dist/FormComponents/Step/RatingStep/RatingStep.js +2 -13
  28. package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +25 -52
  29. package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +3 -26
  30. package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +1 -2
  31. package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +3 -26
  32. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +83 -145
  33. package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +2 -13
  34. package/dist/FormComponents/Step/Step.js +19 -39
  35. package/dist/FormComponents/Step/StepFunctions.js +14 -16
  36. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +43 -62
  37. package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +2 -13
  38. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +6 -21
  39. package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +2 -13
  40. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -15
  41. package/dist/FormComponents/Step/TitleStep/TitleStep.js +3 -26
  42. package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +19 -35
  43. package/dist/FormComponents/Term/Term.js +2 -13
  44. package/dist/Widget.js +13 -25
  45. package/dist/constants/Files/FileExtensions.js +3 -3
  46. package/dist/constants/Files/FileMaxSize.js +1 -1
  47. package/dist/constants/InternalFormStyle.js +1 -1
  48. package/dist/constants/MaterialClassNameSeed.js +1 -1
  49. package/dist/controllers/FileService.js +29 -86
  50. package/dist/index.js +4 -15
  51. package/dist/shared/Loader/Loader.js +5 -17
  52. package/dist/shared/Navbar/Navbar.js +2 -14
  53. package/dist/shared/Rating/Rating.js +4 -27
  54. package/dist/shared/Rating/Ratings/LikeRating.js +9 -21
  55. package/dist/shared/Rating/Ratings/SatisfactionRating.js +15 -27
  56. package/dist/shared/Rating/Ratings/ScaleRating.js +22 -49
  57. package/dist/shared/RoundedButton/RoundedButton.js +12 -24
  58. package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +39 -84
  59. package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +235 -286
  60. package/dist/shared/RoundedSelect/RoundedSelect.js +103 -152
  61. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +125 -160
  62. package/dist/shared/RoundedTextField/RoundedTextField.js +92 -137
  63. package/dist/utils/CbrFunctions.js +30 -30
  64. package/package.json +4 -4
@@ -1,40 +1,3 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- var __rest = (this && this.__rest) || function (s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- };
38
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
39
2
  import React from 'react';
40
3
  import { makeStyles } from '@material-ui/core/styles';
@@ -43,7 +6,7 @@ import FormControl from '@material-ui/core/FormControl';
43
6
  import OutlinedInput from '@material-ui/core/OutlinedInput';
44
7
  import Select from '@material-ui/core/Select';
45
8
  import { FormHelperText } from '@material-ui/core';
46
- var useStyles = makeStyles(function (theme) { return ({
9
+ const useStyles = makeStyles((theme) => ({
47
10
  root: {
48
11
  display: 'flex',
49
12
  flexWrap: 'wrap',
@@ -55,133 +18,121 @@ var useStyles = makeStyles(function (theme) { return ({
55
18
  selectEmpty: {
56
19
  marginTop: theme.spacing(2),
57
20
  },
58
- }); });
59
- var useOutlinedInputStyles = function (props) {
60
- return makeStyles({
61
- root: {
62
- cursor: props.cantEdit ? 'default' : 'default',
63
- height: props.height,
64
- borderRadius: props.borderRadius,
65
- backgroundColor: props.innerBackgroundColor,
66
- fontSize: props.fontSize,
67
- '& $notchedOutline': {
68
- borderColor: props.outlineColor,
69
- '& legend': {
70
- fontSize: 'calc(' + props.fontSize + ' * 0.75)',
71
- },
72
- },
73
- '&:hover $notchedOutline': {
74
- borderColor: props.cantEdit
75
- ? props.outlineColor
76
- : props.focusColor,
77
- },
78
- '& .Mui-disabled': {
79
- cursor: 'default',
80
- color: props.color,
81
- },
82
- '& .Mui-error': {
83
- color: props.errorColor,
84
- },
85
- '&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
86
- borderColor: props.outlineColor,
87
- },
88
- '& .EF-MuiSelect-root': {
89
- paddingLeft: props.paddingLeft,
90
- },
91
- '&$focused $notchedOutline': {
92
- borderColor: props.focusColor,
93
- },
94
- '& .EF-MuiSelect-icon.Mui-disabled': {
95
- color: props.outlineColor,
96
- },
97
- '& .EF-MuiSelect-icon.iconOutlined': {
98
- right: 8,
99
- },
100
- '& .EF-MuiSelect-iconOpen': {
101
- transform: props.showIcon ? 'none' : 'rotate(180deg)',
21
+ }));
22
+ const useOutlinedInputStyles = (props) => makeStyles({
23
+ root: {
24
+ cursor: props.cantEdit ? 'default' : 'default',
25
+ height: props.height,
26
+ borderRadius: props.borderRadius,
27
+ backgroundColor: props.innerBackgroundColor,
28
+ fontSize: props.fontSize,
29
+ '& $notchedOutline': {
30
+ borderColor: props.outlineColor,
31
+ '& legend': {
32
+ fontSize: 'calc(' + props.fontSize + ' * 0.75)',
102
33
  },
34
+ },
35
+ '&:hover $notchedOutline': {
36
+ borderColor: props.cantEdit
37
+ ? props.outlineColor
38
+ : props.focusColor,
39
+ },
40
+ '& .Mui-disabled': {
41
+ cursor: 'default',
103
42
  color: props.color,
104
43
  },
105
- focused: {},
106
- notchedOutline: {},
107
- });
108
- };
109
- var useLabelInputStyles = function (props) {
110
- return makeStyles(function () { return ({
111
- focused: {
112
- color: props.focusColor + ' !important',
44
+ '& .Mui-error': {
45
+ color: props.errorColor,
113
46
  },
114
- root: {
115
- fontWeight: props.fontWeight,
116
- whiteSpace: 'nowrap',
117
- overflow: 'hidden',
118
- maxWidth: 'calc(100% - 45px)',
119
- textOverflow: 'ellipsis',
120
- marginTop: props.height != '40px' ? '-4px' : '0px',
121
- '&.EF-MuiInputLabel-shrink': {
122
- marginTop: '0px',
123
- maxWidth: 'calc(100% - 5px)',
124
- },
125
- '& .Mui-error': {
126
- color: props.errorColor,
127
- },
128
- '&.Mui-error': {
129
- color: props.errorColor,
130
- },
47
+ '&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
48
+ borderColor: props.outlineColor,
131
49
  },
132
- }); });
133
- };
134
- var useHelperTextStyles = function (props) {
135
- return makeStyles(function () { return ({
136
- root: {
137
- color: props.helperTextColor,
138
- '&.Mui-error': {
139
- color: props.errorColor,
140
- },
50
+ '& .EF-MuiSelect-root': {
51
+ paddingLeft: props.paddingLeft,
52
+ },
53
+ '&$focused $notchedOutline': {
54
+ borderColor: props.focusColor,
55
+ },
56
+ '& .EF-MuiSelect-icon.Mui-disabled': {
57
+ color: props.outlineColor,
58
+ },
59
+ '& .EF-MuiSelect-icon.iconOutlined': {
60
+ right: 8,
61
+ },
62
+ '& .EF-MuiSelect-iconOpen': {
63
+ transform: props.showIcon ? 'none' : 'rotate(180deg)',
64
+ },
65
+ color: props.color,
66
+ },
67
+ focused: {},
68
+ notchedOutline: {},
69
+ });
70
+ const useLabelInputStyles = (props) => makeStyles(() => ({
71
+ focused: {
72
+ color: props.focusColor + ' !important',
73
+ },
74
+ root: {
75
+ fontWeight: props.fontWeight,
76
+ whiteSpace: 'nowrap',
77
+ overflow: 'hidden',
78
+ maxWidth: 'calc(100% - 45px)',
79
+ textOverflow: 'ellipsis',
80
+ marginTop: props.height != '40px' ? '-4px' : '0px',
81
+ '&.EF-MuiInputLabel-shrink': {
82
+ marginTop: '0px',
83
+ maxWidth: 'calc(100% - 5px)',
141
84
  },
142
- }); });
143
- };
144
- function CustomSelect(_a) {
145
- var children = _a.children, _b = _a.value, value = _b === void 0 ? '' : _b, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _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.outlineColor, outlineColor = _f === void 0 ? '#0000003b' : _f, _g = _a.helperTextColor, helperTextColor = _g === void 0 ? '#989898' : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? '#ffffff' : _h, _j = _a.readOnly, readOnly = _j === void 0 ? false : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, innerBackgroundColor = _a.innerBackgroundColor, _l = _a.paddingLeft, paddingLeft = _l === void 0 ? 14 : _l, _m = _a.cantEdit, cantEdit = _m === void 0 ? false : _m, _o = _a.showIcon, showIcon = _o === void 0 ? true : _o, _p = _a.containerMargin, containerMargin = _p === void 0 ? '8px' : _p, _q = _a.height, height = _q === void 0 ? '40px' : _q, _r = _a.fontSize, fontSize = _r === void 0 ? '1rem' : _r, required = _a.required, iconComponent = _a.iconComponent, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "backgroundColor", "readOnly", "borderRadius", "innerBackgroundColor", "paddingLeft", "cantEdit", "showIcon", "containerMargin", "height", "fontSize", "required", "iconComponent", "error"]);
146
- var styleProps = {
147
- color: color,
148
- height: height,
149
- readOnly: readOnly,
150
- fontSize: fontSize,
151
- cantEdit: cantEdit,
152
- errorColor: errorColor,
153
- focusColor: focusColor,
154
- paddingLeft: paddingLeft,
155
- outlineColor: outlineColor,
156
- borderRadius: borderRadius,
157
- helperTextColor: helperTextColor,
158
- backgroundColor: backgroundColor,
85
+ '& .Mui-error': {
86
+ color: props.errorColor,
87
+ },
88
+ '&.Mui-error': {
89
+ color: props.errorColor,
90
+ },
91
+ },
92
+ }));
93
+ const useHelperTextStyles = (props) => makeStyles(() => ({
94
+ root: {
95
+ color: props.helperTextColor,
96
+ '&.Mui-error': {
97
+ color: props.errorColor,
98
+ },
99
+ },
100
+ }));
101
+ function CustomSelect({ children, value = '', handleUpdate, label, minWidth, helperText, color = '#293241', errorColor = '#cc2936', focusColor = '#3d5a7f', outlineColor = '#0000003b', helperTextColor = '#989898', backgroundColor = '#ffffff', readOnly = false, borderRadius = 10, innerBackgroundColor, paddingLeft = 14, cantEdit = false, showIcon = true, containerMargin = '8px', height = '40px', fontSize = '1rem', required, iconComponent, error, ...others }) {
102
+ const styleProps = {
103
+ color,
104
+ height,
105
+ readOnly,
106
+ fontSize,
107
+ cantEdit,
108
+ errorColor,
109
+ focusColor,
110
+ paddingLeft,
111
+ outlineColor,
112
+ borderRadius,
113
+ helperTextColor,
114
+ backgroundColor,
159
115
  showIcon: showIcon && iconComponent !== undefined,
160
- innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
116
+ innerBackgroundColor: innerBackgroundColor ?? backgroundColor,
161
117
  };
162
- var classes = useStyles();
163
- var outlinedInputClasses = useOutlinedInputStyles(styleProps)();
164
- var labelClasses = useLabelInputStyles(styleProps)();
165
- var helperTextClasses = useHelperTextStyles(styleProps)();
166
- return (_jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
167
- ? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
118
+ const classes = useStyles();
119
+ const outlinedInputClasses = useOutlinedInputStyles(styleProps)();
120
+ const labelClasses = useLabelInputStyles(styleProps)();
121
+ const helperTextClasses = useHelperTextStyles(styleProps)();
122
+ return (_jsxs(FormControl, { variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
123
+ ? { minWidth, outlineColor, margin: containerMargin }
168
124
  : {
169
125
  margin: containerMargin,
170
- }, fullWidth: true, required: required, error: error }, { children: [label && _jsx(InputLabel, __assign({ classes: labelClasses }, { children: label })), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate }, (showIcon && iconComponent
171
- ? { IconComponent: iconComponent }
172
- : {}), { input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? label + (required ? ' *' : '') : undefined, classes: outlinedInputClasses }) }, { children: children })), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText })))] })));
126
+ }, fullWidth: true, required: required, error: error, children: [label && _jsx(InputLabel, { classes: labelClasses, children: label }), _jsx(Select, { ...others, value: value, onChange: handleUpdate, ...(showIcon && iconComponent
127
+ ? { IconComponent: iconComponent }
128
+ : {}), input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? label + (required ? ' *' : '') : undefined, classes: outlinedInputClasses }), children: children }), helperText !== undefined && (_jsx(FormHelperText, { classes: helperTextClasses, children: helperText }))] }));
173
129
  }
174
130
  /**
175
131
  * Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
176
132
  */
177
- var RoundedSelect = /** @class */ (function (_super) {
178
- __extends(RoundedSelect, _super);
179
- function RoundedSelect() {
180
- return _super !== null && _super.apply(this, arguments) || this;
133
+ class RoundedSelect extends React.Component {
134
+ render() {
135
+ return _jsx(CustomSelect, { ...this.props });
181
136
  }
182
- RoundedSelect.prototype.render = function () {
183
- return _jsx(CustomSelect, __assign({}, this.props));
184
- };
185
- return RoundedSelect;
186
- }(React.Component));
137
+ }
187
138
  export default RoundedSelect;
@@ -1,25 +1,3 @@
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
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
2
  import Autocomplete, { createFilterOptions, } from '@material-ui/lab/Autocomplete';
25
3
  import { makeStyles } from '@material-ui/core/styles';
@@ -28,187 +6,174 @@ import { cloneElement } from 'react';
28
6
  import { MenuItem, Popper } from '@material-ui/core';
29
7
  import RoundedSelect from '../RoundedSelect/RoundedSelect';
30
8
  import CircularProgress from '@material-ui/core/CircularProgress';
31
- var filter = createFilterOptions();
32
- var useTextfieldStyles = function (props) {
33
- return makeStyles(function () { return ({
34
- root: {
35
- borderRadius: props.borderRadius,
36
- backgroundColor: props.backgroundColor,
37
- '& input, textarea': {
38
- cursor: props.cantEdit ? 'default' : 'text',
39
- fontWeight: props.fontWeight,
40
- color: props.color,
41
- fontSize: props.fontSize,
42
- '&::placeholder': {
43
- fontSize: props.fontSize,
44
- },
45
- backgroundColor: props.innerBackgroundColor,
46
- borderRadius: props.borderRadius,
47
- height: props.height,
48
- marginTop: '0px !important',
49
- padding: '0px 38px 0px 12px !important',
50
- },
51
- '& .EF-MuiInputBase-root': {
52
- padding: '0px !important',
53
- pointerEvents: 'all',
54
- },
55
- '& label': {
56
- marginTop: '-4px',
9
+ const filter = createFilterOptions();
10
+ const useTextfieldStyles = (props) => makeStyles(() => ({
11
+ root: {
12
+ borderRadius: props.borderRadius,
13
+ backgroundColor: props.backgroundColor,
14
+ '& input, textarea': {
15
+ cursor: props.cantEdit ? 'default' : 'text',
16
+ fontWeight: props.fontWeight,
17
+ color: props.color,
18
+ fontSize: props.fontSize,
19
+ '&::placeholder': {
57
20
  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
21
  },
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: '#787878',
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 + ' !important',
102
- },
103
- '& .EF-MuiFormHelperText-root': {
104
- color: props.helperTextColor,
105
- },
106
- '& .EF-MuiFormLabel-root.Mui-disabled': {
107
- color: '#0000008a',
22
+ backgroundColor: props.innerBackgroundColor,
23
+ borderRadius: props.borderRadius,
24
+ height: props.height,
25
+ marginTop: '0px !important',
26
+ padding: '0px 38px 0px 12px !important',
27
+ },
28
+ '& .EF-MuiInputBase-root': {
29
+ padding: '0px !important',
30
+ pointerEvents: 'all',
31
+ },
32
+ '& label': {
33
+ marginTop: '-4px',
34
+ fontSize: props.fontSize,
35
+ whiteSpace: 'nowrap',
36
+ overflow: 'hidden',
37
+ textOverflow: 'ellipsis',
38
+ maxWidth: 'calc(100% - 22px)',
39
+ },
40
+ '& label.EF-MuiInputLabel-shrink': {
41
+ marginTop: '0px',
42
+ maxWidth: 'calc(100% - 5px)',
43
+ },
44
+ '& input + fieldset': {
45
+ borderRadius: props.borderRadius,
46
+ },
47
+ '& .EF-MuiInput-underline:after': {
48
+ borderBottomColor: props.outlineColor,
49
+ },
50
+ '& .EF-MuiOutlinedInput-root': {
51
+ borderRadius: props.borderRadius,
52
+ '&.Mui-focused fieldset': {
53
+ borderColor: props.focusColor,
54
+ borderWidth: props.readOnly ? 1 : 2,
108
55
  },
109
56
  '& .EF-MuiOutlinedInput-notchedOutline': {
110
- borderColor: '#0000003b',
57
+ borderColor: props.outlineColor,
111
58
  },
112
- '.EF-MuiAutocomplete-popupIndicator': {
113
- padding: 0,
114
- },
115
- '& .EF-MuiAutocomplete-popupIndicatorOpen': {
116
- transform: props.showIcon ? 'none' : 'rotate(180deg)',
117
- },
118
- '& .EF-MuiAutocomplete-clearIndicator': {
119
- display: 'none',
59
+ height: props.height,
60
+ '& .EF-MuiAutocomplete-input': {
61
+ height: props.height,
62
+ marginTop: -10,
120
63
  },
121
- '& .EF-MuiAutocomplete-endAdornment': {
122
- top: 'calc(50% - 13px)',
64
+ '& .EF-MuiAutocomplete-input::placeholder': {
65
+ color: '#787878',
66
+ opacity: 1,
123
67
  },
124
68
  },
125
- }); });
126
- };
127
- export default function RoundedSmartSelect(_a) {
128
- var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.value, value = _c === void 0 ? '' : _c, handleUpdate = _a.handleUpdate, label = _a.label, _d = _a.getValueString, getValueString = _d === void 0 ? function (value) { return value.value; } : _d, _e = _a.color, color = _e === void 0 ? '#293241' : _e, _f = _a.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.focusColor, focusColor = _g === void 0 ? '#3d5a7f' : _g, _h = _a.helperTextColor, helperTextColor = _h === void 0 ? '#989898' : _h, _j = _a.outlineColor, outlineColor = _j === void 0 ? '#b8b8b8' : _j, _k = _a.backgroundColor, backgroundColor = _k === void 0 ? '#ffffff' : _k, _l = _a.cantEdit, cantEdit = _l === void 0 ? false : _l, _m = _a.loading, loading = _m === void 0 ? false : _m, _o = _a.height, height = _o === void 0 ? '31px' : _o, _p = _a.fontSize, fontSize = _p === void 0 ? '1rem' : _p, required = _a.required, changeListener = _a.changeListener, error = _a.error, innerBackgroundColor = _a.innerBackgroundColor, getOptionSelected = _a.getOptionSelected, helperText = _a.helperText, _q = _a.readOnly, readOnly = _q === void 0 ? false : _q, _r = _a.borderRadius, borderRadius = _r === void 0 ? 10 : _r, _s = _a.fontWeight, fontWeight = _s === void 0 ? '400' : _s, icon = _a.icon, _t = _a.searchable, searchable = _t === void 0 ? false : _t, _u = _a.containerMargin, containerMargin = _u === void 0 ? '0px' : _u, _v = _a.showIcon, showIcon = _v === void 0 ? true : _v, inputRef = _a.inputRef, disabled = _a.disabled, _w = _a.creatable, creatable = _w === void 0 ? false : _w, onBlur = _a.onBlur, name = _a.name;
129
- var props = {
130
- color: color,
131
- height: height,
132
- errorColor: errorColor,
133
- focusColor: focusColor,
134
- outlineColor: outlineColor,
135
- innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
136
- helperTextColor: helperTextColor,
137
- backgroundColor: backgroundColor,
138
- borderRadius: borderRadius,
139
- readOnly: readOnly,
140
- fontSize: fontSize,
141
- fontWeight: fontWeight,
142
- cantEdit: cantEdit,
69
+ '& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
70
+ borderColor: props.cantEdit
71
+ ? props.outlineColor
72
+ : props.focusColor,
73
+ },
74
+ '& label.Mui-focused': {
75
+ color: props.focusColor,
76
+ },
77
+ '& .Mui-error': {
78
+ color: props.errorColor + ' !important',
79
+ },
80
+ '& .EF-MuiFormHelperText-root': {
81
+ color: props.helperTextColor,
82
+ },
83
+ '& .EF-MuiFormLabel-root.Mui-disabled': {
84
+ color: '#0000008a',
85
+ },
86
+ '& .EF-MuiOutlinedInput-notchedOutline': {
87
+ borderColor: '#0000003b',
88
+ },
89
+ '.EF-MuiAutocomplete-popupIndicator': {
90
+ padding: 0,
91
+ },
92
+ '& .EF-MuiAutocomplete-popupIndicatorOpen': {
93
+ transform: props.showIcon ? 'none' : 'rotate(180deg)',
94
+ },
95
+ '& .EF-MuiAutocomplete-clearIndicator': {
96
+ display: 'none',
97
+ },
98
+ '& .EF-MuiAutocomplete-endAdornment': {
99
+ top: 'calc(50% - 13px)',
100
+ },
101
+ },
102
+ }));
103
+ export default function RoundedSmartSelect({ options = [], value = '', handleUpdate, label, getValueString = (value) => value.value, color = '#293241', errorColor = '#cc2936', focusColor = '#3d5a7f', helperTextColor = '#989898', outlineColor = '#b8b8b8', backgroundColor = '#ffffff', cantEdit = false, loading = false, height = '31px', fontSize = '1rem', required, changeListener, error, innerBackgroundColor, getOptionSelected, helperText, readOnly = false, borderRadius = 10, fontWeight = '400', icon, searchable = false, containerMargin = '0px', showIcon = true, inputRef, disabled, creatable = false, onBlur, name, }) {
104
+ const props = {
105
+ color,
106
+ height,
107
+ errorColor,
108
+ focusColor,
109
+ outlineColor,
110
+ innerBackgroundColor: innerBackgroundColor ?? backgroundColor,
111
+ helperTextColor,
112
+ backgroundColor,
113
+ borderRadius,
114
+ readOnly,
115
+ fontSize,
116
+ fontWeight,
117
+ cantEdit,
143
118
  showIcon: showIcon && icon !== undefined,
144
119
  };
145
- var textFieldClasses = useTextfieldStyles(props)();
120
+ const textFieldClasses = useTextfieldStyles(props)();
146
121
  if (searchable) {
147
- return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, freeSolo: creatable, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575' } })) : showIcon && icon ? (icon) : undefined, onOpen: function () { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
148
- var _a, _b;
122
+ return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, freeSolo: creatable, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575' } })) : showIcon && icon ? (icon) : undefined, onOpen: () => { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: (option) => {
149
123
  // Value selected with enter, right from the input
150
124
  if (typeof option === 'string') {
151
125
  return option;
152
126
  }
153
- else if (option === null || option === void 0 ? void 0 : option.inputValue) {
154
- return (_a = option.inputValue) !== null && _a !== void 0 ? _a : '';
127
+ else if (option?.inputValue) {
128
+ return option.inputValue ?? '';
155
129
  }
156
130
  else {
157
131
  // Regular option
158
- return (_b = option.label) !== null && _b !== void 0 ? _b : '';
132
+ return option.label ?? '';
159
133
  }
160
- }, getOptionSelected: getOptionSelected, PopperComponent: function (_a) {
161
- var style = _a.style, props = __rest(_a, ["style"]);
162
- return (_jsx(Popper, __assign({}, props, { style: __assign(__assign({}, style), { zIndex: 1305 }) })));
163
- }, value: value ? value : null, onChange: function (event, newValue) {
134
+ }, getOptionSelected: getOptionSelected, PopperComponent: ({ style, ...props }) => (_jsx(Popper, { ...props, style: { ...style, zIndex: 1305 } })), value: value ? value : null, onChange: (event, newValue) => {
164
135
  if (creatable) {
165
136
  if (typeof newValue === 'string') {
166
- changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue);
167
- handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
137
+ changeListener?.(newValue);
138
+ handleUpdate?.(newValue);
168
139
  }
169
140
  else if (newValue && newValue.inputValue) {
170
- changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue.inputValue);
171
- handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue.inputValue); // Create a new value from the user input
141
+ changeListener?.(newValue.inputValue);
142
+ handleUpdate?.(newValue.inputValue); // Create a new value from the user input
172
143
  }
173
144
  else {
174
- changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue === null || newValue === void 0 ? void 0 : newValue.label);
175
- handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue === null || newValue === void 0 ? void 0 : newValue.label);
145
+ changeListener?.(newValue?.label);
146
+ handleUpdate?.(newValue?.label);
176
147
  }
177
148
  }
178
149
  else {
179
- changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue);
180
- handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
150
+ changeListener?.(newValue);
151
+ handleUpdate?.(newValue);
181
152
  }
182
- }, filterOptions: function (options, params) {
183
- if (value && value.label === (params === null || params === void 0 ? void 0 : params.inputValue)) {
153
+ }, filterOptions: (options, params) => {
154
+ if (value && value.label === params?.inputValue) {
184
155
  return options;
185
156
  }
186
157
  else {
187
- var filtered = filter(options, params);
158
+ const filtered = filter(options, params);
188
159
  // Suggest the creation of a new value
189
160
  if (creatable && params.inputValue !== '') {
190
161
  filtered.push({
191
162
  inputValue: params.inputValue,
192
- label: "Crear \"".concat(params.inputValue, "\""),
163
+ label: `Crear "${params.inputValue}"`,
193
164
  });
194
165
  }
195
166
  return filtered;
196
167
  }
197
- }, renderOption: function (option) {
198
- return typeof option === 'string' ? option : option.label;
199
- }, renderInput: function (params) { return (_jsx(TextField, __assign({ classes: textFieldClasses }, params, { inputRef: inputRef, onBlur: onBlur, name: name, variant: "outlined", label: label, required: required, error: error, helperText: helperText }))); }, style: { pointerEvents: 'none' }, noOptionsText: "No hay opciones" }));
168
+ }, renderOption: (option) => typeof option === 'string' ? option : option.label, renderInput: (params) => (_jsx(TextField, { classes: textFieldClasses, ...params, inputRef: inputRef, onBlur: onBlur, name: name, variant: "outlined", label: label, required: required, error: error, helperText: helperText })), style: { pointerEvents: 'none' }, noOptionsText: "No hay opciones" }));
200
169
  }
201
170
  else {
202
- return (_jsxs(RoundedSelect, __assign({ onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: function (event) {
203
- handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(options.find(function (option) {
204
- return getValueString(option) == event.target.value;
205
- }));
206
- }, onOpen: function () {
171
+ return (_jsxs(RoundedSelect, { onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: (event) => {
172
+ handleUpdate?.(options.find((option) => getValueString(option) == event.target.value));
173
+ }, onOpen: () => {
207
174
  //Show loading icon if loading
208
175
  }, value: getValueString(value), color: color, errorColor: errorColor, focusColor: focusColor, helperTextColor: helperTextColor, backgroundColor: backgroundColor, outlineColor: outlineColor, innerBackgroundColor: innerBackgroundColor, cantEdit: cantEdit, label: label, required: required, readOnly: readOnly, helperText: helperText, containerMargin: containerMargin, height: height, fontSize: fontSize, error: error, iconComponent: icon
209
- ? function (props) {
210
- return cloneElement(icon, props);
211
- }
212
- : undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: "Sin Seleccionar" }) }), 'EMPTY'), options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); })] })));
176
+ ? (props) => cloneElement(icon, props)
177
+ : undefined, showIcon: showIcon, children: [_jsx(MenuItem, { value: '', style: { whiteSpace: 'normal' }, children: _jsx("em", { children: "Sin Seleccionar" }) }, 'EMPTY'), options.map((option) => (_jsx(MenuItem, { value: getValueString(option), style: { whiteSpace: 'normal' }, children: option.label }, getValueString(option))))] }));
213
178
  }
214
179
  }