@agrotools1/at-components 2.0.22 → 2.0.24

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAU3C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAW3C,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { VersionData } from '../../types';
2
+ declare const v2_0_22: VersionData;
3
+ export default v2_0_22;
4
+ //# sourceMappingURL=v2.0.22.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.0.22.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.22.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WAsBd,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -1,7 +1,8 @@
1
+ export type DocumentType = 'generic' | 'cnpj' | 'cpf' | 'cpf-cnpj';
1
2
  export interface DocumentInputProps {
2
3
  id?: string;
3
4
  modelValue?: string;
4
- documentType?: 'cnpj';
5
+ documentType?: DocumentType;
5
6
  label?: string;
6
7
  description?: string;
7
8
  required?: boolean;
@@ -10,11 +11,16 @@ export interface DocumentInputProps {
10
11
  success?: boolean;
11
12
  allowAlpha?: boolean;
12
13
  placeholder?: string;
14
+ maxLength?: number;
15
+ toUpperCase?: boolean;
16
+ unmask?: boolean;
17
+ customMask?: string;
13
18
  class?: any;
14
19
  inputClass?: any;
15
20
  }
16
21
  declare const _default: import('vue').DefineComponent<DocumentInputProps, {
17
22
  input: import('vue').Ref<any, any>;
23
+ localValue: import('vue').Ref<string, string>;
18
24
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
19
25
  "update:modelValue": (payload: string) => any;
20
26
  change: (payload: string) => any;
@@ -29,10 +35,12 @@ declare const _default: import('vue').DefineComponent<DocumentInputProps, {
29
35
  onValidate?: ((isValid: boolean) => any) | undefined;
30
36
  }>, {
31
37
  disabled: boolean;
38
+ toUpperCase: boolean;
32
39
  success: boolean;
33
40
  error: boolean | string;
34
- documentType: "cnpj";
35
41
  allowAlpha: boolean;
42
+ documentType: DocumentType;
43
+ unmask: boolean;
36
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
37
45
  inputRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('../input/Input.vue').InputProps> & Readonly<{
38
46
  "onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentInput.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentInput.vue"],"names":[],"mappings":"AAoPA,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,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,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB;;;;;;;;;;;;;;;;cAPY,OAAO;aAER,OAAO;WADT,OAAO,GAAG,MAAM;kBALT,MAAM;gBAOR,OAAO;;;;;;;;;;;;;;;;;;;;;AA8WtB,wBAUG"}
1
+ {"version":3,"file":"DocumentInput.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentInput.vue"],"names":[],"mappings":"AA0bA,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,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;;;;;;;;;;;;;;;;;cAXY,OAAO;iBAMJ,OAAO;aAJX,OAAO;WADT,OAAO,GAAG,MAAM;gBAEX,OAAO;kBAPL,YAAY;YAWlB,OAAO;;;;;;;;;;;;;;;;;;;;;AA0iBlB,wBAUG"}
@@ -1,21 +1,21 @@
1
- import { defineComponent as X, useId as H, ref as h, computed as g, watch as O, createElementBlock as u, openBlock as i, normalizeClass as j, unref as r, createBlock as y, createCommentVNode as d, createElementVNode as w, withCtx as G, createTextVNode as J, toDisplayString as A, createVNode as S, mergeProps as K } from "vue";
2
- import { cn as k } from "../lib/utils.js";
3
- import { AtCheckCircleRegularIcon as L } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
4
- import { AtCircleXMarkRegularIcon as Q } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
5
- import { AtCircleXMarkSolidIcon as U } from "../packages/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
6
- import W from "../input/Input.vue.js";
7
- import Y from "../label/Label.vue.js";
8
- import { isValidCnpj as x, applyCnpjMask as E } from "./utils.js";
9
- const ee = { key: 0 }, te = { class: "relative flex items-center" }, ae = {
1
+ import { defineComponent as te, useId as ae, ref as C, computed as A, watch as le, createElementBlock as v, openBlock as f, normalizeClass as E, unref as p, createBlock as k, createCommentVNode as m, createElementVNode as R, withCtx as re, createTextVNode as ne, toDisplayString as x, createVNode as U, mergeProps as ce } from "vue";
2
+ import { cn as b } from "../lib/utils.js";
3
+ import { AtCheckCircleRegularIcon as oe } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
4
+ import { AtCircleXMarkRegularIcon as se } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
5
+ import { AtCircleXMarkSolidIcon as ie } from "../packages/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
6
+ import ue from "../input/Input.vue.js";
7
+ import pe from "../label/Label.vue.js";
8
+ import { isValidCpf as j, isValidCnpj as T, applyCpfMask as N, applyCnpjMask 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 pointer-events-none"
12
- }, ue = /* @__PURE__ */ X({
12
+ }, be = /* @__PURE__ */ te({
13
13
  inheritAttrs: !1,
14
14
  __name: "DocumentInput",
15
15
  props: {
16
16
  id: {},
17
17
  modelValue: {},
18
- documentType: { default: "cnpj" },
18
+ documentType: { default: "generic" },
19
19
  label: {},
20
20
  description: {},
21
21
  required: { type: Boolean },
@@ -24,111 +24,212 @@ const ee = { key: 0 }, te = { class: "relative flex items-center" }, ae = {
24
24
  success: { type: Boolean, default: !1 },
25
25
  allowAlpha: { type: Boolean, default: !1 },
26
26
  placeholder: {},
27
+ maxLength: {},
28
+ toUpperCase: { type: Boolean, default: !1 },
29
+ unmask: { type: Boolean, default: !0 },
30
+ customMask: {},
27
31
  class: {},
28
32
  inputClass: {}
29
33
  },
30
34
  emits: ["update:modelValue", "change", "blur", "focus", "validate"],
31
- setup(R, { expose: T, emit: $ }) {
32
- const e = R, o = $, p = e.id || H(), b = `error-${p}`, _ = `desc-${p}`, l = h(e.modelValue || ""), f = h(!1), z = g(() => e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00"), n = g(() => !!e.error && !f.value), C = g(() => e.success && !n.value && l.value.length === 18 && x(l.value));
33
- O(
35
+ setup($, { expose: L, emit: D }) {
36
+ const e = $, u = D, h = e.id || ae(), _ = `error-${h}`, V = `desc-${h}`, n = C(e.modelValue || ""), g = C(!1), B = A(() => e.documentType === "cnpj" || e.documentType === "cpf"), F = A(() => {
37
+ switch (e.documentType) {
38
+ case "cnpj":
39
+ return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
40
+ case "cpf":
41
+ return "000.000.000-00";
42
+ case "cpf-cnpj":
43
+ return "CPF ou CNPJ";
44
+ default:
45
+ return;
46
+ }
47
+ }), d = A(() => !!e.error && !g.value), M = { cnpj: 18, cpf: 14 }, w = A(() => {
48
+ if (!e.success || d.value || !n.value) return !1;
49
+ switch (e.documentType) {
50
+ case "cnpj":
51
+ return n.value.length === M.cnpj && T(n.value);
52
+ case "cpf":
53
+ return n.value.length === M.cpf && j(n.value);
54
+ case "cpf-cnpj":
55
+ return I(n.value);
56
+ default:
57
+ return !0;
58
+ }
59
+ });
60
+ function X(t) {
61
+ return t.replace(/[^A-Z0-9]/gi, "");
62
+ }
63
+ function I(t) {
64
+ const a = t.replace(/[^0-9]/g, "");
65
+ return a.length === 11 ? j(a) : a.length === 14 ? T(a) : !1;
66
+ }
67
+ function q(t, a) {
68
+ if (!a) return t;
69
+ let l = t.replace(/[^0-9A-Za-z]/g, "");
70
+ if (!l) return "";
71
+ let o = "", r = 0;
72
+ for (let s = 0; s < a.length && r < l.length; s++) {
73
+ const c = a[s], i = l[r];
74
+ c === "9" ? /[0-9]/.test(i) ? (o += i, r++) : (r++, s--) : c === "A" ? /[A-Za-z]/.test(i) ? (o += e.toUpperCase ? i.toUpperCase() : i, r++) : (r++, s--) : c === "X" ? /[0-9A-Za-z]/.test(i) ? (o += e.toUpperCase ? i.toUpperCase() : i, r++) : (r++, s--) : o += c;
75
+ }
76
+ return o;
77
+ }
78
+ function G(t) {
79
+ let a = t;
80
+ 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;
81
+ }
82
+ function S(t) {
83
+ switch (e.documentType) {
84
+ case "cnpj":
85
+ return P(t, e.allowAlpha);
86
+ case "cpf":
87
+ return N(t);
88
+ case "cpf-cnpj":
89
+ return t.replace(/[^0-9]/g, "").slice(0, 14);
90
+ default:
91
+ return G(t);
92
+ }
93
+ }
94
+ function H(t) {
95
+ if (e.unmask) {
96
+ if (B.value)
97
+ return X(t);
98
+ 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, "");
100
+ }
101
+ return t;
102
+ }
103
+ function O(t) {
104
+ const a = H(t);
105
+ u("update:modelValue", a), u("change", a);
106
+ }
107
+ function z(t) {
108
+ switch (e.documentType) {
109
+ case "cnpj":
110
+ u("validate", T(t));
111
+ break;
112
+ case "cpf":
113
+ u("validate", j(t));
114
+ break;
115
+ case "cpf-cnpj":
116
+ u("validate", I(t));
117
+ break;
118
+ }
119
+ }
120
+ le(
34
121
  () => e.modelValue,
35
122
  (t) => {
36
- t !== void 0 && t !== l.value && (e.documentType === "cnpj" ? l.value = E(t, e.allowAlpha) : l.value = t);
123
+ if (t === void 0 || e.unmask && (e.documentType === "generic" || e.documentType === "cpf-cnpj"))
124
+ return;
125
+ const a = S(t);
126
+ a !== n.value && (n.value = a);
37
127
  }
38
128
  );
39
- const M = (t) => {
40
- f.value = !1;
41
- const s = t.target, v = s.value, Z = s.selectionStart || 0;
42
- let a = v;
43
- e.documentType === "cnpj" && (a = E(v, e.allowAlpha));
44
- const q = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, B = (v.slice(0, Z).match(q) || []).length;
45
- let c = 0, I = 0;
46
- if (B > 0) {
47
- for (let m = 0; m < a.length; m++) {
48
- const F = a[m];
49
- if (/[A-Z0-9]/.test(F) && I++, c = m + 1, I >= B) break;
50
- }
51
- for (; c < a.length && !/[A-Z0-9]/.test(a[c]); )
129
+ function J(t, a, l, o) {
130
+ const r = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, s = (a.slice(0, o).match(r) || []).length;
131
+ let c = 0, i = 0;
132
+ if (s > 0) {
133
+ for (let y = 0; y < l.length && (/[A-Z0-9]/i.test(l[y]) && i++, c = y + 1, !(i >= s)); y++)
134
+ ;
135
+ for (; c < l.length && !/[A-Z0-9]/i.test(l[c]); )
52
136
  c++;
53
137
  }
54
- s.value !== a && (s.value = a, s.setSelectionRange(c, c)), l.value !== a && (l.value = a, o("update:modelValue", a), o("change", a), e.documentType === "cnpj" && o("validate", x(a)));
55
- }, N = (t) => {
56
- o("focus", t);
57
- }, D = (t) => {
58
- if (o("blur", t), e.documentType === "cnpj") {
59
- const s = x(l.value);
60
- o("validate", s);
138
+ t.value !== l && (t.value = l, t.setSelectionRange(c, c));
139
+ }
140
+ function K(t, a, l, o) {
141
+ const r = e.allowAlpha ? /[A-Za-z0-9]/g : /[0-9]/g, s = (a.slice(0, o).match(r) || []).length, c = Math.min(s, l.length);
142
+ t.value !== l && (t.value = l, t.setSelectionRange(c, c));
143
+ }
144
+ const Q = (t) => {
145
+ g.value = !1;
146
+ const a = t.target, l = a.value, o = a.selectionStart || 0, r = S(l);
147
+ B.value ? J(a, l, r, o) : e.documentType === "cpf-cnpj" ? K(a, l, r, o) : a.value !== r && (a.value = r), n.value !== r && (n.value = r, O(r), z(r));
148
+ }, W = (t) => {
149
+ u("focus", t);
150
+ }, Y = (t) => {
151
+ if (e.documentType === "cpf-cnpj" && n.value) {
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);
61
155
  }
62
- }, P = () => {
63
- l.value = "", f.value = !0, o("update:modelValue", ""), o("change", ""), o("validate", !1);
64
- }, V = h(null);
65
- return T({
66
- input: V
67
- }), (t, s) => (i(), u("div", {
68
- class: j(r(k)("space-y-1.5 w-full", e.class))
156
+ u("blur", t), z(n.value);
157
+ }, ee = () => {
158
+ n.value = "", g.value = !0, u("update:modelValue", ""), u("change", ""), e.documentType !== "generic" && u("validate", !1);
159
+ }, Z = C(null);
160
+ return L({
161
+ input: Z,
162
+ localValue: n
163
+ }), (t, a) => (f(), v("div", {
164
+ class: E(p(b)("space-y-1.5 w-full", e.class))
69
165
  }, [
70
- e.label ? (i(), y(r(Y), {
166
+ e.label ? (f(), k(p(pe), {
71
167
  key: 0,
72
- for: r(p),
73
- class: j(
74
- r(k)(
168
+ for: p(h),
169
+ class: E(
170
+ p(b)(
75
171
  "text-[#101011] font-normal text-[10px] leading-[10px]",
76
- n.value ? "text-[var(--alert-red-dark,#831511)]" : ""
172
+ d.value ? "text-[var(--alert-red-dark,#831511)]" : ""
77
173
  )
78
174
  )
79
175
  }, {
80
- default: G(() => [
81
- J(A(e.label), 1),
82
- e.required ? (i(), u("span", ee, " (Obrigatório)")) : d("", !0)
176
+ default: re(() => [
177
+ ne(x(e.label), 1),
178
+ e.required ? (f(), v("span", fe, " (Obrigatório)")) : m("", !0)
83
179
  ]),
84
180
  _: 1
85
- }, 8, ["for", "class"])) : d("", !0),
86
- w("div", te, [
87
- S(r(W), K({
88
- id: r(p),
181
+ }, 8, ["for", "class"])) : m("", !0),
182
+ R("div", de, [
183
+ U(p(ue), ce({
184
+ id: p(h),
89
185
  ref_key: "inputRef",
90
- ref: V,
91
- "model-value": l.value,
186
+ ref: Z,
187
+ "model-value": n.value,
92
188
  disabled: e.disabled,
93
- class: r(k)("pr-10", n.value || e.success ? "border-[#3E2E46]" : "", e.inputClass),
94
- placeholder: e.placeholder || z.value,
95
- "aria-invalid": n.value,
189
+ class: p(b)("pr-10", d.value || e.success ? "border-[#3E2E46]" : "", e.inputClass),
190
+ placeholder: e.placeholder ?? F.value,
191
+ "aria-invalid": d.value,
96
192
  "aria-describedby": [
97
- e.error && !f.value ? b : void 0,
98
- e.description ? _ : void 0
193
+ e.error && !g.value ? _ : void 0,
194
+ e.description ? V : void 0
99
195
  ].filter(Boolean).join(" ") || void 0
100
196
  }, t.$attrs, {
101
- onInput: M,
102
- onBlur: D,
103
- onFocus: N
197
+ onInput: Q,
198
+ onBlur: Y,
199
+ onFocus: W
104
200
  }), null, 16, ["id", "model-value", "disabled", "class", "placeholder", "aria-invalid", "aria-describedby"]),
105
- C.value || n.value ? (i(), u("div", ae, [
106
- C.value ? (i(), y(r(L), {
201
+ w.value || d.value ? (f(), v("div", me, [
202
+ w.value ? (f(), k(p(oe), {
107
203
  key: 0,
108
- class: "text-[#4b715c] size-5"
109
- })) : n.value ? (i(), y(r(Q), {
204
+ size: "20",
205
+ class: "text-[#4b715c]"
206
+ })) : d.value ? (f(), k(p(se), {
110
207
  key: 1,
111
- class: "text-[var(--alert-red-dark,#831511)] cursor-pointer size-5 pointer-events-auto",
112
- onClick: P
113
- })) : d("", !0)
114
- ])) : d("", !0)
208
+ size: "20",
209
+ class: "text-[var(--alert-red-dark,#831511)] cursor-pointer pointer-events-auto",
210
+ onClick: ee
211
+ })) : m("", !0)
212
+ ])) : m("", !0)
115
213
  ]),
116
- e.description && !e.error ? (i(), u("div", {
214
+ e.description && !e.error ? (f(), v("div", {
117
215
  key: 1,
118
- id: _,
216
+ id: V,
119
217
  class: "text-gray-500 text-[11px] leading-tight"
120
- }, A(e.description), 1)) : d("", !0),
121
- typeof e.error == "string" && n.value ? (i(), u("div", {
218
+ }, x(e.description), 1)) : m("", !0),
219
+ typeof e.error == "string" && d.value ? (f(), v("div", {
122
220
  key: 2,
123
- id: b,
221
+ id: _,
124
222
  class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
125
223
  }, [
126
- S(r(U), { class: "text-[var(--alert-red-dark,#831511)] shrink-0 size-4" }),
127
- w("span", null, A(e.error), 1)
128
- ])) : d("", !0)
224
+ U(p(ie), {
225
+ size: "14",
226
+ class: "text-[var(--alert-red-dark,#831511)] shrink-0"
227
+ }),
228
+ R("span", null, x(e.error), 1)
229
+ ])) : m("", !0)
129
230
  ], 2));
130
231
  }
131
232
  });
132
233
  export {
133
- ue as default
234
+ be as default
134
235
  };
@@ -1,3 +1,11 @@
1
+ export interface FilterOptions {
2
+ toUpperCase?: boolean;
3
+ maxLength?: number;
4
+ allowAlpha?: boolean;
5
+ }
6
+ export declare function filterAlphanumeric(val: string, options?: FilterOptions): string;
7
+ export declare function applyCpfMask(val: string): string;
8
+ export declare function isValidCpf(cpf: string): boolean;
1
9
  export declare function applyCnpjMask(val: string, allowAlpha?: boolean): string;
2
10
  export declare function isValidCnpj(cnpj: string): boolean;
3
11
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/document-input/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,MAAM,CAkC9E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAwCjD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/document-input/utils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAgBnF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAiB/C;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,MAAM,CAkC9E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAwCjD"}
@@ -1,33 +1,55 @@
1
- function u(s, r = !1) {
2
- let l = s.toUpperCase().replace(/[^A-Z0-9]/g, "");
3
- r || (l = l.replace(/[A-Z]/g, ""));
4
- let t = "";
5
- for (let e = 0; e < l.length && t.length < 14; e++) {
6
- const i = l[e];
7
- (t.length < 12 || /[0-9]/.test(i)) && (t += i);
8
- }
9
- let n = "";
1
+ function u(f) {
2
+ const t = f.replace(/[^0-9]/g, "").slice(0, 11);
3
+ let r = "";
10
4
  for (let e = 0; e < t.length; e++)
11
- e === 2 && (n += "."), e === 5 && (n += "."), e === 8 && (n += "/"), e === 12 && (n += "-"), n += t[e];
12
- return n;
5
+ e === 3 && (r += "."), e === 6 && (r += "."), e === 9 && (r += "-"), r += t[e];
6
+ return r;
7
+ }
8
+ function p(f) {
9
+ if (!f) return !1;
10
+ const t = f.replace(/[^0-9]/g, "");
11
+ if (t.length !== 11 || /^(\d)\1{10}$/.test(t)) return !1;
12
+ const r = (e) => {
13
+ let i = 0;
14
+ for (let n = 0; n < e; n++)
15
+ i += Number(t[n]) * (e + 1 - n);
16
+ const l = i % 11;
17
+ return l < 2 ? 0 : 11 - l;
18
+ };
19
+ return r(9) === Number(t[9]) && r(10) === Number(t[10]);
20
+ }
21
+ function d(f, t = !1) {
22
+ let r = f.toUpperCase().replace(/[^A-Z0-9]/g, "");
23
+ t || (r = r.replace(/[A-Z]/g, ""));
24
+ let e = "";
25
+ for (let l = 0; l < r.length && e.length < 14; l++) {
26
+ const n = r[l];
27
+ (e.length < 12 || /[0-9]/.test(n)) && (e += n);
28
+ }
29
+ let i = "";
30
+ for (let l = 0; l < e.length; l++)
31
+ l === 2 && (i += "."), l === 5 && (i += "."), l === 8 && (i += "/"), l === 12 && (i += "-"), i += e[l];
32
+ return i;
13
33
  }
14
- function p(s) {
15
- if (!s) return !1;
16
- const r = s.toUpperCase().replace(/[^A-Z0-9]/g, "");
17
- if (r.length !== 14 || /^([A-Z0-9])\1{13}$/.test(r) || !/^[0-9]{2}$/.test(r.slice(12, 14))) return !1;
18
- const l = (i) => {
19
- const f = i.charCodeAt(0);
20
- return f >= 48 && f <= 57, f - 48;
21
- }, t = (i) => {
22
- let f = 0, a = i - 7;
23
- for (let c = 0; c < i; c++)
24
- f += l(r[c]) * a, a--, a < 2 && (a = 9);
25
- const o = f % 11;
34
+ function g(f) {
35
+ if (!f) return !1;
36
+ const t = f.toUpperCase().replace(/[^A-Z0-9]/g, "");
37
+ if (t.length !== 14 || /^([A-Z0-9])\1{13}$/.test(t) || !/^[0-9]{2}$/.test(t.slice(12, 14))) return !1;
38
+ const r = (n) => {
39
+ const s = n.charCodeAt(0);
40
+ return s >= 48 && s <= 57, s - 48;
41
+ }, e = (n) => {
42
+ let s = 0, a = n - 7;
43
+ for (let c = 0; c < n; c++)
44
+ s += r(t[c]) * a, a--, a < 2 && (a = 9);
45
+ const o = s % 11;
26
46
  return o < 2 ? 0 : 11 - o;
27
- }, n = t(12), e = t(13);
28
- return l(r[12]) === n && l(r[13]) === e;
47
+ }, i = e(12), l = e(13);
48
+ return r(t[12]) === i && r(t[13]) === l;
29
49
  }
30
50
  export {
31
- u as applyCnpjMask,
32
- p as isValidCnpj
51
+ d as applyCnpjMask,
52
+ u as applyCpfMask,
53
+ g as isValidCnpj,
54
+ p as isValidCpf
33
55
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as a, createBlock as s, openBlock as i, normalizeProps as C, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as m, normalizeClass as d, createElementVNode as t } from "vue";
1
+ import { defineComponent as c, createBlock as s, openBlock as i, normalizeProps as C, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as m, normalizeClass as d, createElementVNode as t } from "vue";
2
2
  import w from "../components/IconWrapper/IconWrapper.vue.js";
3
- const g = ["width", "height"], k = /* @__PURE__ */ a({
3
+ const f = ["width", "height"], k = /* @__PURE__ */ c({
4
4
  __name: "AtCheckCircleRegularIcon",
5
5
  props: {
6
6
  size: {},
@@ -11,10 +11,10 @@ const g = ["width", "height"], k = /* @__PURE__ */ a({
11
11
  },
12
12
  setup(o) {
13
13
  const r = o;
14
- return (u, l) => (i(), s(w, C(n(r)), {
15
- default: h(({ class: c, style: e }) => [
14
+ return (g, l) => (i(), s(w, C(n(r)), {
15
+ default: h(({ class: a, style: e }) => [
16
16
  (i(), p("svg", {
17
- class: d(c),
17
+ class: d(a),
18
18
  style: m(e),
19
19
  fill: "currentColor",
20
20
  width: e.width,
@@ -35,7 +35,7 @@ const g = ["width", "height"], k = /* @__PURE__ */ a({
35
35
  })
36
36
  ])
37
37
  ], -1)
38
- ]), 14, g))
38
+ ]), 14, f))
39
39
  ]),
40
40
  _: 1
41
41
  }, 16));
@@ -1,6 +1,6 @@
1
- import { defineComponent as s, createBlock as c, openBlock as C, normalizeProps as a, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as d, normalizeClass as m, createElementVNode as t } from "vue";
1
+ import { defineComponent as s, createBlock as a, openBlock as C, normalizeProps as c, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as d, normalizeClass as m, createElementVNode as t } from "vue";
2
2
  import w from "../components/IconWrapper/IconWrapper.vue.js";
3
- const u = ["width", "height"], k = /* @__PURE__ */ s({
3
+ const f = ["width", "height"], k = /* @__PURE__ */ s({
4
4
  __name: "AtCirclePlusSolidIcon",
5
5
  props: {
6
6
  size: {},
@@ -11,7 +11,7 @@ const u = ["width", "height"], k = /* @__PURE__ */ s({
11
11
  },
12
12
  setup(o) {
13
13
  const i = o;
14
- return (f, l) => (C(), c(w, a(n(i)), {
14
+ return (u, l) => (C(), a(w, c(n(i)), {
15
15
  default: h(({ class: r, style: e }) => [
16
16
  (C(), p("svg", {
17
17
  class: m(r),
@@ -35,7 +35,7 @@ const u = ["width", "height"], k = /* @__PURE__ */ s({
35
35
  })
36
36
  ])
37
37
  ], -1)
38
- ]), 14, u))
38
+ ]), 14, f))
39
39
  ]),
40
40
  _: 1
41
41
  }, 16));
@@ -1,6 +1,6 @@
1
- import { defineComponent as c, createBlock as s, openBlock as i, normalizeProps as C, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as m, normalizeClass as d, createElementVNode as t } from "vue";
1
+ import { defineComponent as s, createBlock as C, openBlock as i, normalizeProps as c, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as m, normalizeClass as d, createElementVNode as t } from "vue";
2
2
  import w from "../components/IconWrapper/IconWrapper.vue.js";
3
- const g = ["width", "height"], _ = /* @__PURE__ */ c({
3
+ const f = ["width", "height"], _ = /* @__PURE__ */ s({
4
4
  __name: "AtCircleXMarkRegularIcon",
5
5
  props: {
6
6
  size: {},
@@ -11,7 +11,7 @@ const g = ["width", "height"], _ = /* @__PURE__ */ c({
11
11
  },
12
12
  setup(o) {
13
13
  const r = o;
14
- return (u, l) => (i(), s(w, C(n(r)), {
14
+ return (g, l) => (i(), C(w, c(n(r)), {
15
15
  default: h(({ class: a, style: e }) => [
16
16
  (i(), p("svg", {
17
17
  class: d(a),
@@ -35,7 +35,7 @@ const g = ["width", "height"], _ = /* @__PURE__ */ c({
35
35
  })
36
36
  ])
37
37
  ], -1)
38
- ]), 14, g))
38
+ ]), 14, f))
39
39
  ]),
40
40
  _: 1
41
41
  }, 16));
@@ -1,6 +1,6 @@
1
- import { defineComponent as c, createBlock as s, openBlock as i, normalizeProps as n, guardReactiveProps as C, withCtx as h, createElementBlock as p, normalizeStyle as d, normalizeClass as m, createElementVNode as t } from "vue";
2
- import w from "../components/IconWrapper/IconWrapper.vue.js";
3
- const f = ["width", "height"], _ = /* @__PURE__ */ c({
1
+ import { defineComponent as s, createBlock as c, openBlock as i, normalizeProps as n, guardReactiveProps as C, withCtx as h, createElementBlock as p, normalizeStyle as d, normalizeClass as m, createElementVNode as t } from "vue";
2
+ import f from "../components/IconWrapper/IconWrapper.vue.js";
3
+ const w = ["width", "height"], _ = /* @__PURE__ */ s({
4
4
  __name: "AtCircleXMarkSolidIcon",
5
5
  props: {
6
6
  size: {},
@@ -11,7 +11,7 @@ const f = ["width", "height"], _ = /* @__PURE__ */ c({
11
11
  },
12
12
  setup(o) {
13
13
  const r = o;
14
- return (g, l) => (i(), s(w, n(C(r)), {
14
+ return (g, l) => (i(), c(f, n(C(r)), {
15
15
  default: h(({ class: a, style: e }) => [
16
16
  (i(), p("svg", {
17
17
  class: m(a),
@@ -35,7 +35,7 @@ const f = ["width", "height"], _ = /* @__PURE__ */ c({
35
35
  })
36
36
  ])
37
37
  ], -1)
38
- ]), 14, f))
38
+ ]), 14, w))
39
39
  ]),
40
40
  _: 1
41
41
  }, 16));
@@ -1,6 +1,6 @@
1
- import { defineComponent as a, createBlock as c, openBlock as o, normalizeProps as s, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as d, normalizeClass as m, createElementVNode as t } from "vue";
1
+ import { defineComponent as a, createBlock as s, openBlock as o, normalizeProps as c, guardReactiveProps as n, withCtx as h, createElementBlock as p, normalizeStyle as d, normalizeClass as m, createElementVNode as t } from "vue";
2
2
  import w from "../components/IconWrapper/IconWrapper.vue.js";
3
- const g = ["width", "height"], _ = /* @__PURE__ */ a({
3
+ const f = ["width", "height"], _ = /* @__PURE__ */ a({
4
4
  __name: "AtOrdenacaoRegularIcon",
5
5
  props: {
6
6
  size: {},
@@ -11,7 +11,7 @@ const g = ["width", "height"], _ = /* @__PURE__ */ a({
11
11
  },
12
12
  setup(C) {
13
13
  const i = C;
14
- return (u, l) => (o(), c(w, s(n(i)), {
14
+ return (g, l) => (o(), s(w, c(n(i)), {
15
15
  default: h(({ class: r, style: e }) => [
16
16
  (o(), p("svg", {
17
17
  class: m(r),
@@ -35,7 +35,7 @@ const g = ["width", "height"], _ = /* @__PURE__ */ a({
35
35
  })
36
36
  ])
37
37
  ], -1)
38
- ]), 14, g))
38
+ ]), 14, f))
39
39
  ]),
40
40
  _: 1
41
41
  }, 16));
@@ -1,6 +1,6 @@
1
1
  import o from "./IconWrapper.vue2.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2c0814de"]]);
3
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-43193bf7"]]);
4
4
  export {
5
- c as default
5
+ a as default
6
6
  };
@@ -9,16 +9,18 @@ const h = ["role"], g = "icon-wrapper", w = /* @__PURE__ */ u({
9
9
  onClickCallback: { type: Function }
10
10
  },
11
11
  setup(r) {
12
- const e = r, { class: s, style: o } = p(e), n = l(() => ({
13
- fill: e.color,
14
- width: e.size || "28",
15
- height: e.size || "28"
16
- })), a = m(), c = l(() => a.onClick ? "button" : "figure"), i = l(() => ({
12
+ const e = r, { class: s, style: t } = p(e), n = l(() => {
13
+ const o = {
14
+ width: e.size || "28",
15
+ height: e.size || "28"
16
+ };
17
+ return e.color && (o.color = e.color, o.fill = e.color), o;
18
+ }), a = m(), c = l(() => a.onClick ? "button" : "figure"), i = l(() => ({
17
19
  ...n.value,
18
- ...o == null ? void 0 : o.value
20
+ ...t == null ? void 0 : t.value
19
21
  }));
20
- return (t, S) => (f(), d("span", k(t.$attrs, { role: c.value }), [
21
- v(t.$slots, "default", {
22
+ return (o, S) => (f(), d("span", k(o.$attrs, { role: c.value }), [
23
+ v(o.$slots, "default", {
22
24
  class: y([g, C(s)]),
23
25
  style: z(i.value)
24
26
  }, void 0, !0)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agrotools1/at-components",
3
3
  "type": "module",
4
- "version": "2.0.22",
4
+ "version": "2.0.24",
5
5
  "private": false,
6
6
  "packageManager": "pnpm@9.1.0",
7
7
  "description": "Componentes da Agrotools - Versão 2 (com re-export da V1)",