@arquimedes.co/eureka-forms 1.1.4 → 1.1.6-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.
@@ -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;
@@ -52,6 +52,7 @@ export interface DatePicker {
52
52
  id: string;
53
53
  type: Types.DATEPICKER;
54
54
  label: string;
55
+ pickTime: boolean;
55
56
  description: string | null;
56
57
  required: boolean;
57
58
  showIcon: boolean;
package/dist/App.js CHANGED
@@ -65,6 +65,7 @@ import FormComponent from './FormComponents/Form/Form';
65
65
  import StepTypes from './constants/FormStepTypes';
66
66
  import axiosInstance from './AxiosAPI';
67
67
  import widgetInstance from './AxiosWidget';
68
+ import LogRocket from 'logrocket';
68
69
  function App(_a) {
69
70
  var _this = this;
70
71
  var _b, _c, _d, _e;
@@ -119,6 +120,20 @@ function App(_a) {
119
120
  setOrganizationInfo(null);
120
121
  }
121
122
  }, []);
123
+ useEffect(function () {
124
+ if (organizationInfo) {
125
+ if (process.env.NODE_ENV === 'production' &&
126
+ apiKey !== 'rCgWiEfOSN1TlUmHO28Y0' &&
127
+ !internal &&
128
+ !postview &&
129
+ !preview) {
130
+ LogRocket.init('63mg8a/forms-uv0gd');
131
+ LogRocket.identify(organizationInfo.idOrganization + '/' + apiKey, {
132
+ organization: organizationInfo.name,
133
+ });
134
+ }
135
+ }
136
+ }, [organizationInfo]);
122
137
  var containerRef = useRef();
123
138
  var loadOrgInfo = function (domain) { return __awaiter(_this, void 0, void 0, function () {
124
139
  var response, _a, error_1;
@@ -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;
@@ -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, secondaryColor: formStyle.secondaryColor, 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));
@@ -20,9 +20,10 @@ 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 _b;
23
24
  var step = _a.step, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
24
- var _b = useState(false), hovering = _b[0], setHovering = _b[1];
25
- var _c = useState(false), focus = _c[0], setFocus = _c[1];
25
+ var _c = useState(false), hovering = _c[0], setHovering = _c[1];
26
+ var _d = useState(false), focus = _d[0], setFocus = _d[1];
26
27
  var calcStyle = function () {
27
28
  if (focus) {
28
29
  return {
@@ -92,7 +93,7 @@ function TextAreaStep(_a) {
92
93
  }
93
94
  return (_jsx(Editor, { editorRef: field.ref, onFocus: function () {
94
95
  setFocus(true);
95
- }, onBlur: field.onBlur, editorState: field.value, onEditorStateChange: field.onChange, toolbarClassName: styles.toolbar, editorClassName: editorClassName, wrapperClassName: styles.wrapper, placeholder: (_b = step.description) !== null && _b !== void 0 ? _b : '', toolbar: {
96
+ }, onBlur: field.onBlur, stripPastedStyles: true, editorState: field.value, onEditorStateChange: field.onChange, toolbarClassName: styles.toolbar, editorClassName: editorClassName, wrapperClassName: styles.wrapper, placeholder: (_b = step.description) !== null && _b !== void 0 ? _b : '', toolbar: {
96
97
  options: [
97
98
  'inline',
98
99
  'list',
@@ -117,7 +118,7 @@ function TextAreaStep(_a) {
117
118
  else {
118
119
  return (_jsx("div", __assign({ className: styles.container, style: {
119
120
  paddingBottom: step.description || !!errors[step.id] ? '0px' : '23px',
120
- } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: "", rules: {
121
+ } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: (_b = originalValues[step.id]) !== null && _b !== void 0 ? _b : '', rules: {
121
122
  required: step.required
122
123
  ? 'Este campo es obligatorio'
123
124
  : undefined,
@@ -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,18 @@ interface StyleProps {
12
12
  outlineColor?: string;
13
13
  /** The backgroundColor of the input */
14
14
  backgroundColor?: string;
15
+ /** The secondary color of the dialog */
16
+ secondaryColor?: string;
17
+ /** The contrastColor of the input */
18
+ contrastColor?: string;
19
+ /** The accent color of the input */
20
+ accentColor?: string;
15
21
  /** The color of the inner input */
16
22
  innerBackgroundColor?: string;
17
23
  /** The borderRadius of the input */
18
24
  borderRadius?: number;
25
+ /** If it should display the timePicker */
26
+ pickTime?: boolean;
19
27
  /** The padding of the input */
20
28
  padding?: string;
21
29
  /** 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
- marginRight: -20,
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: props.accentColor,
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: props.secondaryColor,
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.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.borderRadius, borderRadius = _g === void 0 ? 10 : _g, _h = _a.padding, padding = _h === void 0 ? '6px 12px' : _h, _j = _a.fontSize, fontSize = _j === void 0 ? '1rem' : _j, _k = _a.shrunkenFontSize, shrunkenFontSize = _k === void 0 ? '1rem' : _k, _l = _a.helperTextColor, helperTextColor = _l === void 0 ? '#989898' : _l, _m = _a.fontWeight, fontWeight = _m === void 0 ? '300' : _m, _o = _a.showIcon, showIcon = _o === void 0 ? true : _o, _p = _a.cantEdit, cantEdit = _p === void 0 ? false : _p, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "helperTextColor", "fontWeight", "showIcon", "cantEdit", "onChange", "required"]);
213
+ var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.secondaryColor, secondaryColor = _c === void 0 ? '#98c1d9' : _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.contrastColor, contrastColor = _g === void 0 ? '#ee6c4d' : _g, _h = _a.accentColor, accentColor = _h === void 0 ? '#293241' : _h, _j = _a.errorColor, errorColor = _j === void 0 ? '#cc2936' : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.padding, padding = _l === void 0 ? '6px 0px 6px 12px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, _o = _a.shrunkenFontSize, shrunkenFontSize = _o === void 0 ? '1rem' : _o, _p = _a.helperTextColor, helperTextColor = _p === void 0 ? '#989898' : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '300' : _q, _r = _a.showIcon, showIcon = _r === void 0 ? true : _r, _s = _a.cantEdit, cantEdit = _s === void 0 ? false : _s, _t = _a.pickTime, pickTime = _t === void 0 ? false : _t, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "secondaryColor", "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,9 @@ function CustomDatePicker(_a) {
200
247
  padding: padding,
201
248
  cantEdit: cantEdit,
202
249
  textColor: textColor,
250
+ secondaryColor: secondaryColor,
251
+ accentColor: accentColor,
252
+ contrastColor: contrastColor,
203
253
  focusColor: focusColor,
204
254
  hoverColor: focusColor + '0a',
205
255
  errorColor: errorColor,
@@ -226,25 +276,48 @@ function CustomDatePicker(_a) {
226
276
  fontWeight: fontWeight,
227
277
  helperTextColor: helperTextColor,
228
278
  })();
229
- 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: {
230
- disableEnforceFocus: true,
231
- className: datePicker,
232
- cancelLabel: '',
233
- } //Fixes the typescript declaration of the library: https://material-ui-pickers.dev/api/KeyboardDatePicker
234
- , InputProps: {
235
- required: required,
236
- classes: classes,
237
- disabled: cantEdit,
238
- }, FormHelperTextProps: {
239
- classes: helperTextStyles,
240
- }, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
241
- if (!day) {
242
- return dayComponent;
243
- }
244
- return (_jsx("div", __assign({ onClick: function () {
245
- onChange(day);
246
- } }, { children: cloneElement(dayComponent) }), void 0));
247
- }, variant: "dialog" }), void 0));
279
+ if (pickTime) {
280
+ 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: {
281
+ disableEnforceFocus: true,
282
+ className: datePicker,
283
+ cancelLabel: '',
284
+ } //Fixes the typescript declaration of the library: https://material-ui-pickers.dev/api/KeyboardDatePicker
285
+ , InputProps: {
286
+ required: required,
287
+ classes: classes,
288
+ disabled: cantEdit,
289
+ }, FormHelperTextProps: {
290
+ classes: helperTextStyles,
291
+ }, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
292
+ if (!day) {
293
+ return dayComponent;
294
+ }
295
+ return (_jsx("div", __assign({ onClick: function () {
296
+ onChange(day);
297
+ } }, { children: cloneElement(dayComponent) }), void 0));
298
+ }, variant: "dialog" }), void 0));
299
+ }
300
+ else {
301
+ 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: {
302
+ disableEnforceFocus: true,
303
+ className: datePicker,
304
+ cancelLabel: '',
305
+ } //Fixes the typescript declaration of the library: https://material-ui-pickers.dev/api/KeyboardDatePicker
306
+ , InputProps: {
307
+ required: required,
308
+ classes: classes,
309
+ disabled: cantEdit,
310
+ }, FormHelperTextProps: {
311
+ classes: helperTextStyles,
312
+ }, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
313
+ if (!day) {
314
+ return dayComponent;
315
+ }
316
+ return (_jsx("div", __assign({ onClick: function () {
317
+ onChange(day);
318
+ } }, { children: cloneElement(dayComponent) }), void 0));
319
+ }, variant: "dialog" }), void 0));
320
+ }
248
321
  }
249
322
  /**
250
323
  * 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",
4
+ "version":"1.1.6-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
@@ -72,7 +72,9 @@
72
72
  "draft-js": "^0.11.x",
73
73
  "react-draft-wysiwyg": "^1.14.x",
74
74
  "react-hook-form": "^7.6.4",
75
- "react-router-dom": "^5.2.0"
75
+ "react-router-dom": "^5.2.0",
76
+ "babel-plugin-add-react-displayname": "0.0.x",
77
+ "logrocket": "^2.x.x"
76
78
  },
77
79
  "publishConfig": {
78
80
  "access": "public"
@@ -81,5 +83,5 @@
81
83
  "files": [
82
84
  "/dist"
83
85
  ],
84
- "proxy": "https://api.forms.capta.co"
86
+ "proxy": "https://api.forms.eureka-test.click"
85
87
  }