@arquimedes.co/eureka-forms 1.2.0 → 1.3.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.
@@ -1 +1,2 @@
1
1
  export type { Organization } from './Organization';
2
+ export type { Form } from './Form';
@@ -55,7 +55,6 @@ export interface DatePicker {
55
55
  pickTime: boolean;
56
56
  description: string | null;
57
57
  required: boolean;
58
- showIcon: boolean;
59
58
  size: 1 | 2 | 3 | 4;
60
59
  }
61
60
  declare type FormValidation = {
@@ -0,0 +1 @@
1
+ export * from './@Types';
@@ -0,0 +1 @@
1
+ export * from './@Types';
package/dist/App.js CHANGED
@@ -127,6 +127,7 @@ function App(_a) {
127
127
  if (!(organizationInfo && form !== undefined)) return [3 /*break*/, 4];
128
128
  if (!(process.env.NODE_ENV === 'production' &&
129
129
  apiKey !== 'rCgWiEfOSN1TlUmHO28Y0' &&
130
+ apiKey !== 'FORMSTEST' &&
130
131
  !internal &&
131
132
  !postview &&
132
133
  !preview)) return [3 /*break*/, 4];
@@ -162,7 +163,7 @@ function App(_a) {
162
163
  case 0:
163
164
  _b.trys.push([0, 5, , 6]);
164
165
  if (!domain) return [3 /*break*/, 2];
165
- return [4 /*yield*/, widgetInstance.get("/organization?idOrganization=".concat(domain))];
166
+ return [4 /*yield*/, widgetInstance.get("/organization?idOrganization=" + domain)];
166
167
  case 1:
167
168
  _a = _b.sent();
168
169
  return [3 /*break*/, 4];
@@ -205,8 +206,8 @@ function App(_a) {
205
206
  case 0:
206
207
  _a.trys.push([0, 2, , 3]);
207
208
  return [4 /*yield*/, (domain
208
- ? widgetInstance.get("/form/".concat(apiKey, "?idOrganization=").concat(domain))
209
- : axiosInstance.get("/form/".concat(apiKey)))];
209
+ ? widgetInstance.get("/form/" + apiKey + "?idOrganization=" + domain)
210
+ : axiosInstance.get("/form/" + apiKey))];
210
211
  case 1:
211
212
  response = _a.sent();
212
213
  if (response) {
@@ -1,7 +1,7 @@
1
1
  import axios from 'axios';
2
2
  var headers = {};
3
3
  var widgetInstance = axios.create({
4
- baseURL: "https://api.forms.".concat(process.env.REACT_APP_DOMAIN, "/api"),
4
+ baseURL: "https://api.forms." + process.env.REACT_APP_DOMAIN + "/api",
5
5
  timeout: 30000,
6
6
  headers: headers,
7
7
  });
@@ -119,9 +119,9 @@ function ColumnForm(_a) {
119
119
  payload = {
120
120
  formValues: { steps: values },
121
121
  };
122
- url = "/ticket/".concat(internal ? form.apiKey : apiKey);
122
+ url = "/ticket/" + (internal ? form.apiKey : apiKey);
123
123
  if (!(domain || internal)) return [3 /*break*/, 4];
124
- return [4 /*yield*/, widgetInstance.post("".concat(url, "?idOrganization=").concat(domain), payload)];
124
+ return [4 /*yield*/, widgetInstance.post(url + "?idOrganization=" + domain, payload)];
125
125
  case 3:
126
126
  _b = _c.sent();
127
127
  return [3 /*break*/, 6];
@@ -148,7 +148,7 @@ function ColumnForm(_a) {
148
148
  setShowConfirmation(undefined);
149
149
  } }, void 0)), sections.map(function (idSection, index) { return (_jsx(SectionComponent, __assign({ form: form, domain: domain, postview: postview, clearErrors: clearErrors, widthStats: widthStats, control: control, getValues: getValues, originalValues: originalValues, errors: errors, index: index, setSections: setSections, section: form.sections[idSection], formStyle: formStyle, customSteps: customSteps }, others), index)); }), form.terms &&
150
150
  !internal &&
151
- form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }), !postview && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "login__submit", className: styles.submitBtn, onClick: function () {
151
+ form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }), !postview && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "form__submit", className: styles.submitBtn, onClick: function () {
152
152
  onSubmit();
153
153
  }, style: {
154
154
  background: formStyle.primaryColor,
@@ -24,10 +24,8 @@ function ConfirmationDialog(_a) {
24
24
  },
25
25
  }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
26
26
  onClose();
27
- } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case }), void 0), ' ', "ha sido registrado!"] }), void 0), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." }), void 0), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] }), void 0), _jsx("label", __assign({ className: styles.url, onClick: function () {
28
- var _a, _b, _c;
29
- (_c = (_b = (_a = window
30
- .open) === null || _a === void 0 ? void 0 : _a.call(window, confirmation.url, '_blank')) === null || _b === void 0 ? void 0 : _b.focus) === null || _c === void 0 ? void 0 : _c.call(_b);
27
+ } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case }), void 0), ' ', "ha sido registrado!"] }), void 0), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." }), void 0), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] }), void 0), _jsx("a", __assign({ className: styles.url, "data-testid": "ResUrl", target: "_blank", href: confirmation.url, style: {
28
+ color: formStyle.textColor,
31
29
  } }, { children: confirmation.url }), void 0)] }), void 0)] }), void 0) }), void 0));
32
30
  }
33
31
  export default ConfirmationDialog;
@@ -27,7 +27,7 @@ function CheckBoxStep(_a) {
27
27
  : undefined,
28
28
  }, shouldUnregister: true, render: function (_a) {
29
29
  var field = _a.field;
30
- return (_jsx(RoundedCheckBox, __assign({}, field, { inputRef: field.ref, padding: "0px", size: "1.6rem", cantEdit: postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: field.value }), void 0));
30
+ return (_jsx(RoundedCheckBox, __assign({}, field, { "data-testid": step.id, inputRef: field.ref, padding: "0px", size: "1.6rem", cantEdit: postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: field.value }), void 0));
31
31
  } }, void 0)] }), void 0), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
32
32
  color: !!errors[step.id]
33
33
  ? formStyle.errorColor
@@ -55,7 +55,7 @@ function ClassifierSelector(_a) {
55
55
  } }, { children: _jsxs(RoundedSelect, __assign({ fullWidth: true, value: value, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, errorColor: formStyle.errorColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, label: step.label ? step.label : classifier.name, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
56
56
  onChange(event.target.value);
57
57
  sizeChange();
58
- }, inputRef: inputRef, helperText: errors[step.id]
58
+ }, "data-testid": step.id, inputRef: inputRef, helperText: errors[step.id]
59
59
  ? errors[step.id].message
60
60
  : step.description, error: !!errors[step.id] }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: "Sin Seleccionar" }, void 0) }), 'EMPTY'), classifier.children
61
61
  .filter(function (classifier) {
@@ -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, { 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]
30
+ return (_jsx(RoundedDatePicker, __assign({}, field, { pickTime: step.pickTime, inputRef: field.ref, cantEdit: postview, "data-testid": step.id, 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));
@@ -190,7 +190,8 @@ function FileUploadStep(_a) {
190
190
  }
191
191
  return '';
192
192
  };
193
- return (_jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.labelLabel }, { children: step.label }), void 0), step.description && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: { color: formStyle.descriptionTextColor } }, { children: step.description }), void 0)), _jsx("input", { type: "file", ref: inputRef, className: styles.filesInput, onChange: function (e) {
193
+ return (_jsxs("div", __assign({ className: styles.container +
194
+ (error || !!errors[step.id] ? ' EF-error' : ''), "data-testid": step.id }, { children: [_jsx("div", __assign({ className: styles.labelLabel }, { children: step.label }), void 0), step.description && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: { color: formStyle.descriptionTextColor } }, { children: step.description }), void 0)), _jsx("input", { type: "file", ref: inputRef, className: styles.filesInput, onChange: function (e) {
194
195
  var files = e.target.files;
195
196
  if (files) {
196
197
  var filesArray = Array.from(files);
@@ -45,7 +45,7 @@ function Selector(_a) {
45
45
  ? '100%'
46
46
  : calcStepWidth(step.size, form),
47
47
  minHeight: step.description || step.required ? '55px' : '43px',
48
- } }, { children: _jsxs(RoundedSelect, __assign({ value: value, fullWidth: true, inputRef: inputRef, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, label: step.label, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
48
+ } }, { children: _jsxs(RoundedSelect, __assign({ value: value, fullWidth: true, inputRef: inputRef, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, label: step.label, "data-testid": step.id, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
49
49
  onChange(event.target.value);
50
50
  sizeChange();
51
51
  }, helperText: errors[step.id]
@@ -20,10 +20,9 @@ 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;
24
23
  var step = _a.step, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
25
- var _c = useState(false), hovering = _c[0], setHovering = _c[1];
26
- var _d = useState(false), focus = _d[0], setFocus = _d[1];
24
+ var _b = useState(false), hovering = _b[0], setHovering = _b[1];
25
+ var _c = useState(false), focus = _c[0], setFocus = _c[1];
27
26
  var calcStyle = function () {
28
27
  if (focus) {
29
28
  return {
@@ -42,6 +41,23 @@ function TextAreaStep(_a) {
42
41
  };
43
42
  }
44
43
  };
44
+ var calcDefaultStringValue = function (defaultValue) {
45
+ var _a;
46
+ if (typeof defaultValue === 'string') {
47
+ return defaultValue;
48
+ }
49
+ else {
50
+ return (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text) !== null && _a !== void 0 ? _a : '';
51
+ }
52
+ };
53
+ var calcDefaultDraftValue = function (defaultValue) {
54
+ if (typeof defaultValue === 'string') {
55
+ return EditorState.createWithContent(convertFromRaw(stringToDraft(defaultValue)));
56
+ }
57
+ else {
58
+ return EditorState.createWithContent(convertFromRaw(getRawText(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.draft, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text)));
59
+ }
60
+ };
45
61
  if (step.hasTextEditor) {
46
62
  return (_jsxs("div", __assign({ className: styles.textEditorContainer, style: {
47
63
  '--eureka-outline': formStyle.outlineColor,
@@ -54,7 +70,7 @@ function TextAreaStep(_a) {
54
70
  if (!postview) {
55
71
  setFocus(false);
56
72
  }
57
- } }, { children: _jsx("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: function () {
73
+ } }, { children: _jsx("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', "data-testid": step.id, style: calcStyle(), onMouseEnter: function () {
58
74
  if (!postview) {
59
75
  setHovering(true);
60
76
  }
@@ -67,7 +83,7 @@ function TextAreaStep(_a) {
67
83
  setFocus(true);
68
84
  }
69
85
  } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
70
- ? EditorState.createWithContent(convertFromRaw(getRawText(originalValues[step.id].draft, originalValues[step.id].text)))
86
+ ? calcDefaultDraftValue(originalValues[step.id])
71
87
  : EditorState.createEmpty(), rules: step.required
72
88
  ? {
73
89
  validate: function (editorState) {
@@ -123,13 +139,13 @@ function TextAreaStep(_a) {
123
139
  else {
124
140
  return (_jsx("div", __assign({ className: styles.container, style: {
125
141
  paddingBottom: step.description || !!errors[step.id] ? '0px' : '23px',
126
- } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: (_b = originalValues[step.id]) !== null && _b !== void 0 ? _b : '', rules: {
142
+ } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: calcDefaultStringValue(originalValues[step.id]), rules: {
127
143
  required: step.required
128
144
  ? 'Este campo es obligatorio'
129
145
  : undefined,
130
146
  }, shouldUnregister: true, render: function (_a) {
131
147
  var field = _a.field;
132
- return (_jsx(RoundedTextField, __assign({}, field, { 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]
148
+ 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]
133
149
  ? errors[step.id].message
134
150
  : step.description, error: !!errors[step.id] }), void 0));
135
151
  } }, void 0) }), void 0));
@@ -35,7 +35,7 @@ function TextInputStep(_a) {
35
35
  : undefined,
36
36
  }, shouldUnregister: true, render: function (_a) {
37
37
  var field = _a.field;
38
- return (_jsx(RoundedTextField, __assign({}, field, { 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]
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
40
  : step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id] }), void 0));
41
41
  } }, void 0) }), void 0));
@@ -49,7 +49,7 @@ export function getUploadUrls(files, domain) {
49
49
  extension: file.name.split('.').pop(),
50
50
  }); });
51
51
  if (!domain) return [3 /*break*/, 2];
52
- return [4 /*yield*/, widgetInstance.post("/uploadfile?idOrganization=".concat(domain), filesArray)];
52
+ return [4 /*yield*/, widgetInstance.post("/uploadfile?idOrganization=" + domain, filesArray)];
53
53
  case 1:
54
54
  response = _b.sent();
55
55
  return [3 /*break*/, 4];
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { KeyboardDatePickerProps } from '@material-ui/pickers';
2
+ import { DatePickerProps } from '@material-ui/pickers';
3
3
  interface StyleProps {
4
4
  /** The color of the text */
5
5
  textColor?: string;
@@ -38,13 +38,11 @@ interface StyleProps {
38
38
  helperTextColor?: string;
39
39
  }
40
40
  interface RoundedDatePickerProps extends StyleProps {
41
- /** If the calendar icon should be shown */
42
- showIcon?: boolean;
43
41
  }
44
42
  /**
45
43
  * Generic datepicker with apps designs. Is class do to the use in the react-hook-forms library
46
44
  */
47
- declare class RoundedDatePicker extends React.Component<RoundedDatePickerProps & KeyboardDatePickerProps> {
45
+ declare class RoundedDatePicker extends React.Component<RoundedDatePickerProps & DatePickerProps> {
48
46
  render(): JSX.Element;
49
47
  }
50
48
  export default RoundedDatePicker;
@@ -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, KeyboardDateTimePicker, } from '@material-ui/pickers';
42
+ import { DatePicker, DateTimePicker, } 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) {
@@ -47,8 +47,9 @@ var useDatePickerStyles = function (props) {
47
47
  root: {
48
48
  borderRadius: props.borderRadius,
49
49
  backgroundColor: props.backgroundColor,
50
+ cursor: props.cantEdit ? 'default' : 'pointer',
50
51
  '& input, textarea': {
51
- cursor: props.cantEdit ? 'default' : 'text',
52
+ cursor: props.cantEdit ? 'default' : 'pointer',
52
53
  padding: props.padding,
53
54
  fontWeight: props.fontWeight,
54
55
  color: props.textColor,
@@ -210,7 +211,7 @@ var useDatePickerDialogStyles = function (props) {
210
211
  }); });
211
212
  };
212
213
  function CustomDatePicker(_a) {
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"]);
214
+ 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.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", "secondaryColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "contrastColor", "accentColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "helperTextColor", "fontWeight", "cantEdit", "pickTime", "onChange", "required"]);
214
215
  var classes = useDatePickerStyles({
215
216
  padding: padding,
216
217
  cantEdit: cantEdit,
@@ -277,7 +278,7 @@ function CustomDatePicker(_a) {
277
278
  helperTextColor: helperTextColor,
278
279
  })();
279
280
  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
+ return (_jsx(DateTimePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'Pp', { locale: getLocale() }), format: "Pp", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
281
282
  disableEnforceFocus: true,
282
283
  className: datePicker,
283
284
  cancelLabel: '',
@@ -286,6 +287,7 @@ function CustomDatePicker(_a) {
286
287
  required: required,
287
288
  classes: classes,
288
289
  disabled: cantEdit,
290
+ endAdornment: (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit", style: { color: '#757575' } }, void 0)),
289
291
  }, FormHelperTextProps: {
290
292
  classes: helperTextStyles,
291
293
  }, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
@@ -298,7 +300,7 @@ function CustomDatePicker(_a) {
298
300
  }, variant: "dialog" }), void 0));
299
301
  }
300
302
  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: {
303
+ return (_jsx(DatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'P', { locale: getLocale() }), format: "P", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
302
304
  disableEnforceFocus: true,
303
305
  className: datePicker,
304
306
  cancelLabel: '',
@@ -307,6 +309,7 @@ function CustomDatePicker(_a) {
307
309
  required: required,
308
310
  classes: classes,
309
311
  disabled: cantEdit,
312
+ endAdornment: (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit", style: { color: '#757575' } }, void 0)),
310
313
  }, FormHelperTextProps: {
311
314
  classes: helperTextStyles,
312
315
  }, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "1.2.0",
4
+ "version":"1.3.0-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
8
+ "e2e": "percy exec -- cypress run",
8
9
  "lint": "eslint 'src/**/*.ts'",
9
10
  "tsc-build": "tsc --noEmit false --outDir ./dist"
10
11
  },
@@ -17,11 +18,11 @@
17
18
  "@testing-library/jest-dom": "^5.14.1",
18
19
  "@testing-library/react": "^11.2.7",
19
20
  "@testing-library/user-event": "^12.8.3",
20
- "axios": "^0.21.1",
21
- "date-fns": "^2.23.0",
22
- "draft-js": "^0.11.7",
23
- "react-draft-wysiwyg": "^1.14.7",
24
- "react-hook-form": "7.18.1",
21
+ "axios": "^0.21.x",
22
+ "date-fns": "^2.23.x",
23
+ "draft-js": "^0.11.x",
24
+ "react-draft-wysiwyg": "^1.14.x",
25
+ "react-hook-form": "^7.6.4",
25
26
  "react-router-dom": "^5.2.0",
26
27
  "react-scripts": "5.0.0-next.37",
27
28
  "typescript": "^4.4.3"
@@ -46,35 +47,37 @@
46
47
  },
47
48
  "devDependencies": {
48
49
  "@babel/core": "^7.14.6",
50
+ "@percy/cli": "^1.0.0-beta.76",
51
+ "@percy/cypress": "^3.1.1",
49
52
  "@types/draft-js": "^0.11.5",
50
53
  "@types/jest": "^26.0.24",
51
- "@types/node": "^12.20.25",
52
54
  "@types/react": "^17.0.21",
53
55
  "@types/react-dom": "^17.0.9",
54
56
  "@types/react-draft-wysiwyg": "^1.13.3",
55
57
  "@types/react-router-dom": "^5.1.7",
56
58
  "@typescript-eslint/eslint-plugin": "^4.24.0",
57
59
  "@typescript-eslint/parser": "^4.24.0",
60
+ "cypress": "^9.5.2",
58
61
  "eslint": "^7.27.0",
59
62
  "eslint-config-prettier": "^8.3.0",
60
63
  "eslint-plugin-prettier": "^3.4.0",
61
64
  "jest-junit": "^12.2.0",
65
+ "local-web-server": "^5.2.0",
62
66
  "postcss-normalize": "^10.0.1",
63
67
  "prettier": "^2.3.0",
64
68
  "react": "^17.0.2",
65
69
  "react-dom": "^17.0.2"
66
70
  },
67
71
  "peerDependencies": {
68
- "react": "^17.x.x",
69
- "react-dom": "^17.x.x",
70
72
  "axios": "^0.21.x",
73
+ "babel-plugin-add-react-displayname": "0.0.x",
71
74
  "date-fns": "^2.23.x",
72
75
  "draft-js": "^0.11.x",
76
+ "logrocket": "^2.x.x",
77
+ "react": "^17.x.x",
78
+ "react-dom": "^17.x.x",
73
79
  "react-draft-wysiwyg": "^1.14.x",
74
- "react-hook-form": "^7.6.4",
75
- "react-router-dom": "^5.2.0",
76
- "babel-plugin-add-react-displayname": "0.0.x",
77
- "logrocket": "^2.x.x"
80
+ "react-hook-form": "^7.6.4"
78
81
  },
79
82
  "publishConfig": {
80
83
  "access": "public"