@arquimedes.co/eureka-forms 1.7.8 → 1.8.0-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +2 -1
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +1 -1
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +9 -3
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.d.ts +2 -0
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +16 -4
- package/dist/shared/RoundedSelect/RoundedSelect.js +23 -28
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +1 -1
- package/dist/shared/RoundedTextField/RoundedTextField.d.ts +4 -0
- package/dist/shared/RoundedTextField/RoundedTextField.js +36 -8
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
24
24
|
import styles from './Incident.module.css';
|
|
25
25
|
import StepComponent from '../../../../Step';
|
|
26
26
|
import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
|
|
27
|
+
import TextAreaStep from '../../../../TextAreaStep/TextAreaStep';
|
|
27
28
|
function IncidentComponent(_a) {
|
|
28
29
|
var step = _a.step, form = _a.form, level = _a.level, incident = _a.incident, formStyle = _a.formStyle, handleDelete = _a.handleDelete, others = __rest(_a, ["step", "form", "level", "incident", "formStyle", "handleDelete"]);
|
|
29
30
|
var spaceStep = form.steps[incident.idSpaceStep];
|
|
@@ -43,6 +44,6 @@ function IncidentComponent(_a) {
|
|
|
43
44
|
if (others.editable && !others.postview) {
|
|
44
45
|
handleDelete();
|
|
45
46
|
}
|
|
46
|
-
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsx(StepComponent, __assign({}, others, { formStyle: formStyle, form: form, step: spaceStep, handleSizeChange: function () { }, level: level + 1 }), void 0), _jsx(StepComponent, __assign({}, others, { form: form, formStyle: formStyle, step: elementStep, handleSizeChange: function () { }, level: level + 1 }), void 0), _jsx(
|
|
47
|
+
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsx(StepComponent, __assign({}, others, { formStyle: formStyle, form: form, step: spaceStep, handleSizeChange: function () { }, level: level + 1 }), void 0), _jsx(StepComponent, __assign({}, others, { form: form, formStyle: formStyle, step: elementStep, handleSizeChange: function () { }, level: level + 1 }), void 0), _jsx(TextAreaStep, __assign({}, others, { form: form, backgroundColor: 'transparent', formStyle: formStyle, step: commentStep, maxLength: 200, handleSizeChange: function () { }, level: level + 1 }), void 0)] }), void 0) }), void 0));
|
|
47
48
|
}
|
|
48
49
|
export default IncidentComponent;
|
package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
|
|
3
3
|
import './DraftEditor.css';
|
|
4
4
|
import { RawDraftContentState } from 'draft-js';
|
|
5
5
|
import { TextAreaStepProps } from '../TextAreaStep';
|
|
6
|
-
declare function TextAreaStep({ step, errors, control, editable, postview, formStyle, originalValues, }: TextAreaStepProps): JSX.Element;
|
|
6
|
+
declare function TextAreaStep({ step, errors, control, editable, postview, formStyle, maxLength, originalValues, backgroundColor, }: TextAreaStepProps): JSX.Element;
|
|
7
7
|
export default TextAreaStep;
|
|
8
8
|
export declare function stringToDraft(text: string): RawDraftContentState;
|
|
9
9
|
export declare const getRawText: (draft?: RawDraftContentState | undefined, text?: string | undefined) => RawDraftContentState;
|
|
@@ -20,24 +20,30 @@ import { convertFromRaw, EditorState } from 'draft-js';
|
|
|
20
20
|
import { useState } from 'react';
|
|
21
21
|
import { ClickAwayListener } from '@material-ui/core';
|
|
22
22
|
function TextAreaStep(_a) {
|
|
23
|
-
var step = _a.step, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
|
|
23
|
+
var step = _a.step, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, maxLength = _a.maxLength, originalValues = _a.originalValues, backgroundColor = _a.backgroundColor;
|
|
24
24
|
var _b = useState(false), hovering = _b[0], setHovering = _b[1];
|
|
25
25
|
var _c = useState(false), focus = _c[0], setFocus = _c[1];
|
|
26
26
|
var calcStyle = function () {
|
|
27
|
+
var backgroundColor = formStyle.stepBackgroundColor;
|
|
27
28
|
if (focus) {
|
|
28
29
|
return {
|
|
29
30
|
border: '2px solid ' + formStyle.primaryColor,
|
|
30
31
|
marginTop: -1,
|
|
31
32
|
marginLeft: -1,
|
|
32
33
|
marginBottom: 0,
|
|
34
|
+
backgroundColor: backgroundColor,
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
else if (hovering) {
|
|
36
|
-
return {
|
|
38
|
+
return {
|
|
39
|
+
border: '1px solid ' + formStyle.primaryColor,
|
|
40
|
+
backgroundColor: backgroundColor,
|
|
41
|
+
};
|
|
37
42
|
}
|
|
38
43
|
else {
|
|
39
44
|
return {
|
|
40
45
|
border: '1px solid ' + formStyle.outlineColor,
|
|
46
|
+
backgroundColor: backgroundColor,
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
49
|
};
|
|
@@ -149,7 +155,7 @@ function TextAreaStep(_a) {
|
|
|
149
155
|
}, shouldUnregister: true, render: function (_a) {
|
|
150
156
|
var _b;
|
|
151
157
|
var field = _a.field;
|
|
152
|
-
return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, label: step.label, inputRef: field.ref, required: step.required, cantEdit: !canEdit, 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]
|
|
158
|
+
return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, maxLength: maxLength, label: step.label, inputRef: field.ref, required: step.required, cantEdit: !canEdit, fontWeight: 400, multiline: true, minRows: 4, maxRows: 6, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperTextColor: formStyle.descriptionTextColor, helperText: errors[step.id]
|
|
153
159
|
? errors[step.id].message
|
|
154
160
|
: (_b = step.description) !== null && _b !== void 0 ? _b : (step.required ? ' ' : null), error: !!errors[step.id] }), void 0));
|
|
155
161
|
} }, void 0) }), void 0));
|
|
@@ -4,6 +4,8 @@ import { StepProps } from '../Step';
|
|
|
4
4
|
export interface TextAreaStepProps extends StepProps {
|
|
5
5
|
/** The TextAreaStep to display */
|
|
6
6
|
step: TextArea;
|
|
7
|
+
maxLength?: number;
|
|
8
|
+
backgroundColor?: string;
|
|
7
9
|
}
|
|
8
10
|
declare function TextAreaStep(props: TextAreaStepProps): JSX.Element;
|
|
9
11
|
export default TextAreaStep;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectProps } from '@material-ui/core/Select';
|
|
3
|
-
interface
|
|
4
|
-
/** The color of the helper text when not error */
|
|
5
|
-
helperTextColor?: string;
|
|
3
|
+
interface StyleProps {
|
|
6
4
|
/** The color of the outline when selected and hovered on */
|
|
7
5
|
focusColor?: string;
|
|
8
6
|
/** The color of the outline when it is not selected */
|
|
9
7
|
outlineColor?: string;
|
|
8
|
+
/** The color of the background */
|
|
9
|
+
backgroundColor?: string;
|
|
10
10
|
/** The color of the error to display */
|
|
11
11
|
errorColor?: string;
|
|
12
12
|
/** If the style should change on hover */
|
|
@@ -15,10 +15,20 @@ interface ColorProps {
|
|
|
15
15
|
height?: string;
|
|
16
16
|
/** The color of the text in the form */
|
|
17
17
|
color?: string;
|
|
18
|
+
/** The fontsize of the content */
|
|
19
|
+
fontSize?: string;
|
|
20
|
+
/** The color of the inner input */
|
|
21
|
+
innerBackgroundColor?: string;
|
|
22
|
+
/** If input is readOnly */
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
/** The color of the helper text when not error */
|
|
25
|
+
helperTextColor?: string;
|
|
26
|
+
/** The borderRadius of the input */
|
|
27
|
+
borderRadius?: number;
|
|
18
28
|
/** If custom iconComponent exists */
|
|
19
29
|
showIcon?: boolean;
|
|
20
30
|
}
|
|
21
|
-
interface RoundedSelectProps extends Omit<SelectProps, 'color'>,
|
|
31
|
+
interface RoundedSelectProps extends Omit<SelectProps, 'color'>, StyleProps {
|
|
22
32
|
/** children to display in the options */
|
|
23
33
|
children?: any;
|
|
24
34
|
/** Currently selected value */
|
|
@@ -42,6 +52,8 @@ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
|
42
52
|
containerMargin?: string;
|
|
43
53
|
/** The icon to display */
|
|
44
54
|
iconComponent?: any;
|
|
55
|
+
/** The color of the inner input */
|
|
56
|
+
innerBackgroundColor?: string;
|
|
45
57
|
}
|
|
46
58
|
/**
|
|
47
59
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -61,8 +61,14 @@ var useOutlinedInputStyles = function (props) {
|
|
|
61
61
|
root: {
|
|
62
62
|
cursor: props.cantEdit ? 'default' : 'default',
|
|
63
63
|
height: props.height,
|
|
64
|
+
borderRadius: props.borderRadius,
|
|
65
|
+
backgroundColor: props.innerBackgroundColor,
|
|
66
|
+
fontSize: props.fontSize,
|
|
64
67
|
'& $notchedOutline': {
|
|
65
68
|
borderColor: props.outlineColor,
|
|
69
|
+
'& legend': {
|
|
70
|
+
fontSize: 'calc(' + props.fontSize + ' * 0.75)',
|
|
71
|
+
},
|
|
66
72
|
},
|
|
67
73
|
'&:hover $notchedOutline': {
|
|
68
74
|
borderColor: props.cantEdit
|
|
@@ -88,7 +94,6 @@ var useOutlinedInputStyles = function (props) {
|
|
|
88
94
|
'& .EF-MuiSelect-iconOpen': {
|
|
89
95
|
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
90
96
|
},
|
|
91
|
-
borderRadius: 10,
|
|
92
97
|
color: props.color,
|
|
93
98
|
},
|
|
94
99
|
focused: {},
|
|
@@ -130,43 +135,33 @@ var useHelperTextStyles = function (props) {
|
|
|
130
135
|
}); });
|
|
131
136
|
};
|
|
132
137
|
function CustomSelect(_a) {
|
|
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 =
|
|
134
|
-
var
|
|
135
|
-
var outlinedInputClasses = useOutlinedInputStyles({
|
|
136
|
-
helperTextColor: helperTextColor,
|
|
137
|
-
outlineColor: outlineColor,
|
|
138
|
-
errorColor: errorColor,
|
|
139
|
-
focusColor: focusColor,
|
|
140
|
-
cantEdit: cantEdit,
|
|
141
|
-
height: height,
|
|
138
|
+
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.fontSize, fontSize = _e === void 0 ? '1rem' : _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.cantEdit, cantEdit = _l === void 0 ? false : _l, _m = _a.showIcon, showIcon = _m === void 0 ? true : _m, _o = _a.containerMargin, containerMargin = _o === void 0 ? '8px' : _o, _p = _a.height, height = _p === void 0 ? '40px' : _p, required = _a.required, iconComponent = _a.iconComponent, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "fontSize", "outlineColor", "helperTextColor", "backgroundColor", "readOnly", "borderRadius", "innerBackgroundColor", "cantEdit", "showIcon", "containerMargin", "height", "required", "iconComponent", "error"]);
|
|
139
|
+
var props = {
|
|
142
140
|
color: color,
|
|
143
|
-
showIcon: showIcon && iconComponent !== undefined,
|
|
144
|
-
})();
|
|
145
|
-
var labelClasses = useLabelInputStyles({
|
|
146
|
-
helperTextColor: helperTextColor,
|
|
147
|
-
outlineColor: outlineColor,
|
|
148
|
-
errorColor: errorColor,
|
|
149
|
-
focusColor: focusColor,
|
|
150
|
-
cantEdit: cantEdit,
|
|
151
141
|
height: height,
|
|
152
|
-
color: color,
|
|
153
|
-
})();
|
|
154
|
-
var helperTextClasses = useHelperTextStyles({
|
|
155
|
-
helperTextColor: helperTextColor,
|
|
156
|
-
outlineColor: outlineColor,
|
|
157
142
|
errorColor: errorColor,
|
|
158
143
|
focusColor: focusColor,
|
|
144
|
+
outlineColor: outlineColor,
|
|
145
|
+
innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
|
|
146
|
+
helperTextColor: helperTextColor,
|
|
147
|
+
backgroundColor: backgroundColor,
|
|
148
|
+
borderRadius: borderRadius,
|
|
149
|
+
readOnly: readOnly,
|
|
150
|
+
fontSize: fontSize,
|
|
159
151
|
cantEdit: cantEdit,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
showIcon: showIcon && iconComponent !== undefined,
|
|
153
|
+
};
|
|
154
|
+
var classes = useStyles();
|
|
155
|
+
var outlinedInputClasses = useOutlinedInputStyles(props)();
|
|
156
|
+
var labelClasses = useLabelInputStyles(props)();
|
|
157
|
+
var helperTextClasses = useHelperTextStyles(props)();
|
|
163
158
|
return (_jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
|
|
164
159
|
? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
|
|
165
160
|
: {
|
|
166
161
|
margin: containerMargin,
|
|
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
|
|
162
|
+
}, fullWidth: true, required: required, error: error }, { children: [label && _jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate }, (showIcon && iconComponent
|
|
168
163
|
? { 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
|
+
: {}), { input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? label + (required ? ' *' : '') : undefined, classes: outlinedInputClasses }, void 0) }, { children: children }), void 0), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText }), void 0))] }), void 0));
|
|
170
165
|
}
|
|
171
166
|
/**
|
|
172
167
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -173,6 +173,6 @@ export default function RoundedSmartSelect(_a) {
|
|
|
173
173
|
else {
|
|
174
174
|
return (_jsxs(RoundedSelect, __assign({ onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: handleUpdate, onOpen: function () {
|
|
175
175
|
//Show loading icon if loading
|
|
176
|
-
}, 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 }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: "Sin Seleccionar" }, void 0) }), 'EMPTY'), options.map(function (option) { return (_jsx(MenuItem, __assign({ value: option.value, style: { whiteSpace: 'normal' } }, { children: option.label }), option.value)); })] }), void 0));
|
|
176
|
+
}, value: value, color: color, errorColor: errorColor, focusColor: focusColor, helperTextColor: helperTextColor, innerBackgroundColor: innerBackgroundColor, outlineColor: outlineColor, cantEdit: cantEdit, label: label, required: required, readOnly: readOnly, helperText: helperText, containerMargin: containerMargin, height: height, error: error, iconComponent: iconComponent, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: "Sin Seleccionar" }, void 0) }), 'EMPTY'), options.map(function (option) { return (_jsx(MenuItem, __assign({ value: option.value, style: { whiteSpace: 'normal' } }, { children: option.label }), option.value)); })] }), void 0));
|
|
177
177
|
}
|
|
178
178
|
}
|
|
@@ -31,8 +31,12 @@ interface StyleProps {
|
|
|
31
31
|
helperTextColor?: string;
|
|
32
32
|
/** The icon to display */
|
|
33
33
|
icon?: React.ReactNode;
|
|
34
|
+
/** The max length of the string */
|
|
35
|
+
maxLength?: number;
|
|
34
36
|
}
|
|
35
37
|
interface RoundedTextFieldProps extends StyleProps {
|
|
38
|
+
/** The value of the textfield */
|
|
39
|
+
value?: any;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -35,7 +35,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
35
35
|
}
|
|
36
36
|
return t;
|
|
37
37
|
};
|
|
38
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
38
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
39
|
import React from 'react';
|
|
40
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
41
41
|
import TextField from '@material-ui/core/TextField';
|
|
@@ -82,6 +82,9 @@ var useTextfieldStyles = function (props) {
|
|
|
82
82
|
},
|
|
83
83
|
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
84
84
|
borderColor: props.outlineColor,
|
|
85
|
+
'& legend': {
|
|
86
|
+
fontSize: 'calc(' + props.fontSize + ' * 0.75)',
|
|
87
|
+
},
|
|
85
88
|
},
|
|
86
89
|
},
|
|
87
90
|
'& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
|
|
@@ -100,12 +103,17 @@ var useTextfieldStyles = function (props) {
|
|
|
100
103
|
},
|
|
101
104
|
'& .EF-MuiFormHelperText-root': {
|
|
102
105
|
color: props.helperTextColor,
|
|
106
|
+
marginRight: props.maxLength ? 40 : 14,
|
|
107
|
+
},
|
|
108
|
+
'& .EF-MuiOutlinedInput-multiline': {
|
|
109
|
+
padding: props.padding,
|
|
110
|
+
backgroundColor: props.innerBackgroundColor,
|
|
103
111
|
},
|
|
104
112
|
},
|
|
105
113
|
}); });
|
|
106
114
|
};
|
|
107
115
|
function CustomTextfield(_a) {
|
|
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 ? '
|
|
116
|
+
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 ? 'transparent' : _e, _f = _a.innerBackgroundColor, innerBackgroundColor = _f === void 0 ? 'white' : _f, _g = _a.textColor, textColor = _g === void 0 ? '#293241' : _g, _h = _a.readOnly, readOnly = _h === void 0 ? false : _h, _j = _a.borderRadius, borderRadius = _j === void 0 ? 10 : _j, _k = _a.padding, padding = _k === void 0 ? '6px 12px' : _k, _l = _a.fontSize, fontSize = _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, maxLength = _a.maxLength, value = _a.value, icon = _a.icon, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "errorColor", "fontWeight", "multiline", "cantEdit", "maxLength", "value", "icon"]);
|
|
109
117
|
var classes = useTextfieldStyles({
|
|
110
118
|
padding: padding,
|
|
111
119
|
textColor: textColor,
|
|
@@ -121,13 +129,33 @@ function CustomTextfield(_a) {
|
|
|
121
129
|
fontWeight: fontWeight,
|
|
122
130
|
multiline: multiline,
|
|
123
131
|
cantEdit: cantEdit,
|
|
132
|
+
maxLength: maxLength,
|
|
124
133
|
})();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
var length = maxLength ? value.length : null;
|
|
135
|
+
var inputProps = {
|
|
136
|
+
readOnly: readOnly,
|
|
137
|
+
disabled: cantEdit,
|
|
138
|
+
endAdornment: icon,
|
|
139
|
+
};
|
|
140
|
+
if (maxLength) {
|
|
141
|
+
inputProps.inputProps = { maxLength: maxLength };
|
|
142
|
+
}
|
|
143
|
+
return (_jsxs("div", __assign({ style: { position: 'relative', width: '100%', maxWidth: '100%' } }, { children: [_jsx(TextField, __assign({ classes: classes }, others, { value: value !== null && value !== void 0 ? value : '', multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: inputProps }), void 0), length !== null && (_jsxs("div", __assign({ style: others.helperText
|
|
144
|
+
? {
|
|
145
|
+
position: 'absolute',
|
|
146
|
+
bottom: '3px',
|
|
147
|
+
right: '8px',
|
|
148
|
+
fontSize: '12px',
|
|
149
|
+
color: helperTextColor,
|
|
150
|
+
}
|
|
151
|
+
: {
|
|
152
|
+
fontSize: '12px',
|
|
153
|
+
color: helperTextColor,
|
|
154
|
+
textAlign: 'right',
|
|
155
|
+
paddingRight: '8px',
|
|
156
|
+
paddingTop: '2px',
|
|
157
|
+
paddingBottom: '2px',
|
|
158
|
+
} }, { children: [length, "/", maxLength] }), void 0))] }), void 0));
|
|
131
159
|
}
|
|
132
160
|
/**
|
|
133
161
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
package/package.json
CHANGED