carconnect-gatherleads-ui-lib 2.2.4 → 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.
|
@@ -279,6 +279,8 @@ export declare interface FormConfig {
|
|
|
279
279
|
size?: 'default' | 'sm' | 'lg' | 'xl' | 'icon';
|
|
280
280
|
/** Clases CSS adicionales */
|
|
281
281
|
className?: string;
|
|
282
|
+
/** Deshabilita el botón */
|
|
283
|
+
disabled?: boolean;
|
|
282
284
|
/**Permite esconder el boton */
|
|
283
285
|
showButton?: boolean;
|
|
284
286
|
/** Icono izquierdo */
|
|
@@ -695,8 +697,10 @@ export declare interface GatherInputFieldConfig extends BaseFieldConfig {
|
|
|
695
697
|
maxLength?: number;
|
|
696
698
|
/** Expresión regular para validar el formato del valor */
|
|
697
699
|
pattern?: string;
|
|
700
|
+
/** Funcion para validar el formato del valor */
|
|
701
|
+
validateFn?: (value: string) => boolean | string;
|
|
698
702
|
/** Mensaje que se muestra cuando el patrón no es válido */
|
|
699
|
-
|
|
703
|
+
errorMessage?: string;
|
|
700
704
|
/** Valor numérico mínimo permitido (para inputs number) */
|
|
701
705
|
min?: number;
|
|
702
706
|
/** Valor numérico máximo permitido (para inputs number) */
|
|
@@ -1817,7 +1821,7 @@ export declare interface SelectInputOption {
|
|
|
1817
1821
|
value: string;
|
|
1818
1822
|
/** Patrón de expresión regular para validar el input asociado */
|
|
1819
1823
|
validationPattern?: RegExp;
|
|
1820
|
-
validateFn?: (value: string) => boolean;
|
|
1824
|
+
validateFn?: (value: string) => boolean | string;
|
|
1821
1825
|
/** Mensaje de error personalizado cuando la validación falla */
|
|
1822
1826
|
errorMessage?: string;
|
|
1823
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)
|
|
@@ -19987,7 +20006,7 @@ const _T = ({
|
|
|
19987
20006
|
{
|
|
19988
20007
|
type: "button",
|
|
19989
20008
|
onClick: v,
|
|
19990
|
-
disabled: p || s ||
|
|
20009
|
+
disabled: p || s || e.actionButton.disabled,
|
|
19991
20010
|
variant: e.actionButton.variant || "gather-outline",
|
|
19992
20011
|
size: e.actionButton.size || "default",
|
|
19993
20012
|
leftIcon: e.actionButton.leftIcon,
|
|
@@ -20008,7 +20027,7 @@ const _T = ({
|
|
|
20008
20027
|
leftIcon: e.submitButton?.leftIcon,
|
|
20009
20028
|
rightIcon: e.submitButton?.rightIcon,
|
|
20010
20029
|
className: te("min-w-52", e.submitButton?.className),
|
|
20011
|
-
children: e.submitButton?.text || "Enviar"
|
|
20030
|
+
children: e.submitButton?.text || e.submitButton?.children || "Enviar"
|
|
20012
20031
|
}
|
|
20013
20032
|
)
|
|
20014
20033
|
] })
|