@arquimedes.co/eureka-forms 1.4.0-test → 1.4.4-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 (63) 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 +4 -1
  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 +2 -2
  34. package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +12 -7
  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 +3 -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/RoundedCheckBox/RoundedCheckBox.d.ts +1 -1
  55. package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +1 -1
  56. package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +1 -1
  57. package/dist/shared/RoundedSelect/RoundedSelect.d.ts +5 -1
  58. package/dist/shared/RoundedSelect/RoundedSelect.js +8 -2
  59. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +63 -0
  60. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +172 -0
  61. package/dist/shared/RoundedTextField/RoundedTextField.d.ts +2 -0
  62. package/dist/shared/RoundedTextField/RoundedTextField.js +7 -2
  63. 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;
@@ -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 }, { children: step.description }), void 0))] }), void 0));
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
+ margin: step.title ? '10px 0px' : '0px 0px 5px 0px',
18
+ } }, { children: step.description }), void 0))] }), void 0));
17
19
  }
18
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;
@@ -12,7 +12,7 @@ interface StyleProps {
12
12
  cantEdit?: boolean;
13
13
  }
14
14
  interface ComponentProps extends StyleProps {
15
- onChange: Function;
15
+ onChange?: Function;
16
16
  checked: boolean;
17
17
  }
18
18
  /**
@@ -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.uncheckedColor, uncheckedColor = _e === void 0 ? '#787878' : _e, _f = _a.checkedColor, checkedColor = _f === void 0 ? '#3d5a7f' : _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", "uncheckedColor", "checkedColor", "disabledColor", "errorColor", "cantEdit", "checked"]);
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: (event: React.ChangeEvent<{
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 = _h === void 0 ? '8px' : _h, _j = _a.height, height = _j === void 0 ? '40px' : _j, required = _a.required, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "cantEdit", "containerMargin", "height", "required", "error"]);
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, 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));
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 called when value changes */
41
+ handleUpdate?: (event: React.ChangeEvent<{
42
+ name?: string | undefined;
43
+ value: any;
44
+ }>, child?: React.ReactNode) => void;
45
+ /** Strig to place in the label */
46
+ label: string;
47
+ /** Minimum width in px of the component */
48
+ minWidth?: number;
49
+ /** The helper Text to display */
50
+ helperText?: string;
51
+ /** The margin around the selector */
52
+ containerMargin?: string;
53
+ /** The icon to display */
54
+ icon?: React.ReactNode;
55
+ /** The iconComponent to display in the selector */
56
+ iconComponent?: any;
57
+ /** If the options are searchable */
58
+ searchable?: boolean;
59
+ /** Function to determine the currently selected option */
60
+ getOptionSelected?: (option: any, value: any) => boolean;
61
+ }
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
+ export {};