@arquimedes.co/eureka-forms 1.9.119 → 1.9.120

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.
@@ -137,7 +137,7 @@ function AYFStepMapper(props) {
137
137
  case AYFFormStepTypes.AYF_YEAR:
138
138
  return (_jsx(TextInputStep, __assign({}, props, { step: props.step, defaultValue: new Date().getFullYear().toString() })));
139
139
  case AYFFormStepTypes.AYF_BILL_NUM:
140
- return (_jsx(TextInputStep, __assign({}, props, { step: props.step, icon: _jsx(DescriptionIcon, { style: { color: '#757575', fontSize: 23 } }) })));
140
+ return (_jsx(TextInputStep, __assign({}, props, { step: props.step, maxLength: 50, icon: _jsx(DescriptionIcon, { style: { color: '#757575', fontSize: 23 } }) })));
141
141
  case AYFFormStepTypes.AYF_CUT_OFF_DATE:
142
142
  return (_jsx(DatePickerStep, __assign({}, props, { step: props.step, defaultValue: new Date() })));
143
143
  case AYFFormStepTypes.AYF_ICA_CITY:
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { TextInputStepProps } from '../TextInputStep';
3
- declare function TextInputStep({ icon, step, form, errors, control, editable, postview, formStyle, widthStats, defaultValue, dependencyStore, setDependencyStore, }: TextInputStepProps): JSX.Element;
3
+ declare function TextInputStep({ icon, step, form, errors, control, editable, postview, maxLength, formStyle, widthStats, defaultValue, dependencyStore, setDependencyStore, validation, }: TextInputStepProps): JSX.Element;
4
4
  export default TextInputStep;
@@ -27,15 +27,13 @@ import { Controller } from 'react-hook-form';
27
27
  import { calcStepWidth } from '../../StepFunctions';
28
28
  import { useState } from 'react';
29
29
  function TextInputStep(_a) {
30
- var icon = _a.icon, step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore;
31
- var _c = useState(null), timer = _c[0], setTimer = _c[1];
30
+ var icon = _a.icon, step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, maxLength = _a.maxLength, formStyle = _a.formStyle, widthStats = _a.widthStats, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, _c = _a.validation, validation = _c === void 0 ? step.validation : _c;
31
+ var _d = useState(null), timer = _d[0], setTimer = _d[1];
32
32
  return (_jsx("div", __assign({ className: styles.container, style: {
33
33
  width: widthStats.currentBreakPoint <= step.size
34
34
  ? '100%'
35
35
  : calcStepWidth(step.size, form.size),
36
- minHeight: (!postview &&
37
- editable &&
38
- (step.required || step.validation)) ||
36
+ minHeight: (!postview && editable && (step.required || validation)) ||
39
37
  step.description
40
38
  ? '55px'
41
39
  : '43px',
@@ -43,10 +41,10 @@ function TextInputStep(_a) {
43
41
  required: step.required
44
42
  ? 'Este campo es obligatorio'
45
43
  : undefined,
46
- pattern: step.validation
44
+ pattern: validation
47
45
  ? {
48
- value: new RegExp(step.validation.value),
49
- message: step.validation.message,
46
+ value: new RegExp(validation.value),
47
+ message: validation.message,
50
48
  }
51
49
  : undefined,
52
50
  }, shouldUnregister: true, render: function (_a) {
@@ -68,7 +66,7 @@ function TextInputStep(_a) {
68
66
  }, 1000));
69
67
  }
70
68
  field.onChange(value);
71
- }, "data-testid": step.id, label: step.label, inputRef: ref, cantEdit: !editable || postview, required: step.required, fontWeight: 400, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
69
+ }, maxLength: maxLength, "data-testid": step.id, label: step.label, inputRef: ref, cantEdit: !editable || postview, required: step.required, fontWeight: 400, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
72
70
  ? errors[step.id].message
73
71
  : step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id], icon: step.showIcon ? icon : undefined })));
74
72
  } }) })));
@@ -8,6 +8,10 @@ export interface TextInputStepProps extends StepProps {
8
8
  icon?: React.ReactNode;
9
9
  /** Default value to display */
10
10
  defaultValue?: string;
11
+ /** Custom Validation to display */
12
+ validation?: TextInput['validation'];
13
+ /** Custom step Max char length */
14
+ maxLength?: number;
11
15
  }
12
16
  declare function TextInputStep(props: TextInputStepProps): JSX.Element;
13
17
  export default TextInputStep;
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.9.119",
4
+ "version": "1.9.120",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",