@arquimedes.co/eureka-forms 0.2.40 → 0.2.43

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.
Files changed (32) hide show
  1. package/dist/@Types/Form.d.ts +1 -0
  2. package/dist/@Types/FormStep.d.ts +9 -1
  3. package/dist/App.js +2 -2
  4. package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -6
  5. package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +12 -5
  6. package/dist/FormComponents/Form/Form.d.ts +1 -0
  7. package/dist/FormComponents/Form/Form.js +5 -6
  8. package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.d.ts +9 -0
  9. package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +37 -0
  10. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +4 -0
  11. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +40 -0
  12. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +37 -0
  13. package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +1 -1
  14. package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +1 -1
  15. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +1 -1
  16. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +9 -2
  17. package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +1 -2
  18. package/dist/FormComponents/Step/Step.js +4 -0
  19. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +47 -44
  20. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +1 -0
  21. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +1 -1
  22. package/dist/constants/FormStepTypes.d.ts +1 -0
  23. package/dist/constants/FormStepTypes.js +1 -0
  24. package/dist/constants/InternalFormStyle.js +1 -0
  25. package/dist/index.js +12 -1
  26. package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +2 -0
  27. package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +15 -6
  28. package/dist/shared/RoundedSelect/RoundedSelect.d.ts +17 -11
  29. package/dist/shared/RoundedSelect/RoundedSelect.js +15 -16
  30. package/dist/shared/RoundedTextField/RoundedTextField.d.ts +2 -0
  31. package/dist/shared/RoundedTextField/RoundedTextField.js +10 -7
  32. package/package.json +1 -1
@@ -52,6 +52,7 @@ export interface MaterialStyle {
52
52
  textColor: string;
53
53
  outlineColor: string;
54
54
  stepBackgroundColor: string;
55
+ descriptionTextColor: string;
55
56
  }
56
57
  export interface Section {
57
58
  _id: string;
@@ -1,11 +1,19 @@
1
1
  import Types, { ClassifierOptionTypes, ClientInfoTypes, OptionTypes } from '../constants/FormStepTypes';
2
- export declare type FormStep = Title | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector;
2
+ export declare type FormStep = Title | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector;
3
3
  export interface Title {
4
4
  id: string;
5
5
  type: Types.TITLE;
6
6
  title: string;
7
7
  description: string | null;
8
8
  }
9
+ export interface CheckBox {
10
+ label: string;
11
+ description: string | null;
12
+ id: string;
13
+ type: Types.CHECKBOX;
14
+ required: boolean;
15
+ size: 1 | 2 | 3 | 4;
16
+ }
9
17
  export interface FileUpload {
10
18
  id: string;
11
19
  type: Types.FILEUPLOAD;
package/dist/App.js CHANGED
@@ -188,9 +188,9 @@ function App(_a) {
188
188
  }); };
189
189
  if (form === undefined || organizationInfo === undefined) {
190
190
  if (isWidget) {
191
- return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50 }, void 0) }), void 0) }), void 0));
191
+ return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: 'var(--outlineGrey)' }, void 0) }), void 0) }), void 0));
192
192
  }
193
- return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50 }, void 0) }), void 0));
193
+ return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: 'var(--outlineGrey)' }, void 0) }), void 0));
194
194
  }
195
195
  else if (form === null) {
196
196
  console.log('FORM IS NULL');
@@ -22,13 +22,12 @@ function ConfirmationDialog(_a) {
22
22
  maxWidth: '100vw',
23
23
  boxSizing: 'content-box',
24
24
  },
25
- }, onClose: function () {
26
- onClose();
27
25
  }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
28
26
  onClose();
29
- } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit" }, 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("div", __assign({ className: styles.url, onClick: function () {
30
- var _a, _b, _c;
31
- (_c = (_b = (_a = window.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);
32
- } }, { children: confirmation.url }), void 0)] }), void 0) }), void 0));
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);
31
+ } }, { children: confirmation.url }), void 0)] }), void 0)] }), void 0) }), void 0));
33
32
  }
34
33
  export default ConfirmationDialog;
@@ -2,11 +2,18 @@
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: fit-content;
5
- max-height: 60vh;
5
+ max-height: 80vh;
6
6
  max-width: 80vw;
7
7
  position: relative;
8
8
  }
9
9
 
10
+ .container {
11
+ max-height: 100%;
12
+ display: flex;
13
+ flex-direction: column;
14
+ overflow: hidden;
15
+ overflow-y: scroll;
16
+ }
10
17
  .confirmationContainer,
11
18
  .confirmationContainer *,
12
19
  .confirmationContainer *::after,
@@ -20,8 +27,7 @@
20
27
  margin-left: auto;
21
28
  margin-right: auto;
22
29
  padding-top: 30px;
23
- font-size: 10rem;
24
- height: 10rem;
30
+ height: fit-content;
25
31
  margin-bottom: 15px;
26
32
  }
27
33
 
@@ -36,17 +42,18 @@
36
42
  .linkContainer {
37
43
  margin-top: 20px;
38
44
  font-size: 1.2rem;
39
- margin-right: auto;
40
45
  margin-left: 20px;
41
46
  }
42
47
  .url {
43
48
  font-weight: bolder;
44
49
  margin-left: 40px;
45
50
  margin-right: 40px;
46
- margin-top: 5px;
51
+ margin-top: 10px;
47
52
  margin-bottom: 40px;
48
53
  cursor: pointer;
49
54
  font-size: 1rem;
55
+ max-width: calc(100% - 100px);
56
+ word-break: break-all;
50
57
  }
51
58
  .closeIcon {
52
59
  right: 15px;
@@ -2,6 +2,7 @@
2
2
  import { Organization } from '../../@Types/@Types';
3
3
  import { Form, FormStyle } from '../../@Types/Form';
4
4
  import { CustomStep } from '../../App';
5
+ export declare const getLocale: () => any;
5
6
  export interface WidthStats {
6
7
  currentBreakPoint: number;
7
8
  isMobile: boolean;
@@ -39,13 +39,13 @@ var localeMap = {
39
39
  'en-US': enLocale,
40
40
  es: esLocale,
41
41
  };
42
- var getNavigatorLanguage = function () {
43
- return navigator.languages && navigator.languages.length
42
+ export var getLocale = function () {
43
+ var _a;
44
+ return ((_a = localeMap[navigator.languages && navigator.languages.length
44
45
  ? navigator.languages[0]
45
46
  : navigator.userLanguage ||
46
47
  navigator.language ||
47
- navigator.browserLanguage ||
48
- 'es';
48
+ navigator.browserLanguage]) !== null && _a !== void 0 ? _a : localeMap.es);
49
49
  };
50
50
  var blockSize = 210;
51
51
  var spacingSize = 20;
@@ -108,7 +108,6 @@ var generateClassName = createGenerateClassName({
108
108
  productionPrefix: 'efjss',
109
109
  });
110
110
  function FormTypeComponent(_a) {
111
- var _b;
112
111
  var props = __rest(_a, []);
113
112
  var renderTypes = function () {
114
113
  switch (props.form.type) {
@@ -125,7 +124,7 @@ function FormTypeComponent(_a) {
125
124
  };
126
125
  switch (props.formStyle.type) {
127
126
  case FormStyleTypes.MATERIAL:
128
- return (_jsx(StylesProvider, __assign({ generateClassName: generateClassName }, { children: _jsx(ThemeProvider, __assign({ theme: muiTheme }, { children: _jsx(MuiPickersUtilsProvider, __assign({ utils: DateFnsUtils, locale: (_b = localeMap[getNavigatorLanguage()]) !== null && _b !== void 0 ? _b : localeMap.es }, { children: renderTypes() }), void 0) }), void 0) }), void 0));
127
+ return (_jsx(StylesProvider, __assign({ generateClassName: generateClassName }, { children: _jsx(ThemeProvider, __assign({ theme: muiTheme }, { children: _jsx(MuiPickersUtilsProvider, __assign({ utils: DateFnsUtils, locale: getLocale() }, { children: renderTypes() }), void 0) }), void 0) }), void 0));
129
128
  default:
130
129
  return renderTypes();
131
130
  }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { CheckBox } from '../../../@Types/FormStep';
3
+ import { StepProps } from '../Step';
4
+ export interface CheckBoxStepProps extends StepProps {
5
+ /** The CheckboxStep to display */
6
+ step: CheckBox;
7
+ }
8
+ declare function CheckboxStep({ formStyle, ...others }: CheckBoxStepProps): JSX.Element;
9
+ export default CheckboxStep;
@@ -0,0 +1,37 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { FormStyleTypes } from '../../../constants/FormStepTypes';
25
+ import MaterialCheckBoxStep from './MaterialCheckBoxStep/MaterialCheckBoxStep';
26
+ function CheckboxStep(_a) {
27
+ var formStyle = _a.formStyle, others = __rest(_a, ["formStyle"]);
28
+ switch (formStyle.type) {
29
+ case FormStyleTypes.MATERIAL: {
30
+ return _jsx(MaterialCheckBoxStep, __assign({ formStyle: formStyle }, others), void 0);
31
+ }
32
+ default: {
33
+ return _jsx(MaterialCheckBoxStep, __assign({ formStyle: formStyle }, others), void 0);
34
+ }
35
+ }
36
+ }
37
+ export default CheckboxStep;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { CheckBoxStepProps } from '../CheckBoxStep';
3
+ declare function CheckBoxStep({ step, form, errors, control, postview, formStyle, widthStats, }: CheckBoxStepProps): JSX.Element;
4
+ export default CheckBoxStep;
@@ -0,0 +1,40 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import styles from './MaterialCheckBoxStep.module.css';
14
+ import { calcStepWidth } from '../../StepFunctions';
15
+ import RoundedCheckBox from '../../../../shared/RoundedCheckBox/RoundedCheckBox';
16
+ import { Controller } from 'react-hook-form';
17
+ function CheckBoxStep(_a) {
18
+ var step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats;
19
+ return (_jsxs("div", __assign({ className: styles.container, style: {
20
+ width: widthStats.currentBreakPoint <= step.size
21
+ ? '100%'
22
+ : calcStepWidth(step.size, form),
23
+ maxWidth: '100%',
24
+ minHeight: step.description || step.required ? '55px' : '43px',
25
+ } }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }), void 0), _jsx(Controller, { name: step.id, control: control, defaultValue: false, rules: {
26
+ required: step.required
27
+ ? 'Este campo es obligatorio'
28
+ : undefined,
29
+ }, shouldUnregister: true, render: function (_a) {
30
+ var field = _a.field;
31
+ 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));
32
+ } }, void 0)] }), void 0), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
33
+ color: !!errors[step.id]
34
+ ? formStyle.errorColor
35
+ : formStyle.descriptionTextColor,
36
+ } }, { children: !!errors[step.id]
37
+ ? 'Este campo es obligatorio'
38
+ : step.description }), void 0))] }), void 0));
39
+ }
40
+ export default CheckBoxStep;
@@ -0,0 +1,37 @@
1
+ .container {
2
+ width: fit-content;
3
+ max-width: calc(100% - 20px);
4
+ display: flex;
5
+ padding: 10px;
6
+ padding-bottom: 0px;
7
+ padding-top: 5px;
8
+ margin-bottom: 0px;
9
+ flex-direction: column;
10
+ }
11
+
12
+ .checkboxLbl {
13
+ font-size: 18px;
14
+ margin-right: 10px;
15
+ margin-left: 10px;
16
+ white-space: nowrap;
17
+ overflow: hidden;
18
+ text-overflow: ellipsis;
19
+ }
20
+ .labelCheckBoxContainer {
21
+ display: flex;
22
+ align-items: center;
23
+ flex-direction: row;
24
+ align-items: center;
25
+ height: 31px;
26
+ }
27
+
28
+ .descriptionPar {
29
+ font-size: 0.75rem;
30
+ margin-left: 14px;
31
+ margin-top: 4px;
32
+ font-weight: 400;
33
+ line-height: 1.66;
34
+ max-width: 100%;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ }
@@ -53,7 +53,7 @@ function ClassifierSelector(_a) {
53
53
  : calcStepWidth(step.size, form),
54
54
  maxWidth: '100%',
55
55
  minHeight: step.description || step.required ? '55px' : '43px',
56
- } }, { children: _jsxs(RoundedSelect, __assign({ fullWidth: true, value: value, cantEdit: postview, 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
+ } }, { 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) {
57
57
  onChange(event.target.value);
58
58
  sizeChange();
59
59
  }, inputRef: inputRef, helperText: errors[step.id]
@@ -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, fontWeight: 400, label: step.label, helperText: errors[step.id]
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]
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,7 @@ 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 }, { 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 }, { 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
194
  var files = e.target.files;
195
195
  if (files) {
196
196
  var filesArray = Array.from(files);
@@ -21,11 +21,18 @@
21
21
  -ms-user-select: none;
22
22
  user-select: none;
23
23
  }
24
+
24
25
  .stepDescriptionLabel {
25
- font-size: 0.7rem;
26
+ font-size: 0.75rem;
27
+ margin-left: 14px;
26
28
  margin-top: -4px;
27
- margin-left: 8px;
29
+ font-weight: 400;
30
+ line-height: 1.66;
31
+ max-width: 100%;
32
+ overflow: hidden;
33
+ text-overflow: ellipsis;
28
34
  }
35
+
29
36
  .filesInput {
30
37
  display: none;
31
38
  }
@@ -44,9 +44,8 @@ function Selector(_a) {
44
44
  width: widthStats.currentBreakPoint <= step.size
45
45
  ? '100%'
46
46
  : calcStepWidth(step.size, form),
47
- maxWidth: '100%',
48
47
  minHeight: step.description || step.required ? '55px' : '43px',
49
- } }, { children: _jsxs(RoundedSelect, __assign({ value: value, fullWidth: true, inputRef: inputRef, cantEdit: postview, 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, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
50
49
  onChange(event.target.value);
51
50
  sizeChange();
52
51
  }, helperText: errors[step.id]
@@ -30,6 +30,7 @@ import ClassifierSelectorStep from './ClassifierSelectorStep/ClassifierSelectorS
30
30
  import TextAreaStep from './TextAreaStep/TextAreaStep';
31
31
  import DatePickerStep from './DatePickerStep/DatePickerStep';
32
32
  import FileUploadStep from './FileUploadStep/FileUploadStep';
33
+ import CheckBoxStep from './CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep';
33
34
  function StepComponent(_a) {
34
35
  var step = _a.step, props = __rest(_a, ["step"]);
35
36
  switch (step.type) {
@@ -39,6 +40,9 @@ function StepComponent(_a) {
39
40
  case Types.SELECTOR: {
40
41
  return _jsx(SelectorStep, __assign({ step: step }, props), void 0);
41
42
  }
43
+ case Types.CHECKBOX: {
44
+ return _jsx(CheckBoxStep, __assign({ step: step }, props), void 0);
45
+ }
42
46
  case Types.CLASSIFIER_SELECTOR: {
43
47
  return (_jsx(ClassifierSelectorStep, __assign({ step: step }, props), void 0));
44
48
  }
@@ -36,7 +36,10 @@ function TextAreaStep(_a) {
36
36
  return { border: '1px solid ' + formStyle.primaryColor };
37
37
  }
38
38
  else {
39
- return { border: '1px solid ' + formStyle.outlineColor };
39
+ return {
40
+ border: '1px solid ' + formStyle.outlineColor,
41
+ pointerEvents: postview ? 'none' : 'all',
42
+ };
40
43
  }
41
44
  };
42
45
  if (step.hasTextEditor) {
@@ -51,7 +54,7 @@ function TextAreaStep(_a) {
51
54
  if (!postview) {
52
55
  setFocus(false);
53
56
  }
54
- } }, { children: _jsxs("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: function () {
57
+ } }, { children: _jsx("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: function () {
55
58
  if (!postview) {
56
59
  setHovering(true);
57
60
  }
@@ -63,51 +66,51 @@ function TextAreaStep(_a) {
63
66
  if (!postview) {
64
67
  setFocus(true);
65
68
  }
66
- } }, { children: [postview && (_jsx("div", { className: styles.disabledCurtain }, void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
67
- ? EditorState.createWithContent(convertFromRaw(getRawText(originalValues[step.id].draft, originalValues[step.id].text)))
68
- : EditorState.createEmpty(), rules: step.required
69
- ? {
70
- validate: function (editorState) {
71
- return editorState
72
- .getCurrentContent()
73
- .hasText();
74
- },
75
- }
76
- : {}, shouldUnregister: true, render: function (_a) {
77
- var _b;
78
- var field = _a.field;
79
- var editorClassName = styles.editor;
80
- if (!field.value.getCurrentContent().hasText()) {
81
- if (field.value
69
+ } }, { 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)))
71
+ : EditorState.createEmpty(), rules: step.required
72
+ ? {
73
+ validate: function (editorState) {
74
+ return editorState
82
75
  .getCurrentContent()
83
- .getBlockMap()
84
- .first()
85
- .getType() !== 'unstyled') {
86
- editorClassName +=
87
- ' RichEditor-hidePlaceholder';
88
- }
76
+ .hasText();
77
+ },
78
+ }
79
+ : {}, shouldUnregister: true, render: function (_a) {
80
+ var _b;
81
+ var field = _a.field;
82
+ var editorClassName = styles.editor;
83
+ if (!field.value.getCurrentContent().hasText()) {
84
+ if (field.value
85
+ .getCurrentContent()
86
+ .getBlockMap()
87
+ .first()
88
+ .getType() !== 'unstyled') {
89
+ editorClassName +=
90
+ ' RichEditor-hidePlaceholder';
89
91
  }
90
- return (_jsx(Editor, { editorRef: field.ref, onFocus: function () {
91
- setFocus(true);
92
- }, 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: {
92
+ }
93
+ return (_jsx(Editor, { editorRef: field.ref, onFocus: function () {
94
+ 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
+ options: [
97
+ 'inline',
98
+ 'list',
99
+ 'history',
100
+ ],
101
+ inline: {
93
102
  options: [
94
- 'inline',
95
- 'list',
96
- 'history',
103
+ 'bold',
104
+ 'italic',
105
+ 'underline',
106
+ 'strikethrough',
97
107
  ],
98
- inline: {
99
- options: [
100
- 'bold',
101
- 'italic',
102
- 'underline',
103
- 'strikethrough',
104
- ],
105
- },
106
- list: {
107
- options: ['unordered'],
108
- },
109
- } }, void 0));
110
- } }, void 0)] }), void 0) }), void 0), _jsx("div", __assign({ className: styles.errorMsg, style: {
108
+ },
109
+ list: {
110
+ options: ['unordered'],
111
+ },
112
+ } }, void 0));
113
+ } }, void 0) }), void 0) }), void 0), _jsx("div", __assign({ className: styles.errorMsg, style: {
111
114
  color: formStyle.errorColor,
112
115
  } }, { children: !!errors[step.id] && 'Este campo es obligatorio' }), void 0)] }), void 0));
113
116
  }
@@ -120,7 +123,7 @@ function TextAreaStep(_a) {
120
123
  : undefined,
121
124
  }, shouldUnregister: true, render: function (_a) {
122
125
  var field = _a.field;
123
- 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, helperText: errors[step.id]
126
+ 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]
124
127
  ? errors[step.id].message
125
128
  : step.description, error: !!errors[step.id] }), void 0));
126
129
  } }, void 0) }), void 0));
@@ -22,6 +22,7 @@
22
22
  width: 100%;
23
23
  position: relative;
24
24
  margin-bottom: 1px;
25
+ overflow: hidden;
25
26
  }
26
27
 
27
28
  .editor {
@@ -37,7 +37,7 @@ function TextInputStep(_a) {
37
37
  var field = _a.field;
38
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]
39
39
  ? errors[step.id].message
40
- : step.description, error: !!errors[step.id] }), void 0));
40
+ : step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id] }), void 0));
41
41
  } }, void 0) }), void 0));
42
42
  }
43
43
  export default TextInputStep;
@@ -7,6 +7,7 @@ export declare enum FormStyleTypes {
7
7
  }
8
8
  declare enum TYPES {
9
9
  TITLE = "TITLE",
10
+ CHECKBOX = "CHECKBOX",
10
11
  TEXTAREA = "TEXTAREA",
11
12
  DATEPICKER = "DATEPICKER",
12
13
  FILEUPLOAD = "FILEUPLOAD",
@@ -10,6 +10,7 @@ export var FormStyleTypes;
10
10
  var TYPES;
11
11
  (function (TYPES) {
12
12
  TYPES["TITLE"] = "TITLE";
13
+ TYPES["CHECKBOX"] = "CHECKBOX";
13
14
  TYPES["TEXTAREA"] = "TEXTAREA";
14
15
  TYPES["DATEPICKER"] = "DATEPICKER";
15
16
  TYPES["FILEUPLOAD"] = "FILEUPLOAD";
@@ -8,5 +8,6 @@ var InternalFormStyle = {
8
8
  errorColor: '#cc2936',
9
9
  textColor: '#293241',
10
10
  outlineColor: '#b8b8b8',
11
+ descriptionTextColor: '#989898',
11
12
  };
12
13
  export default InternalFormStyle;
package/dist/index.js CHANGED
@@ -13,4 +13,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as ReactDOM from 'react-dom';
14
14
  import App from './App';
15
15
  import styles from './index.module.css';
16
- ReactDOM.render(_jsx("div", __assign({ className: styles.eurekaForm }, { children: _jsx(App, { isWidget: false, apiKey: window.location.pathname.replace('/', '') }, void 0) }), void 0), document.getElementById('eureka-root'));
16
+ var urlParams = new URLSearchParams(window.location.search);
17
+ var values = urlParams.get('data-values');
18
+ var dataValues = undefined;
19
+ if (values) {
20
+ try {
21
+ dataValues = JSON.parse(decodeURIComponent(values));
22
+ }
23
+ catch (error) {
24
+ console.error('Invalid data-values JSON', error);
25
+ }
26
+ }
27
+ ReactDOM.render(_jsx("div", __assign({ className: styles.eurekaForm }, { children: _jsx(App, { isWidget: false, apiKey: window.location.pathname.replace('/', ''), valuesData: dataValues }, void 0) }), void 0), document.getElementById('eureka-root'));
@@ -26,6 +26,8 @@ interface StyleProps {
26
26
  shrunkenFontSize?: number | string;
27
27
  /** Cant edit */
28
28
  cantEdit?: boolean;
29
+ /** The color of the helper text when not error */
30
+ helperTextColor?: string;
29
31
  }
30
32
  interface RoundedDatePickerProps extends StyleProps {
31
33
  /** If the calendar icon should be shown */
@@ -40,6 +40,8 @@ import React, { cloneElement } from 'react';
40
40
  import { makeStyles } from '@material-ui/core/styles';
41
41
  import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
42
42
  import { KeyboardDatePicker, } from '@material-ui/pickers';
43
+ import { getLocale } from '../../FormComponents/Form/Form';
44
+ import { format } from 'date-fns';
43
45
  var useDatePickerStyles = function (props) {
44
46
  return makeStyles(function () { return ({
45
47
  root: {
@@ -60,9 +62,7 @@ var useDatePickerStyles = function (props) {
60
62
  '& .EF-MuiOutlinedInput-notchedOutline': {
61
63
  borderColor: props.outlineColor,
62
64
  '& span': {
63
- fontSize: props.shrunkenFontSize,
64
- paddingRight: 0,
65
- paddingLeft: 0,
65
+ fontSize: props.fontSize,
66
66
  },
67
67
  },
68
68
  '&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
@@ -96,6 +96,10 @@ var useDatePickerStyles = function (props) {
96
96
  var useDatePickerLabelStyles = function (props) {
97
97
  return makeStyles(function () { return ({
98
98
  root: {
99
+ whiteSpace: 'nowrap',
100
+ overflow: 'hidden',
101
+ maxWidth: 'calc(100% - 50px)',
102
+ textOverflow: 'ellipsis',
99
103
  marginTop: '-4px',
100
104
  fontSize: props.fontSize,
101
105
  '&.Mui-focused': {
@@ -103,7 +107,7 @@ var useDatePickerLabelStyles = function (props) {
103
107
  },
104
108
  '&.EF-MuiInputLabel-shrink': {
105
109
  marginTop: '0px',
106
- fontSize: props.shrunkenFontSize,
110
+ maxWidth: 'calc(100% - 5px)',
107
111
  },
108
112
  '& .Mui-error': {
109
113
  color: props.errorColor,
@@ -117,6 +121,7 @@ var useDatePickerLabelStyles = function (props) {
117
121
  var useDatePickerHelperTextStyles = function (props) {
118
122
  return makeStyles(function () { return ({
119
123
  root: {
124
+ color: props.helperTextColor,
120
125
  '&.Mui-error': {
121
126
  color: props.errorColor,
122
127
  },
@@ -158,7 +163,7 @@ var useDatePickerDialogStyles = function (props) {
158
163
  }); });
159
164
  };
160
165
  function CustomDatePicker(_a) {
161
- 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.fontWeight, fontWeight = _l === void 0 ? '300' : _l, _m = _a.showIcon, showIcon = _m === void 0 ? true : _m, _o = _a.cantEdit, cantEdit = _o === void 0 ? false : _o, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "fontWeight", "showIcon", "cantEdit", "onChange", "required"]);
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"]);
162
167
  var classes = useDatePickerStyles({
163
168
  padding: padding,
164
169
  cantEdit: cantEdit,
@@ -173,6 +178,7 @@ function CustomDatePicker(_a) {
173
178
  fontSize: fontSize,
174
179
  shrunkenFontSize: shrunkenFontSize,
175
180
  fontWeight: fontWeight,
181
+ helperTextColor: helperTextColor,
176
182
  })();
177
183
  var labelClasses = useDatePickerLabelStyles({
178
184
  padding: padding,
@@ -188,6 +194,7 @@ function CustomDatePicker(_a) {
188
194
  fontSize: fontSize,
189
195
  shrunkenFontSize: shrunkenFontSize,
190
196
  fontWeight: fontWeight,
197
+ helperTextColor: helperTextColor,
191
198
  })();
192
199
  var datePicker = useDatePickerDialogStyles({
193
200
  padding: padding,
@@ -203,6 +210,7 @@ function CustomDatePicker(_a) {
203
210
  fontSize: fontSize,
204
211
  shrunkenFontSize: shrunkenFontSize,
205
212
  fontWeight: fontWeight,
213
+ helperTextColor: helperTextColor,
206
214
  })().datePicker;
207
215
  var helperTextStyles = useDatePickerHelperTextStyles({
208
216
  padding: padding,
@@ -216,8 +224,9 @@ function CustomDatePicker(_a) {
216
224
  fontSize: fontSize,
217
225
  shrunkenFontSize: shrunkenFontSize,
218
226
  fontWeight: fontWeight,
227
+ helperTextColor: helperTextColor,
219
228
  })();
220
- return (_jsx(KeyboardDatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: "PPP", format: "PPP", required: required, keyboardIcon: showIcon ? (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit" }, void 0)) : null, InputLabelProps: { classes: labelClasses }, DialogProps: {
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: {
221
230
  disableEnforceFocus: true,
222
231
  className: datePicker,
223
232
  cancelLabel: '',
@@ -1,6 +1,22 @@
1
1
  import React from 'react';
2
2
  import { SelectProps } from '@material-ui/core/Select';
3
- interface RoundedSelectProps extends Omit<SelectProps, 'color'> {
3
+ interface ColorProps {
4
+ /** The color of the helper text when not error */
5
+ helperTextColor?: string;
6
+ /** The color of the outline when selected and hovered on */
7
+ focusColor?: string;
8
+ /** The color of the outline when it is not selected */
9
+ outlineColor?: string;
10
+ /** The color of the error to display */
11
+ errorColor?: string;
12
+ /** If the style should change on hover */
13
+ cantEdit?: boolean;
14
+ /** The hight of the container */
15
+ height?: string;
16
+ /** The color of the text in the form */
17
+ color?: string;
18
+ }
19
+ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
4
20
  /** children to display in the options */
5
21
  children?: any;
6
22
  /** Currently selected value */
@@ -10,26 +26,16 @@ interface RoundedSelectProps extends Omit<SelectProps, 'color'> {
10
26
  name?: string | undefined;
11
27
  value: any;
12
28
  }>, child?: React.ReactNode) => void;
13
- /** The hight of the container */
14
- height?: string;
15
29
  /** Strig to place in the label */
16
30
  label: string;
17
31
  /** Minimum width in px of the component */
18
32
  minWidth?: number;
19
33
  /** The color of the outline when selected and hovered on */
20
34
  focusColor?: string;
21
- /** The color of the error to display */
22
- errorColor?: string;
23
- /** the color of the text */
24
- color?: string;
25
- /** The color of the outline when it is not selected */
26
- outlineColor?: string;
27
35
  /** If outline should be error color */
28
36
  highlightError?: boolean;
29
37
  /** The helper Text to display */
30
38
  helperText?: string;
31
- /** If the selector cant be opened, diabled but with same style */
32
- cantEdit?: boolean;
33
39
  /** the margin around the selector */
34
40
  containerMargin?: string;
35
41
  }
@@ -36,7 +36,7 @@ var __rest = (this && this.__rest) || function (s, e) {
36
36
  return t;
37
37
  };
38
38
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
39
- import React, { useEffect } from 'react';
39
+ import React from 'react';
40
40
  import { makeStyles } from '@material-ui/core/styles';
41
41
  import InputLabel from '@material-ui/core/InputLabel';
42
42
  import FormControl from '@material-ui/core/FormControl';
@@ -105,7 +105,7 @@ var useLabelInputStyles = function (props) {
105
105
  marginTop: props.height != '40px' ? '-4px' : '0px',
106
106
  '&.EF-MuiInputLabel-shrink': {
107
107
  marginTop: '0px',
108
- maxWidth: 'calc(125% - 30px)',
108
+ maxWidth: 'calc(100% - 5px)',
109
109
  },
110
110
  '& .Mui-error': {
111
111
  color: props.errorColor,
@@ -119,6 +119,7 @@ var useLabelInputStyles = function (props) {
119
119
  var useHelperTextStyles = function (props) {
120
120
  return makeStyles(function () { return ({
121
121
  root: {
122
+ color: props.helperTextColor,
122
123
  '&.Mui-error': {
123
124
  color: props.errorColor,
124
125
  },
@@ -126,42 +127,40 @@ var useHelperTextStyles = function (props) {
126
127
  }); });
127
128
  };
128
129
  function CustomSelect(_a) {
129
- 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 = _e === void 0 ? '#0000003b' : _e, _f = _a.cantEdit, cantEdit = _f === void 0 ? false : _f, _g = _a.containerMargin, containerMargin = _g === void 0 ? '8px' : _g, _h = _a.height, height = _h === void 0 ? '40px' : _h, required = _a.required, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "cantEdit", "containerMargin", "height", "required", "error"]);
130
+ 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 = _e === void 0 ? '#0000003b' : _e, _f = _a.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.cantEdit, cantEdit = _g === void 0 ? false : _g, _h = _a.containerMargin, containerMargin = _h === void 0 ? '8px' : _h, _j = _a.height, height = _j === void 0 ? '40px' : _j, required = _a.required, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "cantEdit", "containerMargin", "height", "required", "error"]);
130
131
  var classes = useStyles();
131
132
  var outlinedInputClasses = useOutlinedInputStyles({
132
- focusColor: focusColor,
133
+ helperTextColor: helperTextColor,
133
134
  outlineColor: outlineColor,
134
- cantEdit: cantEdit,
135
- color: color,
136
135
  errorColor: errorColor,
136
+ focusColor: focusColor,
137
+ cantEdit: cantEdit,
137
138
  height: height,
139
+ color: color,
138
140
  })();
139
141
  var labelClasses = useLabelInputStyles({
140
- focusColor: focusColor,
142
+ helperTextColor: helperTextColor,
141
143
  outlineColor: outlineColor,
142
144
  errorColor: errorColor,
143
- color: color,
145
+ focusColor: focusColor,
144
146
  cantEdit: cantEdit,
145
147
  height: height,
148
+ color: color,
146
149
  })();
147
150
  var helperTextClasses = useHelperTextStyles({
148
- focusColor: focusColor,
151
+ helperTextColor: helperTextColor,
149
152
  outlineColor: outlineColor,
150
153
  errorColor: errorColor,
154
+ focusColor: focusColor,
151
155
  cantEdit: cantEdit,
152
- color: color,
153
156
  height: height,
157
+ color: color,
154
158
  })();
155
- var inputLabel = React.useRef();
156
- var _j = React.useState(0), labelWidth = _j[0], setLabelWidth = _j[1];
157
- useEffect(function () {
158
- setLabelWidth(inputLabel.current.offsetWidth);
159
- }, [label]);
160
159
  return (_jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
161
160
  ? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
162
161
  : {
163
162
  margin: containerMargin,
164
- }, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ ref: inputLabel, classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate, input: _jsx(OutlinedInput, { disabled: cantEdit, labelWidth: labelWidth, name: label, classes: outlinedInputClasses }, void 0) }, { children: children }), void 0), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText }), void 0))] }), void 0));
163
+ }, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate, 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));
165
164
  }
166
165
  /**
167
166
  * Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
@@ -29,6 +29,8 @@ interface StyleProps {
29
29
  multiline?: boolean;
30
30
  /** Cant edit */
31
31
  cantEdit?: boolean;
32
+ /** The color of the helper text when not error */
33
+ helperTextColor?: string;
32
34
  }
33
35
  interface RoundedTextFieldProps extends StyleProps {
34
36
  }
@@ -59,10 +59,14 @@ var useTextfieldStyles = function (props) {
59
59
  '& label': {
60
60
  marginTop: props.multiline ? '0px' : '-4px',
61
61
  fontSize: props.fontSize,
62
+ whiteSpace: 'nowrap',
63
+ overflow: 'hidden',
64
+ textOverflow: 'ellipsis',
65
+ maxWidth: 'calc(100% - 22px)',
62
66
  },
63
67
  '& label.EF-MuiInputLabel-shrink': {
64
- fontSize: props.shrunkenFontSize,
65
68
  marginTop: '0px',
69
+ maxWidth: 'calc(100% - 5px)',
66
70
  },
67
71
  '& input + fieldset': {
68
72
  borderRadius: props.borderRadius,
@@ -78,11 +82,6 @@ var useTextfieldStyles = function (props) {
78
82
  },
79
83
  '& .EF-MuiOutlinedInput-notchedOutline': {
80
84
  borderColor: props.outlineColor,
81
- '& span': {
82
- fontSize: props.shrunkenFontSize,
83
- paddingRight: 0,
84
- paddingLeft: 0,
85
- },
86
85
  },
87
86
  },
88
87
  '& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
@@ -96,11 +95,14 @@ var useTextfieldStyles = function (props) {
96
95
  '& .Mui-error': {
97
96
  color: props.errorColor,
98
97
  },
98
+ '& .EF-MuiFormHelperText-root': {
99
+ color: props.helperTextColor,
100
+ },
99
101
  },
100
102
  }); });
101
103
  };
102
104
  function CustomTextfield(_a) {
103
- 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.readOnly, readOnly = _f === void 0 ? false : _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.errorColor, errorColor = _l === void 0 ? '#cc2936' : _l, _m = _a.fontWeight, fontWeight = _m === void 0 ? '300' : _m, _o = _a.multiline, multiline = _o === void 0 ? false : _o, _p = _a.cantEdit, cantEdit = _p === void 0 ? false : _p, others = __rest(_a, ["focusColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit"]);
105
+ 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 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.borderRadius, borderRadius = _h === void 0 ? 10 : _h, _j = _a.padding, padding = _j === void 0 ? '6px 12px' : _j, _k = _a.fontSize, fontSize = _k === void 0 ? '1rem' : _k, _l = _a.shrunkenFontSize, shrunkenFontSize = _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, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit"]);
104
106
  var classes = useTextfieldStyles({
105
107
  padding: padding,
106
108
  textColor: textColor,
@@ -108,6 +110,7 @@ function CustomTextfield(_a) {
108
110
  focusColor: focusColor,
109
111
  outlineColor: outlineColor,
110
112
  innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
113
+ helperTextColor: helperTextColor,
111
114
  backgroundColor: backgroundColor,
112
115
  borderRadius: borderRadius,
113
116
  readOnly: readOnly,
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": "0.2.40",
4
+ "version": "0.2.43",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",