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

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 (120) hide show
  1. package/dist/@Types/FormStep.d.ts +2 -7
  2. package/dist/@Types/FormStep.js +1 -2
  3. package/dist/@Types/GenericFormSteps.d.ts +7 -0
  4. package/dist/App/App.cbr.test.js +78 -0
  5. package/dist/App/App.d.ts +6 -1
  6. package/dist/App/AppHooks.js +2 -2
  7. package/dist/FormSteps/CheckBoxStep/CheckBoxStep.mobileLabel.test.js +123 -0
  8. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +34 -7
  9. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +30 -0
  10. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +1 -1
  11. package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.js +5 -4
  12. package/dist/FormSteps/Step.js +4 -19
  13. package/dist/FormSteps/StepFunctions.d.ts +16 -1
  14. package/dist/FormSteps/StepFunctions.js +58 -14
  15. package/dist/FormSteps/StepFunctions.test.js +32 -55
  16. package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +5 -4
  17. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +4 -4
  18. package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +5 -4
  19. package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +5 -4
  20. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +7 -5
  21. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
  22. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +5 -4
  23. package/dist/Utils/CBRFunctions.js +4 -2
  24. package/dist/Utils/CBRFunctions.test.d.ts +1 -0
  25. package/dist/Utils/CBRFunctions.test.js +123 -0
  26. package/dist/Utils/MaterialProviders.js +6 -0
  27. package/dist/constants/FormStepTypes.d.ts +1 -5
  28. package/dist/constants/FormStepTypes.js +0 -4
  29. package/dist/hooks.d.ts +1 -0
  30. package/dist/hooks.js +1 -0
  31. package/dist/index.lib.d.ts +2 -4
  32. package/dist/index.lib.js +1 -3
  33. package/package.json +7 -8
  34. package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
  35. package/dist/@Types/AvailabilityFormStep.js +0 -24
  36. package/dist/@Types/BankAccountFormStep.d.ts +0 -67
  37. package/dist/@Types/BankAccountFormStep.js +0 -14
  38. package/dist/@Types/BookingFormStep.d.ts +0 -166
  39. package/dist/@Types/BookingFormStep.js +0 -44
  40. package/dist/@Types/CalendarFormStep.d.ts +0 -209
  41. package/dist/@Types/CalendarFormStep.js +0 -55
  42. package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
  43. package/dist/@Types/CommunicationChannelFormStep.js +0 -15
  44. package/dist/@Types/ConsentFormStep.d.ts +0 -36
  45. package/dist/@Types/ConsentFormStep.js +0 -8
  46. package/dist/@Types/EntityFormFormStep.d.ts +0 -66
  47. package/dist/@Types/EntityFormFormStep.js +0 -20
  48. package/dist/@Types/EventFormStep.d.ts +0 -52
  49. package/dist/@Types/EventFormStep.js +0 -13
  50. package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
  51. package/dist/@Types/ExternalReferenceFormStep.js +0 -20
  52. package/dist/@Types/LocationFormStep.d.ts +0 -159
  53. package/dist/@Types/LocationFormStep.js +0 -46
  54. package/dist/@Types/NumericFormSteps.d.ts +0 -108
  55. package/dist/@Types/NumericFormSteps.js +0 -20
  56. package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
  57. package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
  58. package/dist/@Types/StepRef.d.ts +0 -135
  59. package/dist/@Types/StepRef.js +0 -49
  60. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.d.ts +0 -7
  61. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.js +0 -14
  62. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts +0 -8
  63. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js +0 -32
  64. package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
  65. package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
  66. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -7
  67. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -32
  68. package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
  69. package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
  70. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
  71. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -54
  72. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
  73. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
  74. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -168
  75. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -94
  76. package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
  77. package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
  78. package/dist/Icons/AddIcon.d.ts +0 -3
  79. package/dist/Icons/AddIcon.js +0 -7
  80. package/dist/Icons/EditIcon.d.ts +0 -3
  81. package/dist/Icons/EditIcon.js +0 -7
  82. package/dist/Icons/RemoveIcon.d.ts +0 -3
  83. package/dist/Icons/RemoveIcon.js +0 -7
  84. package/dist/Icons/ViewDayIcon.d.ts +0 -3
  85. package/dist/Icons/ViewDayIcon.js +0 -7
  86. package/dist/Icons/ViewWeekIcon.d.ts +0 -3
  87. package/dist/Icons/ViewWeekIcon.js +0 -7
  88. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
  89. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
  90. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -82
  91. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
  92. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
  93. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +0 -25
  94. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +0 -112
  95. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +0 -88
  96. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +0 -75
  97. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +0 -31
  98. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +0 -223
  99. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +0 -608
  100. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +0 -28
  101. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +0 -117
  102. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +0 -49
  103. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +0 -1
  104. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +0 -107
  105. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -24
  106. package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -125
  107. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -153
  108. package/dist/Shared/ErkLocationField/ErkLocationField.test.d.ts +0 -1
  109. package/dist/Shared/ErkLocationField/ErkLocationField.test.js +0 -82
  110. package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
  111. package/dist/Shared/ErkLocationField/addressFields.js +0 -34
  112. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
  113. package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
  114. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
  115. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -502
  116. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -115
  117. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
  118. package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -170
  119. /package/dist/{Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts → App/App.cbr.test.d.ts} +0 -0
  120. /package/dist/{Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts → FormSteps/CheckBoxStep/CheckBoxStep.mobileLabel.test.d.ts} +0 -0
@@ -1,39 +0,0 @@
1
- /**
2
- * DRAFT — PredefinedSelectorFormStep types
3
- *
4
- * Paso que reemplaza tener que configurar manualmente opciones de selectores
5
- * para listas fijas y controladas por Capta (países, ciudades, monedas, etc.).
6
- * Las opciones vienen de APIs internas — el formulario no necesita configurarlas.
7
- *
8
- * También resuelve la cascada Country → State → City via parentStepId.
9
- */
10
- // ===========================================================================
11
- // Tipos predefinidos disponibles
12
- // ===========================================================================
13
- export var PredefinedOptionType;
14
- (function (PredefinedOptionType) {
15
- /** ISO 3166-1 — lista de países */
16
- PredefinedOptionType["COUNTRY"] = "COUNTRY";
17
- /**
18
- * Departamento / provincia / estado.
19
- * Requiere parentStepId apuntando a un step COUNTRY.
20
- */
21
- PredefinedOptionType["STATE"] = "STATE";
22
- /**
23
- * Ciudad / municipio.
24
- * Requiere parentStepId apuntando a un step STATE (o COUNTRY si no hay STATE).
25
- */
26
- PredefinedOptionType["CITY"] = "CITY";
27
- /** ISO 4217 — monedas (USD, COP, EUR, etc.) */
28
- PredefinedOptionType["CURRENCY"] = "CURRENCY";
29
- /** BCP 47 — idiomas (es, en, pt, etc.) */
30
- PredefinedOptionType["LANGUAGE"] = "LANGUAGE";
31
- /** Tipos de canal de comunicación (WhatsApp, Email, Teléfono) */
32
- PredefinedOptionType["COMMUNICATION_CHANNEL_TYPE"] = "COMMUNICATION_CHANNEL_TYPE";
33
- /** Tipos de documento de identidad por país (CC, NIT, Pasaporte, etc.) */
34
- PredefinedOptionType["DOCUMENT_TYPE"] = "DOCUMENT_TYPE";
35
- /** Días de la semana */
36
- PredefinedOptionType["DAY_OF_WEEK"] = "DAY_OF_WEEK";
37
- /** Meses del año */
38
- PredefinedOptionType["MONTH"] = "MONTH";
39
- })(PredefinedOptionType || (PredefinedOptionType = {}));
@@ -1,135 +0,0 @@
1
- /**
2
- * DRAFT — Sistema de referencias dinámicas entre steps
3
- *
4
- * Permite que la configuración de un paso use el valor en tiempo de ejecución
5
- * de otro step del mismo formulario, en lugar de un literal fijo.
6
- *
7
- * Patrón de uso:
8
- *
9
- * // Valor fijo definido en la configuración del formulario
10
- * suffix: { type: 'FIXED', value: 'km' }
11
- *
12
- * // Valor tomado del step 'step_unidad' cuando el usuario interactúa
13
- * suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
14
- *
15
- * Se puede aplicar a cualquier campo de configuración cuyo valor deba
16
- * responder a la selección previa del usuario: sufijos, unidades, monedas,
17
- * títulos dinámicos, límites numéricos, etc.
18
- */
19
- /**
20
- * Representa un valor estático/literal configurado en tiempo de diseño.
21
- * No cambia dinámicamente según las respuestas del usuario.
22
- *
23
- * @typeParam T - Tipo de dato del valor estático.
24
- */
25
- export interface FixedRef<T> {
26
- /**
27
- * Indica que el valor es fijo.
28
- */
29
- type: 'FIXED';
30
- /**
31
- * El valor estático de tipo T.
32
- * @example "km"
33
- * @example 50
34
- */
35
- value: T;
36
- }
37
- /**
38
- * Referencia dinámica al valor actual de otro step en el mismo formulario.
39
- * El runtime del formulario sustituye esta referencia por el valor que el usuario
40
- * haya ingresado en el step indicado.
41
- *
42
- * @typeParam TAllowed - Literal(es) de tipo de step permitidos como origen.
43
- * Por defecto es `string` (cualquier tipo de step). Pasar un literal union
44
- * permite al Form Builder filtrar la lista de steps disponibles en la UI.
45
- *
46
- * @example
47
- * ```ts
48
- * // Referencia a cualquier tipo de step
49
- * const ref: StepRef = {
50
- * type: 'STEP_REF',
51
- * idStep: 'step_unidad_medida',
52
- * fallback: 'm'
53
- * }
54
- *
55
- * // Referencia restringida únicamente a pasos de tipo LOCATION
56
- * const refLocation: StepRef<'LOCATION'> = {
57
- * type: 'STEP_REF',
58
- * idStep: 'step_destino_cliente',
59
- * allowedStepTypes: ['LOCATION']
60
- * }
61
- * ```
62
- */
63
- export interface StepRef<TAllowed extends string = string> {
64
- /**
65
- * Indica que el valor se toma dinámicamente de otro paso.
66
- */
67
- type: 'STEP_REF';
68
- /**
69
- * ID del paso origen en el formulario del cual se leerá el valor en tiempo de ejecución.
70
- * @example "step_ubicacion_cliente"
71
- */
72
- idStep: string;
73
- /**
74
- * Valor de respaldo (fallback) en formato de texto a utilizar mientras el paso referenciado
75
- * no contenga ningún valor (ej: porque el usuario aún no llega a ese paso).
76
- * Si se omite, el campo referenciador se comportará como vacío o sin unidad.
77
- *
78
- * @example "m"
79
- */
80
- fallback?: string;
81
- /**
82
- * Lista de tipos de pasos permitidos para esta referencia.
83
- * Ayuda al Form Builder a filtrar la interfaz de selección de campos y es
84
- * validada por el backend al guardar la configuración del formulario.
85
- * Si no se define, se permite referenciar cualquier tipo de paso.
86
- *
87
- * @example ["LOCATION"]
88
- * @example ["PREDEFINED_SELECTOR", "CHECKBOX"]
89
- */
90
- allowedStepTypes?: TAllowed[];
91
- }
92
- /**
93
- * Tipo genérico para campos que admiten tanto un valor estático como una referencia dinámica.
94
- *
95
- * @typeParam T - Tipo del valor cuando es FIXED (ej: `string`, `number`, `boolean`).
96
- * @typeParam TAllowed - Tipos de paso de origen permitidos si es STEP_REF.
97
- *
98
- * @example
99
- * ```ts
100
- * // Un sufijo de texto dinámico:
101
- * const sufijo: DynamicRef<string> = { type: 'FIXED', value: 'km' };
102
- *
103
- * // Una coordenada geográfica que debe venir de un paso de mapa:
104
- * const origen: DynamicRef<LocationCoords, 'LOCATION'> = {
105
- * type: 'STEP_REF',
106
- * idStep: 'step_mapa_inicio',
107
- * allowedStepTypes: ['LOCATION']
108
- * };
109
- * ```
110
- */
111
- export type DynamicRef<T, TAllowed extends string = string> = FixedRef<T> | StepRef<TAllowed>;
112
- /**
113
- * Comprueba si la referencia dinámica recibida es de tipo FIXED.
114
- * Funciona como Type Guard para TypeScript.
115
- *
116
- * @example
117
- * ```ts
118
- * if (isFixedRef(miRef)) {
119
- * console.log("El valor es:", miRef.value);
120
- * }
121
- * ```
122
- */
123
- export declare function isFixedRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is FixedRef<T>;
124
- /**
125
- * Comprueba si la referencia dinámica recibida es de tipo STEP_REF.
126
- * Funciona como Type Guard para TypeScript.
127
- *
128
- * @example
129
- * ```ts
130
- * if (isStepRef(miRef)) {
131
- * console.log("Apunta al step:", miRef.idStep);
132
- * }
133
- * ```
134
- */
135
- export declare function isStepRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is StepRef<TAllowed>;
@@ -1,49 +0,0 @@
1
- /**
2
- * DRAFT — Sistema de referencias dinámicas entre steps
3
- *
4
- * Permite que la configuración de un paso use el valor en tiempo de ejecución
5
- * de otro step del mismo formulario, en lugar de un literal fijo.
6
- *
7
- * Patrón de uso:
8
- *
9
- * // Valor fijo definido en la configuración del formulario
10
- * suffix: { type: 'FIXED', value: 'km' }
11
- *
12
- * // Valor tomado del step 'step_unidad' cuando el usuario interactúa
13
- * suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
14
- *
15
- * Se puede aplicar a cualquier campo de configuración cuyo valor deba
16
- * responder a la selección previa del usuario: sufijos, unidades, monedas,
17
- * títulos dinámicos, límites numéricos, etc.
18
- */
19
- // ---------------------------------------------------------------------------
20
- // Helpers de narrowing
21
- // ---------------------------------------------------------------------------
22
- /**
23
- * Comprueba si la referencia dinámica recibida es de tipo FIXED.
24
- * Funciona como Type Guard para TypeScript.
25
- *
26
- * @example
27
- * ```ts
28
- * if (isFixedRef(miRef)) {
29
- * console.log("El valor es:", miRef.value);
30
- * }
31
- * ```
32
- */
33
- export function isFixedRef(ref) {
34
- return ref.type === 'FIXED';
35
- }
36
- /**
37
- * Comprueba si la referencia dinámica recibida es de tipo STEP_REF.
38
- * Funciona como Type Guard para TypeScript.
39
- *
40
- * @example
41
- * ```ts
42
- * if (isStepRef(miRef)) {
43
- * console.log("Apunta al step:", miRef.idStep);
44
- * }
45
- * ```
46
- */
47
- export function isStepRef(ref) {
48
- return ref.type === 'STEP_REF';
49
- }
@@ -1,7 +0,0 @@
1
- import { AvailabilityStep } from '../../@Types/CalendarFormStep';
2
- import { StepProps } from '../Step';
3
- export interface AvailabilityStepProps extends StepProps {
4
- step: AvailabilityStep;
5
- }
6
- declare function AvailabilityStepComponent(props: AvailabilityStepProps): JSX.Element;
7
- export default AvailabilityStepComponent;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FormStyleTypes } from '../../constants/FormStepTypes';
3
- import MaterialAvailabilityStep from './MaterialAvailabilityStep/MaterialAvailabilityStep';
4
- import { useAppSelector } from '../../hooks';
5
- function AvailabilityStepComponent(props) {
6
- const { formStyle } = useAppSelector((state) => state.global);
7
- switch (formStyle.type) {
8
- case FormStyleTypes.MATERIAL:
9
- default: {
10
- return _jsx(MaterialAvailabilityStep, { ...props });
11
- }
12
- }
13
- }
14
- export default AvailabilityStepComponent;
@@ -1,8 +0,0 @@
1
- import { AvailabilityStepProps } from '../AvailabilityStep';
2
- /**
3
- * Conector del paso AVAILABILITY: pregunta de disponibilidad compacta
4
- * (grid semanal día × hora). El calendario completo vive en el admin; el form
5
- * solo captura ventanas disponibles que un paso BOOKING puede consumir.
6
- */
7
- declare function MaterialAvailabilityStep({ step, editable }: AvailabilityStepProps): JSX.Element;
8
- export default MaterialAvailabilityStep;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useContext } from 'react';
3
- import { useFormStep } from '../../StepHooks';
4
- import FormContext from '../../../Contexts/FormContext';
5
- import { selectBreakPoint, useAppSelector } from '../../../hooks';
6
- import { calcStepWidth } from '../../StepFunctions';
7
- import ErkAvailabilityPicker from '../../../Shared/ErkAvailabilityPicker/ErkAvailabilityPicker';
8
- /**
9
- * Conector del paso AVAILABILITY: pregunta de disponibilidad compacta
10
- * (grid semanal día × hora). El calendario completo vive en el admin; el form
11
- * solo captura ventanas disponibles que un paso BOOKING puede consumir.
12
- */
13
- function MaterialAvailabilityStep({ step, editable }) {
14
- const currentBreakPoint = useAppSelector(selectBreakPoint);
15
- const { postview, formStyle } = useAppSelector((state) => state.global);
16
- const formCtx = useContext(FormContext);
17
- const isReadOnly = !editable || postview;
18
- const widthStyle = currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, formCtx.size);
19
- const cssVars = {
20
- width: widthStyle,
21
- '--eureka-outline': formStyle.outlineColor,
22
- '--eureka-primary': formStyle.primaryColor,
23
- '--eureka-text': formStyle.textColor,
24
- '--eureka-bg': formStyle.standAloneBackgroundColor ?? '#fff',
25
- };
26
- const { ref, value, onChange, error } = useFormStep(step, {
27
- defaultValue: null,
28
- rules: { required: step.required ? 'Marca tu disponibilidad' : undefined },
29
- });
30
- return (_jsx("div", { ref: ref, style: cssVars, children: _jsx(ErkAvailabilityPicker, { value: value, onChange: onChange, label: step.label, description: step.description, minTime: step.minTime, maxTime: step.maxTime, showWeekends: step.showWeekends, timezone: step.timezone, readOnly: isReadOnly, error: error?.message }) }));
31
- }
32
- export default MaterialAvailabilityStep;
@@ -1,17 +0,0 @@
1
- import { BookingStep } from '../../@Types/BookingFormStep';
2
- import { BookingSlot } from '../../@Types/BookingFormStep';
3
- import { StepProps } from '../Step';
4
- export interface BookingStepProps extends StepProps {
5
- step: BookingStep;
6
- /**
7
- * Callback to fetch available slots for a given person + date.
8
- * The form host wires this to their availability API.
9
- * If omitted, the component shows an empty slot list.
10
- */
11
- fetchSlots?: (params: {
12
- personId?: string;
13
- date: string;
14
- }) => Promise<BookingSlot[]>;
15
- }
16
- declare function BookingStepComponent(props: BookingStepProps): JSX.Element;
17
- export default BookingStepComponent;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FormStyleTypes } from '../../constants/FormStepTypes';
3
- import MaterialBookingStep from './MaterialBookingStep/MaterialBookingStep';
4
- import { useAppSelector } from '../../hooks';
5
- function BookingStepComponent(props) {
6
- const { formStyle } = useAppSelector((state) => state.global);
7
- switch (formStyle.type) {
8
- case FormStyleTypes.MATERIAL:
9
- default: {
10
- return _jsx(MaterialBookingStep, { ...props });
11
- }
12
- }
13
- }
14
- export default BookingStepComponent;
@@ -1,7 +0,0 @@
1
- import { BookingStepProps } from '../BookingStep';
2
- /**
3
- * Conector del paso BOOKING: enlaza el estado del formulario (`useFormStep`) y el
4
- * theming del form con el componente reutilizable `ErkBookingPicker` (en Shared).
5
- */
6
- declare function MaterialBookingStep({ step, editable, fetchSlots }: BookingStepProps): JSX.Element;
7
- export default MaterialBookingStep;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useContext } from 'react';
3
- import { useFormStep } from '../../StepHooks';
4
- import FormContext from '../../../Contexts/FormContext';
5
- import { selectBreakPoint, useAppSelector } from '../../../hooks';
6
- import { calcStepWidth } from '../../StepFunctions';
7
- import ErkBookingPicker from '../../../Shared/ErkBookingPicker/ErkBookingPicker';
8
- /**
9
- * Conector del paso BOOKING: enlaza el estado del formulario (`useFormStep`) y el
10
- * theming del form con el componente reutilizable `ErkBookingPicker` (en Shared).
11
- */
12
- function MaterialBookingStep({ step, editable, fetchSlots }) {
13
- const currentBreakPoint = useAppSelector(selectBreakPoint);
14
- const { postview, formStyle } = useAppSelector((state) => state.global);
15
- const formCtx = useContext(FormContext);
16
- const isReadOnly = !editable || postview;
17
- const widthStyle = currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, formCtx.size);
18
- const cssVars = {
19
- width: widthStyle,
20
- '--eureka-outline': formStyle.outlineColor,
21
- '--eureka-primary': formStyle.primaryColor,
22
- '--eureka-text': formStyle.textColor,
23
- '--eureka-bg': formStyle.standAloneBackgroundColor ?? '#fff',
24
- '--booking-accent': formStyle.secondaryContrastColor,
25
- };
26
- const { ref, value, onChange, error } = useFormStep(step, {
27
- defaultValue: null,
28
- rules: { required: step.required ? 'Selecciona una cita' : undefined },
29
- });
30
- return (_jsx("div", { ref: ref, style: cssVars, children: _jsx(ErkBookingPicker, { value: value, onChange: onChange, label: step.label, description: step.description, durationMinutes: step.durationMinutes, bufferMinutes: step.bufferMinutes, bookingMode: step.bookingMode, temporaryLockMinutes: step.temporaryLockMinutes, personSelectionMode: step.personSelectionMode, persons: step.persons, collectContact: step.collectContact, fetchSlots: fetchSlots, readOnly: isReadOnly, error: error?.message }) }));
31
- }
32
- export default MaterialBookingStep;
@@ -1,10 +0,0 @@
1
- import { LocationStep } from '../../@Types/LocationFormStep';
2
- import { StepProps } from '../Step';
3
- export interface LocationStepProps extends StepProps {
4
- /** The LocationStep to display */
5
- step: LocationStep;
6
- /** The icon to display */
7
- IconComponent?: React.ElementType;
8
- }
9
- declare function LocationStepComponent(props: LocationStepProps): JSX.Element;
10
- export default LocationStepComponent;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FormStyleTypes } from '../../constants/FormStepTypes';
3
- import MaterialLocationStep from './MaterialLocationStep/MaterialLocationStep';
4
- import { useAppSelector } from '../../hooks';
5
- function LocationStepComponent(props) {
6
- const { formStyle } = useAppSelector((state) => state.global);
7
- switch (formStyle.type) {
8
- case FormStyleTypes.MATERIAL:
9
- default: {
10
- return _jsx(MaterialLocationStep, { ...props });
11
- }
12
- }
13
- }
14
- export default LocationStepComponent;
@@ -1,3 +0,0 @@
1
- import { LocationStepProps } from '../LocationStep';
2
- declare function MaterialLocationStep({ step, editable }: LocationStepProps): JSX.Element;
3
- export default MaterialLocationStep;
@@ -1,54 +0,0 @@
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, formStyle } = 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: {
46
- width: widthStyle,
47
- '--eureka-outline': formStyle.outlineColor,
48
- '--eureka-primary': formStyle.primaryColor,
49
- '--eureka-text': formStyle.textColor,
50
- '--eureka-error': formStyle.errorColor,
51
- '--eureka-bg': formStyle.standAloneBackgroundColor ?? '#fff',
52
- }, 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 })] }));
53
- }
54
- export default MaterialLocationStep;
@@ -1,18 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- import { NumberStepProps } from '../NumberStep';
2
- declare function MaterialNumberStep({ step, editable }: NumberStepProps): JSX.Element;
3
- export default MaterialNumberStep;
@@ -1,168 +0,0 @@
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;