@arquimedes.co/eureka-forms 1.7.8 → 1.7.9-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 +2 -2
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.d.ts +2 -0
- 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,7 +20,7 @@ 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 () {
|
|
@@ -149,7 +149,7 @@ function TextAreaStep(_a) {
|
|
|
149
149
|
}, shouldUnregister: true, render: function (_a) {
|
|
150
150
|
var _b;
|
|
151
151
|
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]
|
|
152
|
+
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
153
|
? errors[step.id].message
|
|
154
154
|
: (_b = step.description) !== null && _b !== void 0 ? _b : (step.required ? ' ' : null), error: !!errors[step.id] }), void 0));
|
|
155
155
|
} }, 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;
|
|
@@ -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