@arquimedes.co/eureka-forms 3.0.55-new-steps → 3.0.55

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 (103) hide show
  1. package/dist/@Types/FormStep.d.ts +2 -7
  2. package/dist/@Types/FormStep.js +1 -2
  3. package/dist/App/App.cbr.test.js +78 -0
  4. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +1 -1
  5. package/dist/FormSteps/Step.js +4 -19
  6. package/dist/FormSteps/StepFunctions.js +0 -14
  7. package/dist/FormSteps/StepFunctions.test.js +0 -54
  8. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +7 -5
  9. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
  10. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +5 -4
  11. package/dist/Utils/CBRFunctions.js +4 -2
  12. package/dist/Utils/CBRFunctions.test.d.ts +1 -0
  13. package/dist/Utils/CBRFunctions.test.js +123 -0
  14. package/dist/constants/FormStepTypes.d.ts +1 -5
  15. package/dist/constants/FormStepTypes.js +0 -4
  16. package/dist/index.lib.d.ts +2 -4
  17. package/dist/index.lib.js +1 -3
  18. package/package.json +7 -8
  19. package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
  20. package/dist/@Types/AvailabilityFormStep.js +0 -24
  21. package/dist/@Types/BankAccountFormStep.d.ts +0 -67
  22. package/dist/@Types/BankAccountFormStep.js +0 -14
  23. package/dist/@Types/BookingFormStep.d.ts +0 -166
  24. package/dist/@Types/BookingFormStep.js +0 -44
  25. package/dist/@Types/CalendarFormStep.d.ts +0 -212
  26. package/dist/@Types/CalendarFormStep.js +0 -58
  27. package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
  28. package/dist/@Types/CommunicationChannelFormStep.js +0 -15
  29. package/dist/@Types/ConsentFormStep.d.ts +0 -36
  30. package/dist/@Types/ConsentFormStep.js +0 -8
  31. package/dist/@Types/EntityFormFormStep.d.ts +0 -66
  32. package/dist/@Types/EntityFormFormStep.js +0 -20
  33. package/dist/@Types/EventFormStep.d.ts +0 -52
  34. package/dist/@Types/EventFormStep.js +0 -13
  35. package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
  36. package/dist/@Types/ExternalReferenceFormStep.js +0 -20
  37. package/dist/@Types/LocationFormStep.d.ts +0 -159
  38. package/dist/@Types/LocationFormStep.js +0 -46
  39. package/dist/@Types/NumericFormSteps.d.ts +0 -108
  40. package/dist/@Types/NumericFormSteps.js +0 -20
  41. package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
  42. package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
  43. package/dist/@Types/StepRef.d.ts +0 -135
  44. package/dist/@Types/StepRef.js +0 -49
  45. package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
  46. package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
  47. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -7
  48. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -32
  49. package/dist/FormSteps/CalendarStep/CalendarStep.d.ts +0 -7
  50. package/dist/FormSteps/CalendarStep/CalendarStep.js +0 -14
  51. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.d.ts +0 -8
  52. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.js +0 -32
  53. package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
  54. package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
  55. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
  56. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -47
  57. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
  58. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
  59. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -168
  60. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -94
  61. package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
  62. package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
  63. package/dist/Icons/AddIcon.d.ts +0 -3
  64. package/dist/Icons/AddIcon.js +0 -7
  65. package/dist/Icons/EditIcon.d.ts +0 -3
  66. package/dist/Icons/EditIcon.js +0 -7
  67. package/dist/Icons/RemoveIcon.d.ts +0 -3
  68. package/dist/Icons/RemoveIcon.js +0 -7
  69. package/dist/Icons/ViewDayIcon.d.ts +0 -3
  70. package/dist/Icons/ViewDayIcon.js +0 -7
  71. package/dist/Icons/ViewWeekIcon.d.ts +0 -3
  72. package/dist/Icons/ViewWeekIcon.js +0 -7
  73. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
  74. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
  75. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -82
  76. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
  77. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
  78. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +0 -25
  79. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +0 -112
  80. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +0 -88
  81. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +0 -75
  82. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +0 -31
  83. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +0 -223
  84. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +0 -608
  85. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +0 -28
  86. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +0 -117
  87. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts +0 -1
  88. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +0 -49
  89. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +0 -1
  90. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +0 -107
  91. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -23
  92. package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -73
  93. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -29
  94. package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
  95. package/dist/Shared/ErkLocationField/addressFields.js +0 -34
  96. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
  97. package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
  98. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
  99. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -502
  100. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -115
  101. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
  102. package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -170
  103. /package/dist/{Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts → App/App.cbr.test.d.ts} +0 -0
@@ -5,13 +5,7 @@ import { EurekaDraft } from './Draft/Draft';
5
5
  import { ErkValue } from './ErkValue';
6
6
  import * as GSteps from './GenericFormSteps';
7
7
  import { Time } from './Time';
8
- import { LocationStep } from './LocationFormStep';
9
- import { NumberStep, NumberStepType } from './NumericFormSteps';
10
- import { BookingStep } from './BookingFormStep';
11
- import { CalendarStep } from './CalendarFormStep';
12
- export type { LocationStep, NumberStep, BookingStep, CalendarStep };
13
- export { NumberStepType };
14
- export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper | DatePickerRange | LocationStep | NumberStep | BookingStep | CalendarStep;
8
+ export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper | DatePickerRange;
15
9
  export interface Title extends GSteps.GBaseStep {
16
10
  type: FormStepTypes.TITLE;
17
11
  title?: EurekaDraft;
@@ -238,3 +232,4 @@ export interface Mapper extends GSteps.GBaseStep {
238
232
  deletable?: boolean;
239
233
  max?: number;
240
234
  }
235
+ export {};
@@ -1,2 +1 @@
1
- import { NumberStepType } from './NumericFormSteps';
2
- export { NumberStepType };
1
+ export {};
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen, waitFor } from '@testing-library/react';
3
+ import { describe, expect, it } from 'vitest';
4
+ import '@testing-library/jest-dom';
5
+ import App from './App';
6
+ import CBRFormStepTypes from '../constants/CBRFormStepTypes';
7
+ const INCIDENT = {
8
+ idSpaceStep: 'CBR_TIPO_ESPACIO-PYDqn',
9
+ idElementStep: 'CBR_LOCATIVAS-fp6xL',
10
+ idCommentStep: 'CBR_COMENTARIO-sQjpP',
11
+ num: 1,
12
+ };
13
+ const ID_SUB_ELEMENT_STEP = 'CBR_LOCATIVAS-G4S0r';
14
+ /** Shaped after a real posventa ticket: incidents are stored flat, keyed by generated step ids. */
15
+ const POSVENTA_VALUES = {
16
+ CBR_INCIDENCIAS: [INCIDENT],
17
+ [INCIDENT.idSpaceStep]: { id: '35365', label: 'Zona de Oficios' },
18
+ [INCIDENT.idCommentStep]: 'GRAN HUMEDAD!!!',
19
+ [INCIDENT.idElementStep]: { id: '06', label: 'CIELOS', subStep: ID_SUB_ELEMENT_STEP },
20
+ [ID_SUB_ELEMENT_STEP]: { id: '0601', label: 'Cielo Falso' },
21
+ };
22
+ const POSVENTA_FORM = {
23
+ name: 'Formulario PosVenta',
24
+ firstSection: 'FIRST',
25
+ sections: {
26
+ FIRST: { id: 'FIRST', name: '', nextSection: null, steps: ['CBR_INCIDENCIAS'] },
27
+ },
28
+ steps: {
29
+ CBR_INCIDENCIAS: {
30
+ id: 'CBR_INCIDENCIAS',
31
+ type: CBRFormStepTypes.CBR_INCIDENCIAS,
32
+ label: 'Incidencias',
33
+ description: null,
34
+ addBtnLabel: 'Agregar Incidencia',
35
+ required: true,
36
+ unitLabel: 'Incidencia',
37
+ dependencies: ['CBR_PROYECTO'],
38
+ spaceStep: {
39
+ label: 'Espacio',
40
+ description: null,
41
+ size: 1,
42
+ required: true,
43
+ showIcon: true,
44
+ searchable: true,
45
+ },
46
+ commentStep: { label: 'Comentario', description: null, size: 1, required: true },
47
+ elementStep: {
48
+ label: 'Elemento',
49
+ description: null,
50
+ size: 1,
51
+ required: true,
52
+ showIcon: true,
53
+ searchable: true,
54
+ subStep: {
55
+ label: 'Elemento Hijo',
56
+ description: null,
57
+ size: 1,
58
+ required: true,
59
+ showIcon: true,
60
+ searchable: true,
61
+ },
62
+ },
63
+ },
64
+ },
65
+ size: { blockNum: 4, blockSize: 210, spacingSize: 20 },
66
+ };
67
+ describe('CBR posventa postview', () => {
68
+ it('renders the submitted incidents read-only', async () => {
69
+ const { container } = render(_jsx(App, { formData: POSVENTA_FORM, valuesData: POSVENTA_VALUES, idOrganization: 'melendez', postview: true, internal: true, isWidget: true, editable: false }));
70
+ await waitFor(() => {
71
+ expect(container.textContent).toContain('Incidencia 1');
72
+ });
73
+ expect(container.textContent).toContain('GRAN HUMEDAD!!!');
74
+ expect(screen.getByDisplayValue('Zona de Oficios')).toBeInTheDocument();
75
+ expect(screen.getByDisplayValue('CIELOS')).toBeInTheDocument();
76
+ expect(screen.getByDisplayValue('Cielo Falso')).toBeInTheDocument();
77
+ });
78
+ });
@@ -25,7 +25,7 @@ function MapperElementComponent(props) {
25
25
  const mapSubSteps = () => {
26
26
  return (_jsx(CustomContext.Provider, { value: nestedCustomContext, children: step.rootSteps.map((idSubStep) => {
27
27
  const subStep = form.steps[element.ids[idSubStep]];
28
- return (_createElement(StepComponent, { ...props, editable: editable ? (step.editable ?? true) : false, step: subStep, key: element.ids[idSubStep] }));
28
+ return (_createElement(StepComponent, { ...props, editable: editable ? (step.editable ?? true) : false, step: subStep, key: idSubStep }));
29
29
  }) }));
30
30
  };
31
31
  switch (step.style?.type) {
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import FormStepTypes from '../constants/FormStepTypes';
3
3
  import SelectorStep from './SelectorStep/SelectorStep';
4
4
  import SeparatorStep from './SeparatorStep/SeparatorStep';
@@ -24,18 +24,15 @@ import CustomContext from '../Contexts/CustomContext';
24
24
  import { selectOriginalValue, useCondition } from './StepHooks';
25
25
  import TimePickerStep from './TimePickerStep/TimePickerStep';
26
26
  import PhoneInputStep from './PhoneInputStep/PhoneInputStep';
27
- import LocationStepComponent from './LocationStep/LocationStep';
28
- import NumberStepComponent from './NumberStep/NumberStep';
29
- import BookingStepComponent from './BookingStep/BookingStep';
30
- import CalendarStepComponent from './CalendarStep/CalendarStep';
31
27
  function StepComponent({ step, ...props }) {
32
28
  const { postview, partial } = useAppSelector((state) => state.global);
33
29
  const { customSteps, customClientInfoStep } = useContext(CustomContext);
34
30
  const originalValue = useAppSelector((state) => selectOriginalValue(state, step));
35
- const showStep = useCondition(step.condition);
31
+ const showStep = useCondition(step?.condition);
32
+ /** A rootSteps entry with no matching step definition must not take the whole form down with it. */
36
33
  if (!step) {
37
34
  console.error('Step not found!', step);
38
- return _jsx("div", {});
35
+ return _jsx(_Fragment, {});
39
36
  }
40
37
  if (!showStep)
41
38
  return _jsx(_Fragment, {});
@@ -78,18 +75,6 @@ function StepComponent({ step, ...props }) {
78
75
  case FormStepTypes.DATEPICKER: {
79
76
  return _jsx(DatePickerStep, { ...props, step: step, editable: editable });
80
77
  }
81
- case FormStepTypes.LOCATION: {
82
- return _jsx(LocationStepComponent, { ...props, step: step, editable: editable });
83
- }
84
- case FormStepTypes.NUMBER: {
85
- return _jsx(NumberStepComponent, { ...props, step: step, editable: editable });
86
- }
87
- case FormStepTypes.BOOKING: {
88
- return _jsx(BookingStepComponent, { ...props, step: step, editable: editable });
89
- }
90
- case FormStepTypes.CALENDAR: {
91
- return _jsx(CalendarStepComponent, { ...props, step: step, editable: editable });
92
- }
93
78
  case FormStepTypes.DATEPICKER_RANGE: {
94
79
  return _jsx(DatePickerRangeStep, { ...props, step: step, editable: editable });
95
80
  }
@@ -1,4 +1,3 @@
1
- import { NumberStepType, } from '../@Types/FormStep';
2
1
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
3
2
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
3
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
@@ -88,8 +87,6 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
88
87
  return size;
89
88
  }
90
89
  case FormStepTypes.DATEPICKER:
91
- case FormStepTypes.LOCATION:
92
- case FormStepTypes.NUMBER:
93
90
  case FormStepTypes.TEXTINPUT: {
94
91
  return step.size;
95
92
  }
@@ -120,17 +117,6 @@ export const calcDefaultValue = (step) => {
120
117
  return getRawText();
121
118
  else
122
119
  return '';
123
- case FormStepTypes.LOCATION:
124
- return step.defaultValue ?? null;
125
- case FormStepTypes.NUMBER: {
126
- const numStep = step;
127
- if (numStep.numberType === NumberStepType.MONEY ||
128
- numStep.numberType === NumberStepType.MEASURE ||
129
- numStep.numberType === NumberStepType.UNIT_PRICE) {
130
- return numStep.defaultValue ?? null;
131
- }
132
- return numStep.defaultValue ?? '';
133
- }
134
120
  case FormStepTypes.RATING:
135
121
  case FormStepTypes.DATEPICKER:
136
122
  case FormStepTypes.DATEPICKER_RANGE:
@@ -1,4 +1,3 @@
1
- import * as Steps from '../@Types/FormStep';
2
1
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
3
2
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
3
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
@@ -497,13 +496,6 @@ describe('StepFunctions', function () {
497
496
  const defaultValue = calcDefaultValue(step);
498
497
  expect(defaultValue).toBe(null);
499
498
  });
500
- test('Location step type', async () => {
501
- const step = {
502
- type: FormStepTypes.LOCATION,
503
- };
504
- const defaultValue = calcDefaultValue(step);
505
- expect(defaultValue).toBe(null);
506
- });
507
499
  test('Mapper, FileUpload, CBRFormStep types', async () => {
508
500
  const step1 = {
509
501
  type: FormStepTypes.MAPPER,
@@ -535,52 +527,6 @@ describe('StepFunctions', function () {
535
527
  const defaultValue = calcDefaultValue(step);
536
528
  expect(defaultValue).toBeUndefined();
537
529
  });
538
- test('Number step type without defaultValue', async () => {
539
- const step1 = {
540
- type: FormStepTypes.NUMBER,
541
- numberType: Steps.NumberStepType.INTEGER,
542
- };
543
- const step2 = {
544
- type: FormStepTypes.NUMBER,
545
- numberType: Steps.NumberStepType.DECIMAL,
546
- };
547
- const step3 = {
548
- type: FormStepTypes.NUMBER,
549
- numberType: Steps.NumberStepType.PERCENTAGE,
550
- };
551
- const step4 = {
552
- type: FormStepTypes.NUMBER,
553
- numberType: Steps.NumberStepType.MONEY,
554
- };
555
- const step5 = {
556
- type: FormStepTypes.NUMBER,
557
- numberType: Steps.NumberStepType.MEASURE,
558
- };
559
- const step6 = {
560
- type: FormStepTypes.NUMBER,
561
- numberType: Steps.NumberStepType.UNIT_PRICE,
562
- };
563
- expect(calcDefaultValue(step1)).toBe('');
564
- expect(calcDefaultValue(step2)).toBe('');
565
- expect(calcDefaultValue(step3)).toBe('');
566
- expect(calcDefaultValue(step4)).toBe(null);
567
- expect(calcDefaultValue(step5)).toBe(null);
568
- expect(calcDefaultValue(step6)).toBe(null);
569
- });
570
- test('Number step type with defaultValue', async () => {
571
- const step1 = {
572
- type: FormStepTypes.NUMBER,
573
- numberType: Steps.NumberStepType.INTEGER,
574
- defaultValue: 42,
575
- };
576
- const step2 = {
577
- type: FormStepTypes.NUMBER,
578
- numberType: Steps.NumberStepType.MONEY,
579
- defaultValue: { value: 100, currency: 'USD' },
580
- };
581
- expect(calcDefaultValue(step1)).toBe(42);
582
- expect(calcDefaultValue(step2)).toEqual({ value: 100, currency: 'USD' });
583
- });
584
530
  });
585
531
  describe('iterateNestedSteps', function () {
586
532
  test('should iterate over nested steps', async () => {
@@ -2,9 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
3
  import { format as dateFnsFormat, isValid } from 'date-fns';
4
4
  import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
5
- import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, usePickerContext, PickerDay as MuiPickerDay, renderTimeViewClock, } from '@mui/x-date-pickers';
5
+ import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
6
+ import { PickerDay as MuiPickerDay } from '@mui/x-date-pickers/PickerDay';
6
7
  import { StyledTextField } from '../ErkTextField/ErkTextField';
7
8
  import CalendarIcon from '../../Icons/CalendarIcon';
9
+ import { renderTimeViewClock } from '@mui/x-date-pickers/timeViewRenderers';
8
10
  const StyledDateTimePicker = styled(MuiDateTimePicker, {
9
11
  shouldForwardProp: (propName) => propName !== 'size',
10
12
  })(({ disabled, readOnly, size }) => ({
@@ -126,10 +128,10 @@ const StyledDay = styled(MuiPickerDay)(({ theme }) => ({
126
128
  fontWeight: 500,
127
129
  fontSize: '0.9rem',
128
130
  lineHeight: 'normal',
129
- '&.Erk-MuiPickersDay-today': {
131
+ '&.Erk-MuiPickerDay-today': {
130
132
  backgroundColor: theme.palette.primary.main + '33',
131
133
  },
132
- '&.Erk-MuiPickersDay-dayOutsideMonth': {
134
+ '&.Erk-MuiPickerDay-dayOutsideMonth': {
133
135
  color: 'rgb(0,0,0,0.4)',
134
136
  '&.Mui-selected': {
135
137
  color: theme.palette.primary.contrastText,
@@ -169,7 +171,7 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
169
171
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
170
172
  orientation: _orientation, ...others }) {
171
173
  if (pickTime) {
172
- return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, label: label, disabled: disabled, readOnly: readOnly, showDaysOutsideCurrentMonth: true, slotProps: {
174
+ return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, orientation: "portrait", ...others, label: label, disabled: disabled, readOnly: readOnly, showDaysOutsideCurrentMonth: true, slotProps: {
173
175
  actionBar: {
174
176
  actions: ['clear', 'accept'],
175
177
  },
@@ -229,7 +231,7 @@ orientation: _orientation, ...others }) {
229
231
  } }));
230
232
  }
231
233
  else {
232
- return (_jsx(StyledDatePicker, { ...others, label: label, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
234
+ return (_jsx(StyledDatePicker, { ...others, label: label, size: size, reduceAnimations: true, orientation: "portrait", readOnly: readOnly, disabled: disabled, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
233
235
  actionBar: {
234
236
  actions: ['clear', 'accept'],
235
237
  },
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { PickersShortcutsItem } from '@mui/x-date-pickers';
3
- import { MobileDateRangePickerProps as MuiDateRangePickerProps, DateRange } from '@mui/x-date-pickers-pro';
2
+ import { MobileDateRangePickerProps as MuiDateRangePickerProps } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
3
+ import { DateRange } from '@mui/x-date-pickers-pro';
4
+ import { PickersShortcutsItem } from '@mui/x-date-pickers/PickersShortcuts';
4
5
  import { ErkTextFieldProps } from '../ErkTextField/ErkTextField';
5
6
  interface ErkDateRangePickerProps extends Omit<MuiDateRangePickerProps, 'ref' | 'onChange' | 'value' | 'slotProps'>, Pick<ErkTextFieldProps, 'error' | 'required' | 'helperText' | 'size'> {
6
7
  onChange?: (dateRange: DateRange<Date>) => void;
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
3
  import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
4
4
  import { DatePickerToolbar as MuiDatePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
5
- import { MobileDateRangePicker as MuiDateRangePicker, DateRangePickerDay as MuiDateRangePickerDay, } from '@mui/x-date-pickers-pro';
5
+ import { MobileDateRangePicker as MuiDateRangePicker, } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
6
+ import { DateRangePickerDay as MuiDateRangePickerDay } from '@mui/x-date-pickers-pro';
6
7
  import { format, isValid } from 'date-fns';
7
8
  import { StyledTextField } from '../ErkTextField/ErkTextField';
8
9
  import CalendarIcon from '../../Icons/CalendarIcon';
@@ -70,10 +71,10 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
70
71
  fontWeight: 500,
71
72
  fontSize: '0.9rem',
72
73
  lineHeight: 'normal',
73
- '&.Erk-MuiPickersDay-today:not(.Erk-MuiDateRangePickerDay-rangeIntervalDayHighlight)': {
74
+ '&.Erk-MuiDateRangePickerDay-today:not(.Erk-MuiDateRangePickerDay-rangeIntervalDayHighlight)': {
74
75
  backgroundColor: theme.palette.primary.main + '33',
75
76
  },
76
- '&.Erk-MuiPickersDay-dayOutsideMonth': {
77
+ '&.Erk-MuiDateRangePickerDay-dayOutsideMonth': {
77
78
  color: 'rgb(0,0,0,0.4)',
78
79
  '&.Mui-selected': {
79
80
  color: theme.palette.primary.contrastText,
@@ -83,7 +84,7 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
83
84
  backgroundColor: theme.palette.primary.main + '1a',
84
85
  },
85
86
  }));
86
- const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef, }, ref) {
87
+ const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef }, ref) {
87
88
  const { value, fieldFormat, setOpen, disabled, readOnly, label } = usePickerContext();
88
89
  const { displayValue, isInvalid } = useMemo(() => {
89
90
  const [startDate, endDate] = value ?? [null, null];
@@ -1,17 +1,19 @@
1
1
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
2
2
  export const calcCbrForm = (form, formValues) => {
3
+ /** Callers pass the form straight out of `createNextState`, whose result Immer deep-freezes. */
4
+ const steps = { ...form.steps };
3
5
  for (const step of Object.values(form.steps)) {
4
6
  if (step.type === CBRFormStepTypes.CBR_INCIDENCIAS) {
5
7
  const incidentStep = step;
6
8
  const incValue = formValues[incidentStep.id ?? ''];
7
9
  if (incValue) {
8
10
  for (const incident of incValue) {
9
- handleAddIncident(incident, incidentStep, form.steps, formValues);
11
+ handleAddIncident(incident, incidentStep, steps, formValues);
10
12
  }
11
13
  }
12
14
  }
13
15
  }
14
- return form;
16
+ return { ...form, steps };
15
17
  };
16
18
  const handleAddIncident = (incident, step, steps, formValues) => {
17
19
  const spaceStep = {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,123 @@
1
+ import { createNextState } from '@reduxjs/toolkit';
2
+ import { describe, expect, test } from 'vitest';
3
+ import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
+ import { calcCbrForm } from './CBRFunctions';
5
+ const INCIDENT = {
6
+ idSpaceStep: 'CBR_TIPO_ESPACIO-space1',
7
+ idElementStep: 'CBR_LOCATIVAS-element1',
8
+ idCommentStep: 'CBR_COMENTARIO-comment1',
9
+ num: 1,
10
+ };
11
+ /** Second element level, reached through the element value's `subStep` pointer. */
12
+ const ID_SUB_ELEMENT_STEP = 'CBR_LOCATIVAS-subElement1';
13
+ const FORM_VALUES = {
14
+ CBR_INCIDENCIAS: [INCIDENT],
15
+ [INCIDENT.idSpaceStep]: { id: '35362', label: 'Sala' },
16
+ [INCIDENT.idCommentStep]: 'GRAN HUMEDAD',
17
+ [INCIDENT.idElementStep]: {
18
+ id: '06',
19
+ label: 'CIELOS',
20
+ subStep: ID_SUB_ELEMENT_STEP,
21
+ },
22
+ [ID_SUB_ELEMENT_STEP]: { id: '0601', label: 'Cielo Falso' },
23
+ };
24
+ function buildForm() {
25
+ return {
26
+ name: 'Formulario PosVenta',
27
+ firstSection: 'FIRST',
28
+ sections: {
29
+ FIRST: {
30
+ id: 'FIRST',
31
+ name: '',
32
+ nextSection: null,
33
+ steps: ['CBR_INCIDENCIAS'],
34
+ },
35
+ },
36
+ steps: {
37
+ CBR_INCIDENCIAS: {
38
+ id: 'CBR_INCIDENCIAS',
39
+ type: CBRFormStepTypes.CBR_INCIDENCIAS,
40
+ label: 'Incidencias',
41
+ description: null,
42
+ addBtnLabel: 'Agregar',
43
+ required: true,
44
+ unitLabel: 'Incidencia',
45
+ dependencies: ['CBR_PROYECTO'],
46
+ spaceStep: {
47
+ label: 'Espacio',
48
+ description: null,
49
+ size: 1,
50
+ required: true,
51
+ showIcon: true,
52
+ searchable: true,
53
+ },
54
+ commentStep: {
55
+ label: 'Comentario',
56
+ description: null,
57
+ size: 1,
58
+ required: true,
59
+ },
60
+ elementStep: {
61
+ label: 'Elemento',
62
+ description: null,
63
+ size: 1,
64
+ required: true,
65
+ showIcon: true,
66
+ searchable: true,
67
+ subStep: {
68
+ label: 'Elemento Hijo',
69
+ description: null,
70
+ size: 1,
71
+ required: true,
72
+ showIcon: true,
73
+ searchable: true,
74
+ },
75
+ },
76
+ },
77
+ },
78
+ size: { blockNum: 4, blockSize: 210, spacingSize: 20 },
79
+ };
80
+ }
81
+ describe('calcCbrForm', function () {
82
+ test('expands every incident into its own space, comment and element steps', () => {
83
+ const result = calcCbrForm(buildForm(), FORM_VALUES);
84
+ expect(result.steps[INCIDENT.idSpaceStep]).toMatchObject({
85
+ id: INCIDENT.idSpaceStep,
86
+ type: CBRFormStepTypes.CBR_TIPO_ESPACIO,
87
+ });
88
+ expect(result.steps[INCIDENT.idCommentStep]).toMatchObject({
89
+ id: INCIDENT.idCommentStep,
90
+ type: CBRFormStepTypes.CBR_COMENTARIO,
91
+ });
92
+ expect(result.steps[INCIDENT.idElementStep]).toMatchObject({
93
+ id: INCIDENT.idElementStep,
94
+ type: CBRFormStepTypes.CBR_LOCATIVAS,
95
+ subStep: ID_SUB_ELEMENT_STEP,
96
+ });
97
+ expect(result.steps[ID_SUB_ELEMENT_STEP]).toMatchObject({
98
+ id: ID_SUB_ELEMENT_STEP,
99
+ type: CBRFormStepTypes.CBR_LOCATIVAS,
100
+ });
101
+ });
102
+ test('leaves the form it was given untouched', () => {
103
+ const form = buildForm();
104
+ calcCbrForm(form, FORM_VALUES);
105
+ expect(Object.keys(form.steps)).toEqual(['CBR_INCIDENCIAS']);
106
+ });
107
+ /**
108
+ * The caller hands the form straight out of `createNextState`, whose result Immer deep-freezes, so
109
+ * expanding the incidents by writing into that same `steps` object throws and leaves the form stuck
110
+ * loading forever.
111
+ */
112
+ test('expands a form frozen by createNextState', () => {
113
+ const frozenForm = createNextState(buildForm(), (draft) => {
114
+ draft.steps.CBR_INCIDENCIAS.idSection = 'FIRST';
115
+ });
116
+ expect(Object.isFrozen(frozenForm.steps)).toBe(true);
117
+ const result = calcCbrForm(frozenForm, FORM_VALUES);
118
+ expect(result.steps[INCIDENT.idSpaceStep]).toBeDefined();
119
+ expect(result.steps[INCIDENT.idCommentStep]).toBeDefined();
120
+ expect(result.steps[INCIDENT.idElementStep]).toBeDefined();
121
+ expect(result.steps[ID_SUB_ELEMENT_STEP]).toBeDefined();
122
+ });
123
+ });
@@ -21,11 +21,7 @@ export declare enum FormStepTypes {
21
21
  COLLAPSIBLE = "COLLAPSIBLE",
22
22
  MAPPER = "MAPPER",
23
23
  ENTITYVALUEPICKER = "ENTITYVALUEPICKER",
24
- API_SELECTOR = "API_SELECTOR",
25
- LOCATION = "LOCATION",
26
- NUMBER = "NUMBER",
27
- CALENDAR = "CALENDAR",
28
- BOOKING = "BOOKING"
24
+ API_SELECTOR = "API_SELECTOR"
29
25
  }
30
26
  export declare enum OptionTypes {
31
27
  DEFAULT = "DEFAULT",
@@ -25,10 +25,6 @@ export var FormStepTypes;
25
25
  FormStepTypes["MAPPER"] = "MAPPER";
26
26
  FormStepTypes["ENTITYVALUEPICKER"] = "ENTITYVALUEPICKER";
27
27
  FormStepTypes["API_SELECTOR"] = "API_SELECTOR";
28
- FormStepTypes["LOCATION"] = "LOCATION";
29
- FormStepTypes["NUMBER"] = "NUMBER";
30
- FormStepTypes["CALENDAR"] = "CALENDAR";
31
- FormStepTypes["BOOKING"] = "BOOKING";
32
28
  })(FormStepTypes || (FormStepTypes = {}));
33
29
  export var OptionTypes;
34
30
  (function (OptionTypes) {
@@ -1,8 +1,6 @@
1
1
  import EurekaForm, { AppProps as EurekaFormProps } from './App/App';
2
2
  import { StepProps } from './FormSteps/Step';
3
3
  import * as StepFunctions from './FormSteps/StepFunctions';
4
- import ErkBookingPicker, { ErkBookingPickerProps } from './Shared/ErkBookingPicker/ErkBookingPicker';
5
- import ErkAvailabilityPicker, { ErkAvailabilityPickerProps } from './Shared/ErkAvailabilityPicker/ErkAvailabilityPicker';
6
- export type { StepProps, EurekaFormProps, ErkBookingPickerProps, ErkAvailabilityPickerProps };
7
- export { EurekaForm, StepFunctions, ErkBookingPicker, ErkAvailabilityPicker };
4
+ export type { StepProps, EurekaFormProps };
5
+ export { EurekaForm, StepFunctions };
8
6
  export default EurekaForm;
package/dist/index.lib.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import EurekaForm from './App/App';
2
2
  import * as StepFunctions from './FormSteps/StepFunctions';
3
- import ErkBookingPicker from './Shared/ErkBookingPicker/ErkBookingPicker';
4
- import ErkAvailabilityPicker from './Shared/ErkAvailabilityPicker/ErkAvailabilityPicker';
5
- export { EurekaForm, StepFunctions, ErkBookingPicker, ErkAvailabilityPicker };
3
+ export { EurekaForm, StepFunctions };
6
4
  export default EurekaForm;
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.55-new-steps",
4
+ "version": "3.0.55",
5
5
  "scripts": {
6
6
  "watch": "tsgo --noEmit --watch --project tsconfig.app.json",
7
7
  "start": "vite",
@@ -16,7 +16,6 @@
16
16
  "build-storybook": "storybook build"
17
17
  },
18
18
  "dependencies": {
19
- "@base-ui/react": "^1.6.0",
20
19
  "@reduxjs/toolkit": "2.11.2",
21
20
  "axios": "1.16.0",
22
21
  "date-fns": "4.1.0",
@@ -51,10 +50,10 @@
51
50
  "@eslint/eslintrc": "3.3.3",
52
51
  "@eslint/js": "9.39.1",
53
52
  "@faker-js/faker": "10.1.0",
54
- "@mui/material": "^9.0.1",
55
- "@mui/x-data-grid-pro": "^9.3.0",
56
- "@mui/x-date-pickers": "^9.3.0",
57
- "@mui/x-date-pickers-pro": "^9.3.0",
53
+ "@mui/material": "^9.2.0",
54
+ "@mui/x-data-grid-pro": "^9.10.1",
55
+ "@mui/x-date-pickers": "^9.10.1",
56
+ "@mui/x-date-pickers-pro": "^9.10.1",
58
57
  "@storybook/addon-docs": "^10.4.0",
59
58
  "@storybook/addon-onboarding": "^10.4.0",
60
59
  "@storybook/addon-themes": "^10.4.0",
@@ -98,8 +97,8 @@
98
97
  "peerDependencies": {
99
98
  "@emotion/react": "11.x.x",
100
99
  "@emotion/styled": "11.x.x",
101
- "@mui/material": "^9.0.1",
102
- "@mui/x-date-pickers": "^9.3.0",
100
+ "@mui/material": "^9.2.0",
101
+ "@mui/x-date-pickers": "^9.10.1",
103
102
  "react": "18 || 19",
104
103
  "react-dom": "18 || 19"
105
104
  },
@@ -1,48 +0,0 @@
1
- /**
2
- * @deprecated Renombrado a CalendarFormStep.
3
- * Este archivo existe solo para compatibilidad retroactiva.
4
- * Usar `CalendarFormStep.ts` directamente.
5
- */
6
- export type { CalendarStep as AvailabilityStep } from './CalendarFormStep';
7
- export type { CalendarValue as AvailabilityValue } from './CalendarFormStep';
8
- export { CalendarEventCategory as AvailabilityEventCategory } from './CalendarFormStep';
9
- export { CalendarDefaultView } from './CalendarFormStep';
10
- export type { CalendarEventTemplate } from './CalendarFormStep';
11
- export type { CalendarEvent } from './CalendarFormStep';
12
- export declare enum AvailabilityMode {
13
- WEEKLY = "WEEKLY",
14
- SPECIFIC_DATES = "SPECIFIC_DATES",
15
- COMBINED = "COMBINED"
16
- }
17
- export declare enum AvailabilityDayOfWeek {
18
- MONDAY = 1,
19
- TUESDAY = 2,
20
- WEDNESDAY = 3,
21
- THURSDAY = 4,
22
- FRIDAY = 5,
23
- SATURDAY = 6,
24
- SUNDAY = 7
25
- }
26
- export interface AvailabilitySlot {
27
- start: string;
28
- end: string;
29
- }
30
- export interface AvailabilityDay {
31
- day: AvailabilityDayOfWeek;
32
- slots: AvailabilitySlot[];
33
- recurrence?: string;
34
- }
35
- export interface AvailabilitySpecificDate {
36
- date: string;
37
- slots: AvailabilitySlot[];
38
- }
39
- export interface AvailabilityExclusion {
40
- date?: string;
41
- dateRange?: {
42
- start: string;
43
- end: string;
44
- };
45
- dayOfWeek?: AvailabilityDayOfWeek;
46
- slots?: AvailabilitySlot[];
47
- reason?: string;
48
- }