@agrotools1/at-components 2.0.30 → 2.0.31
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.
- package/dist/changelog/versions/components/index.d.ts.map +1 -1
- package/dist/changelog/versions/components/v2.0.31.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.31.d.ts.map +1 -0
- package/dist/document-input/DocumentAutoComplete.vue.d.ts +1 -1
- package/dist/document-input/DocumentAutoComplete.vue.d.ts.map +1 -1
- package/dist/document-input/DocumentAutoComplete.vue.js +107 -109
- package/dist/document-input/DocumentInput.vue.d.ts +2 -0
- package/dist/document-input/DocumentInput.vue.d.ts.map +1 -1
- package/dist/document-input/DocumentInput.vue.js +98 -87
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAgB3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.0.31.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WAYd,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -64,8 +64,8 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
64
64
|
withIcon: boolean;
|
|
65
65
|
allowAlpha: boolean;
|
|
66
66
|
documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic";
|
|
67
|
-
unmask: boolean;
|
|
68
67
|
withInternalValidation: boolean;
|
|
68
|
+
unmask: boolean;
|
|
69
69
|
optionId: string;
|
|
70
70
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
71
71
|
wrapperRef: HTMLDivElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"AA0kBA,UAAU,KAAK;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAyXD,iBAAS,cAAc;WAiWT,OAAO,IAA6B;;uBAhBtB,GAAG;sBACJ,GAAG;yBACA,GAAG;uBACL,GAAG;yBACD,GAAG;;;YACJ,GAAG;;;;;;EAgB/B;AA4CD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;cA9xBR,OAAO;iBAMJ,OAAO;aAJX,OAAO;WADT,OAAO,GAAG,MAAM;cAUb,OAAO;gBARL,OAAO;kBAPL,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS;4BAgB7B,OAAO;YALvB,OAAO;cAUL,MAAM;;;kBAuxBjB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as ie, useId as ue, ref as y, watch as ce, computed as U, createElementBlock as h, openBlock as n, normalizeClass as S, unref as r, createBlock as A, createCommentVNode as v, createVNode as f, withCtx as m, createTextVNode as z, toDisplayString as k, mergeProps as pe, createElementVNode as _, renderSlot as w, withModifiers as q, withDirectives as de, Fragment as fe, renderList as me, vShow as ge, nextTick as E } from "vue";
|
|
2
2
|
import { cn as F } from "../lib/utils.js";
|
|
3
|
-
import { AtCheckCircleRegularIcon as
|
|
4
|
-
import { AtCheckSolidIcon as
|
|
5
|
-
import { AtCircleXMarkRegularIcon as
|
|
6
|
-
import { AtCircleXMarkSolidIcon as
|
|
7
|
-
import { reactiveOmit as
|
|
8
|
-
import { useForwardPropsEmits as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { isValidCpf as
|
|
20
|
-
import
|
|
21
|
-
const
|
|
3
|
+
import { AtCheckCircleRegularIcon as he } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
|
|
4
|
+
import { AtCheckSolidIcon as ve } from "../packages/at-icons/dist/AtCheckSolidIcon/index.js";
|
|
5
|
+
import { AtCircleXMarkRegularIcon as ye } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
|
|
6
|
+
import { AtCircleXMarkSolidIcon as R } from "../packages/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
|
|
7
|
+
import { reactiveOmit as Ae } from "@vueuse/core";
|
|
8
|
+
import { useForwardPropsEmits as ke } from "reka-ui";
|
|
9
|
+
import we from "../combobox/Combobox.vue.js";
|
|
10
|
+
import xe from "../combobox/ComboboxAnchor.vue.js";
|
|
11
|
+
import Te from "../combobox/ComboboxEmpty.vue.js";
|
|
12
|
+
import Ce from "../combobox/ComboboxGroup.vue.js";
|
|
13
|
+
import Ve from "../combobox/ComboboxInput.vue.js";
|
|
14
|
+
import be from "../combobox/ComboboxItem.vue.js";
|
|
15
|
+
import _e from "../combobox/ComboboxItemIndicator.vue.js";
|
|
16
|
+
import Ie from "../combobox/ComboboxList.vue.js";
|
|
17
|
+
import $e from "../combobox/ComboboxViewport.vue.js";
|
|
18
|
+
import Me from "../label/Label.vue.js";
|
|
19
|
+
import { isValidCpf as x, isValidCnpj as T, applyCpfMask as O, applyCnpjMask as X } from "./utils.js";
|
|
20
|
+
import je from "../node_modules/.pnpm/lucide-vue-next@0.542.0_vue@3.5.19_typescript@5.8.3_/node_modules/lucide-vue-next/dist/esm/icons/loader-circle.js";
|
|
21
|
+
const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "py-6 flex items-center justify-center text-sm text-gray-500"
|
|
24
|
-
},
|
|
24
|
+
}, Ze = { class: "flex items-center gap-2" }, at = /* @__PURE__ */ ie({
|
|
25
25
|
__name: "DocumentAutoComplete",
|
|
26
26
|
props: {
|
|
27
27
|
id: {},
|
|
@@ -50,8 +50,8 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
50
50
|
optionId: { default: "identifier" }
|
|
51
51
|
},
|
|
52
52
|
emits: ["update:modelValue", "select", "validate", "blur", "focus", "clear"],
|
|
53
|
-
setup(
|
|
54
|
-
const e =
|
|
53
|
+
setup(H, { emit: J }) {
|
|
54
|
+
const e = H, s = J, C = e.id || ue(), G = `error-${C}`, K = `desc-${C}`, Q = Ae(
|
|
55
55
|
e,
|
|
56
56
|
"modelValue",
|
|
57
57
|
"documentType",
|
|
@@ -75,25 +75,25 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
75
75
|
"loadingText",
|
|
76
76
|
"optionId",
|
|
77
77
|
"modelValue"
|
|
78
|
-
),
|
|
79
|
-
function
|
|
78
|
+
), W = ke(Q, s), i = y(""), V = y(!1), I = y(!1), L = y(!1), $ = y(null), M = y(e.modelValue);
|
|
79
|
+
function Y(t, a) {
|
|
80
80
|
if (!a) return t;
|
|
81
81
|
const l = t.replace(/[^0-9A-Za-z]/g, "");
|
|
82
82
|
if (!l) return "";
|
|
83
|
-
let c = "",
|
|
84
|
-
for (let p = 0; p < a.length &&
|
|
85
|
-
const u = a[p], d = l[
|
|
86
|
-
u === "9" ? /[0-9]/.test(d) ? (c += d,
|
|
83
|
+
let c = "", o = 0;
|
|
84
|
+
for (let p = 0; p < a.length && o < l.length; p++) {
|
|
85
|
+
const u = a[p], d = l[o];
|
|
86
|
+
u === "9" ? /[0-9]/.test(d) ? (c += d, o++) : (o++, p--) : u === "A" ? /[A-Za-z]/.test(d) ? (c += e.toUpperCase ? d.toUpperCase() : d, o++) : (o++, p--) : u === "X" ? /[0-9A-Za-z]/.test(d) ? (c += e.toUpperCase ? d.toUpperCase() : d, o++) : (o++, p--) : (c += u, d === u && o++);
|
|
87
87
|
}
|
|
88
88
|
return c;
|
|
89
89
|
}
|
|
90
90
|
function j(t) {
|
|
91
91
|
if (e.customMask && e.documentType === "generic")
|
|
92
|
-
return
|
|
92
|
+
return Y(t, e.customMask);
|
|
93
93
|
const a = /[A-Z]/i.test(t);
|
|
94
|
-
return e.documentType === "cpf" ?
|
|
94
|
+
return e.documentType === "cpf" ? O(t) : e.documentType === "cnpj" ? X(t, e.allowAlpha) : e.documentType === "cpf-cnpj" ? e.allowAlpha && a || t.length > 11 ? X(t, e.allowAlpha) : O(t) : t;
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const P = (t) => {
|
|
97
97
|
if (!t) return i.value || "";
|
|
98
98
|
if (typeof t == "string") {
|
|
99
99
|
const c = t.replace(
|
|
@@ -108,19 +108,19 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
108
108
|
);
|
|
109
109
|
return j(l);
|
|
110
110
|
};
|
|
111
|
-
|
|
111
|
+
ce(
|
|
112
112
|
() => e.modelValue,
|
|
113
113
|
(t) => {
|
|
114
114
|
if (M.value = t, t == null || t === "") {
|
|
115
115
|
i.value !== "" && (i.value = ""), M.value = void 0;
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
const a =
|
|
118
|
+
const a = P(t);
|
|
119
119
|
i.value !== a && (i.value = a);
|
|
120
120
|
},
|
|
121
121
|
{ immediate: !0 }
|
|
122
122
|
);
|
|
123
|
-
const
|
|
123
|
+
const ee = U(() => e.maxLength ? e.maxLength : e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18), te = U(() => {
|
|
124
124
|
switch (e.documentType) {
|
|
125
125
|
case "cnpj":
|
|
126
126
|
return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
|
|
@@ -138,10 +138,8 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
138
138
|
if (!t || I.value) return !1;
|
|
139
139
|
const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
140
140
|
if (!l) return !1;
|
|
141
|
-
if (e.documentType === "cpf"
|
|
142
|
-
|
|
143
|
-
if (e.documentType === "cpf-cnpj")
|
|
144
|
-
return l.length === 11 ? !y(l) : l.length === 14 ? !A(l) : l.length > 0 && l.length !== 11 && l.length !== 14;
|
|
141
|
+
if (l.length === 11 && !x(l) || l.length === 14 && !T(l) || L.value && (e.documentType === "cpf" && l.length !== 11 || e.documentType === "cnpj" && l.length !== 14 || e.documentType === "cpf-cnpj" && l.length !== 11 && l.length !== 14))
|
|
142
|
+
return !0;
|
|
145
143
|
}
|
|
146
144
|
return !1;
|
|
147
145
|
}), B = U(() => {
|
|
@@ -151,114 +149,114 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
151
149
|
const t = e.modelValue;
|
|
152
150
|
if (!t) return !1;
|
|
153
151
|
const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
|
|
154
|
-
if (e.documentType === "cpf") return
|
|
155
|
-
if (e.documentType === "cnpj") return
|
|
152
|
+
if (e.documentType === "cpf") return x(l);
|
|
153
|
+
if (e.documentType === "cnpj") return T(l);
|
|
156
154
|
if (e.documentType === "cpf-cnpj")
|
|
157
|
-
return l.length === 11 ?
|
|
155
|
+
return l.length === 11 ? x(l) : T(l);
|
|
158
156
|
}
|
|
159
157
|
return !1;
|
|
160
158
|
});
|
|
161
|
-
function
|
|
159
|
+
function D(t) {
|
|
162
160
|
let a = !1;
|
|
163
|
-
e.documentType === "cpf" ? a =
|
|
161
|
+
e.documentType === "cpf" ? a = x(t) : e.documentType === "cnpj" ? a = T(t) : e.documentType === "cpf-cnpj" && (a = t.length === 11 ? x(t) : T(t)), s("validate", a);
|
|
164
162
|
}
|
|
165
|
-
function
|
|
163
|
+
function le(t) {
|
|
166
164
|
const a = t.target;
|
|
167
165
|
let l = a.value;
|
|
168
166
|
const c = a.selectionStart || 0;
|
|
169
167
|
I.value = !1, e.toUpperCase && (l = l.toUpperCase());
|
|
170
|
-
let
|
|
168
|
+
let o = l.replace(
|
|
171
169
|
e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
|
|
172
170
|
""
|
|
173
171
|
), p = e.maxLength;
|
|
174
|
-
p || (e.customMask && e.documentType === "generic" ? p = e.customMask.length : p = e.documentType === "cpf" ? 11 : 14),
|
|
175
|
-
const u = j(
|
|
176
|
-
s("update:modelValue",
|
|
172
|
+
p || (e.customMask && e.documentType === "generic" ? p = e.customMask.length : p = e.documentType === "cpf" ? 11 : 14), o = o.slice(0, p);
|
|
173
|
+
const u = j(o), d = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, ne = (l.slice(0, c).match(d) || []).length, se = (e.unmask ? o : u) || void 0;
|
|
174
|
+
s("update:modelValue", se), D(o), i.value = u, E(() => {
|
|
177
175
|
a.value = u;
|
|
178
|
-
let Z = 0,
|
|
179
|
-
for (let
|
|
176
|
+
let Z = 0, N = 0;
|
|
177
|
+
for (let b = 0; b < u.length && ((e.documentType === "generic" && e.customMask || e.allowAlpha ? /[A-Z0-9]/i.test(u[b]) : /[0-9]/.test(u[b])) && N++, Z = b + 1, !(N >= ne)); b++)
|
|
180
178
|
;
|
|
181
179
|
a.setSelectionRange(Z, Z);
|
|
182
180
|
});
|
|
183
181
|
}
|
|
184
|
-
function
|
|
182
|
+
function ae(t) {
|
|
185
183
|
i.value = "", M.value = null, s("update:modelValue", null), E(() => {
|
|
186
184
|
if (!$.value) return;
|
|
187
|
-
const a = $.value.querySelector(`[id="${
|
|
185
|
+
const a = $.value.querySelector(`[id="${C}"]`) || $.value.querySelector("input"), l = (a == null ? void 0 : a.tagName) === "INPUT" ? a : a == null ? void 0 : a.querySelector("input");
|
|
188
186
|
l && (l.value = "", l.dispatchEvent(new Event("input", { bubbles: !0 }))), E(() => {
|
|
189
|
-
|
|
187
|
+
V.value = !1;
|
|
190
188
|
});
|
|
191
|
-
}), I.value = !0, s("validate", !1), s("clear"),
|
|
189
|
+
}), I.value = !0, s("validate", !1), s("clear"), V.value = !1;
|
|
192
190
|
}
|
|
193
|
-
function
|
|
191
|
+
function re(t) {
|
|
194
192
|
if (!t) {
|
|
195
193
|
i.value = "", I.value = !0, s("update:modelValue", null);
|
|
196
194
|
return;
|
|
197
195
|
}
|
|
198
196
|
s("update:modelValue", t), s("select", t);
|
|
199
197
|
const l = (t.identifier || t.value || t.text || "").replace(/[^A-Z0-9]/gi, "");
|
|
200
|
-
i.value = j(l),
|
|
198
|
+
i.value = j(l), D(l), V.value = !1;
|
|
201
199
|
}
|
|
202
200
|
function oe(t) {
|
|
203
|
-
s("blur", t);
|
|
201
|
+
L.value = !0, s("blur", t);
|
|
204
202
|
const a = i.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
|
|
205
203
|
let l = !1;
|
|
206
|
-
a.length === 11 ? l =
|
|
204
|
+
a.length === 11 ? l = x(a) : a.length === 14 && (l = T(a)), l && s("update:modelValue", e.toUpperCase ? a.toUpperCase() : a);
|
|
207
205
|
}
|
|
208
206
|
return (t, a) => (n(), h("div", {
|
|
209
|
-
class: S(
|
|
207
|
+
class: S(r(F)("space-y-1.5 w-full", e.class)),
|
|
210
208
|
ref_key: "wrapperRef",
|
|
211
209
|
ref: $
|
|
212
210
|
}, [
|
|
213
|
-
e.label ? (n(),
|
|
211
|
+
e.label ? (n(), A(r(Me), {
|
|
214
212
|
key: 0,
|
|
215
|
-
for:
|
|
213
|
+
for: r(C),
|
|
216
214
|
class: S(
|
|
217
|
-
|
|
215
|
+
r(F)(
|
|
218
216
|
"text-[#101011] font-normal text-[10px] leading-[10px]",
|
|
219
217
|
g.value ? "text-[var(--alert-red-dark,#831511)]" : ""
|
|
220
218
|
)
|
|
221
219
|
)
|
|
222
220
|
}, {
|
|
223
221
|
default: m(() => [
|
|
224
|
-
z(
|
|
225
|
-
e.required && !e.label.includes("(Obrigatório)") ? (n(), h("span",
|
|
222
|
+
z(k(e.label), 1),
|
|
223
|
+
e.required && !e.label.includes("(Obrigatório)") ? (n(), h("span", Be, " (Obrigatório)")) : v("", !0)
|
|
226
224
|
]),
|
|
227
225
|
_: 1
|
|
228
226
|
}, 8, ["for", "class"])) : v("", !0),
|
|
229
|
-
f(
|
|
227
|
+
f(r(we), pe(r(W), {
|
|
230
228
|
"model-value": M.value,
|
|
231
229
|
searchTerm: i.value,
|
|
232
230
|
"onUpdate:searchTerm": a[3] || (a[3] = (l) => i.value = l),
|
|
233
|
-
open:
|
|
234
|
-
"onUpdate:open": a[4] || (a[4] = (l) =>
|
|
231
|
+
open: V.value,
|
|
232
|
+
"onUpdate:open": a[4] || (a[4] = (l) => V.value = l),
|
|
235
233
|
"reset-search-term-on-select": !1,
|
|
236
234
|
"filter-function": () => !0,
|
|
237
|
-
"onUpdate:modelValue":
|
|
235
|
+
"onUpdate:modelValue": re
|
|
238
236
|
}), {
|
|
239
237
|
default: m(() => [
|
|
240
|
-
_("div",
|
|
241
|
-
f(
|
|
238
|
+
_("div", Ue, [
|
|
239
|
+
f(r(xe), { class: "w-full h-full" }, {
|
|
242
240
|
default: m(() => [
|
|
243
|
-
|
|
244
|
-
f(
|
|
245
|
-
id:
|
|
246
|
-
"display-value":
|
|
247
|
-
placeholder: e.placeholder ||
|
|
241
|
+
w(t.$slots, "input", {}, () => [
|
|
242
|
+
f(r(Ve), {
|
|
243
|
+
id: r(C),
|
|
244
|
+
"display-value": P,
|
|
245
|
+
placeholder: e.placeholder || te.value,
|
|
248
246
|
"with-icon": e.withIcon,
|
|
249
247
|
"with-clear-button": !1,
|
|
250
248
|
disabled: e.disabled,
|
|
251
249
|
error: g.value,
|
|
252
250
|
success: B.value,
|
|
253
251
|
class: S(
|
|
254
|
-
|
|
252
|
+
r(F)(
|
|
255
253
|
"pr-20",
|
|
256
254
|
g.value || B.value ? "border-[#3E2E46]" : "",
|
|
257
255
|
e.inputClass
|
|
258
256
|
)
|
|
259
257
|
),
|
|
260
|
-
maxlength:
|
|
261
|
-
onInput:
|
|
258
|
+
maxlength: ee.value,
|
|
259
|
+
onInput: le,
|
|
262
260
|
onBlur: oe,
|
|
263
261
|
onFocus: a[0] || (a[0] = (l) => s("focus", l))
|
|
264
262
|
}, null, 8, ["id", "placeholder", "with-icon", "disabled", "error", "success", "class", "maxlength"])
|
|
@@ -272,60 +270,60 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
272
270
|
g.value || e.modelValue && !B.value ? (n(), h("div", {
|
|
273
271
|
key: 0,
|
|
274
272
|
class: "flex items-center justify-center w-full h-full cursor-pointer",
|
|
275
|
-
onMousedown: a[1] || (a[1] =
|
|
276
|
-
onClick: a[2] || (a[2] =
|
|
273
|
+
onMousedown: a[1] || (a[1] = q((l) => !e.disabled && ae(), ["stop", "prevent"])),
|
|
274
|
+
onClick: a[2] || (a[2] = q(() => {
|
|
277
275
|
}, ["stop", "prevent"]))
|
|
278
276
|
}, [
|
|
279
|
-
g.value ? (n(),
|
|
277
|
+
g.value ? (n(), A(r(R), {
|
|
280
278
|
key: 0,
|
|
281
279
|
size: "20",
|
|
282
280
|
class: "text-[var(--alert-red-dark,#831511)] transition-opacity hover:opacity-80"
|
|
283
|
-
})) : (n(),
|
|
281
|
+
})) : (n(), A(r(ye), {
|
|
284
282
|
key: 1,
|
|
285
283
|
size: "20",
|
|
286
284
|
class: "text-gray-400 transition-colors hover:text-[#831511]"
|
|
287
285
|
}))
|
|
288
|
-
], 32)) : B.value ? (n(),
|
|
286
|
+
], 32)) : B.value ? (n(), A(r(he), {
|
|
289
287
|
key: 1,
|
|
290
288
|
size: "20",
|
|
291
289
|
class: "text-[#4b715c] pointer-events-none"
|
|
292
290
|
})) : v("", !0)
|
|
293
291
|
], 2)
|
|
294
292
|
]),
|
|
295
|
-
|
|
296
|
-
f(
|
|
293
|
+
w(t.$slots, "list", {}, () => [
|
|
294
|
+
f(r(Ie), null, {
|
|
297
295
|
default: m(() => [
|
|
298
|
-
e.loading && (e.loadingText || t.$slots.loading) ? (n(), h("div",
|
|
299
|
-
|
|
300
|
-
_("div",
|
|
301
|
-
f(
|
|
302
|
-
_("span", null,
|
|
296
|
+
e.loading && (e.loadingText || t.$slots.loading) ? (n(), h("div", Se, [
|
|
297
|
+
w(t.$slots, "loading", {}, () => [
|
|
298
|
+
_("div", Ze, [
|
|
299
|
+
f(r(je), { class: "size-4 animate-spin" }),
|
|
300
|
+
_("span", null, k(e.loadingText), 1)
|
|
303
301
|
])
|
|
304
302
|
])
|
|
305
|
-
])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (n(),
|
|
303
|
+
])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (n(), A(r(Te), { key: 1 }, {
|
|
306
304
|
default: m(() => [
|
|
307
|
-
|
|
308
|
-
z(
|
|
305
|
+
w(t.$slots, "empty", {}, () => [
|
|
306
|
+
z(k(e.notFoundText), 1)
|
|
309
307
|
])
|
|
310
308
|
]),
|
|
311
309
|
_: 3
|
|
312
310
|
})) : v("", !0),
|
|
313
|
-
|
|
311
|
+
de(f(r($e), null, {
|
|
314
312
|
default: m(() => [
|
|
315
|
-
f(
|
|
313
|
+
f(r(Ce), null, {
|
|
316
314
|
default: m(() => [
|
|
317
|
-
|
|
318
|
-
e.options && e.options.length ? (n(!0), h(
|
|
315
|
+
w(t.$slots, "default", {}, () => [
|
|
316
|
+
e.options && e.options.length ? (n(!0), h(fe, { key: 0 }, me(e.options, (l, c) => (n(), A(r(be), {
|
|
319
317
|
key: l[e.optionId] || c,
|
|
320
318
|
value: l
|
|
321
319
|
}, {
|
|
322
320
|
default: m(() => [
|
|
323
|
-
|
|
324
|
-
z(
|
|
321
|
+
w(t.$slots, "option", { item: l }, () => [
|
|
322
|
+
z(k(l.text || l.label || l), 1)
|
|
325
323
|
]),
|
|
326
|
-
f(
|
|
324
|
+
f(r(_e), { class: "ml-auto" }, {
|
|
327
325
|
default: m(() => [
|
|
328
|
-
f(
|
|
326
|
+
f(r(ve), { size: "16" })
|
|
329
327
|
]),
|
|
330
328
|
_: 1
|
|
331
329
|
})
|
|
@@ -339,7 +337,7 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
339
337
|
]),
|
|
340
338
|
_: 3
|
|
341
339
|
}, 512), [
|
|
342
|
-
[
|
|
340
|
+
[ge, !e.loading]
|
|
343
341
|
])
|
|
344
342
|
]),
|
|
345
343
|
_: 3
|
|
@@ -350,23 +348,23 @@ const je = { key: 0 }, Be = { class: "relative flex items-center" }, Ue = {
|
|
|
350
348
|
}, 16, ["model-value", "searchTerm", "open"]),
|
|
351
349
|
e.description && !g.value ? (n(), h("div", {
|
|
352
350
|
key: 1,
|
|
353
|
-
id:
|
|
351
|
+
id: K,
|
|
354
352
|
class: "text-gray-500 text-[11px] leading-tight"
|
|
355
|
-
},
|
|
353
|
+
}, k(e.description), 1)) : v("", !0),
|
|
356
354
|
typeof e.error == "string" && g.value ? (n(), h("div", {
|
|
357
355
|
key: 2,
|
|
358
|
-
id:
|
|
356
|
+
id: G,
|
|
359
357
|
class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
|
|
360
358
|
}, [
|
|
361
|
-
f(
|
|
359
|
+
f(r(R), {
|
|
362
360
|
size: "14",
|
|
363
361
|
class: "text-[var(--alert-red-dark,#831511)] shrink-0"
|
|
364
362
|
}),
|
|
365
|
-
_("span", null,
|
|
363
|
+
_("span", null, k(e.error), 1)
|
|
366
364
|
])) : v("", !0)
|
|
367
365
|
], 2));
|
|
368
366
|
}
|
|
369
367
|
});
|
|
370
368
|
export {
|
|
371
|
-
|
|
369
|
+
at as default
|
|
372
370
|
};
|
|
@@ -10,6 +10,7 @@ export interface DocumentInputProps {
|
|
|
10
10
|
error?: boolean | string;
|
|
11
11
|
success?: boolean;
|
|
12
12
|
allowAlpha?: boolean;
|
|
13
|
+
withInternalValidation?: boolean;
|
|
13
14
|
placeholder?: string;
|
|
14
15
|
maxLength?: number;
|
|
15
16
|
toUpperCase?: boolean;
|
|
@@ -42,6 +43,7 @@ declare const _default: import('vue').DefineComponent<DocumentInputProps, {
|
|
|
42
43
|
error: boolean | string;
|
|
43
44
|
allowAlpha: boolean;
|
|
44
45
|
documentType: DocumentType;
|
|
46
|
+
withInternalValidation: boolean;
|
|
45
47
|
unmask: boolean;
|
|
46
48
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
47
49
|
inputRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('../input/Input.vue').InputProps> & Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentInput.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DocumentInput.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentInput.vue"],"names":[],"mappings":"AA2dA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAA;AAElE,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB;;;;;;;;;;;;;;;;;;;cAZY,OAAO;iBAOJ,OAAO;aALX,OAAO;WADT,OAAO,GAAG,MAAM;gBAEX,OAAO;kBAPL,YAAY;4BAQF,OAAO;YAIvB,OAAO;;;;;;;;;;;;;;;;;;;;;AAulBlB,wBAUG"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as te, useId as ae, ref as k, computed as
|
|
2
|
-
import { cn as
|
|
3
|
-
import { AtCheckCircleRegularIcon as
|
|
1
|
+
import { defineComponent as te, useId as ae, ref as k, computed as x, watch as le, createElementBlock as h, openBlock as d, normalizeClass as b, unref as p, createBlock as j, createCommentVNode as m, createElementVNode as U, withCtx as re, createTextVNode as ne, toDisplayString as V, createVNode as R, mergeProps as oe } from "vue";
|
|
2
|
+
import { cn as T } from "../lib/utils.js";
|
|
3
|
+
import { AtCheckCircleRegularIcon as ce } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
|
|
4
4
|
import { AtCircleXMarkRegularIcon as se } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
|
|
5
5
|
import { AtCircleXMarkSolidIcon as ie } from "../packages/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
|
|
6
6
|
import ue from "../input/Input.vue.js";
|
|
7
7
|
import pe from "../label/Label.vue.js";
|
|
8
|
-
import { isValidCpf as
|
|
9
|
-
const
|
|
8
|
+
import { isValidCpf as v, isValidCnpj as g, applyCnpjMask as E, applyCpfMask as P } from "./utils.js";
|
|
9
|
+
const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "absolute right-2.5 flex items-center justify-center"
|
|
12
|
-
},
|
|
12
|
+
}, Te = /* @__PURE__ */ te({
|
|
13
13
|
inheritAttrs: !1,
|
|
14
14
|
__name: "DocumentInput",
|
|
15
15
|
props: {
|
|
@@ -23,6 +23,7 @@ const de = { key: 0 }, fe = { class: "relative flex items-center" }, me = {
|
|
|
23
23
|
error: { type: [Boolean, String], default: !1 },
|
|
24
24
|
success: { type: Boolean, default: !1 },
|
|
25
25
|
allowAlpha: { type: Boolean, default: !1 },
|
|
26
|
+
withInternalValidation: { type: Boolean, default: !1 },
|
|
26
27
|
placeholder: {},
|
|
27
28
|
maxLength: {},
|
|
28
29
|
toUpperCase: { type: Boolean, default: !1 },
|
|
@@ -32,10 +33,10 @@ const de = { key: 0 }, fe = { class: "relative flex items-center" }, me = {
|
|
|
32
33
|
inputClass: {}
|
|
33
34
|
},
|
|
34
35
|
emits: ["update:modelValue", "change", "blur", "focus", "validate", "clear"],
|
|
35
|
-
setup($, { expose:
|
|
36
|
-
const e = $, s = D,
|
|
36
|
+
setup($, { expose: N, emit: D }) {
|
|
37
|
+
const e = $, s = D, y = e.id || ae(), w = `error-${y}`, _ = `desc-${y}`, n = k(e.modelValue || ""), A = k(!1), B = k(!1), I = x(
|
|
37
38
|
() => e.documentType === "cnpj" || e.documentType === "cpf" || e.documentType === "cpf-cnpj"
|
|
38
|
-
), F =
|
|
39
|
+
), F = x(() => {
|
|
39
40
|
switch (e.documentType) {
|
|
40
41
|
case "cnpj":
|
|
41
42
|
return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
|
|
@@ -46,80 +47,90 @@ const de = { key: 0 }, fe = { class: "relative flex items-center" }, me = {
|
|
|
46
47
|
default:
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
}),
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
case "cpf-cnpj":
|
|
57
|
-
return I(n.value);
|
|
58
|
-
default:
|
|
50
|
+
}), f = x(() => {
|
|
51
|
+
if (e.error) return !0;
|
|
52
|
+
if (e.withInternalValidation) {
|
|
53
|
+
if (!n.value || A.value) return !1;
|
|
54
|
+
const t = n.value.replace(/[^A-Z0-9]/gi, "");
|
|
55
|
+
if (!t) return !1;
|
|
56
|
+
if (t.length === 11 && !v(t) || t.length === 14 && !g(t) || B.value && (e.documentType === "cpf" && t.length !== 11 || e.documentType === "cnpj" && t.length !== 14 || e.documentType === "cpf-cnpj" && t.length !== 11 && t.length !== 14))
|
|
59
57
|
return !0;
|
|
60
58
|
}
|
|
59
|
+
return !1;
|
|
60
|
+
}), M = x(() => {
|
|
61
|
+
if (f.value) return !1;
|
|
62
|
+
if (e.success) return !0;
|
|
63
|
+
if (e.withInternalValidation) {
|
|
64
|
+
if (!n.value) return !1;
|
|
65
|
+
const t = n.value.replace(/[^A-Z0-9]/gi, "");
|
|
66
|
+
if (e.documentType === "cpf") return v(t);
|
|
67
|
+
if (e.documentType === "cnpj") return g(t);
|
|
68
|
+
if (e.documentType === "cpf-cnpj")
|
|
69
|
+
return t.length === 11 ? v(t) : g(t);
|
|
70
|
+
}
|
|
71
|
+
return !1;
|
|
61
72
|
});
|
|
62
|
-
function
|
|
73
|
+
function L(t) {
|
|
63
74
|
return t.replace(/[^A-Z0-9]/gi, "");
|
|
64
75
|
}
|
|
65
|
-
function
|
|
76
|
+
function X(t) {
|
|
66
77
|
const a = t.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
|
|
67
|
-
return a.length === 11 ?
|
|
78
|
+
return a.length === 11 ? v(a) : a.length === 14 ? g(a) : !1;
|
|
68
79
|
}
|
|
69
80
|
function q(t, a) {
|
|
70
81
|
if (!a) return t;
|
|
71
82
|
let r = t.replace(/[^0-9A-Za-z]/g, "");
|
|
72
83
|
if (!r) return "";
|
|
73
|
-
let
|
|
84
|
+
let c = "", l = 0;
|
|
74
85
|
for (let i = 0; i < a.length && l < r.length; i++) {
|
|
75
|
-
const
|
|
76
|
-
|
|
86
|
+
const o = a[i], u = r[l];
|
|
87
|
+
o === "9" ? /[0-9]/.test(u) ? (c += u, l++) : (l++, i--) : o === "A" ? /[A-Za-z]/.test(u) ? (c += e.toUpperCase ? u.toUpperCase() : u, l++) : (l++, i--) : o === "X" ? /[0-9A-Za-z]/.test(u) ? (c += e.toUpperCase ? u.toUpperCase() : u, l++) : (l++, i--) : c += o;
|
|
77
88
|
}
|
|
78
|
-
return
|
|
89
|
+
return c;
|
|
79
90
|
}
|
|
80
|
-
function
|
|
91
|
+
function O(t) {
|
|
81
92
|
let a = t;
|
|
82
93
|
return e.customMask && e.documentType === "generic" ? a = q(a, e.customMask) : (e.toUpperCase && (a = a.toUpperCase()), e.maxLength !== void 0 && a.length > e.maxLength && (a = a.slice(0, e.maxLength))), a;
|
|
83
94
|
}
|
|
84
|
-
function
|
|
95
|
+
function Z(t) {
|
|
85
96
|
switch (e.documentType) {
|
|
86
97
|
case "cnpj":
|
|
87
|
-
return
|
|
98
|
+
return E(t, e.allowAlpha);
|
|
88
99
|
case "cpf":
|
|
89
100
|
return P(t);
|
|
90
101
|
case "cpf-cnpj": {
|
|
91
102
|
const a = t.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "").slice(0, 14);
|
|
92
103
|
if (!a) return "";
|
|
93
104
|
const r = /[A-Z]/i.test(a);
|
|
94
|
-
return e.allowAlpha && r || a.length > 11 ?
|
|
105
|
+
return e.allowAlpha && r || a.length > 11 ? E(a, e.allowAlpha) : P(a);
|
|
95
106
|
}
|
|
96
107
|
default:
|
|
97
|
-
return
|
|
108
|
+
return O(t);
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
|
-
function
|
|
111
|
+
function G(t) {
|
|
101
112
|
if (e.unmask) {
|
|
102
|
-
if (
|
|
103
|
-
return
|
|
113
|
+
if (I.value)
|
|
114
|
+
return L(t);
|
|
104
115
|
if (e.documentType === "generic" || e.documentType === "cpf-cnpj")
|
|
105
116
|
return e.customMask && e.documentType === "generic" || e.documentType === "cpf-cnpj" && e.allowAlpha ? t.replace(/[^0-9A-Za-z]/g, "") : t.replace(/[^0-9]/g, "");
|
|
106
117
|
}
|
|
107
118
|
return t;
|
|
108
119
|
}
|
|
109
|
-
function
|
|
110
|
-
const a =
|
|
120
|
+
function H(t) {
|
|
121
|
+
const a = G(t);
|
|
111
122
|
s("update:modelValue", a), s("change", a);
|
|
112
123
|
}
|
|
113
124
|
function z(t) {
|
|
114
125
|
switch (e.documentType) {
|
|
115
126
|
case "cnpj":
|
|
116
|
-
s("validate",
|
|
127
|
+
s("validate", g(t));
|
|
117
128
|
break;
|
|
118
129
|
case "cpf":
|
|
119
|
-
s("validate",
|
|
130
|
+
s("validate", v(t));
|
|
120
131
|
break;
|
|
121
132
|
case "cpf-cnpj":
|
|
122
|
-
s("validate",
|
|
133
|
+
s("validate", X(t));
|
|
123
134
|
break;
|
|
124
135
|
}
|
|
125
136
|
}
|
|
@@ -128,101 +139,101 @@ const de = { key: 0 }, fe = { class: "relative flex items-center" }, me = {
|
|
|
128
139
|
(t) => {
|
|
129
140
|
if (t === void 0 || e.unmask && (e.documentType === "generic" || e.documentType === "cpf-cnpj"))
|
|
130
141
|
return;
|
|
131
|
-
const a =
|
|
142
|
+
const a = Z(t);
|
|
132
143
|
a !== n.value && (n.value = a);
|
|
133
144
|
}
|
|
134
145
|
);
|
|
135
|
-
function J(t, a, r,
|
|
136
|
-
const l = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, i = (a.slice(0,
|
|
137
|
-
let
|
|
146
|
+
function J(t, a, r, c) {
|
|
147
|
+
const l = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, i = (a.slice(0, c).match(l) || []).length;
|
|
148
|
+
let o = 0, u = 0;
|
|
138
149
|
if (i > 0) {
|
|
139
|
-
for (let
|
|
150
|
+
for (let C = 0; C < r.length && (/[A-Z0-9]/i.test(r[C]) && u++, o = C + 1, !(u >= i)); C++)
|
|
140
151
|
;
|
|
141
|
-
for (;
|
|
142
|
-
|
|
152
|
+
for (; o < r.length && !/[A-Z0-9]/i.test(r[o]); )
|
|
153
|
+
o++;
|
|
143
154
|
}
|
|
144
|
-
t.value !== r && (t.value = r, t.setSelectionRange(
|
|
155
|
+
t.value !== r && (t.value = r, t.setSelectionRange(o, o));
|
|
145
156
|
}
|
|
146
|
-
function K(t, a, r,
|
|
147
|
-
const l = e.allowAlpha ? /[A-Za-z0-9]/g : /[0-9]/g, i = (a.slice(0,
|
|
148
|
-
t.value !== r && (t.value = r, t.setSelectionRange(
|
|
157
|
+
function K(t, a, r, c) {
|
|
158
|
+
const l = e.allowAlpha ? /[A-Za-z0-9]/g : /[0-9]/g, i = (a.slice(0, c).match(l) || []).length, o = Math.min(i, r.length);
|
|
159
|
+
t.value !== r && (t.value = r, t.setSelectionRange(o, o));
|
|
149
160
|
}
|
|
150
161
|
const Q = (t) => {
|
|
151
|
-
|
|
152
|
-
const a = t.target, r = a.value,
|
|
153
|
-
|
|
162
|
+
A.value = !1;
|
|
163
|
+
const a = t.target, r = a.value, c = a.selectionStart || 0, l = Z(r);
|
|
164
|
+
I.value ? J(a, r, l, c) : e.documentType === "cpf-cnpj" ? K(a, r, l, c) : a.value !== l && (a.value = l), n.value !== l && (n.value = l, H(l), z(l));
|
|
154
165
|
}, W = (t) => {
|
|
155
166
|
s("focus", t);
|
|
156
167
|
}, Y = (t) => {
|
|
157
|
-
s("blur", t), z(n.value);
|
|
168
|
+
B.value = !0, s("blur", t), z(n.value);
|
|
158
169
|
}, ee = () => {
|
|
159
|
-
n.value = "",
|
|
160
|
-
},
|
|
161
|
-
return
|
|
162
|
-
input:
|
|
170
|
+
n.value = "", A.value = !0, s("update:modelValue", ""), s("change", ""), s("clear"), e.documentType !== "generic" && s("validate", !1);
|
|
171
|
+
}, S = k(null);
|
|
172
|
+
return N({
|
|
173
|
+
input: S,
|
|
163
174
|
localValue: n
|
|
164
|
-
}), (t, a) => (
|
|
165
|
-
class:
|
|
175
|
+
}), (t, a) => (d(), h("div", {
|
|
176
|
+
class: b(p(T)("space-y-1.5 w-full", e.class))
|
|
166
177
|
}, [
|
|
167
|
-
e.label ? (
|
|
178
|
+
e.label ? (d(), j(p(pe), {
|
|
168
179
|
key: 0,
|
|
169
|
-
for: p(
|
|
170
|
-
class:
|
|
171
|
-
p(
|
|
180
|
+
for: p(y),
|
|
181
|
+
class: b(
|
|
182
|
+
p(T)(
|
|
172
183
|
"text-[#101011] font-normal text-[10px] leading-[10px]",
|
|
173
|
-
|
|
184
|
+
f.value ? "text-[var(--alert-red-dark,#831511)]" : ""
|
|
174
185
|
)
|
|
175
186
|
)
|
|
176
187
|
}, {
|
|
177
188
|
default: re(() => [
|
|
178
|
-
ne(
|
|
179
|
-
e.required ? (
|
|
189
|
+
ne(V(e.label), 1),
|
|
190
|
+
e.required ? (d(), h("span", fe, " (Obrigatório)")) : m("", !0)
|
|
180
191
|
]),
|
|
181
192
|
_: 1
|
|
182
193
|
}, 8, ["for", "class"])) : m("", !0),
|
|
183
|
-
|
|
184
|
-
R(p(ue),
|
|
185
|
-
id: p(
|
|
194
|
+
U("div", de, [
|
|
195
|
+
R(p(ue), oe({
|
|
196
|
+
id: p(y),
|
|
186
197
|
ref_key: "inputRef",
|
|
187
|
-
ref:
|
|
198
|
+
ref: S,
|
|
188
199
|
"model-value": n.value,
|
|
189
200
|
disabled: e.disabled,
|
|
190
|
-
class: p(
|
|
201
|
+
class: p(T)("pr-10", f.value || e.success ? "border-[#3E2E46]" : "", e.inputClass),
|
|
191
202
|
placeholder: e.placeholder ?? F.value,
|
|
192
|
-
"aria-invalid":
|
|
203
|
+
"aria-invalid": f.value,
|
|
193
204
|
"aria-describedby": [
|
|
194
|
-
e.error && !
|
|
195
|
-
e.description ?
|
|
205
|
+
e.error && !A.value ? w : void 0,
|
|
206
|
+
e.description ? _ : void 0
|
|
196
207
|
].filter(Boolean).join(" ") || void 0
|
|
197
208
|
}, t.$attrs, {
|
|
198
209
|
onInput: Q,
|
|
199
210
|
onBlur: Y,
|
|
200
211
|
onFocus: W
|
|
201
212
|
}), null, 16, ["id", "model-value", "disabled", "class", "placeholder", "aria-invalid", "aria-describedby"]),
|
|
202
|
-
|
|
203
|
-
|
|
213
|
+
M.value || f.value || n.value ? (d(), h("div", me, [
|
|
214
|
+
M.value ? (d(), j(p(ce), {
|
|
204
215
|
key: 0,
|
|
205
216
|
size: "20",
|
|
206
217
|
class: "text-[#4b715c] pointer-events-none"
|
|
207
|
-
})) :
|
|
218
|
+
})) : f.value || n.value ? (d(), j(p(se), {
|
|
208
219
|
key: 1,
|
|
209
220
|
size: "20",
|
|
210
|
-
class:
|
|
211
|
-
p(
|
|
221
|
+
class: b(
|
|
222
|
+
p(T)(
|
|
212
223
|
"cursor-pointer transition-opacity hover:opacity-80",
|
|
213
|
-
|
|
224
|
+
f.value ? "text-[var(--alert-red-dark,#831511)]" : "text-gray-400"
|
|
214
225
|
)
|
|
215
226
|
),
|
|
216
227
|
onClick: ee
|
|
217
228
|
}, null, 8, ["class"])) : m("", !0)
|
|
218
229
|
])) : m("", !0)
|
|
219
230
|
]),
|
|
220
|
-
e.description && !e.error ? (
|
|
231
|
+
e.description && !e.error ? (d(), h("div", {
|
|
221
232
|
key: 1,
|
|
222
|
-
id:
|
|
233
|
+
id: _,
|
|
223
234
|
class: "text-gray-500 text-[11px] leading-tight"
|
|
224
|
-
},
|
|
225
|
-
typeof e.error == "string" &&
|
|
235
|
+
}, V(e.description), 1)) : m("", !0),
|
|
236
|
+
(typeof e.error == "string" || e.withInternalValidation && f.value) && f.value ? (d(), h("div", {
|
|
226
237
|
key: 2,
|
|
227
238
|
id: w,
|
|
228
239
|
class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
|
|
@@ -231,11 +242,11 @@ const de = { key: 0 }, fe = { class: "relative flex items-center" }, me = {
|
|
|
231
242
|
size: "14",
|
|
232
243
|
class: "text-[var(--alert-red-dark,#831511)] shrink-0"
|
|
233
244
|
}),
|
|
234
|
-
|
|
245
|
+
U("span", null, V(typeof e.error == "string" ? e.error : "Documento inválido"), 1)
|
|
235
246
|
])) : m("", !0)
|
|
236
247
|
], 2));
|
|
237
248
|
}
|
|
238
249
|
});
|
|
239
250
|
export {
|
|
240
|
-
|
|
251
|
+
Te as default
|
|
241
252
|
};
|