@arquimedes.co/eureka-forms 3.0.48-test → 3.0.49-new-steps

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 (140) hide show
  1. package/dist/@Types/AvailabilityFormStep.d.ts +48 -0
  2. package/dist/@Types/AvailabilityFormStep.js +24 -0
  3. package/dist/@Types/BankAccountFormStep.d.ts +67 -0
  4. package/dist/@Types/BankAccountFormStep.js +14 -0
  5. package/dist/@Types/BookingFormStep.d.ts +156 -0
  6. package/dist/@Types/BookingFormStep.js +44 -0
  7. package/dist/@Types/CalendarFormStep.d.ts +192 -0
  8. package/dist/@Types/CalendarFormStep.js +48 -0
  9. package/dist/@Types/CommunicationChannelFormStep.d.ts +51 -0
  10. package/dist/@Types/CommunicationChannelFormStep.js +15 -0
  11. package/dist/@Types/Condition.d.ts +4 -6
  12. package/dist/@Types/ConsentFormStep.d.ts +36 -0
  13. package/dist/@Types/ConsentFormStep.js +8 -0
  14. package/dist/@Types/EntityFormFormStep.d.ts +66 -0
  15. package/dist/@Types/EntityFormFormStep.js +20 -0
  16. package/dist/@Types/EventFormStep.d.ts +52 -0
  17. package/dist/@Types/EventFormStep.js +13 -0
  18. package/dist/@Types/ExternalReferenceFormStep.d.ts +74 -0
  19. package/dist/@Types/ExternalReferenceFormStep.js +20 -0
  20. package/dist/@Types/Form.d.ts +0 -1
  21. package/dist/@Types/FormStep.d.ts +8 -10
  22. package/dist/@Types/FormStep.js +2 -1
  23. package/dist/@Types/LocationFormStep.d.ts +159 -0
  24. package/dist/@Types/LocationFormStep.js +46 -0
  25. package/dist/@Types/NumericFormSteps.d.ts +108 -0
  26. package/dist/@Types/NumericFormSteps.js +20 -0
  27. package/dist/@Types/PredefinedSelectorFormStep.d.ts +51 -0
  28. package/dist/@Types/PredefinedSelectorFormStep.js +39 -0
  29. package/dist/@Types/StepRef.d.ts +135 -0
  30. package/dist/@Types/StepRef.js +49 -0
  31. package/dist/App/App.js +1 -1
  32. package/dist/App/AppFunctions.js +3 -8
  33. package/dist/App/AppHooks.js +1 -20
  34. package/dist/Form/Form.js +2 -6
  35. package/dist/Form/Form.module.css +39 -48
  36. package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +4 -8
  37. package/dist/FormSteps/BookingStep/BookingStep.d.ts +17 -0
  38. package/dist/FormSteps/BookingStep/BookingStep.js +14 -0
  39. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +3 -0
  40. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +362 -0
  41. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.module.css +174 -0
  42. package/dist/FormSteps/CBRStepMapper.js +1 -1
  43. package/dist/FormSteps/CalendarStep/CalendarStep.d.ts +7 -0
  44. package/dist/FormSteps/CalendarStep/CalendarStep.js +14 -0
  45. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.d.ts +3 -0
  46. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.js +269 -0
  47. package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.module.css +531 -0
  48. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
  49. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +4 -52
  50. package/dist/FormSteps/LocationStep/LocationStep.d.ts +10 -0
  51. package/dist/FormSteps/LocationStep/LocationStep.js +14 -0
  52. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +3 -0
  53. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +47 -0
  54. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +18 -0
  55. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +3 -0
  56. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +168 -0
  57. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +94 -0
  58. package/dist/FormSteps/NumberStep/NumberStep.d.ts +10 -0
  59. package/dist/FormSteps/NumberStep/NumberStep.js +14 -0
  60. package/dist/FormSteps/Step.js +16 -0
  61. package/dist/FormSteps/StepFunctions.js +23 -6
  62. package/dist/FormSteps/StepFunctions.test.js +57 -3
  63. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +1 -2
  64. package/dist/Icons/@ErkIcon.d.ts +2 -2
  65. package/dist/Icons/@ErkIcon.js +2 -2
  66. package/dist/Icons/AddIcon.d.ts +3 -0
  67. package/dist/Icons/AddIcon.js +7 -0
  68. package/dist/Icons/EditIcon.d.ts +3 -0
  69. package/dist/Icons/{EmailIcon.js → EditIcon.js} +3 -3
  70. package/dist/Icons/RemoveIcon.d.ts +3 -0
  71. package/dist/Icons/RemoveIcon.js +7 -0
  72. package/dist/Icons/ViewDayIcon.d.ts +3 -0
  73. package/dist/Icons/ViewDayIcon.js +7 -0
  74. package/dist/Icons/ViewWeekIcon.d.ts +3 -0
  75. package/dist/Icons/ViewWeekIcon.js +7 -0
  76. package/dist/Services/DraftService.js +1 -4
  77. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +19 -0
  78. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +80 -0
  79. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +82 -0
  80. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +29 -0
  81. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +139 -0
  82. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +1 -3
  83. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +2 -3
  84. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +1 -2
  85. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +23 -0
  86. package/dist/Shared/ErkLocationField/ErkLocationField.js +73 -0
  87. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +29 -0
  88. package/dist/Shared/ErkLocationField/addressFields.d.ts +12 -0
  89. package/dist/Shared/ErkLocationField/addressFields.js +34 -0
  90. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +6 -0
  91. package/dist/Shared/ErkLocationField/locationRestrictions.js +51 -0
  92. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +15 -0
  93. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +499 -0
  94. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +115 -0
  95. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +42 -0
  96. package/dist/Shared/ErkNumberField/ErkNumberField.js +170 -0
  97. package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
  98. package/dist/Shared/InputIcon/InputIcon.js +0 -6
  99. package/dist/Shared/Navbar/Navbar.d.ts +1 -2
  100. package/dist/Shared/Navbar/Navbar.js +3 -22
  101. package/dist/Shared/Navbar/Navbar.module.css +8 -22
  102. package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +2 -8
  103. package/dist/States/GlobalSlice.d.ts +1 -4
  104. package/dist/States/GlobalSlice.js +1 -8
  105. package/dist/constants/ErkIconTypes.d.ts +1 -3
  106. package/dist/constants/ErkIconTypes.js +0 -2
  107. package/dist/constants/FormStepTypes.d.ts +6 -3
  108. package/dist/constants/FormStepTypes.js +4 -1
  109. package/dist/hooks.d.ts +0 -3
  110. package/dist/hooks.js +1 -17
  111. package/package.json +3 -9
  112. package/dist/@Types/ErkValue.d.ts +0 -16
  113. package/dist/@Types/ErkValue.js +0 -1
  114. package/dist/@Types/User.d.ts +0 -13
  115. package/dist/@Types/User.js +0 -1
  116. package/dist/Icons/EmailIcon.d.ts +0 -3
  117. package/dist/Icons/Entities/SchoolIcon.d.ts +0 -3
  118. package/dist/Icons/Entities/SchoolIcon.js +0 -7
  119. package/dist/Icons/GroupIcon.d.ts +0 -3
  120. package/dist/Icons/GroupIcon.js +0 -7
  121. package/dist/Icons/LockedIcon.d.ts +0 -3
  122. package/dist/Icons/LockedIcon.js +0 -7
  123. package/dist/Login/Login.module.css +0 -135
  124. package/dist/Login/LoginLayout.module.css +0 -68
  125. package/dist/Login/LoginPage.d.ts +0 -10
  126. package/dist/Login/LoginPage.js +0 -101
  127. package/dist/Login/LoginTextField.d.ts +0 -14
  128. package/dist/Login/LoginTextField.js +0 -29
  129. package/dist/Services/ApiSelectorService.d.ts +0 -366
  130. package/dist/Services/ApiSelectorService.js +0 -173
  131. package/dist/Services/ApiSelectorService.test.d.ts +0 -1
  132. package/dist/Services/ApiSelectorService.test.js +0 -87
  133. package/dist/Services/IntegrationService.d.ts +0 -21
  134. package/dist/Services/IntegrationService.js +0 -22
  135. package/dist/Services/UserService.d.ts +0 -10
  136. package/dist/Services/UserService.js +0 -21
  137. package/dist/Shared/SmartDraftRenderer/LinkDecorator.d.ts +0 -14
  138. package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +0 -48
  139. package/dist/constants/ErkValueTypes.d.ts +0 -6
  140. package/dist/constants/ErkValueTypes.js +0 -7
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { AddressFieldMode, LocationInputMode } from '../../../@Types/LocationFormStep';
4
+ import { useFormStep } from '../../StepHooks';
5
+ import FormContext from '../../../Contexts/FormContext';
6
+ import { selectBreakPoint, useAppSelector } from '../../../hooks';
7
+ import { calcStepWidth } from '../../StepFunctions';
8
+ import ErkLocationField from '../../../Shared/ErkLocationField/ErkLocationField';
9
+ import { fieldConfig } from '../../../Shared/ErkLocationField/addressFields';
10
+ import { validateRestrictions } from '../../../Shared/ErkLocationField/locationRestrictions';
11
+ import styles from './MaterialLocationStep.module.css';
12
+ function MaterialLocationStep({ step, editable }) {
13
+ const currentBreakPoint = useAppSelector(selectBreakPoint);
14
+ const { postview } = useAppSelector((state) => state.global);
15
+ const form = useContext(FormContext);
16
+ const isReadOnly = !editable || postview;
17
+ const widthStyle = currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, form.size);
18
+ const { ref, value, onChange, error } = useFormStep(step, {
19
+ defaultValue: step.defaultValue ?? null,
20
+ rules: {
21
+ required: step.required ? 'La ubicación es obligatoria' : undefined,
22
+ validate: (val) => {
23
+ if (!val)
24
+ return step.required ? 'La ubicación es obligatoria' : true;
25
+ if (val.source === LocationInputMode.MANUAL) {
26
+ // Un campo es obligatorio en manual solo si no está omitido (FIXED lo llena solo).
27
+ const detail = val.addressDetail;
28
+ const isRequired = (key) => fieldConfig(step.addressFields, key).mode !== AddressFieldMode.OMIT;
29
+ if (step.required && isRequired('street') && !detail?.street)
30
+ return 'Por favor completa la calle en el formulario manual.';
31
+ if (step.required && isRequired('city') && !detail?.city)
32
+ return 'Por favor completa la ciudad en el formulario manual.';
33
+ if (step.required && isRequired('country') && !detail?.country)
34
+ return 'Por favor completa el país en el formulario manual.';
35
+ return true;
36
+ }
37
+ if (val.latitude === undefined || val.longitude === undefined) {
38
+ return step.required ? 'Coordenadas geográficas no capturadas.' : true;
39
+ }
40
+ // Restricciones geográficas (radio / geofence).
41
+ return validateRestrictions(val.latitude, val.longitude, step.restrictions) ?? true;
42
+ },
43
+ },
44
+ });
45
+ return (_jsxs("div", { className: styles.container, style: { width: widthStyle }, children: [step.label && _jsxs("div", { className: styles.label, children: [step.label, step.required && _jsx("span", { className: styles.required, children: " *" })] }), _jsx(ErkLocationField, { value: value, onChange: onChange, allowedModes: step.allowedModes, defaultMode: step.defaultMode, addressFields: step.addressFields, helperText: error?.message ?? step.description, required: step.required, error: !!error, readOnly: isReadOnly, inputRef: ref })] }));
46
+ }
47
+ export default MaterialLocationStep;
@@ -0,0 +1,18 @@
1
+ .container {
2
+ max-width: 100%;
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: 6px;
6
+ padding: 5px 10px 0;
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .label {
11
+ font-size: 14px;
12
+ font-weight: 500;
13
+ color: var(--eureka-text, #333);
14
+ }
15
+
16
+ .required {
17
+ color: var(--eureka-error, #e53935);
18
+ }
@@ -0,0 +1,3 @@
1
+ import { NumberStepProps } from '../NumberStep';
2
+ declare function MaterialNumberStep({ step, editable }: NumberStepProps): JSX.Element;
3
+ export default MaterialNumberStep;
@@ -0,0 +1,168 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext, useState, useEffect } from 'react';
3
+ import { NumberStepType, } from '../../../@Types/NumericFormSteps';
4
+ import { useFormStep } from '../../StepHooks';
5
+ import FormContext from '../../../Contexts/FormContext';
6
+ import { selectBreakPoint, useAppSelector } from '../../../hooks';
7
+ import { calcStepWidth } from '../../StepFunctions';
8
+ import ErkNumberField from '../../../Shared/ErkNumberField/ErkNumberField';
9
+ import ErkSelect from '../../../Shared/ErkSelect/ErkSelect';
10
+ import ErkMenuItem from '../../../Shared/ErkMenuItem';
11
+ import styles from './MaterialNumberStep.module.css';
12
+ const DEFAULT_CURRENCIES = ['COP', 'USD', 'EUR', 'MXN', 'CLP', 'BRL'];
13
+ const DEFAULT_UNITS = ['unidades', 'kg', 'g', 'm', 'cm', 'l', 'ml', 'hrs', 'mes', 'año'];
14
+ // ---------------------------------------------------------------------------
15
+ // Helpers
16
+ // ---------------------------------------------------------------------------
17
+ function getNumericValue(value) {
18
+ if (value === null || value === undefined)
19
+ return null;
20
+ if (typeof value === 'number')
21
+ return value;
22
+ return value.value;
23
+ }
24
+ // ---------------------------------------------------------------------------
25
+ // Component
26
+ // ---------------------------------------------------------------------------
27
+ function MaterialNumberStep({ step, editable }) {
28
+ const currentBreakPoint = useAppSelector(selectBreakPoint);
29
+ const { postview, formStyle } = useAppSelector((state) => state.global);
30
+ const form = useContext(FormContext);
31
+ const isReadOnly = !editable || postview;
32
+ const widthStyle = currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, form.size);
33
+ const isComposite = step.numberType === NumberStepType.MONEY ||
34
+ step.numberType === NumberStepType.MEASURE ||
35
+ step.numberType === NumberStepType.UNIT_PRICE;
36
+ // Narrowed views — only used after the corresponding numberType check
37
+ const asMoney = step;
38
+ const asMeasure = step;
39
+ const asUnitPrice = step;
40
+ const { ref, value, onChange, error } = useFormStep(step, {
41
+ defaultValue: step.defaultValue ?? null,
42
+ rules: {
43
+ required: step.required ? 'Este campo es obligatorio' : undefined,
44
+ validate: (val) => {
45
+ if (!step.required && (val === null || val === undefined || val === ''))
46
+ return true;
47
+ if (step.required && (val === null || val === undefined || val === ''))
48
+ return 'Este campo es obligatorio';
49
+ const numVal = getNumericValue(val);
50
+ if (numVal === null)
51
+ return 'Formato numérico inválido';
52
+ if (step.min !== undefined && numVal < step.min)
53
+ return `El valor mínimo es ${step.min}`;
54
+ if (step.max !== undefined && numVal > step.max)
55
+ return `El valor máximo es ${step.max}`;
56
+ return true;
57
+ },
58
+ },
59
+ });
60
+ // Currency/unit selectors
61
+ const [selectedCurrency, setSelectedCurrency] = useState(() => {
62
+ const v = value;
63
+ return v?.currency ?? asMoney.currency ?? asUnitPrice.currency ?? 'COP';
64
+ });
65
+ const [selectedUnit, setSelectedUnit] = useState(() => {
66
+ const v = value;
67
+ return v?.unit ?? asMeasure.unit ?? asUnitPrice.unit ?? 'unidades';
68
+ });
69
+ // Sync when value changes externally
70
+ useEffect(() => {
71
+ if (value && typeof value === 'object') {
72
+ if ('currency' in value && value.currency && value.currency !== selectedCurrency) {
73
+ void Promise.resolve().then(() => setSelectedCurrency(value.currency));
74
+ }
75
+ if ('unit' in value && value.unit && value.unit !== selectedUnit) {
76
+ void Promise.resolve().then(() => setSelectedUnit(value.unit));
77
+ }
78
+ }
79
+ }, [value, selectedCurrency, selectedUnit]);
80
+ // ---------------------------------------------------------------------------
81
+ // Handlers: wrap ErkNumberField's (number | null) into the step value shape
82
+ // ---------------------------------------------------------------------------
83
+ const handleNumberChange = (num) => {
84
+ if (num === null) {
85
+ onChange(null);
86
+ return;
87
+ }
88
+ if (step.numberType === NumberStepType.MONEY) {
89
+ onChange({ value: num, currency: selectedCurrency });
90
+ }
91
+ else if (step.numberType === NumberStepType.MEASURE) {
92
+ onChange({ value: num, unit: selectedUnit });
93
+ }
94
+ else if (step.numberType === NumberStepType.UNIT_PRICE) {
95
+ onChange({ value: num, currency: selectedCurrency, unit: selectedUnit });
96
+ }
97
+ else {
98
+ onChange(num);
99
+ }
100
+ };
101
+ const handleCurrencyChange = (curr) => {
102
+ const next = curr ?? 'USD';
103
+ setSelectedCurrency(next);
104
+ const num = getNumericValue(value);
105
+ if (num !== null) {
106
+ onChange(step.numberType === NumberStepType.UNIT_PRICE
107
+ ? { value: num, currency: next, unit: selectedUnit }
108
+ : { value: num, currency: next });
109
+ }
110
+ };
111
+ const handleUnitChange = (u) => {
112
+ const next = u ?? 'unidades';
113
+ setSelectedUnit(next);
114
+ const num = getNumericValue(value);
115
+ if (num !== null) {
116
+ onChange(step.numberType === NumberStepType.UNIT_PRICE
117
+ ? { value: num, currency: selectedCurrency, unit: next }
118
+ : { value: num, unit: next });
119
+ }
120
+ };
121
+ // ---------------------------------------------------------------------------
122
+ // Static suffix text shown inside ErkNumberField
123
+ // ---------------------------------------------------------------------------
124
+ const staticSuffix = () => {
125
+ if (step.numberType === NumberStepType.PERCENTAGE)
126
+ return '%';
127
+ if (step.numberType === NumberStepType.MONEY && !asMoney.allowCurrencyChange)
128
+ return asMoney.currency ?? 'USD';
129
+ if (step.numberType === NumberStepType.MEASURE && !asMeasure.allowUnitChange)
130
+ return asMeasure.unit ?? 'unidades';
131
+ // UNIT_PRICE renders its adornment fully inside the field only when neither part is editable.
132
+ if (step.numberType === NumberStepType.UNIT_PRICE && !asUnitPrice.allowCurrencyChange && !asUnitPrice.allowUnitChange)
133
+ return `${asUnitPrice.currency ?? 'USD'} / ${asUnitPrice.unit ?? 'unidades'}`;
134
+ if (!isComposite && step.suffix)
135
+ return step.suffix;
136
+ return undefined;
137
+ };
138
+ // ---------------------------------------------------------------------------
139
+ // Resolved selector lists
140
+ // ---------------------------------------------------------------------------
141
+ const currenciesList = step.numberType === NumberStepType.MONEY || step.numberType === NumberStepType.UNIT_PRICE
142
+ ? (step.availableCurrencies ?? DEFAULT_CURRENCIES)
143
+ : [];
144
+ const unitsList = step.numberType === NumberStepType.MEASURE || step.numberType === NumberStepType.UNIT_PRICE
145
+ ? (step.availableUnits ?? DEFAULT_UNITS)
146
+ : [];
147
+ const isMoneyDynamic = step.numberType === NumberStepType.MONEY && asMoney.allowCurrencyChange;
148
+ const isMeasureDynamic = step.numberType === NumberStepType.MEASURE && asMeasure.allowUnitChange;
149
+ // UNIT_PRICE has two independent toggles: currency and unit can each be fixed or selectable.
150
+ const isUnitPriceCurrencyDynamic = step.numberType === NumberStepType.UNIT_PRICE && !!asUnitPrice.allowCurrencyChange;
151
+ const isUnitPriceUnitDynamic = step.numberType === NumberStepType.UNIT_PRICE && !!asUnitPrice.allowUnitChange;
152
+ const isUnitPriceDynamic = isUnitPriceCurrencyDynamic || isUnitPriceUnitDynamic;
153
+ // ---------------------------------------------------------------------------
154
+ // Shared CSS vars
155
+ // ---------------------------------------------------------------------------
156
+ const cssVars = {
157
+ width: widthStyle,
158
+ '--eureka-outline': formStyle.outlineColor,
159
+ '--eureka-primary': formStyle.primaryColor,
160
+ '--eureka-text': formStyle.textColor,
161
+ '--eureka-bg': formStyle.standAloneBackgroundColor ?? '#fff',
162
+ };
163
+ // ---------------------------------------------------------------------------
164
+ // Read-only view
165
+ // ---------------------------------------------------------------------------
166
+ return (_jsx("div", { className: styles.container, style: cssVars, children: _jsxs("div", { className: styles.inputRow, children: [_jsx("div", { style: { flex: 1 }, children: _jsx(ErkNumberField, { label: step.label, value: getNumericValue(value), onChange: handleNumberChange, error: !!error, errorBorder: true, required: step.required, helperText: error?.message ?? step.description ?? undefined, inputRef: ref, min: step.min, max: step.max, decimals: step.numberType === NumberStepType.INTEGER ? 0 : (step.decimals ?? 2), suffix: staticSuffix(), readOnly: isReadOnly, spinner: step.spinner, step: step.step, placeholder: step.placeholder }) }), isMoneyDynamic && (_jsx("div", { className: styles.selectWrapper, children: _jsx(ErkSelect, { value: selectedCurrency, onChange: handleCurrencyChange, clearable: false, children: currenciesList.map((c) => (_jsx(ErkMenuItem, { value: c, children: c }, c))) }) })), isMeasureDynamic && (_jsx("div", { className: styles.selectWrapper, children: _jsx(ErkSelect, { value: selectedUnit, onChange: handleUnitChange, clearable: false, children: unitsList.map((u) => (_jsx(ErkMenuItem, { value: u, children: u }, u))) }) })), isUnitPriceDynamic && (_jsxs(_Fragment, { children: [isUnitPriceCurrencyDynamic ? (_jsx("div", { className: styles.selectWrapper, children: _jsx(ErkSelect, { value: selectedCurrency, onChange: handleCurrencyChange, clearable: false, children: currenciesList.map((c) => (_jsx(ErkMenuItem, { value: c, children: c }, c))) }) })) : (_jsx("span", { className: styles.suffixText, children: asUnitPrice.currency ?? 'USD' })), _jsx("span", { className: styles.dividerSlash, children: "/" }), isUnitPriceUnitDynamic ? (_jsx("div", { className: styles.selectWrapper, children: _jsx(ErkSelect, { value: selectedUnit, onChange: handleUnitChange, clearable: false, children: unitsList.map((u) => (_jsx(ErkMenuItem, { value: u, children: u }, u))) }) })) : (_jsx("span", { className: styles.suffixText, children: asUnitPrice.unit ?? 'unidades' }))] }))] }) }));
167
+ }
168
+ export default MaterialNumberStep;
@@ -0,0 +1,94 @@
1
+ .container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ }
6
+
7
+ .inputRow {
8
+ display: flex;
9
+ align-items: flex-start;
10
+ gap: 12px;
11
+ width: 100%;
12
+ }
13
+
14
+ .selectWrapper {
15
+ width: 100px;
16
+ min-width: 90px;
17
+ }
18
+
19
+ .dividerSlash {
20
+ align-self: flex-start;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ height: 40px;
25
+ font-size: 20px;
26
+ font-weight: bold;
27
+ color: var(--eureka-text, #333);
28
+ opacity: 0.6;
29
+ margin-left: 2px;
30
+ margin-right: 2px;
31
+ }
32
+
33
+ .suffixText {
34
+ align-self: flex-start;
35
+ display: flex;
36
+ align-items: center;
37
+ height: 40px;
38
+ font-size: 14px;
39
+ font-weight: 600;
40
+ color: var(--eureka-primary, #1976d2);
41
+ padding: 0 4px;
42
+ user-select: none;
43
+ }
44
+
45
+ /* Read-Only Styles */
46
+ .readOnlyContainer {
47
+ width: 100%;
48
+ margin-bottom: 8px;
49
+ }
50
+
51
+ .readOnlyCard {
52
+ display: flex;
53
+ align-items: center;
54
+ padding: 12px 16px;
55
+ border: 1px solid var(--eureka-outline, #e0e0e0);
56
+ border-radius: 12px;
57
+ background-color: var(--eureka-bg, #ffffff);
58
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
59
+ transition: box-shadow 0.2s ease, border-color 0.2s ease;
60
+ }
61
+
62
+ .readOnlyCard:hover {
63
+ border-color: var(--eureka-primary, #1976d2);
64
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
65
+ }
66
+
67
+ .readOnlyDetails {
68
+ display: flex;
69
+ flex-direction: column;
70
+ gap: 2px;
71
+ width: 100%;
72
+ }
73
+
74
+ .readOnlyLabel {
75
+ font-size: 11px !important;
76
+ text-transform: uppercase;
77
+ letter-spacing: 0.5px;
78
+ color: var(--eureka-text, #333) !important;
79
+ opacity: 0.6;
80
+ font-weight: 600 !important;
81
+ }
82
+
83
+ .readOnlyValue {
84
+ font-size: 16px !important;
85
+ font-weight: 600 !important;
86
+ color: var(--eureka-primary, #1976d2) !important;
87
+ }
88
+
89
+ .readOnlyDesc {
90
+ font-size: 12px !important;
91
+ color: var(--eureka-text, #333) !important;
92
+ opacity: 0.5;
93
+ margin-top: 2px !important;
94
+ }
@@ -0,0 +1,10 @@
1
+ import { NumberStep } from '../../@Types/FormStep';
2
+ import { StepProps } from '../Step';
3
+ export interface NumberStepProps extends StepProps {
4
+ /** The NumberStep to display */
5
+ step: NumberStep;
6
+ /** The icon to display */
7
+ IconComponent?: React.ElementType;
8
+ }
9
+ declare function NumberStepComponent(props: NumberStepProps): JSX.Element;
10
+ export default NumberStepComponent;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FormStyleTypes } from '../../constants/FormStepTypes';
3
+ import MaterialNumberStep from './MaterialNumberStep/MaterialNumberStep';
4
+ import { useAppSelector } from '../../hooks';
5
+ function NumberStepComponent(props) {
6
+ const { formStyle } = useAppSelector((state) => state.global);
7
+ switch (formStyle.type) {
8
+ case FormStyleTypes.MATERIAL:
9
+ default: {
10
+ return _jsx(MaterialNumberStep, { ...props });
11
+ }
12
+ }
13
+ }
14
+ export default NumberStepComponent;
@@ -24,6 +24,10 @@ 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';
27
31
  function StepComponent({ step, ...props }) {
28
32
  const { postview, partial } = useAppSelector((state) => state.global);
29
33
  const { customSteps, customClientInfoStep } = useContext(CustomContext);
@@ -74,6 +78,18 @@ function StepComponent({ step, ...props }) {
74
78
  case FormStepTypes.DATEPICKER: {
75
79
  return _jsx(DatePickerStep, { ...props, step: step, editable: editable });
76
80
  }
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
+ }
77
93
  case FormStepTypes.DATEPICKER_RANGE: {
78
94
  return _jsx(DatePickerRangeStep, { ...props, step: step, editable: editable });
79
95
  }
@@ -1,3 +1,4 @@
1
+ import { NumberStepType, } from '../@Types/FormStep';
1
2
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
2
3
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
3
4
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
@@ -87,6 +88,8 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
87
88
  return size;
88
89
  }
89
90
  case FormStepTypes.DATEPICKER:
91
+ case FormStepTypes.LOCATION:
92
+ case FormStepTypes.NUMBER:
90
93
  case FormStepTypes.TEXTINPUT: {
91
94
  return step.size;
92
95
  }
@@ -117,6 +120,17 @@ export const calcDefaultValue = (step) => {
117
120
  return getRawText();
118
121
  else
119
122
  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
+ }
120
134
  case FormStepTypes.RATING:
121
135
  case FormStepTypes.DATEPICKER:
122
136
  case FormStepTypes.DATEPICKER_RANGE:
@@ -135,7 +149,7 @@ export const calcDefaultValue = (step) => {
135
149
  return undefined;
136
150
  }
137
151
  };
138
- export const iterateNestedSteps = (idStep, steps, iteration, path = []) => {
152
+ export const iterateNestedSteps = (idStep, steps, iteration, path = [idStep]) => {
139
153
  const step = steps[idStep];
140
154
  if (!step) {
141
155
  console.error('Missing Step:', idStep);
@@ -144,12 +158,15 @@ export const iterateNestedSteps = (idStep, steps, iteration, path = []) => {
144
158
  iteration(step, path);
145
159
  if (step.type === FormStepTypes.MAPPER) {
146
160
  for (const idStep of step.rootSteps) {
147
- iterateNestedSteps(idStep, step.steps, iteration, [...path, step.id]);
161
+ iterateNestedSteps(idStep, step.steps, iteration, [
162
+ ...path,
163
+ step.id,
164
+ ]);
148
165
  }
149
166
  }
150
167
  else {
151
168
  for (const idSubStep of calcSubSteps(step.id, steps)) {
152
- iterateNestedSteps(idSubStep, steps, iteration, path);
169
+ iterateNestedSteps(idSubStep, steps, iteration, [...path, step.id]);
153
170
  }
154
171
  }
155
172
  };
@@ -520,13 +537,13 @@ const evaluateEntityPropertyCondition = (condition, entity, entityValue) => {
520
537
  case OperatorTypes.PAST_RELATIVE_MORE:
521
538
  case OperatorTypes.FUTURE_RELATIVE_LESS:
522
539
  case OperatorTypes.FUTURE_RELATIVE_MORE: {
523
- const date = getRelativeDate(condition.value?.days, condition.value?.hours, condition.value?.minutes, condition.propertyOperator === OperatorTypes.PAST_RELATIVE_LESS ||
540
+ const date = getRelativeDate(condition.days, condition.hours, condition.minutes, condition.propertyOperator === OperatorTypes.PAST_RELATIVE_LESS ||
524
541
  condition.propertyOperator === OperatorTypes.PAST_RELATIVE_MORE);
525
542
  if (condition.propertyOperator === OperatorTypes.PAST_RELATIVE_LESS ||
526
543
  condition.propertyOperator === OperatorTypes.FUTURE_RELATIVE_LESS)
527
- return new Date(value).getTime() < date.getTime();
544
+ return new Date().getTime() > date.getTime();
528
545
  else
529
- return new Date(value).getTime() > date.getTime();
546
+ return new Date().getTime() < date.getTime();
530
547
  }
531
548
  }
532
549
  return false;
@@ -1,3 +1,4 @@
1
+ import * as Steps from '../@Types/FormStep';
1
2
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
2
3
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
3
4
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
@@ -496,6 +497,13 @@ describe('StepFunctions', function () {
496
497
  const defaultValue = calcDefaultValue(step);
497
498
  expect(defaultValue).toBe(null);
498
499
  });
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
+ });
499
507
  test('Mapper, FileUpload, CBRFormStep types', async () => {
500
508
  const step1 = {
501
509
  type: FormStepTypes.MAPPER,
@@ -527,6 +535,52 @@ describe('StepFunctions', function () {
527
535
  const defaultValue = calcDefaultValue(step);
528
536
  expect(defaultValue).toBeUndefined();
529
537
  });
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
+ });
530
584
  });
531
585
  describe('iterateNestedSteps', function () {
532
586
  test('should iterate over nested steps', async () => {
@@ -565,9 +619,9 @@ describe('StepFunctions', function () {
565
619
  const iterationMock = vi.fn();
566
620
  iterateNestedSteps('idStep1', steps, iterationMock);
567
621
  expect(iterationMock).toHaveBeenCalledTimes(3);
568
- expect(iterationMock).toHaveBeenCalledWith(steps.idStep1, []);
569
- expect(iterationMock).toHaveBeenCalledWith(steps.idStep1.steps.idStep2, ['idStep1']);
570
- expect(iterationMock).toHaveBeenCalledWith(steps.idStep1.steps.idStep3, ['idStep1']);
622
+ expect(iterationMock).toHaveBeenCalledWith(steps.idStep1, ['idStep1']);
623
+ expect(iterationMock).toHaveBeenCalledWith(steps.idStep1.steps.idStep2, ['idStep1', 'idStep1']);
624
+ expect(iterationMock).toHaveBeenCalledWith(steps.idStep1.steps.idStep3, ['idStep1', 'idStep1', 'idStep2']);
571
625
  });
572
626
  });
573
627
  });
@@ -31,13 +31,12 @@ function TitleStep({ step }) {
31
31
  return values;
32
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
33
  }, [stableDepsValues]);
34
- const path = useMemo(() => [...step.stepPath, step.id].join('.'), [step.stepPath, step.id]);
35
34
  return (_jsxs("div", { className: styles.container, style: {
36
35
  color: formStyle.textColor,
37
36
  width: widthStats.currentBreakPoint <= size ? '100%' : calcStepWidth(size, form.size),
38
37
  }, children: [_jsx("div", { className: styles.titleLbl, style: {
39
38
  textAlign: widthStats.isMobile && widthStats.currentBreakPoint <= size ? 'center' : 'start',
40
- }, children: _jsx(SmartDraftRenderer, { draft: title, dependencies: values, property: `${path}.title`, onChange: (title) => onChange({ ...value, title }) }) }), _jsx("div", { className: styles.descriptionPar, children: _jsx(SmartDraftRenderer, { draft: description, dependencies: values, margin: title ? '10px 0px' : '0px 0px 5px 0px', property: `${path}.description`, onChange: (description) => onChange({ ...value, description }) }) })] }));
39
+ }, children: _jsx(SmartDraftRenderer, { draft: title, dependencies: values, property: `${step.stepPath.join('.')}.title`, onChange: (title) => onChange({ ...value, title }) }) }), _jsx("div", { className: styles.descriptionPar, children: _jsx(SmartDraftRenderer, { draft: description, dependencies: values, margin: title ? '10px 0px' : '0px 0px 5px 0px', property: `${step.stepPath.join('.')}.description`, onChange: (description) => onChange({ ...value, description }) }) })] }));
41
40
  }
42
41
  export default TitleStep;
43
42
  function calcBaseDraft(value) {
@@ -9,6 +9,6 @@ export interface IconProps {
9
9
  preserveAspectRatio?: 'none';
10
10
  }
11
11
  export declare function useIconProps(props: IconProps): IconProps & {
12
- width?: number | string;
13
- height?: number | string;
12
+ width?: number;
13
+ height?: number;
14
14
  };
@@ -1,7 +1,7 @@
1
1
  export function useIconProps(props) {
2
2
  return {
3
- width: props.size ?? '1em',
4
- height: props.size ?? '1em',
3
+ width: props.size,
4
+ height: props.size,
5
5
  className: props.className ? props.className + ' ErkIcon' : 'ErkIcon',
6
6
  fill: 'currentColor',
7
7
  ...props,
@@ -0,0 +1,3 @@
1
+ import { IconProps } from './@ErkIcon';
2
+ declare function AddIcon(props: IconProps): JSX.Element;
3
+ export default AddIcon;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useIconProps } from './@ErkIcon';
3
+ function AddIcon(props) {
4
+ const iconProps = useIconProps(props);
5
+ return (_jsx("svg", { ...iconProps, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" }) }));
6
+ }
7
+ export default AddIcon;
@@ -0,0 +1,3 @@
1
+ import { IconProps } from './@ErkIcon';
2
+ declare function EditIcon(props: IconProps): JSX.Element;
3
+ export default EditIcon;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useIconProps } from './@ErkIcon';
3
- function EmailIcon(props) {
3
+ function EditIcon(props) {
4
4
  const iconProps = useIconProps(props);
5
- return (_jsx("svg", { ...iconProps, version: "1.1", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-1 14H5c-.55 0-1-.45-1-1V8l6.94 4.34c.65.41 1.47.41 2.12 0L20 8v9c0 .55-.45 1-1 1zm-7-7L4 6h16l-8 5z" }) }));
5
+ return (_jsx("svg", { ...iconProps, version: "1.1", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" }) }));
6
6
  }
7
- export default EmailIcon;
7
+ export default EditIcon;
@@ -0,0 +1,3 @@
1
+ import { IconProps } from './@ErkIcon';
2
+ declare function RemoveIcon(props: IconProps): JSX.Element;
3
+ export default RemoveIcon;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useIconProps } from './@ErkIcon';
3
+ function RemoveIcon(props) {
4
+ const iconProps = useIconProps(props);
5
+ return (_jsx("svg", { ...iconProps, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M19 13H5v-2h14v2z" }) }));
6
+ }
7
+ export default RemoveIcon;
@@ -0,0 +1,3 @@
1
+ import { IconProps } from './@ErkIcon';
2
+ declare function ViewDayIcon(props: IconProps): JSX.Element;
3
+ export default ViewDayIcon;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useIconProps } from './@ErkIcon';
3
+ function ViewDayIcon(props) {
4
+ const iconProps = useIconProps(props);
5
+ return (_jsx("svg", { ...iconProps, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M2 21h19v-2H2v2zm0-4h19v-8H2v8zm0-10h19V5H2v2z" }) }));
6
+ }
7
+ export default ViewDayIcon;