@arquimedes.co/eureka-forms 3.0.11-refactor → 3.0.16-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.
Files changed (25) hide show
  1. package/dist/App/AppHooks.js +1 -1
  2. package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +2 -2
  3. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +1 -1
  4. package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +1 -3
  5. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +1 -1
  6. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.js +1 -1
  7. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +16 -1
  8. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +1 -1
  9. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +1 -1
  10. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +1 -1
  11. package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +4 -4
  12. package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +2 -0
  13. package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +1 -1
  14. package/dist/Shared/ErkButton/ErkButton.d.ts +14 -20
  15. package/dist/Shared/ErkButton/ErkButton.js +18 -18
  16. package/dist/Shared/ErkButton/ErkButton.stories.d.ts +0 -8
  17. package/dist/Shared/ErkButton/ErkButton.stories.js +0 -10
  18. package/dist/Shared/ErkCheckbox/ErkCheckBox.d.ts +2 -2
  19. package/dist/Shared/ErkCheckbox/ErkCheckBox.js +5 -4
  20. package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.d.ts +0 -3
  21. package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.js +0 -3
  22. package/dist/Shared/ErkPhoneInput/EkrPhoneInput.js +3 -0
  23. package/dist/Shared/ErkSmartSelect/ErkSmartSelect.js +1 -1
  24. package/dist/Shared/ErkTextField/ErkTextField.js +1 -1
  25. package/package.json +45 -41
@@ -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) {
@@ -54,12 +54,12 @@ function TermComponent({ term, tempError }) {
54
54
  setShowDialog(false);
55
55
  }, children: _jsx(CloseIcon, { style: { fontSize: 'inherit' } }) }), _jsx("div", { className: styles.dialogTitle, style: {
56
56
  borderBottom: '1px solid ' + formStyle.primaryColor,
57
- }, children: term.clickEffect.title }), _jsx("div", { className: styles.dialogContentContainer, children: term.clickEffect.text }), _jsx(ErkButton, { text: 'Aceptar', padding: "20px 15px", backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, fontSize: 20, onClick: () => {
57
+ }, children: term.clickEffect.title }), _jsx("div", { className: styles.dialogContentContainer, children: term.clickEffect.text }), _jsx(ErkButton, { text: 'Aceptar', sx: { padding: '20px 15px', fontSize: '20px' }, onClick: () => {
58
58
  setShowDialog(false);
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
  }
@@ -100,7 +100,7 @@ function CBRIncidentsStep({ step, editable, ...others }) {
100
100
  }
101
101
  }
102
102
  onChange(tempIncidents);
103
- }, ...others }, index))) }), _jsxs("div", { className: styles.btnContainer, children: [_jsx("input", { ref: ref, className: 'hidden-input' }), _jsx(ErkButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: () => {
103
+ }, ...others }, index))) }), _jsxs("div", { className: styles.btnContainer, children: [_jsx("input", { ref: ref, className: 'hidden-input' }), _jsx(ErkButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), sx: { padding: '5px 15px' }, onClick: () => {
104
104
  if (editable && !postview) {
105
105
  handleAddIncident();
106
106
  }
@@ -74,8 +74,6 @@ function CBRPropertyStepComponent(props) {
74
74
  },
75
75
  }, open: true, children: _jsxs("div", { className: styles.confirmationContainer, style: { color: formStyle.textColor }, children: [_jsx("div", { className: styles.closeIcon, onClick: () => {
76
76
  setShowWarning(undefined);
77
- }, children: _jsx(CloseIcon, { style: { fontSize: 'inherit' } }) }), _jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.warningContainer, style: { color: formStyle.primaryColor }, children: _jsx(WarningIcon, { style: { fontSize: '160px' } }) }), _jsxs("div", { className: styles.messageContainer, children: ["La garant\u00EDa de su inmueble expir\u00F3 el d\u00EDa ", showWarning.toLocaleDateString(), "."] }), _jsx("div", { className: styles.btnContainer, children: _jsx(ErkButton, { text: 'Continuar', color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: () => {
78
- setShowWarning(undefined);
79
- } }) })] })] }) }))] }));
77
+ }, children: _jsx(CloseIcon, { style: { fontSize: 'inherit' } }) }), _jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.warningContainer, style: { color: formStyle.primaryColor }, children: _jsx(WarningIcon, { style: { fontSize: '160px' } }) }), _jsxs("div", { className: styles.messageContainer, children: ["La garant\u00EDa de su inmueble expir\u00F3 el d\u00EDa ", showWarning.toLocaleDateString(), "."] }), _jsx("div", { className: styles.btnContainer, children: _jsx(ErkButton, { text: 'Continuar', sx: { padding: '5px 15px' }, onClick: () => setShowWarning(undefined) }) })] })] }) }))] }));
80
78
  }
81
79
  export default CBRPropertyStepComponent;
@@ -35,7 +35,7 @@ function CheckBoxStep({ step, editable }) {
35
35
  height: step.size < 4 ? 31 : undefined,
36
36
  minHeight: 31,
37
37
  alignItems: step.isList ? 'start' : 'center',
38
- }, children: [step.label && !step.isList && renderLabel(true), _jsx(ErkCheckBox, { ...field, padding: "0px", size: "1.6rem", inputRef: ref, error: !!error, checked: value, onChange: onChange, "data-testid": step.id, readOnly: !editable || postview }), step.label && step.isList && renderLabel()] }), (step.description ?? !!error) && (_jsx("div", { className: styles.descriptionPar, style: {
38
+ }, children: [step.label && !step.isList && renderLabel(true), _jsx(ErkCheckBox, { ...field, padding: "0px", inputRef: ref, error: !!error, checked: value, onChange: onChange, "data-testid": step.id, readOnly: !editable || postview }), step.label && step.isList && renderLabel()] }), (step.description ?? !!error) && (_jsx("div", { className: styles.descriptionPar, style: {
39
39
  color: error ? formStyle.errorColor : formStyle.descriptionTextColor,
40
40
  }, children: error ? 'Este campo es obligatorio' : step.description }))] }) }), renderNested()] }));
41
41
  }
@@ -26,6 +26,6 @@ function MaterialEntityValueDialog({ type, entity, message, entityValue, handleC
26
26
  },
27
27
  }, open: true, children: _jsxs("div", { className: styles.confirmationContainer, style: { color: formStyle.textColor }, children: [_jsx("div", { className: styles.closeIcon, onClick: () => handleClose(), children: _jsx(CloseIcon, { style: { fontSize: 'inherit' } }) }), _jsxs("div", { className: styles.container, children: [_jsxs("div", { className: styles.contentContainer, children: [_jsx("div", { className: styles.warningContainer, style: {
28
28
  color: type === 'INFO' ? formStyle.primaryColor : formStyle.errorColor,
29
- }, children: type === 'INFO' ? (_jsx(InfoIcon, { style: { fontSize: '160px' } })) : (_jsx(WarningIcon, { style: { fontSize: '160px' } })) }), _jsx("div", { className: styles.messageContainer, children: _jsx(Editor, { editorClassName: 'Erk-Forms-Dialog', editorState: editorState, readOnly: true, toolbarHidden: true }) })] }), _jsx("div", { className: styles.btnContainer, children: _jsx(ErkButton, { text: 'Continuar', color: formStyle.primaryContrastColor, backgroundColor: type === 'INFO' ? formStyle.primaryColor : formStyle.errorColor, fontSize: '1.2rem', height: undefined, padding: '16px 20px', onClick: () => handleClose() }) })] })] }) }));
29
+ }, children: type === 'INFO' ? (_jsx(InfoIcon, { style: { fontSize: '160px' } })) : (_jsx(WarningIcon, { style: { fontSize: '160px' } })) }), _jsx("div", { className: styles.messageContainer, children: _jsx(Editor, { editorClassName: 'Erk-Forms-Dialog', editorState: editorState, readOnly: true, toolbarHidden: true }) })] }), _jsx("div", { className: styles.btnContainer, children: _jsx(ErkButton, { text: 'Continuar', onClick: () => handleClose(), sx: { padding: '16px 20px', fontSize: '1.2rem' } }) })] })] }) }));
30
30
  }
31
31
  export default MaterialEntityValueDialog;
@@ -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
+ };
@@ -142,7 +142,7 @@ function FileUploadStep({ step, editable }) {
142
142
  }
143
143
  inputRef.current.value = '';
144
144
  }
145
- }, multiple: true, accept: getAcceptedExtensions() }), _jsxs("div", { className: styles.btnContainer, children: [_jsx("input", { ref: ref, className: 'hidden-input' }), _jsx(ErkButton, { disabled: !editable || postview, text: 'Examinar' + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: () => {
145
+ }, multiple: true, accept: getAcceptedExtensions() }), _jsxs("div", { className: styles.btnContainer, children: [_jsx("input", { ref: ref, className: 'hidden-input' }), _jsx(ErkButton, { disabled: !editable || postview, text: 'Examinar' + (step.required ? ' *' : ''), sx: { padding: '5px 15px' }, onClick: () => {
146
146
  if (editable && !postview) {
147
147
  const input = inputRef.current;
148
148
  if (input !== null) {
@@ -61,7 +61,7 @@ function MapperComponent({ form, step, error, value, loading, inputRef, editable
61
61
  return (_jsxs("div", { className: container, style: { color: formStyle.textColor }, "data-testid": step.id, id: step.id, children: [step.label && _jsx("div", { className: styles.titleLbl, children: step.label }), step.description && (_jsx("p", { className: styles.descriptionPar, style: {
62
62
  margin: step.description ? '10px 0px' : '0px 0px 5px 0px',
63
63
  }, children: step.description })), mapElements(), _jsx("input", { id: step.id + '-input', ref: inputRef, className: 'hidden-input', readOnly: true, value: inputValue }), step.creatable !== false &&
64
- (!step.max || elements.filter((elem) => !elem.deleted).length < step.max) && (_jsxs("div", { className: styles.btnContainer, children: [!customAdd && (_jsx(ErkButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: () => {
64
+ (!step.max || elements.filter((elem) => !elem.deleted).length < step.max) && (_jsxs("div", { className: styles.btnContainer, children: [!customAdd && (_jsx(ErkButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), sx: { padding: '5px 15px' }, onClick: () => {
65
65
  if (editable && !postview) {
66
66
  handleAddElement();
67
67
  }
@@ -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 ?? (step.required ? ' ' : null) }) }), _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,
@@ -1,31 +1,25 @@
1
- import React from 'react';
2
1
  import { ButtonProps as MuiButtonProps } from '@mui/material';
3
- interface ButtonProps extends Omit<MuiButtonProps, 'color'> {
2
+ declare module '@mui/material/Button' {
3
+ interface ButtonPropsColorOverrides {
4
+ inherit: false;
5
+ }
6
+ }
7
+ export interface ErkButtonProps extends Omit<MuiButtonProps, 'color' | 'onSubmit' | 'ref'> {
4
8
  /** Button text */
5
- text: string;
6
- /** Background Color */
7
- backgroundColor?: string;
8
- /** Font Color */
9
- color?: string;
9
+ text?: string;
10
+ /** The color of the button */
11
+ color?: 'primary' | 'secondary' | 'error' | 'warning';
10
12
  /** Button Click Handle */
11
13
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
12
14
  /** If button is disabled */
13
15
  disabled?: boolean;
14
- /** Text font size */
15
- fontSize?: number | string;
16
- /** Button padding '0 13px 0 13px' format */
17
- padding?: string;
18
- /** border radius */
19
- borderRadius?: number;
20
- /** Component height */
21
- height?: number;
22
- /** If text is bold */
23
- bold?: boolean;
24
- /** The width of the button */
25
- width?: string;
16
+ /** If the button es loading */
17
+ loading?: boolean;
18
+ /** The href to redirect */
19
+ buttonRef?: React.Ref<HTMLButtonElement>;
26
20
  }
27
21
  /**
28
22
  * Generic capta button
29
23
  */
30
- declare function ErkButton({ text, color, ...props }: ButtonProps): JSX.Element;
24
+ declare function ErkButton({ text, color, loading, children, disabled, buttonRef, ...props }: ErkButtonProps): JSX.Element;
31
25
  export default ErkButton;
@@ -1,31 +1,31 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button as MuiButton, styled } from '@mui/material';
3
- const StyledButton = styled(MuiButton)(({ height = 28, bold = false, fontColor = '#ffffff', fontSize = '1rem', borderRadius = 10, width = 'fit-content', padding = '0 13px 0 13px', backgroundColor = '#3d5a7f', }) => ({
4
- width,
3
+ import Loader from '../Loader/Loader';
4
+ const StyledButton = styled(MuiButton)(({ theme, color }) => ({
5
+ width: 'fit-content',
5
6
  textTransform: 'none',
6
7
  fontFamily: 'inherit',
7
- fontSize,
8
- borderRadius,
9
- padding,
10
- height: height,
8
+ fontSize: '1rem',
9
+ borderRadius: 10,
10
+ padding: '0 13px 0 13px',
11
+ minHeight: 28,
11
12
  boxShadow: 'none',
12
- backgroundColor,
13
- color: fontColor,
14
- '&:hover': {
15
- boxShadow: 'none',
16
- backgroundColor,
17
- },
13
+ '&:hover': { boxShadow: 'none' },
18
14
  '&:disabled': {
19
- backgroundColor,
20
- color: fontColor,
15
+ backgroundColor: theme.palette[color ?? 'primary']?.main,
16
+ color: theme.palette[color ?? 'primary']?.contrastText,
21
17
  opacity: 0.5,
22
18
  },
23
- fontWeight: bold ? 'bold' : 'normal',
19
+ fontWeight: 'normal',
24
20
  }));
25
21
  /**
26
22
  * Generic capta button
27
23
  */
28
- function ErkButton({ text, color, ...props }) {
29
- return (_jsx(StyledButton, { text: '', fontColor: color, variant: "contained", ...props, children: text }));
24
+ function ErkButton({ text, color = 'primary', loading, children, disabled, buttonRef, ...props }) {
25
+ return (_jsxs(StyledButton, { text: '', ref: buttonRef, variant: "contained", disabled: disabled ?? loading, color: color, ...props, children: [loading && _jsx(Loader, { size: 20, color: 'white' }), text && (_jsx("label", { style: {
26
+ visibility: loading ? 'hidden' : 'visible',
27
+ fontSize: 'inherit',
28
+ cursor: 'inherit',
29
+ }, children: text })), _jsx("div", { style: { visibility: loading ? 'hidden' : 'visible' }, children: children })] }));
30
30
  }
31
31
  export default ErkButton;
@@ -5,15 +5,7 @@ declare const meta: {
5
5
  tags: string[];
6
6
  args: {
7
7
  text: string;
8
- backgroundColor: string;
9
- color: string;
10
8
  disabled: false;
11
- fontSize: string;
12
- padding: string;
13
- borderRadius: number;
14
- height: number;
15
- bold: false;
16
- width: string;
17
9
  };
18
10
  };
19
11
  export default meta;
@@ -4,15 +4,7 @@ const meta = {
4
4
  tags: ['autodocs'],
5
5
  args: {
6
6
  text: 'Label',
7
- backgroundColor: '#3d5a7f',
8
- color: '#ffffff',
9
7
  disabled: false,
10
- fontSize: '1rem',
11
- padding: '0 13px 0 13px',
12
- borderRadius: 10,
13
- height: 28,
14
- bold: false,
15
- width: 'fit-content',
16
8
  },
17
9
  };
18
10
  export default meta;
@@ -30,7 +22,5 @@ export const Disabled = {
30
22
  export const DifferentColors = {
31
23
  args: {
32
24
  text: 'Label',
33
- backgroundColor: 'red',
34
- color: 'blue',
35
25
  },
36
26
  };
@@ -1,7 +1,7 @@
1
- import React, { CSSProperties } from 'react';
1
+ import React from 'react';
2
2
  import { CheckboxProps as MuiCheckboxProps } from '@mui/material';
3
3
  interface StyleProps {
4
- size?: CSSProperties['fontSize'];
4
+ size?: 'small' | 'medium';
5
5
  padding?: string;
6
6
  error?: number;
7
7
  }
@@ -3,9 +3,10 @@ import React from 'react';
3
3
  import CheckboxUncheckedIcon from '../../Icons/CheckboxUncheckedIcon';
4
4
  import CheckboxCheckedIcon from '../../Icons/CheckboxCheckedIcon';
5
5
  import { FormControl, Checkbox as MuiCheckbox, styled } from '@mui/material';
6
- const StyledCheckbox = styled(MuiCheckbox)(({ theme, size = '1.5rem', padding = '9px', disabled, readOnly, error }) => ({
7
- padding: padding,
8
- fontSize: size,
6
+ const StyledCheckbox = styled(MuiCheckbox, { shouldForwardProp: (prop) => prop !== 'size' })(({ theme, padding = '0px', size = 'small', disabled, readOnly, error }) => ({
7
+ padding,
8
+ width: size === 'small' ? 26 : 32,
9
+ height: size === 'small' ? 26 : 32,
9
10
  opacity: disabled ? 0.5 : 1,
10
11
  pointerEvents: readOnly ? 'none' : undefined,
11
12
  color: error ? theme.palette.error.main : '#787878',
@@ -17,7 +18,7 @@ const StyledCheckbox = styled(MuiCheckbox)(({ theme, size = '1.5rem', padding =
17
18
  * Generic capta checkbox
18
19
  */
19
20
  function CustomCheckBox({ onChange, error = false, readOnly = false, disabled = false, ...others }) {
20
- return (_jsx(FormControl, { error: true, children: _jsx(StyledCheckbox, { ...others, error: +error, readOnly: readOnly, disabled: disabled, inputProps: { disabled: disabled || readOnly }, icon: _jsx(CheckboxUncheckedIcon, { style: { fontSize: 'inherit' } }), checkedIcon: _jsx(CheckboxCheckedIcon, { style: { fontSize: 'inherit' } }), onChange: (event) => onChange?.(typeof event === 'boolean' ? event : event.target.checked) }) }));
21
+ return (_jsx(FormControl, { error: true, children: _jsx(StyledCheckbox, { ...others, error: +error, readOnly: readOnly, disabled: disabled, inputProps: { disabled: disabled || readOnly }, icon: _jsx(CheckboxUncheckedIcon, {}), checkedIcon: _jsx(CheckboxCheckedIcon, {}), onChange: (event) => onChange?.(typeof event === 'boolean' ? event : event.target.checked) }) }));
21
22
  }
22
23
  /**
23
24
  * Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
@@ -3,9 +3,6 @@ import ErkCheckBox from './ErkCheckBox';
3
3
  declare const meta: {
4
4
  component: typeof ErkCheckBox;
5
5
  tags: string[];
6
- args: {
7
- size: string;
8
- };
9
6
  };
10
7
  export default meta;
11
8
  type Story = StoryObj<typeof meta>;
@@ -2,9 +2,6 @@ import ErkCheckBox from './ErkCheckBox';
2
2
  const meta = {
3
3
  component: ErkCheckBox,
4
4
  tags: ['autodocs'],
5
- args: {
6
- size: '1.5rem',
7
- },
8
5
  };
9
6
  export default meta;
10
7
  export const Uncheked = {
@@ -14,6 +14,9 @@ const StyledSelect = styled(Select)(() => ({
14
14
  input: {
15
15
  padding: 0,
16
16
  },
17
+ '& .Erk-MuiSelect-select': {
18
+ height: '20px',
19
+ },
17
20
  '& .Erk-MuiSelect-select.Erk-MuiInputBase-inputSizeSmall': {
18
21
  paddingBottom: 0,
19
22
  borderBottom: 'none',
@@ -52,6 +52,6 @@ export default function ErkSmartSelect({ options, value = '', onChange, label, g
52
52
  }, renderInput: (params) => (_jsx(StyledTextField, { ...params, size: size, label: label, labelMargin: 0, name: others.name, readOnly: readOnly, disabled: disabled, inputRef: inputRef, error: others.error, onBlur: others.onBlur, required: others.required, helperText: others.helperText })) }));
53
53
  }
54
54
  else {
55
- return (_jsxs(ErkSelect, { ...others, labelMargin: 0, inputRef: inputRef, onChange: (value) => onChange?.(options?.find((option) => getValueString(option) === value)), value: loading ? '' : getValueString(value), label: label, IconComponent: loading ? () => _jsx(CircularProgress, { size: 22 }) : IconComponent, children: [_jsx(ErkMenuItem, { value: '', "data-testid": 'smart-select-empty', children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }, 'EMPTY'), options?.map((option) => (_jsx(ErkMenuItem, { value: getValueString(option), "data-testid": 'smart-select-' + getValueString(option), children: option.label }, getValueString(option)))), options === undefined && value && !loading && (_jsx(ErkMenuItem, { value: getValueString(value), children: value.label ?? '' }, getValueString(value)))] }));
55
+ return (_jsxs(ErkSelect, { ...others, labelMargin: 0, inputRef: inputRef, onChange: (value) => onChange?.(options?.find((option) => getValueString(option) === value)), value: loading ? '' : getValueString(value), label: label, IconComponent: loading ? () => _jsx(CircularProgress, { size: 22 }) : IconComponent, children: [options?.map((option) => (_jsx(ErkMenuItem, { value: getValueString(option), "data-testid": 'smart-select-' + getValueString(option), children: option.label }, getValueString(option)))), options === undefined && value && !loading && (_jsx(ErkMenuItem, { value: getValueString(value), children: value.label ?? '' }, getValueString(value)))] }));
56
56
  }
57
57
  }
@@ -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.11-refactor",
4
+ "version":"3.0.16-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,15 +45,18 @@
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",
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",
57
60
  "@storybook/addon-coverage": "^1.0.4",
58
61
  "@storybook/addon-essentials": "^8.3.5",
59
62
  "@storybook/addon-interactions": "^8.3.5",
@@ -67,43 +70,44 @@
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"