@arquimedes.co/eureka-forms 3.0.34-react-compiler → 3.0.35-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +6 -6
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +8 -3
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +7 -16
- package/dist/FormSteps/DatePickerRangeStep/MaterialDatePickerRangeStep/MaterialDatePickerRangeStep.js +2 -2
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +2 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.js +8 -10
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +23 -47
- package/dist/Shared/{ErkDatePickerRange/ErkDatePickerRange.d.ts → ErkDateRangePicker/ErkDateRangePicker.d.ts} +3 -3
- package/dist/Shared/{ErkDatePickerRange/ErkDatePickerRange.js → ErkDateRangePicker/ErkDateRangePicker.js} +2 -2
- package/dist/Shared/{ErkDatePickerRange/ErkDatePickerRange.stories.d.ts → ErkDateRangePicker/ErkDateRangePicker.stories.d.ts} +2 -2
- package/dist/Shared/{ErkDatePickerRange/ErkDatePickerRange.stories.js → ErkDateRangePicker/ErkDateRangePicker.stories.js} +23 -23
- package/dist/Shared/ErkSelect/ErkSelect.js +1 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { useCallback, useContext, useEffect, useLayoutEffect, useState } from 'react';
|
|
3
3
|
import CBRFormStepTypes from '../../../../constants/CBRFormStepTypes';
|
|
4
4
|
import IncidentComponent from './Incident/Incident';
|
|
5
5
|
import styles from './MaterialCBRIncidentsStep.module.css';
|
|
@@ -28,10 +28,9 @@ function CBRIncidentsStep({ step, editable, ...others }) {
|
|
|
28
28
|
steps: { ...form.steps },
|
|
29
29
|
});
|
|
30
30
|
const [firstRender, setFirstRender] = useState(false);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, []);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
setFirstRender(true);
|
|
33
|
+
}, [setFirstRender]);
|
|
35
34
|
const handleAddIncident = useCallback(() => {
|
|
36
35
|
const current = value.filter((incident) => !incident.deleted);
|
|
37
36
|
const newIncident = {
|
|
@@ -79,7 +78,8 @@ function CBRIncidentsStep({ step, editable, ...others }) {
|
|
|
79
78
|
const timer = setTimeout(() => handleAddIncident(), 0);
|
|
80
79
|
return () => clearTimeout(timer);
|
|
81
80
|
}
|
|
82
|
-
|
|
81
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
+
}, [firstRender]);
|
|
83
83
|
return (_jsxs("div", { className: styles.container, style: { color: formStyle.textColor }, children: [_jsx("div", { className: styles.titleLbl, children: step.label }), step.description && (_jsx("p", { className: styles.descriptionPar, style: {
|
|
84
84
|
margin: step.description ? '10px 0px' : '0px 0px 5px 0px',
|
|
85
85
|
}, children: step.description })), _jsx(FormContext.Provider, { value: localForm, children: value.map((incident, index) => (_jsx(IncidentComponent, { incident: incident, step: step, editable: editable, handleDelete: () => {
|
|
@@ -25,8 +25,10 @@ function ClassifierSelectorStep({ step, editable }) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
return dependencies;
|
|
28
|
-
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
}, []);
|
|
29
30
|
const dependencies = useAppSelector((state) => selectDependencies(state, idDependencies));
|
|
31
|
+
const dependenciesValues = useMemo(() => idDependencies.map((id) => dependencies[id].value), [dependencies, idDependencies]);
|
|
30
32
|
const { postview, preview } = useAppSelector((state) => state.global);
|
|
31
33
|
const form = useContext(FormContext);
|
|
32
34
|
const classifier = form.classifiers?.[step.idClassifier ?? ''];
|
|
@@ -46,12 +48,15 @@ function ClassifierSelectorStep({ step, editable }) {
|
|
|
46
48
|
label: classifier?.clientName?.trim?.() && preview ? classifier?.clientName : classifier?.name,
|
|
47
49
|
};
|
|
48
50
|
});
|
|
49
|
-
},
|
|
51
|
+
},
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
[dependenciesValues]);
|
|
50
54
|
useEffect(() => {
|
|
51
55
|
if (value && !options?.find((option) => option.value === value?.value)) {
|
|
52
56
|
onChange('');
|
|
53
57
|
}
|
|
54
|
-
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
}, [options]);
|
|
55
60
|
if (!step.idClassifier || !classifier)
|
|
56
61
|
return _jsx(_Fragment, {});
|
|
57
62
|
const mapNestedOption = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
3
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import styles from './MaterialCollapsibleStep.module.css';
|
|
5
5
|
import { Controller, useFormContext } from 'react-hook-form';
|
|
6
6
|
import StepComponent from '../../Step';
|
|
@@ -14,23 +14,14 @@ function Collapsible({ step, open, setOpen, ...others }) {
|
|
|
14
14
|
const form = useContext(FormContext);
|
|
15
15
|
const { formState: { errors }, } = useFormContext();
|
|
16
16
|
const contentRef = React.useRef(null);
|
|
17
|
-
const [
|
|
18
|
-
React.useLayoutEffect(() => {
|
|
19
|
-
if (open) {
|
|
20
|
-
if (firstTime)
|
|
21
|
-
setHeightState('auto');
|
|
22
|
-
else
|
|
23
|
-
setHeightState(contentRef.current?.offsetHeight ?? 'auto');
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
setHeightState(0);
|
|
27
|
-
}
|
|
28
|
-
}, [open, firstTime]);
|
|
17
|
+
const depsErrors = useMemo(() => step.dependencies?.map((dep) => errors[dep]) ?? [], [step.dependencies, errors]);
|
|
29
18
|
useEffect(() => {
|
|
30
|
-
|
|
19
|
+
//TODO: review this
|
|
20
|
+
if (!open && depsErrors.find((dep) => !!dep)) {
|
|
31
21
|
setOpen(true);
|
|
32
22
|
}
|
|
33
|
-
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
+
}, [depsErrors]);
|
|
34
25
|
return (_jsxs("div", { style: { maxWidth: '100%' }, children: [_jsxs("div", { className: styles.container, style: {
|
|
35
26
|
color: formStyle.textColor,
|
|
36
27
|
borderColor: formStyle.primaryColor,
|
|
@@ -43,7 +34,7 @@ function Collapsible({ step, open, setOpen, ...others }) {
|
|
|
43
34
|
setFirstTime(false);
|
|
44
35
|
setOpen(!open);
|
|
45
36
|
}, children: _jsx("div", { className: styles.expandIcon, children: open ? (_jsx(ExpandLessIcon, { style: { fontSize: 'inherit' } })) : (_jsx(ExpandMoreIcon, { style: { fontSize: 'inherit' } })) }) })] }), _jsx("div", { className: styles.content, style: {
|
|
46
|
-
height:
|
|
37
|
+
height: open ? (firstTime ? 'auto' : contentRef.current?.offsetHeight) : 0,
|
|
47
38
|
}, children: _jsx("div", { className: styles.contentContainer, ref: contentRef, children: step.steps.map((idSubStep) => {
|
|
48
39
|
const subStep = form.steps[idSubStep];
|
|
49
40
|
return _createElement(StepComponent, { ...others, step: subStep, key: idSubStep });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import ErkDateRangePicker from '../../../Shared/ErkDateRangePicker/ErkDateRangePicker';
|
|
4
4
|
import { useAppSelector } from '../../../hooks';
|
|
5
5
|
import { useFormStep } from '../../StepHooks';
|
|
6
6
|
import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
|
|
@@ -29,6 +29,6 @@ function MaterialDatePickerRangeStep({ step, editable, defaultValue }) {
|
|
|
29
29
|
}, [onChange]);
|
|
30
30
|
const [minDate, maxDate] = [safeDate(step.minDate), safeDate(step.maxDate)];
|
|
31
31
|
const dateRangeValue = value?.length === 2 ? [safeDate(value[0]) ?? null, safeDate(value[1]) ?? null] : [null, null];
|
|
32
|
-
return (_jsx(MaterialInputContainer, { step: step, editable: editable, children: _jsx(
|
|
32
|
+
return (_jsx(MaterialInputContainer, { step: step, editable: editable, children: _jsx(ErkDateRangePicker, { ...field, value: dateRangeValue, inputRef: ref, error: !!error, minDate: minDate, maxDate: maxDate, labelMargin: 0, onChange: handleChange, required: step.required, readOnly: !editable || postview, helperText: error?.message ?? step.description }) }));
|
|
33
33
|
}
|
|
34
34
|
export default MaterialDatePickerRangeStep;
|
|
@@ -105,7 +105,8 @@ function FileUploadStep({ step, editable }) {
|
|
|
105
105
|
void getLinks(filesToFetchLink);
|
|
106
106
|
onChange([...value, ...filesToFetchLink]);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
// eslint-disable-next-line
|
|
109
|
+
}, [fileChange]);
|
|
109
110
|
const calcErrorMsg = () => {
|
|
110
111
|
if (fieldError) {
|
|
111
112
|
const errNum = value.filter((val) => val.state === 'ERROR').length;
|
|
@@ -29,7 +29,8 @@ function PagedMapperElement({ step, num, loading, element, children, editable, o
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
return null;
|
|
32
|
-
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
}, [value]);
|
|
33
34
|
const prevIndex = useMemo(() => {
|
|
34
35
|
for (let i = page - 1; i >= 0; i--) {
|
|
35
36
|
const element = elements[i];
|
|
@@ -38,7 +39,8 @@ function PagedMapperElement({ step, num, loading, element, children, editable, o
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
return null;
|
|
41
|
-
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
}, [value]);
|
|
42
44
|
/** Esto se usa para no tener que escuchar todo el tiempo los errores del formulario */
|
|
43
45
|
const handleErrors = handleSubmit(() => { }, (errors) => {
|
|
44
46
|
console.error('Errors:', errors);
|
|
@@ -68,16 +70,12 @@ function PagedMapperElement({ step, num, loading, element, children, editable, o
|
|
|
68
70
|
page: index,
|
|
69
71
|
});
|
|
70
72
|
return;
|
|
71
|
-
},
|
|
73
|
+
},
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
[elements]);
|
|
72
76
|
const widthStats = useAppSelector((state) => state.widthStats);
|
|
73
77
|
const { calcName } = customElementModifiers ?? {};
|
|
74
78
|
const name = calcName ? calcName(element) : step.unitLabel ? step.unitLabel + ' ' + (num + 1) : '';
|
|
75
|
-
const [pagingWidth, setPagingWidth] = React.useState(0);
|
|
76
|
-
React.useLayoutEffect(() => {
|
|
77
|
-
if (pagingRef.current) {
|
|
78
|
-
setPagingWidth(pagingRef.current.clientWidth);
|
|
79
|
-
}
|
|
80
|
-
}, []);
|
|
81
79
|
const renderElement = (renderElementButtons) => {
|
|
82
80
|
return (_jsx("div", { className: widthStats.isMobile ? styles.mobileContainer : styles.container, ref: containerRef, children: _jsxs("div", { className: styles.contentContainer, style: {
|
|
83
81
|
width: (size.blockSize + size.spacingSize) * (step.style?.size ?? size.blockNum - 1),
|
|
@@ -85,7 +83,7 @@ function PagedMapperElement({ step, num, loading, element, children, editable, o
|
|
|
85
83
|
if (editable && !postview) {
|
|
86
84
|
handleDelete?.();
|
|
87
85
|
}
|
|
88
|
-
}, children: _jsx(DeleteIcon, { style: { fontSize: 'inherit' } }) }))] }), children, totalElements.length > 0 && (_jsx("div", { className: styles.pagingContainer, ref: pagingRef, children: _jsx(CustomStepper, { totalElements: totalElements.length, position: position, handleNext: nextIndex !== null ? () => void handleChangePage(nextIndex) : undefined, handlePrev: prevIndex !== null ? () => void handleChangePage(prevIndex) : undefined, width:
|
|
86
|
+
}, children: _jsx(DeleteIcon, { style: { fontSize: 'inherit' } }) }))] }), children, totalElements.length > 0 && (_jsx("div", { className: styles.pagingContainer, ref: pagingRef, children: _jsx(CustomStepper, { totalElements: totalElements.length, position: position, handleNext: nextIndex !== null ? () => void handleChangePage(nextIndex) : undefined, handlePrev: prevIndex !== null ? () => void handleChangePage(prevIndex) : undefined, width: pagingRef.current?.clientWidth }) }))] }) }));
|
|
89
87
|
};
|
|
90
88
|
return (_jsx("div", { className: styles.containerContainer, children: customElementRender ? customElementRender(element, num, renderElement) : renderElement() }));
|
|
91
89
|
}
|
|
@@ -31,12 +31,26 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
|
|
|
31
31
|
const allDeps = useMemo(() => [...(step.dependencies ?? []), ...getOptionalDependencies(step)], [getOptionalDependencies, step]);
|
|
32
32
|
const idDependencies = useMemo(() => getOptionsConditionsIdSteps(step), [getOptionsConditionsIdSteps, step]);
|
|
33
33
|
const dependencies = useAppSelector((state) => selectDependencies(state, allDeps));
|
|
34
|
+
const allDepsValues = useMemo(() => allDeps.map((dep) => dependencies[dep]?.value), [dependencies, allDeps]);
|
|
34
35
|
const deps = useAppSelector((state) => selectDependencies(state, idDependencies));
|
|
35
|
-
const
|
|
36
|
+
const dependenciesValues = useMemo(() => idDependencies.map((id) => deps[id]?.value), [deps, idDependencies]);
|
|
37
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
+
const conditionDependencies = useMemo(() => deps, [dependenciesValues]);
|
|
36
39
|
const { emptyDep, invalids } = useAppSelector((state) => selectStepDependencies(state, step, form));
|
|
37
40
|
const { getValues, setFocus } = useFormContext();
|
|
38
41
|
const isEmpty = useAppSelector((state) => state.site.dependencies[step.id]?.empty);
|
|
39
|
-
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!postview && editable) {
|
|
44
|
+
void calcOptions(firstTime);
|
|
45
|
+
if (firstTime)
|
|
46
|
+
setFirstTime(false);
|
|
47
|
+
}
|
|
48
|
+
else if (value && !step.searchable) {
|
|
49
|
+
setOptions([value]);
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, [allDepsValues]);
|
|
53
|
+
const calcOptions = async (firstTime) => {
|
|
40
54
|
if (!firstTime)
|
|
41
55
|
setOptions(undefined);
|
|
42
56
|
if (value && !firstTime)
|
|
@@ -71,34 +85,7 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
|
|
|
71
85
|
setOptions(null);
|
|
72
86
|
}
|
|
73
87
|
setLoading(false);
|
|
74
|
-
}
|
|
75
|
-
dependencies,
|
|
76
|
-
dispatch,
|
|
77
|
-
getOptions,
|
|
78
|
-
getValueString,
|
|
79
|
-
idCurrentAgent,
|
|
80
|
-
idOrganization,
|
|
81
|
-
isEmpty,
|
|
82
|
-
onChange,
|
|
83
|
-
postview,
|
|
84
|
-
step,
|
|
85
|
-
value,
|
|
86
|
-
]);
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
if (!postview && editable) {
|
|
89
|
-
const timer = setTimeout(() => {
|
|
90
|
-
void calcOptions(firstTime);
|
|
91
|
-
if (firstTime)
|
|
92
|
-
setFirstTime(false);
|
|
93
|
-
}, 0);
|
|
94
|
-
return () => clearTimeout(timer);
|
|
95
|
-
}
|
|
96
|
-
else if (value && !step.searchable) {
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
setOptions([value]);
|
|
99
|
-
}, 0);
|
|
100
|
-
}
|
|
101
|
-
}, [allDeps, dependencies, editable, firstTime, postview, step.searchable, value, calcOptions]);
|
|
88
|
+
};
|
|
102
89
|
const warning = useMemo(() => getValueWarning?.(value), [value, getValueWarning]);
|
|
103
90
|
const onFocus = useCallback(() => {
|
|
104
91
|
if (emptyDep || !editable || postview)
|
|
@@ -127,26 +114,14 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
|
|
|
127
114
|
}
|
|
128
115
|
if (!touched)
|
|
129
116
|
setTouched(true);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
emptyDep,
|
|
133
|
-
postview,
|
|
134
|
-
editable,
|
|
135
|
-
invalids,
|
|
136
|
-
touched,
|
|
137
|
-
dispatch,
|
|
138
|
-
form.steps,
|
|
139
|
-
form.type,
|
|
140
|
-
getValues,
|
|
141
|
-
setFocus,
|
|
142
|
-
step.idSection,
|
|
143
|
-
value,
|
|
144
|
-
]);
|
|
117
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
|
+
}, [options, emptyDep, postview, editable, invalids, touched]);
|
|
145
119
|
const filteredOptions = useMemo(() => {
|
|
146
120
|
if (!options || !filterOptions)
|
|
147
121
|
return options;
|
|
148
122
|
return filterOptions(options, conditionDependencies);
|
|
149
|
-
|
|
123
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
124
|
+
}, [options, conditionDependencies]);
|
|
150
125
|
const errorMsg = useMemo(() => {
|
|
151
126
|
if (postview || loading)
|
|
152
127
|
return undefined;
|
|
@@ -163,7 +138,8 @@ function SmartSelectStep({ step, editable, getOptions, calcDepError, defaultValu
|
|
|
163
138
|
return 'Error al cargar las opciones';
|
|
164
139
|
}
|
|
165
140
|
return undefined;
|
|
166
|
-
|
|
141
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
142
|
+
}, [invalids, touched, value, filteredOptions]);
|
|
167
143
|
return (_jsxs(React.Fragment, { children: [_jsx(MaterialInputContainer, { step: step, onClick: onFocus, editable: editable, children: _jsx(ErkSmartSelect, { ...field, value: value, inputRef: ref, onFocus: onFocus, loading: loading, label: step.label, onChange: onChange, required: step.required, searchable: step.searchable, getValueString: getValueString, disabled: emptyDep, getOptionSelected: getOptionSelected, options: filteredOptions ?? undefined, IconComponent: step.showIcon ? IconComponent : undefined, error: !!errorMsg || !!warning || !!error, readOnly: !editable || postview || emptyDep || filteredOptions === null, helperText: errorMsg ?? warning ?? error?.message?.toString() ?? step.description ?? undefined }) }), renderNestedSteps?.(value)] }));
|
|
168
144
|
}
|
|
169
145
|
export default SmartSelectStep;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { MobileDateRangePickerProps as MuiDateRangePickerProps } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
|
|
3
3
|
import { DateRange } from '@mui/x-date-pickers-pro';
|
|
4
4
|
import { ErkTextFieldProps } from '../ErkTextField/ErkTextField';
|
|
5
|
-
interface
|
|
5
|
+
interface ErkDateRangePickerProps extends Omit<MuiDateRangePickerProps<boolean>, 'ref' | 'onChange' | 'value' | 'slotProps'>, Pick<ErkTextFieldProps, 'error' | 'required' | 'helperText' | 'size'> {
|
|
6
6
|
onChange?: (dateRange: DateRange<Date>) => void;
|
|
7
7
|
value?: DateRange<Date>;
|
|
8
8
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
@@ -12,7 +12,7 @@ interface ErkDatePickerRangeProps extends Omit<MuiDateRangePickerProps<boolean>,
|
|
|
12
12
|
/**
|
|
13
13
|
* Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
|
|
14
14
|
*/
|
|
15
|
-
declare class
|
|
15
|
+
declare class ErkDateRangePicker extends React.Component<ErkDateRangePickerProps> {
|
|
16
16
|
render(): JSX.Element;
|
|
17
17
|
}
|
|
18
|
-
export default
|
|
18
|
+
export default ErkDateRangePicker;
|
|
@@ -165,9 +165,9 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
|
|
|
165
165
|
/**
|
|
166
166
|
* Generic datepicker with apps designs. Is class due to the use in the react-hook-forms library
|
|
167
167
|
*/
|
|
168
|
-
class
|
|
168
|
+
class ErkDateRangePicker extends React.Component {
|
|
169
169
|
render() {
|
|
170
170
|
return _jsx(CustomDatePickerRange, { ...this.props });
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
export default
|
|
173
|
+
export default ErkDateRangePicker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import
|
|
2
|
+
import ErkDateRangePicker from './ErkDateRangePicker';
|
|
3
3
|
declare const meta: {
|
|
4
|
-
component: typeof
|
|
4
|
+
component: typeof ErkDateRangePicker;
|
|
5
5
|
tags: string[];
|
|
6
6
|
args: {
|
|
7
7
|
readOnly: false;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import ErkDateRangePicker from './ErkDateRangePicker';
|
|
3
3
|
import { useArgs } from 'storybook/internal/preview-api';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
const meta = {
|
|
6
|
-
component:
|
|
6
|
+
component: ErkDateRangePicker,
|
|
7
7
|
tags: ['autodocs'],
|
|
8
8
|
args: {
|
|
9
9
|
readOnly: false,
|
|
@@ -26,7 +26,7 @@ export const Default = {
|
|
|
26
26
|
},
|
|
27
27
|
render: function Component(args) {
|
|
28
28
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
29
|
-
return _jsx(
|
|
29
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
export const Interactive = {
|
|
@@ -41,7 +41,7 @@ export const Interactive = {
|
|
|
41
41
|
setValue(newValue);
|
|
42
42
|
args.onChange?.(newValue);
|
|
43
43
|
};
|
|
44
|
-
return (_jsxs("div", { children: [_jsx(
|
|
44
|
+
return (_jsxs("div", { children: [_jsx(ErkDateRangePicker, { ...args, value: value, onChange: handleChange }), _jsxs("div", { style: { marginTop: '20px', fontSize: '14px' }, children: [_jsx("strong", { children: "Valor seleccionado:" }), _jsxs("div", { children: ["Inicio: ", value[0]?.toLocaleDateString('es-ES') ?? 'No seleccionado'] }), _jsxs("div", { children: ["Fin: ", value[1]?.toLocaleDateString('es-ES') ?? 'No seleccionado'] })] })] }));
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
export const ValueAndLabel = {
|
|
@@ -55,7 +55,7 @@ export const ValueAndLabel = {
|
|
|
55
55
|
args.onChange?.(value);
|
|
56
56
|
setArgs({ value });
|
|
57
57
|
};
|
|
58
|
-
return _jsx(
|
|
58
|
+
return _jsx(ErkDateRangePicker, { ...args, onChange: onValueChange });
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
export const Full = {
|
|
@@ -66,7 +66,7 @@ export const Full = {
|
|
|
66
66
|
},
|
|
67
67
|
render: function Component(args) {
|
|
68
68
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
69
|
-
return _jsx(
|
|
69
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
export const Error = {
|
|
@@ -78,7 +78,7 @@ export const Error = {
|
|
|
78
78
|
},
|
|
79
79
|
render: function Component(args) {
|
|
80
80
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
81
|
-
return _jsx(
|
|
81
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
82
82
|
},
|
|
83
83
|
};
|
|
84
84
|
export const Menu = {
|
|
@@ -88,7 +88,7 @@ export const Menu = {
|
|
|
88
88
|
},
|
|
89
89
|
render: function Component(args) {
|
|
90
90
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
91
|
-
return _jsx(
|
|
91
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
92
92
|
},
|
|
93
93
|
play: async ({ canvas, userEvent }) => {
|
|
94
94
|
const selector = canvas.getByTestId('date-picker');
|
|
@@ -107,7 +107,7 @@ export const WithSelectedRange = {
|
|
|
107
107
|
args.onChange?.(value);
|
|
108
108
|
setArgs({ value });
|
|
109
109
|
};
|
|
110
|
-
return _jsx(
|
|
110
|
+
return _jsx(ErkDateRangePicker, { ...args, onChange: onValueChange });
|
|
111
111
|
},
|
|
112
112
|
};
|
|
113
113
|
export const Disabled = {
|
|
@@ -119,7 +119,7 @@ export const Disabled = {
|
|
|
119
119
|
},
|
|
120
120
|
render: function Component(args) {
|
|
121
121
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
122
|
-
return _jsx(
|
|
122
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
export const ReadOnly = {
|
|
@@ -131,7 +131,7 @@ export const ReadOnly = {
|
|
|
131
131
|
},
|
|
132
132
|
render: function Component(args) {
|
|
133
133
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
134
|
-
return _jsx(
|
|
134
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
export const WithError = {
|
|
@@ -143,7 +143,7 @@ export const WithError = {
|
|
|
143
143
|
},
|
|
144
144
|
render: function Component(args) {
|
|
145
145
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
146
|
-
return _jsx(
|
|
146
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
147
147
|
},
|
|
148
148
|
};
|
|
149
149
|
export const Required = {
|
|
@@ -155,7 +155,7 @@ export const Required = {
|
|
|
155
155
|
},
|
|
156
156
|
render: function Component(args) {
|
|
157
157
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
158
|
-
return _jsx(
|
|
158
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
159
159
|
},
|
|
160
160
|
};
|
|
161
161
|
export const SmallSize = {
|
|
@@ -167,7 +167,7 @@ export const SmallSize = {
|
|
|
167
167
|
},
|
|
168
168
|
render: function Component(args) {
|
|
169
169
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
170
|
-
return _jsx(
|
|
170
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
171
171
|
},
|
|
172
172
|
};
|
|
173
173
|
export const MediumSize = {
|
|
@@ -179,7 +179,7 @@ export const MediumSize = {
|
|
|
179
179
|
},
|
|
180
180
|
render: function Component(args) {
|
|
181
181
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
182
|
-
return _jsx(
|
|
182
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
183
183
|
},
|
|
184
184
|
};
|
|
185
185
|
export const CurrentMonth = {
|
|
@@ -190,7 +190,7 @@ export const CurrentMonth = {
|
|
|
190
190
|
},
|
|
191
191
|
render: function Component(args) {
|
|
192
192
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
193
|
-
return _jsx(
|
|
193
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
194
194
|
},
|
|
195
195
|
};
|
|
196
196
|
export const LastWeek = {
|
|
@@ -201,7 +201,7 @@ export const LastWeek = {
|
|
|
201
201
|
},
|
|
202
202
|
render: function Component(args) {
|
|
203
203
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
204
|
-
return _jsx(
|
|
204
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
205
205
|
},
|
|
206
206
|
};
|
|
207
207
|
export const NextMonth = {
|
|
@@ -215,7 +215,7 @@ export const NextMonth = {
|
|
|
215
215
|
},
|
|
216
216
|
render: function Component(args) {
|
|
217
217
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
218
|
-
return _jsx(
|
|
218
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
219
219
|
},
|
|
220
220
|
};
|
|
221
221
|
export const WithMinMaxDates = {
|
|
@@ -228,7 +228,7 @@ export const WithMinMaxDates = {
|
|
|
228
228
|
},
|
|
229
229
|
render: function Component(args) {
|
|
230
230
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
231
|
-
return _jsx(
|
|
231
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
232
232
|
},
|
|
233
233
|
};
|
|
234
234
|
export const YearRange = {
|
|
@@ -239,7 +239,7 @@ export const YearRange = {
|
|
|
239
239
|
},
|
|
240
240
|
render: function Component(args) {
|
|
241
241
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
242
|
-
return _jsx(
|
|
242
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
243
243
|
},
|
|
244
244
|
};
|
|
245
245
|
export const QuarterRange = {
|
|
@@ -250,7 +250,7 @@ export const QuarterRange = {
|
|
|
250
250
|
},
|
|
251
251
|
render: function Component(args) {
|
|
252
252
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
253
|
-
return _jsx(
|
|
253
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
254
254
|
},
|
|
255
255
|
};
|
|
256
256
|
export const EventDuration = {
|
|
@@ -261,7 +261,7 @@ export const EventDuration = {
|
|
|
261
261
|
},
|
|
262
262
|
render: function Component(args) {
|
|
263
263
|
const [value, setValue] = useState(args.value ?? [null, null]);
|
|
264
|
-
return _jsx(
|
|
264
|
+
return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
|
|
265
265
|
},
|
|
266
266
|
};
|
|
267
267
|
export const MultipleStates = {
|
|
@@ -269,6 +269,6 @@ export const MultipleStates = {
|
|
|
269
269
|
const [range1, setRange1] = useState([null, null]);
|
|
270
270
|
const [range2, setRange2] = useState([new Date('2025-01-01'), new Date('2025-01-31')]);
|
|
271
271
|
const [range3, setRange3] = useState([null, null]);
|
|
272
|
-
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '20px' }, children: [_jsx(
|
|
272
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '20px' }, children: [_jsx(ErkDateRangePicker, { label: "Fecha de Inicio del Proyecto", value: range1, onChange: setRange1, helperText: "Seleccione el per\u00EDodo del proyecto" }), _jsx(ErkDateRangePicker, { label: "Per\u00EDodo de Pruebas", value: range2, onChange: setRange2, helperText: "Enero 2025" }), _jsx(ErkDateRangePicker, { label: "Fecha de Entrega", value: range3, onChange: setRange3, error: range3[0] === null, helperText: range3[0] === null ? 'Este campo es obligatorio' : 'Fecha confirmada', required: true })] }));
|
|
273
273
|
},
|
|
274
274
|
};
|
|
@@ -39,6 +39,7 @@ export const StyledSelect = styled(MuiSelect)(({ theme, size, ...props }) => ({
|
|
|
39
39
|
},
|
|
40
40
|
'& .Mui-disabled, &.Mui-readOnly': {
|
|
41
41
|
cursor: 'default',
|
|
42
|
+
pointerEvents: 'none',
|
|
42
43
|
},
|
|
43
44
|
'&.Erk-MuiInputBase-root.Mui-focused': {
|
|
44
45
|
'& .Erk-MuiOutlinedInput-notchedOutline': {
|
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.
|
|
4
|
+
"version":"3.0.35-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"watch": "tsgo --noEmit --watch --project tsconfig.app.json",
|
|
7
7
|
"start": "vite",
|
|
@@ -111,4 +111,4 @@
|
|
|
111
111
|
"files": [
|
|
112
112
|
"/dist"
|
|
113
113
|
]
|
|
114
|
-
}
|
|
114
|
+
}
|