@arquimedes.co/eureka-forms 1.1.3-test → 1.1.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.
- package/dist/@Types/Form.d.ts +2 -0
- package/dist/@Types/FormStep.d.ts +1 -0
- package/dist/App.js +0 -2
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +4 -9
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.module.css +2 -1
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +1 -1
- package/dist/constants/InternalFormStyle.js +2 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +6 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +94 -22
- package/package.json +2 -2
package/dist/@Types/Form.d.ts
CHANGED
|
@@ -47,8 +47,10 @@ export interface MaterialStyle {
|
|
|
47
47
|
type: FormStyleTypes.MATERIAL;
|
|
48
48
|
backgroundColor: string;
|
|
49
49
|
primaryColor: string;
|
|
50
|
+
secondaryColor: string;
|
|
50
51
|
errorColor: string;
|
|
51
52
|
primaryContrastColor: string;
|
|
53
|
+
secondaryContrastColor: string;
|
|
52
54
|
textColor: string;
|
|
53
55
|
outlineColor: string;
|
|
54
56
|
stepBackgroundColor: string;
|
package/dist/App.js
CHANGED
|
@@ -69,8 +69,6 @@ function App(_a) {
|
|
|
69
69
|
var _this = this;
|
|
70
70
|
var _b, _c, _d, _e;
|
|
71
71
|
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSteps = _a.customSteps, handleConfirmed = _a.handleConfirmed, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps", "handleConfirmed"]);
|
|
72
|
-
// eslint-disable-next-line no-console
|
|
73
|
-
console.log('PROPS:', { formData: formData, customSteps: customSteps });
|
|
74
72
|
var _f = useState(undefined), form = _f[0], setForm = _f[1];
|
|
75
73
|
var _g = useState({}), originalValues = _g[0], setOriginalValues = _g[1];
|
|
76
74
|
var _h = useState(undefined), organizationInfo = _h[0], setOrganizationInfo = _h[1];
|
|
@@ -112,6 +112,10 @@ function ColumnForm(_a) {
|
|
|
112
112
|
idStep = _a[_i];
|
|
113
113
|
updateValue(idStep, values, form, customSteps);
|
|
114
114
|
}
|
|
115
|
+
if (internal) {
|
|
116
|
+
// eslint-disable-next-line no-console
|
|
117
|
+
console.log('UPDATED:', values);
|
|
118
|
+
}
|
|
115
119
|
payload = {
|
|
116
120
|
formValues: { steps: values },
|
|
117
121
|
};
|
|
@@ -191,10 +195,7 @@ var mapOriginal = function (values, form) {
|
|
|
191
195
|
return newValues;
|
|
192
196
|
};
|
|
193
197
|
var updateValue = function (idStep, values, form, customSteps) {
|
|
194
|
-
console.log('FORM', form);
|
|
195
198
|
var step = form.steps[idStep];
|
|
196
|
-
console.log('idStep', idStep);
|
|
197
|
-
console.log('STEP:', step);
|
|
198
199
|
switch (step === null || step === void 0 ? void 0 : step.type) {
|
|
199
200
|
case Types.TEXTAREA: {
|
|
200
201
|
var value = values[step.id];
|
|
@@ -222,13 +223,7 @@ var updateValue = function (idStep, values, form, customSteps) {
|
|
|
222
223
|
break;
|
|
223
224
|
}
|
|
224
225
|
default:
|
|
225
|
-
// eslint-disable-next-line no-console
|
|
226
|
-
console.log(customSteps);
|
|
227
|
-
// eslint-disable-next-line no-console
|
|
228
|
-
console.log('TYPE', step === null || step === void 0 ? void 0 : step.type);
|
|
229
226
|
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
230
|
-
// eslint-disable-next-line no-console
|
|
231
|
-
console.log('UPDATE:', custom);
|
|
232
227
|
if (custom !== undefined) {
|
|
233
228
|
custom.updateValue(idStep, values, form);
|
|
234
229
|
}
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
.submitBtnContainer {
|
|
16
16
|
margin-top: 10px;
|
|
17
17
|
width: 200px;
|
|
18
|
+
max-width: calc(100% - 40px);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.submitBtn {
|
|
21
22
|
border-radius: 20px;
|
|
22
23
|
padding: 15px 10px;
|
|
23
|
-
width: 100
|
|
24
|
+
width: calc(100% - 30px);
|
|
24
25
|
margin: 0 auto 0 auto;
|
|
25
26
|
font-size: 1.4rem;
|
|
26
27
|
cursor: pointer;
|
package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js
CHANGED
|
@@ -27,7 +27,7 @@ function DatePickerStep(_a) {
|
|
|
27
27
|
: undefined,
|
|
28
28
|
}, shouldUnregister: true, render: function (_a) {
|
|
29
29
|
var field = _a.field;
|
|
30
|
-
return (_jsx(RoundedDatePicker, __assign({}, field, { showIcon: step.showIcon, inputRef: field.ref, cantEdit: postview, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, helperTextColor: formStyle.descriptionTextColor, fontWeight: 400, label: step.label, helperText: errors[step.id]
|
|
30
|
+
return (_jsx(RoundedDatePicker, __assign({}, field, { pickTime: step.pickTime, showIcon: step.showIcon, inputRef: field.ref, cantEdit: postview, contrastColor: formStyle.secondaryContrastColor, accentColor: formStyle.textColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, helperTextColor: formStyle.descriptionTextColor, fontWeight: 400, label: step.label, helperText: errors[step.id]
|
|
31
31
|
? errors[step.id].message
|
|
32
32
|
: step.description, error: !!errors[step.id], required: step.required }), void 0));
|
|
33
33
|
} }, void 0) }), void 0));
|
|
@@ -4,7 +4,9 @@ var InternalFormStyle = {
|
|
|
4
4
|
backgroundColor: '#ffffff',
|
|
5
5
|
stepBackgroundColor: '#ffffff',
|
|
6
6
|
primaryColor: '#3d5a7f',
|
|
7
|
+
secondaryColor: '#98c1d9',
|
|
7
8
|
primaryContrastColor: '#ffffff',
|
|
9
|
+
secondaryContrastColor: '#ee6c4d',
|
|
8
10
|
errorColor: '#cc2936',
|
|
9
11
|
textColor: '#293241',
|
|
10
12
|
outlineColor: '#b8b8b8',
|
|
@@ -12,10 +12,16 @@ interface StyleProps {
|
|
|
12
12
|
outlineColor?: string;
|
|
13
13
|
/** The backgroundColor of the input */
|
|
14
14
|
backgroundColor?: string;
|
|
15
|
+
/** The contrastColor of the input */
|
|
16
|
+
contrastColor?: string;
|
|
17
|
+
/** The accent color of the input */
|
|
18
|
+
accentColor?: string;
|
|
15
19
|
/** The color of the inner input */
|
|
16
20
|
innerBackgroundColor?: string;
|
|
17
21
|
/** The borderRadius of the input */
|
|
18
22
|
borderRadius?: number;
|
|
23
|
+
/** If it should display the timePicker */
|
|
24
|
+
pickTime?: boolean;
|
|
19
25
|
/** The padding of the input */
|
|
20
26
|
padding?: string;
|
|
21
27
|
/** The size of the font to display the input in */
|
|
@@ -39,7 +39,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
39
39
|
import React, { cloneElement } from 'react';
|
|
40
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
41
41
|
import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
|
|
42
|
-
import { KeyboardDatePicker, } from '@material-ui/pickers';
|
|
42
|
+
import { KeyboardDatePicker, KeyboardDateTimePicker, } from '@material-ui/pickers';
|
|
43
43
|
import { getLocale } from '../../FormComponents/Form/Form';
|
|
44
44
|
import { format } from 'date-fns';
|
|
45
45
|
var useDatePickerStyles = function (props) {
|
|
@@ -78,8 +78,9 @@ var useDatePickerStyles = function (props) {
|
|
|
78
78
|
: props.focusColor,
|
|
79
79
|
},
|
|
80
80
|
'& .EF-MuiInputAdornment-root': {
|
|
81
|
+
width: 5,
|
|
81
82
|
'& button': {
|
|
82
|
-
|
|
83
|
+
marginLeft: -25,
|
|
83
84
|
fontSize: 18,
|
|
84
85
|
padding: 16,
|
|
85
86
|
},
|
|
@@ -159,11 +160,57 @@ var useDatePickerDialogStyles = function (props) {
|
|
|
159
160
|
color: props.backgroundColor,
|
|
160
161
|
backgroundColor: props.focusColor,
|
|
161
162
|
},
|
|
163
|
+
//Title
|
|
164
|
+
'& .EF-MuiPickersToolbar-toolbar': {
|
|
165
|
+
color: props.backgroundColor,
|
|
166
|
+
backgroundColor: props.focusColor,
|
|
167
|
+
},
|
|
168
|
+
'& .EF-MuiPickerDTTabs-tabs': {
|
|
169
|
+
color: props.backgroundColor,
|
|
170
|
+
backgroundColor: props.focusColor,
|
|
171
|
+
},
|
|
172
|
+
'& .EF-MuiPickersYear-yearSelected, .EF-MuiPickersYear-root:focus': {
|
|
173
|
+
color: props.focusColor,
|
|
174
|
+
},
|
|
175
|
+
'& .EF-MuiTabs-indicator': {
|
|
176
|
+
backgroundColor: props.contrastColor,
|
|
177
|
+
},
|
|
178
|
+
'& .EF-MuiPickersClockNumber-clockNumber': {
|
|
179
|
+
color: 'var(--accent)',
|
|
180
|
+
},
|
|
181
|
+
'& .EF-MuiPickersClockNumber-clockNumberSelected': {
|
|
182
|
+
color: props.backgroundColor,
|
|
183
|
+
},
|
|
184
|
+
'& .EF-MuiPickersClock-pin, .EF-MuiPickersClockPointer-pointer': {
|
|
185
|
+
backgroundColor: props.focusColor,
|
|
186
|
+
},
|
|
187
|
+
'& .EF-MuiPickersClockPointer-noPoint': {
|
|
188
|
+
backgroundColor: props.focusColor,
|
|
189
|
+
},
|
|
190
|
+
'& .EF-MuiPickersClockPointer-thumb': {
|
|
191
|
+
borderColor: props.focusColor,
|
|
192
|
+
},
|
|
193
|
+
'& .EF-MuiPickersDay-dayDisabled': {
|
|
194
|
+
color: 'rgba(0, 0, 0, 0.38)',
|
|
195
|
+
pointerEvents: 'all',
|
|
196
|
+
},
|
|
197
|
+
'& .EF-MuiPickersDay-current': {
|
|
198
|
+
color: props.backgroundColor,
|
|
199
|
+
backgroundColor: 'var(--secondary2)',
|
|
200
|
+
},
|
|
201
|
+
'& .EF-MuiPickersDay-hidden': {
|
|
202
|
+
opacity: 0.4,
|
|
203
|
+
pointerEvents: 'none',
|
|
204
|
+
},
|
|
205
|
+
'& .EF-MuiPickersDay-hidden.EF-MuiPickersDay-current': {
|
|
206
|
+
opacity: 0.8,
|
|
207
|
+
pointerEvents: 'none',
|
|
208
|
+
},
|
|
162
209
|
},
|
|
163
210
|
}); });
|
|
164
211
|
};
|
|
165
212
|
function CustomDatePicker(_a) {
|
|
166
|
-
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.outlineColor, outlineColor = _c === void 0 ? '#0000003b' : _c, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? 'white' : _d, innerBackgroundColor = _a.innerBackgroundColor, _e = _a.textColor, textColor = _e === void 0 ? '#293241' : _e, _f = _a.
|
|
213
|
+
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.outlineColor, outlineColor = _c === void 0 ? '#0000003b' : _c, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? 'white' : _d, innerBackgroundColor = _a.innerBackgroundColor, _e = _a.textColor, textColor = _e === void 0 ? '#293241' : _e, _f = _a.contrastColor, contrastColor = _f === void 0 ? '#ee6c4d' : _f, _g = _a.accentColor, accentColor = _g === void 0 ? '#293241' : _g, _h = _a.errorColor, errorColor = _h === void 0 ? '#cc2936' : _h, _j = _a.borderRadius, borderRadius = _j === void 0 ? 10 : _j, _k = _a.padding, padding = _k === void 0 ? '6px 0px 6px 12px' : _k, _l = _a.fontSize, fontSize = _l === void 0 ? '1rem' : _l, _m = _a.shrunkenFontSize, shrunkenFontSize = _m === void 0 ? '1rem' : _m, _o = _a.helperTextColor, helperTextColor = _o === void 0 ? '#989898' : _o, _p = _a.fontWeight, fontWeight = _p === void 0 ? '300' : _p, _q = _a.showIcon, showIcon = _q === void 0 ? true : _q, _r = _a.cantEdit, cantEdit = _r === void 0 ? false : _r, _s = _a.pickTime, pickTime = _s === void 0 ? false : _s, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "contrastColor", "accentColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "helperTextColor", "fontWeight", "showIcon", "cantEdit", "pickTime", "onChange", "required"]);
|
|
167
214
|
var classes = useDatePickerStyles({
|
|
168
215
|
padding: padding,
|
|
169
216
|
cantEdit: cantEdit,
|
|
@@ -200,6 +247,8 @@ function CustomDatePicker(_a) {
|
|
|
200
247
|
padding: padding,
|
|
201
248
|
cantEdit: cantEdit,
|
|
202
249
|
textColor: textColor,
|
|
250
|
+
accentColor: accentColor,
|
|
251
|
+
contrastColor: contrastColor,
|
|
203
252
|
focusColor: focusColor,
|
|
204
253
|
hoverColor: focusColor + '0a',
|
|
205
254
|
errorColor: errorColor,
|
|
@@ -226,25 +275,48 @@ function CustomDatePicker(_a) {
|
|
|
226
275
|
fontWeight: fontWeight,
|
|
227
276
|
helperTextColor: helperTextColor,
|
|
228
277
|
})();
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
278
|
+
if (pickTime) {
|
|
279
|
+
return (_jsx(KeyboardDateTimePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'Pp', { locale: getLocale() }), format: "Pp", required: required, keyboardIcon: showIcon ? (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit" }, void 0)) : null, InputLabelProps: { classes: labelClasses }, DialogProps: {
|
|
280
|
+
disableEnforceFocus: true,
|
|
281
|
+
className: datePicker,
|
|
282
|
+
cancelLabel: '',
|
|
283
|
+
} //Fixes the typescript declaration of the library: https://material-ui-pickers.dev/api/KeyboardDatePicker
|
|
284
|
+
, InputProps: {
|
|
285
|
+
required: required,
|
|
286
|
+
classes: classes,
|
|
287
|
+
disabled: cantEdit,
|
|
288
|
+
}, FormHelperTextProps: {
|
|
289
|
+
classes: helperTextStyles,
|
|
290
|
+
}, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
|
|
291
|
+
if (!day) {
|
|
292
|
+
return dayComponent;
|
|
293
|
+
}
|
|
294
|
+
return (_jsx("div", __assign({ onClick: function () {
|
|
295
|
+
onChange(day);
|
|
296
|
+
} }, { children: cloneElement(dayComponent) }), void 0));
|
|
297
|
+
}, variant: "dialog" }), void 0));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
return (_jsx(KeyboardDatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'P', { locale: getLocale() }), format: "P", required: required, keyboardIcon: showIcon ? (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit" }, void 0)) : null, InputLabelProps: { classes: labelClasses }, DialogProps: {
|
|
301
|
+
disableEnforceFocus: true,
|
|
302
|
+
className: datePicker,
|
|
303
|
+
cancelLabel: '',
|
|
304
|
+
} //Fixes the typescript declaration of the library: https://material-ui-pickers.dev/api/KeyboardDatePicker
|
|
305
|
+
, InputProps: {
|
|
306
|
+
required: required,
|
|
307
|
+
classes: classes,
|
|
308
|
+
disabled: cantEdit,
|
|
309
|
+
}, FormHelperTextProps: {
|
|
310
|
+
classes: helperTextStyles,
|
|
311
|
+
}, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
|
|
312
|
+
if (!day) {
|
|
313
|
+
return dayComponent;
|
|
314
|
+
}
|
|
315
|
+
return (_jsx("div", __assign({ onClick: function () {
|
|
316
|
+
onChange(day);
|
|
317
|
+
} }, { children: cloneElement(dayComponent) }), void 0));
|
|
318
|
+
}, variant: "dialog" }), void 0));
|
|
319
|
+
}
|
|
248
320
|
}
|
|
249
321
|
/**
|
|
250
322
|
* Generic datepicker with apps designs. Is class do to the use in the react-hook-forms library
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arquimedes.co/eureka-forms",
|
|
3
3
|
"repository": "git://github.com/Arquimede5/Eureka-Forms.git",
|
|
4
|
-
"version":"1.1.
|
|
4
|
+
"version":"1.1.5-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
7
7
|
"build": "react-scripts build",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"files": [
|
|
82
82
|
"/dist"
|
|
83
83
|
],
|
|
84
|
-
"proxy": "https://api.forms.
|
|
84
|
+
"proxy": "https://api.forms.eureka-test.click"
|
|
85
85
|
}
|