@arquimedes.co/eureka-forms 3.0.62 → 3.0.63

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 (105) hide show
  1. package/README +33 -1
  2. package/dist/@Types/AvailabilityFormStep.d.ts +48 -0
  3. package/dist/@Types/AvailabilityFormStep.js +24 -0
  4. package/dist/@Types/BankAccountFormStep.d.ts +67 -0
  5. package/dist/@Types/BankAccountFormStep.js +14 -0
  6. package/dist/@Types/BookingFormStep.d.ts +187 -0
  7. package/dist/@Types/BookingFormStep.js +44 -0
  8. package/dist/@Types/CalendarFormStep.d.ts +209 -0
  9. package/dist/@Types/CalendarFormStep.js +55 -0
  10. package/dist/@Types/CommunicationChannelFormStep.d.ts +51 -0
  11. package/dist/@Types/CommunicationChannelFormStep.js +15 -0
  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/FormStep.d.ts +7 -2
  21. package/dist/@Types/FormStep.js +2 -1
  22. package/dist/@Types/LocationFormStep.d.ts +159 -0
  23. package/dist/@Types/LocationFormStep.js +46 -0
  24. package/dist/@Types/NumericFormSteps.d.ts +108 -0
  25. package/dist/@Types/NumericFormSteps.js +20 -0
  26. package/dist/@Types/PredefinedSelectorFormStep.d.ts +51 -0
  27. package/dist/@Types/PredefinedSelectorFormStep.js +39 -0
  28. package/dist/@Types/StepRef.d.ts +135 -0
  29. package/dist/@Types/StepRef.js +49 -0
  30. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.d.ts +7 -0
  31. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.js +14 -0
  32. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts +8 -0
  33. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js +32 -0
  34. package/dist/FormSteps/BookingStep/BookingStep.d.ts +17 -0
  35. package/dist/FormSteps/BookingStep/BookingStep.js +14 -0
  36. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +7 -0
  37. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +32 -0
  38. package/dist/FormSteps/LocationStep/LocationStep.d.ts +10 -0
  39. package/dist/FormSteps/LocationStep/LocationStep.js +14 -0
  40. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +3 -0
  41. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +54 -0
  42. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +18 -0
  43. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +3 -0
  44. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +170 -0
  45. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +96 -0
  46. package/dist/FormSteps/NumberStep/NumberStep.d.ts +10 -0
  47. package/dist/FormSteps/NumberStep/NumberStep.js +14 -0
  48. package/dist/FormSteps/Step.js +16 -0
  49. package/dist/FormSteps/StepFunctions.js +14 -0
  50. package/dist/FormSteps/StepFunctions.test.js +54 -0
  51. package/dist/Icons/AddIcon.d.ts +3 -0
  52. package/dist/Icons/AddIcon.js +7 -0
  53. package/dist/Icons/EditIcon.d.ts +3 -0
  54. package/dist/Icons/EditIcon.js +7 -0
  55. package/dist/Icons/RemoveIcon.d.ts +3 -0
  56. package/dist/Icons/RemoveIcon.js +7 -0
  57. package/dist/Icons/ViewDayIcon.d.ts +3 -0
  58. package/dist/Icons/ViewDayIcon.js +7 -0
  59. package/dist/Icons/ViewWeekIcon.d.ts +3 -0
  60. package/dist/Icons/ViewWeekIcon.js +7 -0
  61. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +19 -0
  62. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +80 -0
  63. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +88 -0
  64. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +29 -0
  65. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +139 -0
  66. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +25 -0
  67. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +112 -0
  68. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +88 -0
  69. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts +1 -0
  70. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +73 -0
  71. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +31 -0
  72. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +228 -0
  73. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +608 -0
  74. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +28 -0
  75. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +117 -0
  76. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts +1 -0
  77. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +49 -0
  78. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +1 -0
  79. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +107 -0
  80. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +1 -3
  81. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +2 -3
  82. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +1 -2
  83. package/dist/Shared/ErkIconButton/ErkIconButton.d.ts +17 -0
  84. package/dist/Shared/ErkIconButton/ErkIconButton.js +11 -0
  85. package/dist/Shared/ErkIconButton/ErkIconButton.module.css +41 -0
  86. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +24 -0
  87. package/dist/Shared/ErkLocationField/ErkLocationField.js +128 -0
  88. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +164 -0
  89. package/dist/Shared/ErkLocationField/ErkLocationField.test.d.ts +1 -0
  90. package/dist/Shared/ErkLocationField/ErkLocationField.test.js +82 -0
  91. package/dist/Shared/ErkLocationField/addressFields.d.ts +12 -0
  92. package/dist/Shared/ErkLocationField/addressFields.js +34 -0
  93. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +6 -0
  94. package/dist/Shared/ErkLocationField/locationRestrictions.js +51 -0
  95. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +15 -0
  96. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +502 -0
  97. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +128 -0
  98. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +42 -0
  99. package/dist/Shared/ErkNumberField/ErkNumberField.js +169 -0
  100. package/dist/Utils/AxiosWidget.js +9 -1
  101. package/dist/constants/FormStepTypes.d.ts +5 -1
  102. package/dist/constants/FormStepTypes.js +4 -0
  103. package/dist/index.lib.d.ts +4 -2
  104. package/dist/index.lib.js +3 -1
  105. package/package.json +2 -1
@@ -0,0 +1,108 @@
1
+ /**
2
+ * NumericFormSteps types
3
+ * Cubre el paso relacionado con números y sus múltiples subtipos.
4
+ */
5
+ import { GBaseStep } from './GenericFormSteps';
6
+ import FormStepTypes from '../constants/FormStepTypes';
7
+ /** Subtipo del paso numérico — discriminante secundario */
8
+ export declare enum NumberStepType {
9
+ INTEGER = "INTEGER",
10
+ DECIMAL = "DECIMAL",
11
+ PERCENTAGE = "PERCENTAGE",
12
+ /** Monto de dinero en una divisa (ej: 1500 COP). */
13
+ MONEY = "MONEY",
14
+ /** Magnitud con unidad de medida (ej: 5 kg). */
15
+ MEASURE = "MEASURE",
16
+ /** Precio por unidad: divisa sobre unidad (ej: 20 USD / hora). */
17
+ UNIT_PRICE = "UNIT_PRICE"
18
+ }
19
+ /** Campos base compartidos por todos los subtipos numéricos */
20
+ interface GNumberStep extends GBaseStep {
21
+ type: FormStepTypes.NUMBER;
22
+ numberType: NumberStepType;
23
+ label: string;
24
+ description: string | null;
25
+ required: boolean;
26
+ min?: number;
27
+ max?: number;
28
+ /** Cantidad de decimales permitidos (0 = entero). Default: 2 */
29
+ decimals?: number;
30
+ /** Sufijo de unidad estático que se muestra junto al valor (solo visual, no afecta el número guardado). */
31
+ suffix?: string;
32
+ /**
33
+ * Mostrar u ocultar los botones +/− de incremento/decremento.
34
+ * Default: true
35
+ */
36
+ spinner?: boolean;
37
+ /**
38
+ * Tamaño de cada incremento/decremento al usar los botones o las flechas del teclado.
39
+ * Útil para monedas (0.01), cantidades grandes (100) o porcentajes (5).
40
+ * Default: 1
41
+ */
42
+ step?: number;
43
+ /** Texto de placeholder del campo numérico. */
44
+ placeholder?: string;
45
+ size: 1 | 2 | 3 | 4;
46
+ }
47
+ export interface IntegerStep extends GNumberStep {
48
+ numberType: NumberStepType.INTEGER;
49
+ /** Siempre 0 para enteros, pero puede dejarse undefined */
50
+ decimals?: 0;
51
+ defaultValue?: number;
52
+ }
53
+ export interface DecimalStep extends GNumberStep {
54
+ numberType: NumberStepType.DECIMAL;
55
+ defaultValue?: number;
56
+ }
57
+ export interface PercentageStep extends GNumberStep {
58
+ numberType: NumberStepType.PERCENTAGE;
59
+ defaultValue?: number;
60
+ }
61
+ export interface MoneyStep extends GNumberStep {
62
+ numberType: NumberStepType.MONEY;
63
+ /** Moneda fija (ej: "COP", "USD", "EUR") */
64
+ currency?: string;
65
+ allowCurrencyChange?: boolean;
66
+ availableCurrencies?: string[];
67
+ defaultValue?: MoneyValue | null;
68
+ }
69
+ export interface MeasureStep extends GNumberStep {
70
+ numberType: NumberStepType.MEASURE;
71
+ /** Unidad fija (ej: "kg", "m", "hrs") */
72
+ unit?: string;
73
+ allowUnitChange?: boolean;
74
+ availableUnits?: string[];
75
+ defaultValue?: MeasureValue | null;
76
+ }
77
+ export interface UnitPriceStep extends GNumberStep {
78
+ numberType: NumberStepType.UNIT_PRICE;
79
+ /** Moneda del precio (ej: "USD") */
80
+ currency?: string;
81
+ /** Unidad base del precio (ej: "hrs", "km", "mes") */
82
+ unit?: string;
83
+ allowCurrencyChange?: boolean;
84
+ allowUnitChange?: boolean;
85
+ availableCurrencies?: string[];
86
+ availableUnits?: string[];
87
+ defaultValue?: UnitPriceValue | null;
88
+ }
89
+ /** Unión discriminada del paso NUMBER — narrowing por numberType */
90
+ export type NumberStep = IntegerStep | DecimalStep | PercentageStep | MoneyStep | MeasureStep | UnitPriceStep;
91
+ export type IntegerValue = number;
92
+ export type DecimalValue = number;
93
+ export type PercentageValue = number;
94
+ export interface MoneyValue {
95
+ value: number;
96
+ currency: string;
97
+ }
98
+ export interface MeasureValue {
99
+ value: number;
100
+ unit: string;
101
+ }
102
+ export interface UnitPriceValue {
103
+ value: number;
104
+ currency: string;
105
+ unit: string;
106
+ }
107
+ export type NumberStepValue = number | MoneyValue | MeasureValue | UnitPriceValue;
108
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * NumericFormSteps types
3
+ * Cubre el paso relacionado con números y sus múltiples subtipos.
4
+ */
5
+ // ===========================================================================
6
+ // NUMBER
7
+ // ===========================================================================
8
+ /** Subtipo del paso numérico — discriminante secundario */
9
+ export var NumberStepType;
10
+ (function (NumberStepType) {
11
+ NumberStepType["INTEGER"] = "INTEGER";
12
+ NumberStepType["DECIMAL"] = "DECIMAL";
13
+ NumberStepType["PERCENTAGE"] = "PERCENTAGE";
14
+ /** Monto de dinero en una divisa (ej: 1500 COP). */
15
+ NumberStepType["MONEY"] = "MONEY";
16
+ /** Magnitud con unidad de medida (ej: 5 kg). */
17
+ NumberStepType["MEASURE"] = "MEASURE";
18
+ /** Precio por unidad: divisa sobre unidad (ej: 20 USD / hora). */
19
+ NumberStepType["UNIT_PRICE"] = "UNIT_PRICE";
20
+ })(NumberStepType || (NumberStepType = {}));
@@ -0,0 +1,51 @@
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
+ import { GSmartSelect } from './GenericFormSteps';
11
+ export declare enum PredefinedOptionType {
12
+ /** ISO 3166-1 — lista de países */
13
+ COUNTRY = "COUNTRY",
14
+ /**
15
+ * Departamento / provincia / estado.
16
+ * Requiere parentStepId apuntando a un step COUNTRY.
17
+ */
18
+ STATE = "STATE",
19
+ /**
20
+ * Ciudad / municipio.
21
+ * Requiere parentStepId apuntando a un step STATE (o COUNTRY si no hay STATE).
22
+ */
23
+ CITY = "CITY",
24
+ /** ISO 4217 — monedas (USD, COP, EUR, etc.) */
25
+ CURRENCY = "CURRENCY",
26
+ /** BCP 47 — idiomas (es, en, pt, etc.) */
27
+ LANGUAGE = "LANGUAGE",
28
+ /** Tipos de canal de comunicación (WhatsApp, Email, Teléfono) */
29
+ COMMUNICATION_CHANNEL_TYPE = "COMMUNICATION_CHANNEL_TYPE",
30
+ /** Tipos de documento de identidad por país (CC, NIT, Pasaporte, etc.) */
31
+ DOCUMENT_TYPE = "DOCUMENT_TYPE",
32
+ /** Días de la semana */
33
+ DAY_OF_WEEK = "DAY_OF_WEEK",
34
+ /** Meses del año */
35
+ MONTH = "MONTH"
36
+ }
37
+ export interface PredefinedSelectorStep extends GSmartSelect {
38
+ type: 'PREDEFINED_SELECTOR';
39
+ predefinedType: PredefinedOptionType;
40
+ /**
41
+ * Solo para STATE y CITY: id del step padre que filtra las opciones.
42
+ * - COUNTRY step → filtra estados del país seleccionado
43
+ * - STATE step → filtra ciudades del estado seleccionado
44
+ *
45
+ * Si no se especifica, se listan todas las opciones sin filtrar.
46
+ */
47
+ parentStepId?: string;
48
+ maxSize?: number;
49
+ defaultValue?: string;
50
+ }
51
+ export type PredefinedSelectorValue = string;
@@ -0,0 +1,39 @@
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 = {}));
@@ -0,0 +1,135 @@
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>;
@@ -0,0 +1,49 @@
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
+ }
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,32 @@
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;
@@ -0,0 +1,17 @@
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;
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,32 @@
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;
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,3 @@
1
+ import { LocationStepProps } from '../LocationStep';
2
+ declare function MaterialLocationStep({ step, editable }: LocationStepProps): JSX.Element;
3
+ export default MaterialLocationStep;
@@ -0,0 +1,54 @@
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;
@@ -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;