@arquimedes.co/eureka-forms 1.4.2-test → 1.4.5-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 (58) hide show
  1. package/dist/@Types/CBRFormStep.d.ts +72 -0
  2. package/dist/@Types/CBRFormStep.js +1 -0
  3. package/dist/@Types/Form.d.ts +3 -0
  4. package/dist/@Types/FormStep.d.ts +10 -41
  5. package/dist/@Types/GenericFormSteps.d.ts +58 -0
  6. package/dist/@Types/GenericFormSteps.js +1 -0
  7. package/dist/App.js +27 -8
  8. package/dist/App.module.css +1 -0
  9. package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +1 -1
  10. package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +45 -12
  11. package/dist/FormComponents/Form/Form.d.ts +4 -1
  12. package/dist/FormComponents/Form/Form.js +22 -10
  13. package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +2 -1
  14. package/dist/FormComponents/Section/Section.d.ts +4 -1
  15. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +9 -0
  16. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +25 -0
  17. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +8 -0
  18. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +48 -0
  19. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.module.css +60 -0
  20. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +11 -0
  21. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +112 -0
  22. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +34 -0
  23. package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.d.ts +8 -0
  24. package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +124 -0
  25. package/dist/FormComponents/Step/CBRStepMapper.d.ts +13 -0
  26. package/dist/FormComponents/Step/CBRStepMapper.js +243 -0
  27. package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_INMUEBLE.json +13151 -0
  28. package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_LOCATIVAS.json +71 -0
  29. package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_PROYECTO.json +74 -0
  30. package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_TIPO_DOC.json +50 -0
  31. package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_TIPO_ESPACIO.json +320 -0
  32. package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_TIPO_SOLICITANTE.json +42 -0
  33. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +1 -1
  34. package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +7 -5
  35. package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +1 -1
  36. package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +7 -5
  37. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +4 -0
  38. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +147 -0
  39. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.module.css +9 -0
  40. package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +24 -0
  41. package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +25 -0
  42. package/dist/FormComponents/Step/Step.js +6 -1
  43. package/dist/FormComponents/Step/StepFunctions.d.ts +3 -3
  44. package/dist/FormComponents/Step/StepFunctions.js +5 -5
  45. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +5 -2
  46. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +0 -1
  47. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +1 -1
  48. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +3 -3
  49. package/dist/FormComponents/Step/TextInputStep/TextInputStep.d.ts +2 -0
  50. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +1 -1
  51. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +1 -8
  52. package/dist/constants/CBRFormStepTypes.d.ts +20 -0
  53. package/dist/constants/CBRFormStepTypes.js +21 -0
  54. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +3 -3
  55. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +40 -50
  56. package/dist/shared/RoundedTextField/RoundedTextField.d.ts +2 -0
  57. package/dist/shared/RoundedTextField/RoundedTextField.js +5 -1
  58. package/package.json +2 -1
@@ -0,0 +1,147 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
59
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
60
+ import styles from './MaterialSmartSelectStep.module.css';
61
+ import { Controller } from 'react-hook-form';
62
+ import { calcStepWidth } from '../../StepFunctions';
63
+ import RoundedSmartSelect from '../../../../shared/RoundedSmartSelect/RoundedSmartSelect';
64
+ import { cloneElement, useEffect, useState } from 'react';
65
+ import React from 'react';
66
+ function SmartSelect(_a) {
67
+ var _this = this;
68
+ var _b, _c, _d;
69
+ var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, dependencyStore = _a.dependencyStore, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "calcDepError", "iconComponent", "valueOverwrite", "dependencyStore", "getOptionSelected", "setDependencyStore"]);
70
+ var _e = useState(), options = _e[0], setOptions = _e[1];
71
+ var _f = useState(), depError = _f[0], setDepError = _f[1];
72
+ var calcOptions = function () { return __awaiter(_this, void 0, void 0, function () {
73
+ var resp;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, (getOptions === null || getOptions === void 0 ? void 0 : getOptions(step, dependencyStore))];
77
+ case 1:
78
+ resp = _a.sent();
79
+ if (resp !== null) {
80
+ setDepError(undefined);
81
+ }
82
+ setOptions(resp);
83
+ return [2 /*return*/];
84
+ }
85
+ });
86
+ }); };
87
+ useEffect(function () {
88
+ if (value) {
89
+ onChange(null);
90
+ }
91
+ calcOptions();
92
+ }, (_c = (_b = step.dependencies) === null || _b === void 0 ? void 0 : _b.map(function (dep) { return dependencyStore[dep]; })) !== null && _c !== void 0 ? _c : []);
93
+ var handleMissingDep = function () { return __awaiter(_this, void 0, void 0, function () {
94
+ var missingDeps, _i, _a, idDep;
95
+ return __generator(this, function (_b) {
96
+ if (step.dependencies) {
97
+ missingDeps = [];
98
+ for (_i = 0, _a = step.dependencies; _i < _a.length; _i++) {
99
+ idDep = _a[_i];
100
+ if (dependencyStore[idDep] === null) {
101
+ missingDeps.push(idDep);
102
+ }
103
+ }
104
+ setDepError(calcDepError === null || calcDepError === void 0 ? void 0 : calcDepError(missingDeps.map(function (idDep) { var _a; return (_a = form.steps[idDep]) === null || _a === void 0 ? void 0 : _a.type; })));
105
+ if (missingDeps.length > 0) {
106
+ trigger(missingDeps, { shouldFocus: true });
107
+ }
108
+ }
109
+ return [2 /*return*/];
110
+ });
111
+ }); };
112
+ return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.container, style: {
113
+ width: widthStats.currentBreakPoint <= step.size
114
+ ? '100%'
115
+ : calcStepWidth(step.size, form.size),
116
+ minHeight: step.description || step.required ? '55px' : '43px',
117
+ }, onClick: function () {
118
+ if (options === null) {
119
+ handleMissingDep();
120
+ }
121
+ } }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: options === null, loading: options === undefined, options: options !== null && options !== void 0 ? options : [], "data-testid": step.id, inputRef: inputRef, cantEdit: postview, fullWidth: true, backgroundColor: "transparent", innerBackgroundColor: (_d = formStyle.stepBackgroundColor) !== null && _d !== void 0 ? _d : 'white', label: step.label, required: step.required, height: '31px', searchable: step.searchable, icon: step.showIcon ? icon : undefined, iconComponent: step.showIcon ? iconComponent : undefined, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, containerMargin: "0px", handleUpdate: function (value) {
122
+ var _a;
123
+ if (dependencyStore[step.id] !== undefined) {
124
+ setDependencyStore(__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = value, _a)));
125
+ }
126
+ valueOverwrite
127
+ ? onChange(valueOverwrite(value))
128
+ : onChange(value);
129
+ }, getOptionSelected: getOptionSelected, helperText: depError !== null && depError !== void 0 ? depError : (errors[step.id]
130
+ ? errors[step.id].message
131
+ : step.description), error: depError !== undefined || !!errors[step.id] }, void 0) }), void 0), children &&
132
+ cloneElement(children, {
133
+ value: value,
134
+ stepProps: __assign({ step: step, form: form, errors: errors, trigger: trigger, postview: postview, formStyle: formStyle, widthStats: widthStats, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
135
+ })] }, void 0));
136
+ }
137
+ function SmartSelectStep(props) {
138
+ return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: null, rules: {
139
+ required: props.step.required
140
+ ? 'Este campo es obligatorio'
141
+ : undefined,
142
+ }, shouldUnregister: true, render: function (_a) {
143
+ var field = _a.field;
144
+ return (_jsx(SmartSelect, __assign({}, props, { inputRef: field.ref, value: field.value, onChange: field.onChange, onBlur: field.onBlur }), void 0));
145
+ } }, void 0));
146
+ }
147
+ export default SmartSelectStep;
@@ -0,0 +1,9 @@
1
+ .container {
2
+ width: fit-content;
3
+ max-width: calc(100% - 20px);
4
+ display: flex;
5
+ padding: 10px;
6
+ padding-bottom: 0px;
7
+ padding-top: 5px;
8
+ margin-bottom: 0px;
9
+ }
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import Types from '../../../constants/FormStepTypes';
3
+ import { StepProps } from '../Step';
4
+ import { GSmartSelect } from '../../../@Types/GenericFormSteps';
5
+ export interface SmartSelectStepProps extends Omit<StepProps, 'step'> {
6
+ /** The SmartSelectStep to display */
7
+ step: GSmartSelect;
8
+ /** The icon to display */
9
+ icon?: React.ReactNode;
10
+ /** The iconComponent to display in the selector */
11
+ iconComponent?: any;
12
+ /** Function to call to get the options of the selector, return null if dependency is not met */
13
+ getOptions?: (step: GSmartSelect, dependencyStore: Record<string, any>) => Promise<any[] | null>;
14
+ /** Function to determine the currently selected option */
15
+ getOptionSelected?: (option: any, value: any) => boolean;
16
+ /** Function that returns the error message based on the types of the missing Dependencies, undefined if no error msg */
17
+ calcDepError?: (types: Types[]) => string | undefined;
18
+ /** children to render */
19
+ children?: React.ReactElement<any, string>;
20
+ /** Function that overwrites the value before setting it */
21
+ valueOverwrite?: (value: any) => any;
22
+ }
23
+ declare function SmartSelectStep(props: SmartSelectStepProps): JSX.Element;
24
+ export default SmartSelectStep;
@@ -0,0 +1,25 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { FormStyleTypes } from '../../../constants/FormStepTypes';
14
+ import MaterialSmartSelectStep from './MaterialSmartSelectStep/MaterialSmartSelectStep';
15
+ function SmartSelectStep(props) {
16
+ switch (props.formStyle.type) {
17
+ case FormStyleTypes.MATERIAL: {
18
+ return _jsx(MaterialSmartSelectStep, __assign({}, props), void 0);
19
+ }
20
+ default: {
21
+ return _jsx(MaterialSmartSelectStep, __assign({}, props), void 0);
22
+ }
23
+ }
24
+ }
25
+ export default SmartSelectStep;
@@ -31,6 +31,7 @@ import TextAreaStep from './TextAreaStep/TextAreaStep';
31
31
  import DatePickerStep from './DatePickerStep/DatePickerStep';
32
32
  import FileUploadStep from './FileUploadStep/FileUploadStep';
33
33
  import CheckBoxStep from './CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep';
34
+ import CBRStepMapper from './CBRStepMapper';
34
35
  function StepComponent(_a) {
35
36
  var step = _a.step, props = __rest(_a, ["step"]);
36
37
  var customStep = props.customSteps[step.type];
@@ -66,7 +67,11 @@ function StepComponent(_a) {
66
67
  return _jsx(FileUploadStep, __assign({ step: step }, props), void 0);
67
68
  }
68
69
  default:
69
- return _jsx("div", {}, void 0);
70
+ break;
70
71
  }
72
+ if (step.type.startsWith('CBR')) {
73
+ return _jsx(CBRStepMapper, __assign({}, props, { step: step }), void 0);
74
+ }
75
+ return _jsx("div", {}, void 0);
71
76
  }
72
77
  export default StepComponent;
@@ -1,5 +1,5 @@
1
- import { Form } from '../../@Types/Form';
1
+ import { FormSize } from '../../@Types/Form';
2
2
  import { ClassifierSelector, FormSelector, FormStep } from '../../@Types/FormStep';
3
- export declare function calcFillerSize(step: FormSelector | ClassifierSelector, steps: Record<string, FormStep>, values: Record<string, unknown>, form: Form): number;
3
+ export declare function calcFillerSize(step: FormSelector | ClassifierSelector, steps: Record<string, FormStep>, values: Record<string, unknown>, size: FormSize): number;
4
4
  export declare function recursivelyCheckOpenSize(idStep: string, steps: Record<string, FormStep>, values: Record<string, any>): number;
5
- export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, form: Form) => number;
5
+ export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, size: FormSize) => number;
@@ -1,8 +1,8 @@
1
1
  import Types, { ClassifierOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
2
- export function calcFillerSize(step, steps, values, form) {
3
- if (step.maxSize < form.blockNum) {
2
+ export function calcFillerSize(step, steps, values, size) {
3
+ if (step.maxSize < size.blockNum) {
4
4
  var stepSize = step.maxSize - recursivelyCheckOpenSize(step.id, steps, values);
5
- return (form.blockSize * stepSize + form.spacingSize * (stepSize - 1) + 20);
5
+ return (size.blockSize * stepSize + size.spacingSize * (stepSize - 1) + 20);
6
6
  }
7
7
  else {
8
8
  return 0;
@@ -45,6 +45,6 @@ export function recursivelyCheckOpenSize(idStep, steps, values) {
45
45
  return 4;
46
46
  }
47
47
  }
48
- export var calcStepWidth = function (stepSize, form) {
49
- return form.blockSize * stepSize + form.spacingSize * (stepSize - 1);
48
+ export var calcStepWidth = function (stepSize, size) {
49
+ return size.blockSize * stepSize + size.spacingSize * (stepSize - 1);
50
50
  };
@@ -138,16 +138,19 @@ function TextAreaStep(_a) {
138
138
  }
139
139
  else {
140
140
  return (_jsx("div", __assign({ className: styles.container, style: {
141
- paddingBottom: step.description || !!errors[step.id] ? '0px' : '23px',
141
+ paddingBottom: step.required || step.description || !!errors[step.id]
142
+ ? '0px'
143
+ : '5px',
142
144
  } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: calcDefaultStringValue(originalValues[step.id]), rules: {
143
145
  required: step.required
144
146
  ? 'Este campo es obligatorio'
145
147
  : undefined,
146
148
  }, shouldUnregister: true, render: function (_a) {
149
+ var _b;
147
150
  var field = _a.field;
148
151
  return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, label: step.label, inputRef: field.ref, required: step.required, cantEdit: postview, fontWeight: 400, multiline: true, minRows: 4, maxRows: 6, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperTextColor: formStyle.descriptionTextColor, helperText: errors[step.id]
149
152
  ? errors[step.id].message
150
- : step.description, error: !!errors[step.id] }), void 0));
153
+ : (_b = step.description) !== null && _b !== void 0 ? _b : (step.required ? ' ' : null), error: !!errors[step.id] }), void 0));
151
154
  } }, void 0) }), void 0));
152
155
  }
153
156
  }
@@ -4,7 +4,6 @@
4
4
  max-width: calc(100% - 20px);
5
5
  display: flex;
6
6
  padding: 10px;
7
- padding-bottom: 0px;
8
7
  padding-top: 5px;
9
8
  width: calc(100% - 20px);
10
9
  }
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { TextInputStepProps } from '../TextInputStep';
3
- declare function TextInputStep({ step, form, postview, formStyle, widthStats, control, errors, }: TextInputStepProps): JSX.Element;
3
+ declare function TextInputStep({ icon, step, form, postview, formStyle, widthStats, control, errors, }: TextInputStepProps): JSX.Element;
4
4
  export default TextInputStep;
@@ -15,11 +15,11 @@ import styles from './MaterialTextInputStep.module.css';
15
15
  import { Controller } from 'react-hook-form';
16
16
  import { calcStepWidth } from '../../StepFunctions';
17
17
  function TextInputStep(_a) {
18
- var step = _a.step, form = _a.form, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, control = _a.control, errors = _a.errors;
18
+ var icon = _a.icon, step = _a.step, form = _a.form, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, control = _a.control, errors = _a.errors;
19
19
  return (_jsx("div", __assign({ className: styles.container, style: {
20
20
  width: widthStats.currentBreakPoint <= step.size
21
21
  ? '100%'
22
- : calcStepWidth(step.size, form),
22
+ : calcStepWidth(step.size, form.size),
23
23
  minHeight: step.description || step.required || step.validation
24
24
  ? '55px'
25
25
  : '43px',
@@ -37,7 +37,7 @@ function TextInputStep(_a) {
37
37
  var field = _a.field;
38
38
  return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, label: step.label, inputRef: field.ref, cantEdit: postview, required: step.required, fontWeight: 400, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
39
39
  ? errors[step.id].message
40
- : step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id] }), void 0));
40
+ : step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id], icon: step.showIcon ? icon : undefined }), void 0));
41
41
  } }, void 0) }), void 0));
42
42
  }
43
43
  export default TextInputStep;
@@ -4,6 +4,8 @@ import { StepProps } from '../Step';
4
4
  export interface TextInputStepProps extends StepProps {
5
5
  /** The TextInputStep to display */
6
6
  step: TextInput;
7
+ /** The icon to display */
8
+ icon?: React.ReactNode;
7
9
  }
8
10
  declare function TextInputStep(props: TextInputStepProps): JSX.Element;
9
11
  export default TextInputStep;
@@ -14,7 +14,7 @@ import styles from './MaterialTitleStep.module.css';
14
14
  function TitleStep(_a) {
15
15
  var step = _a.step, formStyle = _a.formStyle;
16
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',
17
+ margin: step.title ? '10px 0px' : '0px 0px 5px 0px',
18
18
  } }, { children: step.description }), void 0))] }), void 0));
19
19
  }
20
20
  export default TitleStep;
@@ -3,11 +3,7 @@
3
3
  flex-direction: column;
4
4
  width: 900px;
5
5
  max-width: 100%;
6
- margin-bottom: 10px;
7
- padding: 10px;
8
- padding-bottom: 0px;
9
- padding-top: 5px;
10
- margin-bottom: 5px;
6
+ padding: 5px 10px;
11
7
  }
12
8
 
13
9
  .titleLbl {
@@ -21,9 +17,6 @@
21
17
 
22
18
  .descriptionPar {
23
19
  font-size: 16px;
24
- margin: 0px;
25
20
  white-space: pre-wrap;
26
- margin-top: 15px;
27
- margin-bottom: 10px;
28
21
  cursor: default;
29
22
  }
@@ -0,0 +1,20 @@
1
+ declare enum TYPES {
2
+ CBR_POSTVENTA = "CBR_POSTVENTA",
3
+ CBR_FIRST_NAME = "CBR_FIRST_NAME",
4
+ CBR_MIDDLE_NAME = "CBR_MIDDLE_NAME",
5
+ CBR_LAST_NAME = "CBR_LAST_NAME",
6
+ CBR_SECOND_LAST_NAME = "CBR_SECOND_LAST_NAME",
7
+ CBR_DOC = "CBR_DOC",
8
+ CBR_CEL = "CBR_CEL",
9
+ CBR_PHONE = "CBR_PHONE",
10
+ CBR_EMAIL = "CBR_EMAIL",
11
+ CBR_PROYECTO = "CBR_PROYECTO",
12
+ CBR_TIPO_DOC = "CBR_TIPO_DOC",
13
+ CBR_TIPO_SOLICITANTE = "CBR_TIPO_SOLICITANTE",
14
+ CBR_INMUEBLE = "CBR_INMUEBLE",
15
+ CBR_TIPO_ESPACIO = "CBR_TIPO_ESPACIO",
16
+ CBR_LOCATIVAS = "CBR_LOCATIVAS",
17
+ CBR_INCIDENCIAS = "CBR_INCIDENCIAS",
18
+ CBR_COMENTARIO = "CBR_COMENTARIO"
19
+ }
20
+ export default TYPES;
@@ -0,0 +1,21 @@
1
+ var TYPES;
2
+ (function (TYPES) {
3
+ TYPES["CBR_POSTVENTA"] = "CBR_POSTVENTA";
4
+ TYPES["CBR_FIRST_NAME"] = "CBR_FIRST_NAME";
5
+ TYPES["CBR_MIDDLE_NAME"] = "CBR_MIDDLE_NAME";
6
+ TYPES["CBR_LAST_NAME"] = "CBR_LAST_NAME";
7
+ TYPES["CBR_SECOND_LAST_NAME"] = "CBR_SECOND_LAST_NAME";
8
+ TYPES["CBR_DOC"] = "CBR_DOC";
9
+ TYPES["CBR_CEL"] = "CBR_CEL";
10
+ TYPES["CBR_PHONE"] = "CBR_PHONE";
11
+ TYPES["CBR_EMAIL"] = "CBR_EMAIL";
12
+ TYPES["CBR_PROYECTO"] = "CBR_PROYECTO";
13
+ TYPES["CBR_TIPO_DOC"] = "CBR_TIPO_DOC";
14
+ TYPES["CBR_TIPO_SOLICITANTE"] = "CBR_TIPO_SOLICITANTE";
15
+ TYPES["CBR_INMUEBLE"] = "CBR_INMUEBLE";
16
+ TYPES["CBR_TIPO_ESPACIO"] = "CBR_TIPO_ESPACIO";
17
+ TYPES["CBR_LOCATIVAS"] = "CBR_LOCATIVAS";
18
+ TYPES["CBR_INCIDENCIAS"] = "CBR_INCIDENCIAS";
19
+ TYPES["CBR_COMENTARIO"] = "CBR_COMENTARIO";
20
+ })(TYPES || (TYPES = {}));
21
+ export default TYPES;
@@ -37,8 +37,6 @@ export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color'>,
37
37
  options?: any[];
38
38
  /** If the input is loading */
39
39
  loading?: boolean;
40
- /** Function to call to fetch data if none is found */
41
- fetchData?: () => Promise<void>;
42
40
  /** function called when value changes */
43
41
  handleUpdate?: (event: React.ChangeEvent<{
44
42
  name?: string | undefined;
@@ -58,6 +56,8 @@ export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color'>,
58
56
  iconComponent?: any;
59
57
  /** If the options are searchable */
60
58
  searchable?: boolean;
59
+ /** Function to determine the currently selected option */
60
+ getOptionSelected?: (option: any, value: any) => boolean;
61
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;
62
+ export default function RoundedSmartSelect({ options, value, handleUpdate, label, color, errorColor, focusColor, helperTextColor, outlineColor, backgroundColor, cantEdit, loading, height, fontSize, required, error, innerBackgroundColor, getOptionSelected, helperText, readOnly, borderRadius, fontWeight, icon, iconComponent, searchable, containerMargin, showIcon, inputRef, disabled, onBlur, name, }: RoundedSmartSelectProps): JSX.Element;
63
63
  export {};
@@ -27,13 +27,6 @@ import TextField from '@material-ui/core/TextField';
27
27
  import { Popper } from '@material-ui/core';
28
28
  import RoundedSelect from '../RoundedSelect/RoundedSelect';
29
29
  var filter = createFilterOptions();
30
- var useStyles = makeStyles(function (theme) { return ({
31
- root: {
32
- '& > * + *': {
33
- marginTop: theme.spacing(3),
34
- },
35
- },
36
- }); });
37
30
  var useTextfieldStyles = function (props) {
38
31
  return makeStyles(function () { return ({
39
32
  root: {
@@ -41,7 +34,6 @@ var useTextfieldStyles = function (props) {
41
34
  backgroundColor: props.backgroundColor,
42
35
  '& input, textarea': {
43
36
  cursor: props.cantEdit ? 'default' : 'text',
44
- padding: '6px 12px',
45
37
  fontWeight: props.fontWeight,
46
38
  color: props.color,
47
39
  fontSize: props.fontSize,
@@ -51,6 +43,12 @@ var useTextfieldStyles = function (props) {
51
43
  backgroundColor: props.innerBackgroundColor,
52
44
  borderRadius: props.borderRadius,
53
45
  height: props.height,
46
+ marginTop: '0px !important',
47
+ padding: '0px 38px 0px 12px !important',
48
+ },
49
+ '& .EF-MuiInputBase-root': {
50
+ padding: '0px !important',
51
+ pointerEvents: 'all',
54
52
  },
55
53
  '& label': {
56
54
  marginTop: '-4px',
@@ -98,11 +96,14 @@ var useTextfieldStyles = function (props) {
98
96
  color: props.focusColor,
99
97
  },
100
98
  '& .Mui-error': {
101
- color: props.errorColor,
99
+ color: props.errorColor + ' !important',
102
100
  },
103
101
  '& .EF-MuiFormHelperText-root': {
104
102
  color: props.helperTextColor,
105
103
  },
104
+ '& .EF-MuiFormLabel-root.Mui-disabled': {
105
+ color: '#0000008a',
106
+ },
106
107
  '& .EF-MuiOutlinedInput-notchedOutline': {
107
108
  borderColor: '#0000003b',
108
109
  },
@@ -116,7 +117,7 @@ var useTextfieldStyles = function (props) {
116
117
  }); });
117
118
  };
118
119
  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 _b = _a.options, options = _b === void 0 ? [] : _b, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, _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, getOptionSelected = _a.getOptionSelected, 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, inputRef = _a.inputRef, disabled = _a.disabled, onBlur = _a.onBlur, name = _a.name;
120
121
  var props = {
121
122
  color: color,
122
123
  height: height,
@@ -133,50 +134,39 @@ export default function RoundedSmartSelect(_a) {
133
134
  cantEdit: cantEdit,
134
135
  showIcon: showIcon && icon !== undefined,
135
136
  };
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
137
  var textFieldClasses = useTextfieldStyles(props)();
143
138
  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));
139
+ return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, disabled: cantEdit || disabled, popupIcon: showIcon && icon ? icon : undefined, onOpen: function () {
140
+ //Show loading icon if loading
141
+ }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
142
+ // Value selected with enter, right from the input
143
+ if (typeof option === 'string') {
144
+ return option;
145
+ }
146
+ else if (option.inputValue) {
147
+ return option.inputValue;
148
+ }
149
+ else {
150
+ // Regular option
151
+ return option.label;
152
+ }
153
+ }, getOptionSelected: getOptionSelected, PopperComponent: function (_a) {
154
+ var style = _a.style, props = __rest(_a, ["style"]);
155
+ return (_jsx(Popper, __assign({}, props, { style: __assign(__assign({}, style), { zIndex: 1305 }) }), void 0));
156
+ }, value: value ? value : null, onChange: function (event, newValue) {
157
+ handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
158
+ }, filterOptions: function (options, params) {
159
+ if (value) {
160
+ return options;
161
+ }
162
+ else {
163
+ return filter(options, params);
164
+ }
165
+ }, renderOption: function (option) { return option.label; }, 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 }), void 0)); }, style: { pointerEvents: 'none' }, noOptionsText: "No hay opciones" }, void 0));
174
166
  }
175
167
  else {
176
- return (_jsx(RoundedSelect, { fullWidth: true, handleUpdate: handleUpdate, onOpen: function () {
177
- if (options.length === 0 && fetchData) {
178
- fetchData();
179
- }
168
+ return (_jsx(RoundedSelect, { onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: handleUpdate, onOpen: function () {
169
+ //Show loading icon if loading
180
170
  }, 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
171
  }
182
172
  }
@@ -31,6 +31,8 @@ interface StyleProps {
31
31
  cantEdit?: boolean;
32
32
  /** The color of the helper text when not error */
33
33
  helperTextColor?: string;
34
+ /** The icon to display */
35
+ icon?: React.ReactNode;
34
36
  }
35
37
  interface RoundedTextFieldProps extends StyleProps {
36
38
  }
@@ -95,6 +95,9 @@ var useTextfieldStyles = function (props) {
95
95
  '& .Mui-error': {
96
96
  color: props.errorColor,
97
97
  },
98
+ '& .EF-MuiOutlinedInput-adornedEnd': {
99
+ paddingRight: '7px',
100
+ },
98
101
  '& .EF-MuiFormHelperText-root': {
99
102
  color: props.helperTextColor,
100
103
  },
@@ -102,7 +105,7 @@ var useTextfieldStyles = function (props) {
102
105
  }); });
103
106
  };
104
107
  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, 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"]);
108
+ 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, icon = _a.icon, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit", "inputProps", "value", "icon"]);
106
109
  var classes = useTextfieldStyles({
107
110
  padding: padding,
108
111
  textColor: textColor,
@@ -124,6 +127,7 @@ function CustomTextfield(_a) {
124
127
  readOnly: readOnly,
125
128
  disabled: cantEdit,
126
129
  inputProps: inputProps,
130
+ endAdornment: icon,
127
131
  } }), void 0));
128
132
  }
129
133
  /**