@agrotools1/at-components 2.0.28 → 2.0.30
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/button-new/ButtonNew.vue.d.ts +42 -0
- package/dist/button-new/ButtonNew.vue.d.ts.map +1 -0
- package/dist/button-new/ButtonNew.vue.js +131 -0
- package/dist/button-new/ButtonNew.vue2.js +4 -0
- package/dist/button-new/index.d.ts +3 -0
- package/dist/button-new/index.d.ts.map +1 -0
- package/dist/button-new/index.js +9 -0
- package/dist/button-new/variants.d.ts +66 -0
- package/dist/button-new/variants.d.ts.map +1 -0
- package/dist/button-new/variants.js +74 -0
- package/dist/changelog/versions/components/index.d.ts.map +1 -1
- package/dist/changelog/versions/components/v2.0.29.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.29.d.ts.map +1 -0
- package/dist/changelog/versions/components/v2.0.30.d.ts +4 -0
- package/dist/changelog/versions/components/v2.0.30.d.ts.map +1 -0
- package/dist/date-picker/DatePicker.vue.d.ts +5 -0
- package/dist/date-picker/DatePicker.vue.d.ts.map +1 -1
- package/dist/date-picker/DatePicker.vue.js +29 -27
- package/dist/document-input/DocumentAutoComplete.vue.d.ts +80 -0
- package/dist/document-input/DocumentAutoComplete.vue.d.ts.map +1 -0
- package/dist/document-input/DocumentAutoComplete.vue.js +372 -0
- package/dist/document-input/DocumentAutoComplete.vue2.js +4 -0
- 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 +76 -70
- package/dist/document-input/index.d.ts +2 -0
- package/dist/document-input/index.d.ts.map +1 -1
- package/dist/document-input/index.js +9 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +428 -417
- package/dist/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 +13 -0
- package/dist/packages/at-icons/dist/AtCheckSolidIcon/AtCheckSolidIcon.vue.js +46 -0
- package/dist/packages/at-icons/dist/AtCheckSolidIcon/index.js +5 -0
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as te, useId as ae, ref as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { defineComponent as te, useId as ae, ref as k, computed as A, watch as le, createElementBlock as v, openBlock as f, normalizeClass as x, unref as p, createBlock as b, createCommentVNode as m, createElementVNode as E, withCtx as re, createTextVNode as ne, toDisplayString as j, createVNode as R, mergeProps as ce } from "vue";
|
|
2
|
+
import { cn as C } from "../lib/utils.js";
|
|
3
3
|
import { AtCheckCircleRegularIcon as oe } 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 T, isValidCnpj as _, applyCnpjMask as N, applyCpfMask as P } from "./utils.js";
|
|
9
|
+
const de = { key: 0 }, fe = { class: "relative flex items-center" }, me = {
|
|
10
10
|
key: 0,
|
|
11
|
-
class: "absolute right-2.5 flex items-center justify-center
|
|
11
|
+
class: "absolute right-2.5 flex items-center justify-center"
|
|
12
12
|
}, be = /* @__PURE__ */ te({
|
|
13
13
|
inheritAttrs: !1,
|
|
14
14
|
__name: "DocumentInput",
|
|
@@ -31,9 +31,11 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
31
31
|
class: {},
|
|
32
32
|
inputClass: {}
|
|
33
33
|
},
|
|
34
|
-
emits: ["update:modelValue", "change", "blur", "focus", "validate"],
|
|
34
|
+
emits: ["update:modelValue", "change", "blur", "focus", "validate", "clear"],
|
|
35
35
|
setup($, { expose: L, emit: D }) {
|
|
36
|
-
const e = $,
|
|
36
|
+
const e = $, s = D, h = e.id || ae(), w = `error-${h}`, V = `desc-${h}`, n = k(e.modelValue || ""), g = k(!1), B = A(
|
|
37
|
+
() => e.documentType === "cnpj" || e.documentType === "cpf" || e.documentType === "cpf-cnpj"
|
|
38
|
+
), F = A(() => {
|
|
37
39
|
switch (e.documentType) {
|
|
38
40
|
case "cnpj":
|
|
39
41
|
return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
|
|
@@ -44,13 +46,13 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
44
46
|
default:
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
|
-
}), d = A(() => !!e.error && !g.value), M = { cnpj: 18, cpf: 14 },
|
|
49
|
+
}), d = A(() => !!e.error && !g.value), M = { cnpj: 18, cpf: 14 }, Z = A(() => {
|
|
48
50
|
if (!e.success || d.value || !n.value) return !1;
|
|
49
51
|
switch (e.documentType) {
|
|
50
52
|
case "cnpj":
|
|
51
|
-
return n.value.length === M.cnpj &&
|
|
53
|
+
return n.value.length === M.cnpj && _(n.value);
|
|
52
54
|
case "cpf":
|
|
53
|
-
return n.value.length === M.cpf &&
|
|
55
|
+
return n.value.length === M.cpf && T(n.value);
|
|
54
56
|
case "cpf-cnpj":
|
|
55
57
|
return I(n.value);
|
|
56
58
|
default:
|
|
@@ -61,17 +63,17 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
61
63
|
return t.replace(/[^A-Z0-9]/gi, "");
|
|
62
64
|
}
|
|
63
65
|
function I(t) {
|
|
64
|
-
const a = t.replace(/[^0-9]/g, "");
|
|
65
|
-
return a.length === 11 ?
|
|
66
|
+
const a = t.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
|
|
67
|
+
return a.length === 11 ? T(a) : a.length === 14 ? _(a) : !1;
|
|
66
68
|
}
|
|
67
69
|
function q(t, a) {
|
|
68
70
|
if (!a) return t;
|
|
69
|
-
let
|
|
70
|
-
if (!
|
|
71
|
-
let o = "",
|
|
72
|
-
for (let
|
|
73
|
-
const c = a[
|
|
74
|
-
c === "9" ? /[0-9]/.test(
|
|
71
|
+
let r = t.replace(/[^0-9A-Za-z]/g, "");
|
|
72
|
+
if (!r) return "";
|
|
73
|
+
let o = "", l = 0;
|
|
74
|
+
for (let i = 0; i < a.length && l < r.length; i++) {
|
|
75
|
+
const c = a[i], u = r[l];
|
|
76
|
+
c === "9" ? /[0-9]/.test(u) ? (o += u, l++) : (l++, i--) : c === "A" ? /[A-Za-z]/.test(u) ? (o += e.toUpperCase ? u.toUpperCase() : u, l++) : (l++, i--) : c === "X" ? /[0-9A-Za-z]/.test(u) ? (o += e.toUpperCase ? u.toUpperCase() : u, l++) : (l++, i--) : o += c;
|
|
75
77
|
}
|
|
76
78
|
return o;
|
|
77
79
|
}
|
|
@@ -82,11 +84,15 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
82
84
|
function S(t) {
|
|
83
85
|
switch (e.documentType) {
|
|
84
86
|
case "cnpj":
|
|
85
|
-
return
|
|
87
|
+
return N(t, e.allowAlpha);
|
|
86
88
|
case "cpf":
|
|
87
|
-
return
|
|
88
|
-
case "cpf-cnpj":
|
|
89
|
-
|
|
89
|
+
return P(t);
|
|
90
|
+
case "cpf-cnpj": {
|
|
91
|
+
const a = t.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "").slice(0, 14);
|
|
92
|
+
if (!a) return "";
|
|
93
|
+
const r = /[A-Z]/i.test(a);
|
|
94
|
+
return e.allowAlpha && r || a.length > 11 ? N(a, e.allowAlpha) : P(a);
|
|
95
|
+
}
|
|
90
96
|
default:
|
|
91
97
|
return G(t);
|
|
92
98
|
}
|
|
@@ -96,24 +102,24 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
96
102
|
if (B.value)
|
|
97
103
|
return X(t);
|
|
98
104
|
if (e.documentType === "generic" || e.documentType === "cpf-cnpj")
|
|
99
|
-
return e.customMask && e.documentType === "generic" ? t.replace(/[^0-9A-Za-z]/g, "") : t.replace(/[^0-9]/g, "");
|
|
105
|
+
return e.customMask && e.documentType === "generic" || e.documentType === "cpf-cnpj" && e.allowAlpha ? t.replace(/[^0-9A-Za-z]/g, "") : t.replace(/[^0-9]/g, "");
|
|
100
106
|
}
|
|
101
107
|
return t;
|
|
102
108
|
}
|
|
103
109
|
function O(t) {
|
|
104
110
|
const a = H(t);
|
|
105
|
-
|
|
111
|
+
s("update:modelValue", a), s("change", a);
|
|
106
112
|
}
|
|
107
113
|
function z(t) {
|
|
108
114
|
switch (e.documentType) {
|
|
109
115
|
case "cnpj":
|
|
110
|
-
|
|
116
|
+
s("validate", _(t));
|
|
111
117
|
break;
|
|
112
118
|
case "cpf":
|
|
113
|
-
|
|
119
|
+
s("validate", T(t));
|
|
114
120
|
break;
|
|
115
121
|
case "cpf-cnpj":
|
|
116
|
-
|
|
122
|
+
s("validate", I(t));
|
|
117
123
|
break;
|
|
118
124
|
}
|
|
119
125
|
}
|
|
@@ -126,71 +132,66 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
126
132
|
a !== n.value && (n.value = a);
|
|
127
133
|
}
|
|
128
134
|
);
|
|
129
|
-
function J(t, a,
|
|
130
|
-
const
|
|
131
|
-
let c = 0,
|
|
132
|
-
if (
|
|
133
|
-
for (let y = 0; y <
|
|
135
|
+
function J(t, a, r, o) {
|
|
136
|
+
const l = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, i = (a.slice(0, o).match(l) || []).length;
|
|
137
|
+
let c = 0, u = 0;
|
|
138
|
+
if (i > 0) {
|
|
139
|
+
for (let y = 0; y < r.length && (/[A-Z0-9]/i.test(r[y]) && u++, c = y + 1, !(u >= i)); y++)
|
|
134
140
|
;
|
|
135
|
-
for (; c <
|
|
141
|
+
for (; c < r.length && !/[A-Z0-9]/i.test(r[c]); )
|
|
136
142
|
c++;
|
|
137
143
|
}
|
|
138
|
-
t.value !==
|
|
144
|
+
t.value !== r && (t.value = r, t.setSelectionRange(c, c));
|
|
139
145
|
}
|
|
140
|
-
function K(t, a,
|
|
141
|
-
const
|
|
142
|
-
t.value !==
|
|
146
|
+
function K(t, a, r, o) {
|
|
147
|
+
const l = e.allowAlpha ? /[A-Za-z0-9]/g : /[0-9]/g, i = (a.slice(0, o).match(l) || []).length, c = Math.min(i, r.length);
|
|
148
|
+
t.value !== r && (t.value = r, t.setSelectionRange(c, c));
|
|
143
149
|
}
|
|
144
150
|
const Q = (t) => {
|
|
145
151
|
g.value = !1;
|
|
146
|
-
const a = t.target,
|
|
147
|
-
B.value ? J(a,
|
|
152
|
+
const a = t.target, r = a.value, o = a.selectionStart || 0, l = S(r);
|
|
153
|
+
B.value ? J(a, r, l, o) : e.documentType === "cpf-cnpj" ? K(a, r, l, o) : a.value !== l && (a.value = l), n.value !== l && (n.value = l, O(l), z(l));
|
|
148
154
|
}, W = (t) => {
|
|
149
|
-
|
|
155
|
+
s("focus", t);
|
|
150
156
|
}, Y = (t) => {
|
|
151
|
-
|
|
152
|
-
const a = n.value.replace(/[^0-9]/g, "");
|
|
153
|
-
let l = n.value;
|
|
154
|
-
a.length === 11 ? l = N(a) : a.length === 14 && (l = P(a)), l !== n.value && (n.value = l);
|
|
155
|
-
}
|
|
156
|
-
u("blur", t), z(n.value);
|
|
157
|
+
s("blur", t), z(n.value);
|
|
157
158
|
}, ee = () => {
|
|
158
|
-
n.value = "", g.value = !0,
|
|
159
|
-
},
|
|
159
|
+
n.value = "", g.value = !0, s("update:modelValue", ""), s("change", ""), s("clear"), e.documentType !== "generic" && s("validate", !1);
|
|
160
|
+
}, U = k(null);
|
|
160
161
|
return L({
|
|
161
|
-
input:
|
|
162
|
+
input: U,
|
|
162
163
|
localValue: n
|
|
163
164
|
}), (t, a) => (f(), v("div", {
|
|
164
|
-
class:
|
|
165
|
+
class: x(p(C)("space-y-1.5 w-full", e.class))
|
|
165
166
|
}, [
|
|
166
|
-
e.label ? (f(),
|
|
167
|
+
e.label ? (f(), b(p(pe), {
|
|
167
168
|
key: 0,
|
|
168
169
|
for: p(h),
|
|
169
|
-
class:
|
|
170
|
-
p(
|
|
170
|
+
class: x(
|
|
171
|
+
p(C)(
|
|
171
172
|
"text-[#101011] font-normal text-[10px] leading-[10px]",
|
|
172
173
|
d.value ? "text-[var(--alert-red-dark,#831511)]" : ""
|
|
173
174
|
)
|
|
174
175
|
)
|
|
175
176
|
}, {
|
|
176
177
|
default: re(() => [
|
|
177
|
-
ne(
|
|
178
|
-
e.required ? (f(), v("span",
|
|
178
|
+
ne(j(e.label), 1),
|
|
179
|
+
e.required ? (f(), v("span", de, " (Obrigatório)")) : m("", !0)
|
|
179
180
|
]),
|
|
180
181
|
_: 1
|
|
181
182
|
}, 8, ["for", "class"])) : m("", !0),
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
E("div", fe, [
|
|
184
|
+
R(p(ue), ce({
|
|
184
185
|
id: p(h),
|
|
185
186
|
ref_key: "inputRef",
|
|
186
|
-
ref:
|
|
187
|
+
ref: U,
|
|
187
188
|
"model-value": n.value,
|
|
188
189
|
disabled: e.disabled,
|
|
189
|
-
class: p(
|
|
190
|
+
class: p(C)("pr-10", d.value || e.success ? "border-[#3E2E46]" : "", e.inputClass),
|
|
190
191
|
placeholder: e.placeholder ?? F.value,
|
|
191
192
|
"aria-invalid": d.value,
|
|
192
193
|
"aria-describedby": [
|
|
193
|
-
e.error && !g.value ?
|
|
194
|
+
e.error && !g.value ? w : void 0,
|
|
194
195
|
e.description ? V : void 0
|
|
195
196
|
].filter(Boolean).join(" ") || void 0
|
|
196
197
|
}, t.$attrs, {
|
|
@@ -198,34 +199,39 @@ const fe = { key: 0 }, de = { class: "relative flex items-center" }, me = {
|
|
|
198
199
|
onBlur: Y,
|
|
199
200
|
onFocus: W
|
|
200
201
|
}), null, 16, ["id", "model-value", "disabled", "class", "placeholder", "aria-invalid", "aria-describedby"]),
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
Z.value || d.value || n.value ? (f(), v("div", me, [
|
|
203
|
+
Z.value ? (f(), b(p(oe), {
|
|
203
204
|
key: 0,
|
|
204
205
|
size: "20",
|
|
205
|
-
class: "text-[#4b715c]"
|
|
206
|
-
})) : d.value ? (f(),
|
|
206
|
+
class: "text-[#4b715c] pointer-events-none"
|
|
207
|
+
})) : d.value || n.value ? (f(), b(p(se), {
|
|
207
208
|
key: 1,
|
|
208
209
|
size: "20",
|
|
209
|
-
class:
|
|
210
|
+
class: x(
|
|
211
|
+
p(C)(
|
|
212
|
+
"cursor-pointer transition-opacity hover:opacity-80",
|
|
213
|
+
d.value ? "text-[var(--alert-red-dark,#831511)]" : "text-gray-400"
|
|
214
|
+
)
|
|
215
|
+
),
|
|
210
216
|
onClick: ee
|
|
211
|
-
})) : m("", !0)
|
|
217
|
+
}, null, 8, ["class"])) : m("", !0)
|
|
212
218
|
])) : m("", !0)
|
|
213
219
|
]),
|
|
214
220
|
e.description && !e.error ? (f(), v("div", {
|
|
215
221
|
key: 1,
|
|
216
222
|
id: V,
|
|
217
223
|
class: "text-gray-500 text-[11px] leading-tight"
|
|
218
|
-
},
|
|
224
|
+
}, j(e.description), 1)) : m("", !0),
|
|
219
225
|
typeof e.error == "string" && d.value ? (f(), v("div", {
|
|
220
226
|
key: 2,
|
|
221
|
-
id:
|
|
227
|
+
id: w,
|
|
222
228
|
class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
|
|
223
229
|
}, [
|
|
224
|
-
|
|
230
|
+
R(p(ie), {
|
|
225
231
|
size: "14",
|
|
226
232
|
class: "text-[var(--alert-red-dark,#831511)] shrink-0"
|
|
227
233
|
}),
|
|
228
|
-
|
|
234
|
+
E("span", null, j(e.error), 1)
|
|
229
235
|
])) : m("", !0)
|
|
230
236
|
], 2));
|
|
231
237
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { default as AgtDocumentInput } from './DocumentInput.vue';
|
|
2
|
+
export { default as AgtDocumentAutoComplete } from './DocumentAutoComplete.vue';
|
|
3
|
+
export { AgtComboboxItem as AgtDocumentAutoCompleteItem, AgtComboboxItemIndicator as AgtDocumentAutoCompleteItemIndicator } from '../combobox';
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EACL,eAAe,IAAI,2BAA2B,EAC9C,wBAAwB,IAAI,oCAAoC,EACjE,MAAM,aAAa,CAAA"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as m } from "./DocumentInput.vue.js";
|
|
2
|
+
import { default as r } from "./DocumentAutoComplete.vue.js";
|
|
3
|
+
import { default as p } from "../combobox/ComboboxItem.vue.js";
|
|
4
|
+
import { default as l } from "../combobox/ComboboxItemIndicator.vue.js";
|
|
5
|
+
import "reka-ui";
|
|
2
6
|
export {
|
|
3
|
-
|
|
7
|
+
r as AgtDocumentAutoComplete,
|
|
8
|
+
p as AgtDocumentAutoCompleteItem,
|
|
9
|
+
l as AgtDocumentAutoCompleteItemIndicator,
|
|
10
|
+
m as AgtDocumentInput
|
|
4
11
|
};
|