@arquimedes.co/eureka-forms 3.0.14-refactor → 3.0.17-refactor

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.
@@ -143,7 +143,7 @@ export const useLogRocket = (organization, form, { apiKey, internal, postview, p
143
143
  const LogRocket = await import('logrocket');
144
144
  LogRocket.default.init('63mg8a/forms-uv0gd');
145
145
  LogRocket.default.identify(organization.idOrganization + '/' + apiKey, {
146
- name: organization.name + '/' + (form?.name ? form?.name : '404'),
146
+ name: organization.name + '/' + (form?.name ?? '404'),
147
147
  });
148
148
  }
149
149
  catch (error) {
@@ -59,7 +59,7 @@ function TermComponent({ term, tempError }) {
59
59
  if (!postview) {
60
60
  field.onChange(true);
61
61
  }
62
- } })] })) }), _jsxs("div", { className: styles.container + ' noselect', children: [_jsx("div", { className: styles.checkboxContainer, children: _jsx(ErkCheckbox, { inputRef: ref, ...field, checked: field.value, disabled: postview, padding: "5px", error: !!error }) }), _jsx("p", { className: styles.messageContainer, style: {
62
+ } })] })) }), _jsxs("div", { className: styles.container + ' noselect', children: [_jsx("div", { className: styles.checkboxContainer, children: _jsx(ErkCheckbox, { inputRef: ref, ...field, checked: field.value, readOnly: postview, padding: "5px", error: !!error }) }), _jsx("p", { className: styles.messageContainer, style: {
63
63
  color: !!error && tempError ? formStyle.errorColor : 'inherit',
64
64
  }, children: renderText(term.message) })] })] }));
65
65
  }
@@ -34,7 +34,7 @@ function EntityValuePickerStep({ step, editable }) {
34
34
  }
35
35
  : undefined);
36
36
  }, []);
37
- return (_jsxs(React.Fragment, { children: [dialogs !== undefined && form.entities?.[step.idEntity] && (_jsx(MaterialEntityValueDialog, { type: dialogs.current.type, entity: form.entities?.[step.idEntity], entityValue: dialogs.value, message: dialogs.current.message, handleClose: handleCloseDialog })), _jsx(StepFillerContainer, { step: step, children: _jsx(SmartSelect, { editable: editable, step: step, IconComponent: () => (step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined), getOptions: getEntityValueOptions, getOptionSelected: (option, value) => option._id === value._id, calcDepError: (steps) => {
37
+ return (_jsxs(React.Fragment, { children: [dialogs !== undefined && form.entities?.[step.idEntity] && (_jsx(MaterialEntityValueDialog, { type: dialogs.current.type, entity: form.entities?.[step.idEntity], entityValue: dialogs.value, message: dialogs.current.message, handleClose: handleCloseDialog })), _jsx(StepFillerContainer, { step: step, children: _jsx(SmartSelect, { editable: editable, step: step, getOptionalDependencies: getOptionalDependencies, IconComponent: () => (step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined), getOptions: getEntityValueOptions, getOptionSelected: (option, value) => option._id === value._id, calcDepError: (steps) => {
38
38
  for (const step of steps) {
39
39
  if (step.type === FormStepTypes.ENTITYVALUEPICKER) {
40
40
  return 'Selecciona un ' + step.label;
@@ -149,3 +149,18 @@ const getEntityValueOptions = async (idOrganization, step, dependencyStore) => {
149
149
  });
150
150
  return response.data.filter((option) => step.options[option._id]?.type !== EntityValueOptionTypes.HIDE);
151
151
  };
152
+ const getOptionalDependencies = (step) => {
153
+ const optional = [];
154
+ for (const filter of step.filters) {
155
+ switch (filter.type) {
156
+ case EntityValueDataTypes.STEP: {
157
+ if (filter.idStep && !filter.required && !step.dependencies?.includes(filter.idStep))
158
+ optional.push(filter.idStep);
159
+ break;
160
+ }
161
+ default:
162
+ break;
163
+ }
164
+ }
165
+ return optional;
166
+ };
@@ -1,4 +1,4 @@
1
1
  import { SmartSelectStepProps } from '../SmartSelectStep';
2
2
  import { GSmartSelect } from '../../../@Types/GenericFormSteps';
3
- declare function SmartSelectStep<StepType extends GSmartSelect>({ step, editable, getOptions, calcDepError, defaultValue, filterOptions, IconComponent, valueOverwrite, getValueString, changeListener, getValueWarning, getOptionSelected, getOptionsConditionsIdSteps, renderNestedSteps, }: SmartSelectStepProps<StepType>): JSX.Element;
3
+ declare function SmartSelectStep<StepType extends GSmartSelect>({ step, editable, getOptions, calcDepError, defaultValue, filterOptions, IconComponent, valueOverwrite, getValueString, changeListener, getValueWarning, getOptionSelected, getOptionalDependencies, getOptionsConditionsIdSteps, renderNestedSteps, }: SmartSelectStepProps<StepType>): JSX.Element;
4
4
  export default SmartSelectStep;
@@ -9,7 +9,7 @@ import { focusStep, setEmptyDependency } from '../../../States/SiteSlice';
9
9
  import { selectDependencies, selectStepDependencies, useFormStep } from '../../StepHooks';
10
10
  import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
11
11
  import { FormTypes } from '../../../constants/FormStepTypes';
12
- function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValue, filterOptions, IconComponent, valueOverwrite, getValueString, changeListener, getValueWarning, getOptionSelected, getOptionsConditionsIdSteps = () => [], renderNestedSteps, }) {
12
+ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValue, filterOptions, IconComponent, valueOverwrite, getValueString, changeListener, getValueWarning, getOptionSelected, getOptionalDependencies = () => [], getOptionsConditionsIdSteps = () => [], renderNestedSteps, }) {
13
13
  const { ref, value, error, field, onChange: handleChange, } = useFormStep(step, {
14
14
  sizeChange: true,
15
15
  defaultValue: defaultValue ?? null,
@@ -28,9 +28,9 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
28
28
  const [firstTime, setFirstTime] = useState(true);
29
29
  const [touched, setTouched] = useState(false);
30
30
  const dispatch = useAppDispatch();
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- const idDependencies = useMemo(() => getOptionsConditionsIdSteps(step), []);
33
- const dependencies = useAppSelector((state) => selectDependencies(state, step.dependencies));
31
+ const allDeps = useMemo(() => [...(step.dependencies ?? []), ...getOptionalDependencies(step)], [getOptionalDependencies, step]);
32
+ const idDependencies = useMemo(() => getOptionsConditionsIdSteps(step), [getOptionsConditionsIdSteps, step]);
33
+ const dependencies = useAppSelector((state) => selectDependencies(state, allDeps));
34
34
  const deps = useAppSelector((state) => selectDependencies(state, idDependencies));
35
35
  const conditionDependencies = useMemo(() => deps,
36
36
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -18,6 +18,8 @@ export interface SmartSelectStepProps<StepType extends GSmartSelect = GSmartSele
18
18
  getValueString: (value: any) => string;
19
19
  /** Function to if currently selected option has warning */
20
20
  getValueWarning?: (value: any) => string | null;
21
+ /** Function called to get the idSteps of the optional dependencies */
22
+ getOptionalDependencies?: (step: StepType) => string[];
21
23
  /** Function called to get the idSteps of the step's conditions for better refreshing */
22
24
  getOptionsConditionsIdSteps?: (step: StepType) => string[];
23
25
  /** Function that returns the error message based on the steps of the missing Dependencies, undefined if no error msg */
@@ -15,7 +15,7 @@ function TextAreaStep({ step, editable, maxLength }) {
15
15
  });
16
16
  return (_jsxs("div", { className: styles.container, style: {
17
17
  paddingBottom: step.required || step.description || !!error ? '0px' : '12px',
18
- }, children: [_jsx("div", { className: styles.erkTextArea, children: _jsx(ErkTextField, { ...field, multiline: true, value: value, inputRef: ref, error: !!error, labelMargin: 0, label: step.label, onChange: onChange, "data-testid": step.id, maxLength: maxLength, required: step.required, disabled: !editable || postview, minRows: postview && partial ? undefined : 4, helperText: error?.message ?? step.description ?? (step.required ? ' ' : null) }) }), _jsxs("div", { className: styles.print, children: [value && (_jsxs(React.Fragment, { children: [_jsx("div", { className: styles.printLbl, style: {
18
+ }, children: [_jsx("div", { className: styles.erkTextArea, children: _jsx(ErkTextField, { ...field, multiline: true, value: value, inputRef: ref, error: !!error, labelMargin: 0, label: step.label, onChange: onChange, "data-testid": step.id, maxLength: maxLength, required: step.required, readOnly: !editable || postview, minRows: postview && partial ? undefined : 4, helperText: error?.message ?? step.description }) }), _jsxs("div", { className: styles.print, children: [value && (_jsxs(React.Fragment, { children: [_jsx("div", { className: styles.printLbl, style: {
19
19
  color: formStyle.descriptionTextColor,
20
20
  }, children: step.label }), _jsx("div", { className: styles.printLine, style: {
21
21
  color: formStyle.stepBackgroundColor,
@@ -111,7 +111,7 @@ function CustomTextfield({ onChange, value = '', IconComponent, size = 'small',
111
111
  if (maxLength) {
112
112
  inputProps.inputProps = { maxLength };
113
113
  }
114
- const helperText = others.helperText ?? (others.error === false ? ' ' : undefined);
114
+ const helperText = others.helperText ?? (others.error === false && !others.readOnly ? ' ' : undefined);
115
115
  return (_jsxs("div", { style: {
116
116
  position: 'relative',
117
117
  width: fullWidth ? '100%' : 'fit-content',
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":"3.0.14-refactor",
4
+ "version":"3.0.17-refactor",
5
5
  "scripts": {
6
6
  "watch": "tsc --noEmit --watch --project tsconfig.app.json",
7
7
  "start": "vite",
@@ -16,19 +16,19 @@
16
16
  "cypress": "DISPLAY=:0 cypress open"
17
17
  },
18
18
  "dependencies": {
19
- "@reduxjs/toolkit": "^2.4.0",
20
- "axios": "^1.7.7",
19
+ "@reduxjs/toolkit": "^2.6.0",
20
+ "axios": "^1.8.1",
21
21
  "date-fns": "^4.1.0",
22
22
  "draft-js": "^0.11.7",
23
- "i18n-iso-countries": "^7.13.0",
24
- "libphonenumber-js": "^1.11.14",
25
- "logrocket": "^9.0.0",
26
- "nanoid": "^5.0.7",
23
+ "i18n-iso-countries": "^7.14.0",
24
+ "libphonenumber-js": "^1.12.5",
25
+ "logrocket": "^9.0.2",
26
+ "nanoid": "^5.1.2",
27
27
  "react-draft-wysiwyg": "^1.15.0",
28
28
  "react-google-recaptcha": "^3.1.0",
29
- "react-hook-form": "^7.53.2",
30
- "react-international-phone": "^4.3.0",
31
- "react-redux": "^9.1.2",
29
+ "react-hook-form": "^7.54.2",
30
+ "react-international-phone": "^4.5.0",
31
+ "react-redux": "^9.2.0",
32
32
  "typescript": "^5.7.2"
33
33
  },
34
34
  "eslintConfig": {},
@@ -45,65 +45,69 @@
45
45
  ]
46
46
  },
47
47
  "devDependencies": {
48
- "@mui/material": "^6.3.0",
49
- "@mui/x-data-grid-pro": "^7.23.5",
50
- "@mui/x-date-pickers": "^7.23.3",
51
- "@mui/x-date-pickers-pro": "^7.23.3",
52
48
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
53
- "@babel/preset-env": "^7.26.0",
54
- "@babel/preset-react": "^7.25.9",
49
+ "@babel/preset-env": "^7.26.9",
50
+ "@babel/preset-react": "^7.26.3",
55
51
  "@babel/preset-typescript": "^7.26.0",
56
- "@faker-js/faker": "^9.2.0",
57
- "@storybook/addon-coverage": "^1.0.4",
58
- "@storybook/addon-essentials": "^8.3.5",
59
- "@storybook/addon-interactions": "^8.3.5",
60
- "@storybook/addon-links": "^8.3.5",
61
- "@storybook/addon-onboarding": "^8.3.5",
62
- "@storybook/addon-themes": "^8.3.5",
63
- "@storybook/blocks": "^8.3.5",
64
- "@storybook/react": "^8.3.5",
65
- "@storybook/react-webpack5": "^8.3.5",
66
- "@storybook/test": "^8.3.5",
52
+ "@eslint/compat": "^1.2.7",
53
+ "@eslint/eslintrc": "^3.3.0",
54
+ "@eslint/js": "^9.21.0",
55
+ "@faker-js/faker": "^9.5.1",
56
+ "@mui/material": "^6.4.7",
57
+ "@mui/x-data-grid-pro": "^7.27.2",
58
+ "@mui/x-date-pickers": "^7.27.1",
59
+ "@mui/x-date-pickers-pro": "^7.27.1",
60
+ "@storybook/addon-coverage": "^1.0.5",
61
+ "@storybook/addon-essentials": "^8.6.4",
62
+ "@storybook/addon-interactions": "^8.6.4",
63
+ "@storybook/addon-links": "^8.6.4",
64
+ "@storybook/addon-onboarding": "^8.6.4",
65
+ "@storybook/addon-themes": "^8.6.4",
66
+ "@storybook/blocks": "^8.6.4",
67
+ "@storybook/react": "^8.6.4",
68
+ "@storybook/react-webpack5": "^8.6.4",
69
+ "@storybook/test": "^8.6.4",
67
70
  "@storybook/testing-library": "^0.2.2",
68
71
  "@testing-library/dom": "^10.4.0",
69
72
  "@testing-library/jest-dom": "^6.6.3",
70
- "@testing-library/react": "^16.0.1",
71
- "@testing-library/user-event": "^14.5.2",
73
+ "@testing-library/react": "^16.2.0",
74
+ "@testing-library/user-event": "^14.6.1",
72
75
  "@types/draft-js": "^0.11.18",
73
- "@types/react": "^18.3.12",
74
- "@types/react-dom": "^18.3.1",
76
+ "@types/react": "^18.3.18",
77
+ "@types/react-dom": "^18.3.5",
75
78
  "@types/react-draft-wysiwyg": "^1.13.8",
76
79
  "@types/react-google-recaptcha": "^2.1.9",
77
- "@typescript-eslint/eslint-plugin": "^8.8.1",
78
- "@typescript-eslint/parser": "^8.8.1",
79
- "@vitejs/plugin-react-swc": "^3.7.2",
80
- "chromatic": "^11.19.0",
81
- "cypress": "^13.16.0",
80
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
81
+ "@typescript-eslint/parser": "^8.26.0",
82
+ "@vitejs/plugin-react-swc": "^3.8.0",
83
+ "chromatic": "^11.27.0",
84
+ "cypress": "^14.1.0",
82
85
  "dotenv-webpack": "^8.1.0",
83
- "eslint": "^8.57.1",
84
- "eslint-config-prettier": "^9.1.0",
85
- "eslint-plugin-react": "^7.37.1",
86
- "eslint-plugin-react-hooks": "^4.6.2",
87
- "eslint-plugin-react-refresh": "^0.4.12",
88
- "eslint-plugin-storybook": "^0.9.0",
86
+ "eslint": "^9.21.0",
87
+ "eslint-config-prettier": "^10.0.2",
88
+ "eslint-plugin-react": "^7.37.4",
89
+ "eslint-plugin-react-hooks": "^5.2.0",
90
+ "eslint-plugin-react-refresh": "^0.4.19",
91
+ "eslint-plugin-storybook": "^0.11.4",
92
+ "globals": "^16.0.0",
89
93
  "identity-obj-proxy": "^3.0.0",
90
- "jsdom": "^25.0.1",
91
- "prettier": "3.4.1",
94
+ "jsdom": "^26.0.0",
95
+ "prettier": "3.5.3",
92
96
  "react-docgen-typescript": "^2.2.2",
93
- "react-refresh": "^0.14.2",
94
- "storybook": "^8.4.5",
97
+ "react-refresh": "^0.16.0",
98
+ "storybook": "^8.6.4",
95
99
  "storybook-mock-date-decorator": "^2.0.6",
96
- "vite": "^6.0.1",
100
+ "vite": "^6.2.0",
97
101
  "vite-plugin-svgr": "^4.3.0",
98
- "vitest": "^2.1.6"
102
+ "vitest": "^3.0.8"
99
103
  },
100
104
  "peerDependencies": {
101
- "react": "^18.x.x",
102
- "react-dom": "^18.x.x",
103
105
  "@emotion/react": "^11.x.x",
104
106
  "@emotion/styled": "^11.x.x",
105
107
  "@mui/material": "^6.x.x",
106
- "@mui/x-date-pickers": "^7.x.x"
108
+ "@mui/x-date-pickers": "^7.x.x",
109
+ "react": "^18.x.x",
110
+ "react-dom": "^18.x.x"
107
111
  },
108
112
  "publishConfig": {
109
113
  "access": "public"