carconnect-gatherleads-ui-lib 2.2.5 → 2.3.0
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.
|
@@ -697,8 +697,10 @@ export declare interface GatherInputFieldConfig extends BaseFieldConfig {
|
|
|
697
697
|
maxLength?: number;
|
|
698
698
|
/** Expresión regular para validar el formato del valor */
|
|
699
699
|
pattern?: string;
|
|
700
|
+
/** Funcion para validar el formato del valor */
|
|
701
|
+
validateFn?: (value: string) => boolean | string;
|
|
700
702
|
/** Mensaje que se muestra cuando el patrón no es válido */
|
|
701
|
-
|
|
703
|
+
errorMessage?: string;
|
|
702
704
|
/** Valor numérico mínimo permitido (para inputs number) */
|
|
703
705
|
min?: number;
|
|
704
706
|
/** Valor numérico máximo permitido (para inputs number) */
|
|
@@ -1819,7 +1821,7 @@ export declare interface SelectInputOption {
|
|
|
1819
1821
|
value: string;
|
|
1820
1822
|
/** Patrón de expresión regular para validar el input asociado */
|
|
1821
1823
|
validationPattern?: RegExp;
|
|
1822
|
-
validateFn?: (value: string) => boolean;
|
|
1824
|
+
validateFn?: (value: string) => boolean | string;
|
|
1823
1825
|
/** Mensaje de error personalizado cuando la validación falla */
|
|
1824
1826
|
errorMessage?: string;
|
|
1825
1827
|
/** Texto placeholder específico para esta opción */
|
|
@@ -2793,16 +2793,22 @@ const Ph = (e) => {
|
|
|
2793
2793
|
message: `${e.label} no puede tener más de ${r.maxLength} caracteres`
|
|
2794
2794
|
}), r.pattern && (t.pattern = {
|
|
2795
2795
|
value: new RegExp(r.pattern),
|
|
2796
|
-
message: r.
|
|
2796
|
+
message: r.errorMessage || `${e.label} no tiene el formato correcto`
|
|
2797
|
+
}), r.validateFn && (t.validate = (o) => {
|
|
2798
|
+
const a = r.validateFn?.(o);
|
|
2799
|
+
return typeof a == "string" ? a : a === !1 ? r.errorMessage || `El campo ${e.label} no es válido` : !0;
|
|
2797
2800
|
});
|
|
2798
2801
|
break;
|
|
2799
2802
|
}
|
|
2800
2803
|
case "email": {
|
|
2801
2804
|
const r = e;
|
|
2802
|
-
t.pattern = {
|
|
2803
|
-
value: new RegExp(r.pattern
|
|
2804
|
-
message: r.
|
|
2805
|
-
}
|
|
2805
|
+
r.pattern && (t.pattern = {
|
|
2806
|
+
value: new RegExp(r.pattern),
|
|
2807
|
+
message: r.errorMessage || "Ingresa un email válido"
|
|
2808
|
+
}), r.validateFn && (t.validate = (o) => {
|
|
2809
|
+
const a = r.validateFn?.(o);
|
|
2810
|
+
return typeof a == "string" ? a : a === !1 ? r.errorMessage || `El campo ${e.label} no es válido` : !0;
|
|
2811
|
+
});
|
|
2806
2812
|
break;
|
|
2807
2813
|
}
|
|
2808
2814
|
case "number": {
|
|
@@ -2810,7 +2816,16 @@ const Ph = (e) => {
|
|
|
2810
2816
|
t.validate = (o) => {
|
|
2811
2817
|
if (o === "" || o === null || o === void 0) return !0;
|
|
2812
2818
|
const a = Number(o);
|
|
2813
|
-
|
|
2819
|
+
if (isNaN(a)) return "Debe ser un número válido";
|
|
2820
|
+
if (r.min !== void 0 && a < r.min)
|
|
2821
|
+
return `Debe ser mayor o igual a ${r.min}`;
|
|
2822
|
+
if (r.max !== void 0 && a > r.max)
|
|
2823
|
+
return `Debe ser menor o igual a ${r.max}`;
|
|
2824
|
+
if (r.validateFn) {
|
|
2825
|
+
const s = r.validateFn?.(o);
|
|
2826
|
+
return typeof s == "string" ? s : s === !1 ? r.errorMessage || `El campo ${e.label} no es válido` : !0;
|
|
2827
|
+
}
|
|
2828
|
+
return !0;
|
|
2814
2829
|
};
|
|
2815
2830
|
break;
|
|
2816
2831
|
}
|
|
@@ -3482,7 +3497,7 @@ function bg({
|
|
|
3482
3497
|
);
|
|
3483
3498
|
}
|
|
3484
3499
|
const vg = wt(
|
|
3485
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:
|
|
3500
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 ",
|
|
3486
3501
|
{
|
|
3487
3502
|
variants: {
|
|
3488
3503
|
variant: {
|
|
@@ -3524,7 +3539,10 @@ const vg = wt(
|
|
|
3524
3539
|
}, d) => /* @__PURE__ */ S(
|
|
3525
3540
|
bg,
|
|
3526
3541
|
{
|
|
3527
|
-
className: te(
|
|
3542
|
+
className: te(
|
|
3543
|
+
vg({ variant: t, size: r }),
|
|
3544
|
+
e
|
|
3545
|
+
),
|
|
3528
3546
|
ref: d,
|
|
3529
3547
|
disabled: l || a,
|
|
3530
3548
|
asChild: o,
|
|
@@ -9094,7 +9112,6 @@ const b0 = {
|
|
|
9094
9112
|
const W = Array.isArray(N) ? N : [];
|
|
9095
9113
|
d?.(W);
|
|
9096
9114
|
} else {
|
|
9097
|
-
console.log({ newValue: N });
|
|
9098
9115
|
const W = N ? [N] : [];
|
|
9099
9116
|
d?.(W.length > 0 ? W : null);
|
|
9100
9117
|
}
|
|
@@ -19622,7 +19639,6 @@ const _T = ({
|
|
|
19622
19639
|
clearErrors: a
|
|
19623
19640
|
}) => {
|
|
19624
19641
|
const s = (n) => {
|
|
19625
|
-
console.log({ error: r });
|
|
19626
19642
|
const u = {
|
|
19627
19643
|
placeholder: e.placeholder,
|
|
19628
19644
|
disabled: e.disabled,
|
|
@@ -19692,8 +19708,11 @@ const _T = ({
|
|
|
19692
19708
|
(y) => y.value === g
|
|
19693
19709
|
);
|
|
19694
19710
|
if (v?.validateFn) {
|
|
19695
|
-
|
|
19711
|
+
const y = v.validateFn(m);
|
|
19712
|
+
if (y === !1)
|
|
19696
19713
|
return v.errorMessage || `${c.label || c.name} no es válido para ${v.label}`;
|
|
19714
|
+
if (typeof y == "string")
|
|
19715
|
+
return y;
|
|
19697
19716
|
} else if (v?.validationPattern && !v.validationPattern.test(m))
|
|
19698
19717
|
return v.errorMessage || `${c.label || c.name} no es válido para ${v.label}`;
|
|
19699
19718
|
if (v?.maxLength && m.length > v.maxLength)
|