@agrotools1/at-components 2.0.31 → 2.0.33

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":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAgB3C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAkB3C,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { VersionData } from '../../types';
2
+ declare const v2_0_32: VersionData;
3
+ export default v2_0_32;
4
+ //# sourceMappingURL=v2.0.32.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.0.32.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.32.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WAiBd,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { VersionData } from '../../types';
2
+ declare const v2_0_33: VersionData;
3
+ export default v2_0_33;
4
+ //# sourceMappingURL=v2.0.33.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.0.33.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.33.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WA4Bd,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -1,28 +1,69 @@
1
1
  interface Props {
2
+ /** ID único do componente. */
2
3
  id?: string;
4
+ /** Valor selecionado ou digitado (v-model). */
3
5
  modelValue?: any;
6
+ /**
7
+ * Tipo de documento. Define máscara e validação.
8
+ * @default 'cpf-cnpj'
9
+ */
4
10
  documentType?: 'cpf' | 'cnpj' | 'cpf-cnpj' | 'generic';
11
+ /** Texto do rótulo (label) acima do campo. */
5
12
  label?: string;
13
+ /** Texto de ajuda ou descrição abaixo do campo. */
6
14
  description?: string;
15
+ /** Indica se o campo é obrigatório. */
7
16
  required?: boolean;
17
+ /** Desabilita o componente e oculta o ícone de limpeza. */
8
18
  disabled?: boolean;
19
+ /**
20
+ * Estado de erro. Se for string, exibe a mensagem.
21
+ * Se for true, destaca o campo em vermelho.
22
+ */
9
23
  error?: boolean | string;
24
+ /** Exibe o ícone de sucesso (check) quando o documento é válido. */
10
25
  success?: boolean;
26
+ /** Permite caracteres alfanuméricos (letras) no CNPJ (Padrão 2026). */
11
27
  allowAlpha?: boolean;
28
+ /** Placeholder customizado. */
12
29
  placeholder?: string;
30
+ /** Limite máximo de caracteres (modo generic). */
13
31
  maxLength?: number;
32
+ /** Converte a digitação para maiúsculas (modo generic). */
14
33
  toUpperCase?: boolean;
34
+ /**
35
+ * Se true, o modelValue emitirá apenas os caracteres limpos.
36
+ * Se false, emitirá o valor formatado.
37
+ */
15
38
  unmask?: boolean;
39
+ /** Máscara customizada para o modo generic. */
16
40
  customMask?: string;
41
+ /** Classes CSS para o container. */
17
42
  class?: any;
43
+ /** Classes CSS para o input interno. */
18
44
  inputClass?: any;
45
+ /** Exibe o ícone de lupa (search) à esquerda. */
19
46
  withIcon?: boolean;
47
+ /** Habilita a validação matemática automática. */
20
48
  withInternalValidation?: boolean;
49
+ /** Lista de opções para o autocomplete. */
21
50
  options?: any[];
51
+ /** Indica estado de carregamento. */
22
52
  loading?: boolean;
53
+ /** Texto exibido quando nenhum resultado é encontrado. */
23
54
  notFoundText?: string;
55
+ /** Texto exibido durante o carregamento das opções. */
24
56
  loadingText?: string;
57
+ /**
58
+ * Chave do objeto que identifica unicamente a opção.
59
+ * @default 'identifier'
60
+ */
25
61
  optionId?: string;
62
+ /**
63
+ * Controla a exibição do ícone de limpeza (X).
64
+ * @default true
65
+ */
66
+ withClearIcon?: boolean;
26
67
  }
27
68
  declare function __VLS_template(): {
28
69
  attrs: Partial<{}>;
@@ -49,6 +90,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
49
90
  blur: (event: FocusEvent) => any;
50
91
  focus: (event: FocusEvent) => any;
51
92
  validate: (isValid: boolean) => any;
93
+ "update:searchTerm": (value: string) => any;
52
94
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
53
95
  onClear?: (() => any) | undefined;
54
96
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
@@ -56,6 +98,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
56
98
  onBlur?: ((event: FocusEvent) => any) | undefined;
57
99
  onFocus?: ((event: FocusEvent) => any) | undefined;
58
100
  onValidate?: ((isValid: boolean) => any) | undefined;
101
+ "onUpdate:searchTerm"?: ((value: string) => any) | undefined;
59
102
  }>, {
60
103
  disabled: boolean;
61
104
  toUpperCase: boolean;
@@ -66,6 +109,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
66
109
  documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic";
67
110
  withInternalValidation: boolean;
68
111
  unmask: boolean;
112
+ withClearIcon: boolean;
69
113
  optionId: string;
70
114
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
71
115
  wrapperRef: HTMLDivElement;
@@ -1 +1 @@
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,GAA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,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
+ {"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"AAknBA,UAAU,KAAK;IACb,8BAA8B;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,+CAA+C;IAC/C,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;IACtD,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,oCAAoC;IACp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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";
1
+ import { defineComponent as ie, useId as ue, ref as y, watch as ce, computed as B, createElementBlock as g, openBlock as s, normalizeClass as U, unref as r, createBlock as k, createCommentVNode as v, createVNode as d, withCtx as m, createTextVNode as Z, toDisplayString as A, mergeProps as pe, createElementVNode as _, renderSlot as T, withModifiers as q, withDirectives as de, Fragment as fe, renderList as me, vShow as he, nextTick as z } from "vue";
2
2
  import { cn as F } from "../lib/utils.js";
3
- import { AtCheckCircleRegularIcon as he } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
3
+ import { AtCheckCircleRegularIcon as ge } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
4
4
  import { AtCheckSolidIcon as ve } from "../packages/at-icons/dist/AtCheckSolidIcon/index.js";
5
5
  import { AtCircleXMarkRegularIcon as ye } from "../packages/at-icons/dist/AtCircleXMarkRegularIcon/index.js";
6
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";
7
+ import { reactiveOmit as ke } from "@vueuse/core";
8
+ import { useForwardPropsEmits as Ae } from "reka-ui";
9
+ import Te from "../combobox/Combobox.vue.js";
10
10
  import xe from "../combobox/ComboboxAnchor.vue.js";
11
- import Te from "../combobox/ComboboxEmpty.vue.js";
11
+ import we from "../combobox/ComboboxEmpty.vue.js";
12
12
  import Ce from "../combobox/ComboboxGroup.vue.js";
13
13
  import Ve from "../combobox/ComboboxInput.vue.js";
14
14
  import be from "../combobox/ComboboxItem.vue.js";
@@ -16,7 +16,7 @@ import _e from "../combobox/ComboboxItemIndicator.vue.js";
16
16
  import Ie from "../combobox/ComboboxList.vue.js";
17
17
  import $e from "../combobox/ComboboxViewport.vue.js";
18
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";
19
+ import { isValidCpf as x, isValidCnpj as w, applyCpfMask as O, applyCnpjMask as X } from "./utils.js";
20
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
21
  const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
22
22
  key: 0,
@@ -47,11 +47,12 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
47
47
  loading: { type: Boolean },
48
48
  notFoundText: {},
49
49
  loadingText: {},
50
- optionId: { default: "identifier" }
50
+ optionId: { default: "identifier" },
51
+ withClearIcon: { type: Boolean, default: !0 }
51
52
  },
52
- emits: ["update:modelValue", "select", "validate", "blur", "focus", "clear"],
53
+ emits: ["update:modelValue", "update:searchTerm", "select", "validate", "blur", "focus", "clear"],
53
54
  setup(H, { emit: J }) {
54
- const e = H, s = J, C = e.id || ue(), G = `error-${C}`, K = `desc-${C}`, Q = Ae(
55
+ const e = H, o = J, C = e.id || ue(), G = `error-${C}`, K = `desc-${C}`, Q = ke(
55
56
  e,
56
57
  "modelValue",
57
58
  "documentType",
@@ -75,38 +76,34 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
75
76
  "loadingText",
76
77
  "optionId",
77
78
  "modelValue"
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
- if (!a) return t;
81
- const l = t.replace(/[^0-9A-Za-z]/g, "");
82
- if (!l) return "";
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++);
79
+ ), W = Ae(Q, o), i = y(""), V = y(!1), I = y(!1), E = y(!1), $ = y(null), M = y(e.modelValue);
80
+ function Y(t, l) {
81
+ if (!l) return t;
82
+ const a = t.replace(/[^0-9A-Za-z]/g, "");
83
+ if (!a) return "";
84
+ let f = "", n = 0;
85
+ for (let c = 0; c < l.length && n < a.length; c++) {
86
+ const u = l[c], p = a[n];
87
+ u === "9" ? /[0-9]/.test(p) ? (f += p, n++) : (n++, c--) : u === "A" ? /[A-Za-z]/.test(p) ? (f += e.toUpperCase ? p.toUpperCase() : p, n++) : (n++, c--) : u === "X" ? /[0-9A-Za-z]/.test(p) ? (f += e.toUpperCase ? p.toUpperCase() : p, n++) : (n++, c--) : (f += u, p === u && n++);
87
88
  }
88
- return c;
89
+ return f;
89
90
  }
90
- function j(t) {
91
+ function L(t) {
91
92
  if (e.customMask && e.documentType === "generic")
92
93
  return Y(t, e.customMask);
93
- const a = /[A-Z]/i.test(t);
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;
94
+ const l = /[A-Z]/i.test(t);
95
+ return e.documentType === "cpf" ? O(t) : e.documentType === "cnpj" ? X(t, e.allowAlpha) : e.documentType === "cpf-cnpj" ? e.allowAlpha && l || t.length > 11 ? X(t, e.allowAlpha) : O(t) : t;
95
96
  }
96
97
  const P = (t) => {
97
98
  if (!t) return i.value || "";
98
99
  if (typeof t == "string") {
99
- const c = t.replace(
100
+ const l = t.replace(
100
101
  e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
101
102
  ""
102
103
  );
103
- return j(c);
104
+ return L(l);
104
105
  }
105
- const l = (t.identifier || t.value || t.text || "").replace(
106
- e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
107
- ""
108
- );
109
- return j(l);
106
+ return t.text || t.label || t.identifier || t.value || "";
110
107
  };
111
108
  ce(
112
109
  () => e.modelValue,
@@ -115,12 +112,12 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
115
112
  i.value !== "" && (i.value = ""), M.value = void 0;
116
113
  return;
117
114
  }
118
- const a = P(t);
119
- i.value !== a && (i.value = a);
115
+ const l = P(t);
116
+ i.value !== l && (i.value = l);
120
117
  },
121
118
  { immediate: !0 }
122
119
  );
123
- const ee = U(() => e.maxLength ? e.maxLength : e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18), te = U(() => {
120
+ const ee = B(() => e.maxLength ? e.maxLength : e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18), te = B(() => {
124
121
  switch (e.documentType) {
125
122
  case "cnpj":
126
123
  return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
@@ -131,199 +128,199 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
131
128
  default:
132
129
  return;
133
130
  }
134
- }), g = U(() => {
131
+ }), h = B(() => {
135
132
  if (e.error) return !0;
136
133
  if (e.withInternalValidation) {
137
134
  const t = e.modelValue;
138
135
  if (!t || I.value) return !1;
139
- const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
140
- if (!l) return !1;
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))
136
+ const a = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
137
+ if (!a) return !1;
138
+ if (a.length === 11 && !x(a) || a.length === 14 && !w(a) || E.value && (e.documentType === "cpf" && a.length !== 11 || e.documentType === "cnpj" && a.length !== 14 || e.documentType === "cpf-cnpj" && a.length !== 11 && a.length !== 14))
142
139
  return !0;
143
140
  }
144
141
  return !1;
145
- }), B = U(() => {
146
- if (g.value) return !1;
142
+ }), j = B(() => {
143
+ if (h.value) return !1;
147
144
  if (e.success) return !0;
148
145
  if (e.withInternalValidation) {
149
146
  const t = e.modelValue;
150
147
  if (!t) return !1;
151
- const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
152
- if (e.documentType === "cpf") return x(l);
153
- if (e.documentType === "cnpj") return T(l);
148
+ const a = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
149
+ if (e.documentType === "cpf") return x(a);
150
+ if (e.documentType === "cnpj") return w(a);
154
151
  if (e.documentType === "cpf-cnpj")
155
- return l.length === 11 ? x(l) : T(l);
152
+ return a.length === 11 ? x(a) : w(a);
156
153
  }
157
154
  return !1;
158
155
  });
159
156
  function D(t) {
160
- let a = !1;
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);
157
+ let l = !1;
158
+ e.documentType === "cpf" ? l = x(t) : e.documentType === "cnpj" ? l = w(t) : e.documentType === "cpf-cnpj" && (l = t.length === 11 ? x(t) : w(t)), o("validate", l);
162
159
  }
163
160
  function le(t) {
164
- const a = t.target;
165
- let l = a.value;
166
- const c = a.selectionStart || 0;
167
- I.value = !1, e.toUpperCase && (l = l.toUpperCase());
168
- let o = l.replace(
161
+ const l = t.target;
162
+ let a = l.value;
163
+ const f = l.selectionStart || 0;
164
+ I.value = !1, e.toUpperCase && (a = a.toUpperCase());
165
+ let n = a.replace(
169
166
  e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
170
167
  ""
171
- ), p = e.maxLength;
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(() => {
175
- a.value = u;
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++)
168
+ ), c = e.maxLength;
169
+ c || (e.customMask && e.documentType === "generic" ? c = e.customMask.length : c = e.documentType === "cpf" ? 11 : 14), n = n.slice(0, c);
170
+ const u = L(n), p = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, ne = (a.slice(0, f).match(p) || []).length, se = (e.unmask ? n : u) || void 0;
171
+ o("update:modelValue", se), o("update:searchTerm", n), D(n), i.value = u, z(() => {
172
+ l.value = u;
173
+ let S = 0, N = 0;
174
+ 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++, S = b + 1, !(N >= ne)); b++)
178
175
  ;
179
- a.setSelectionRange(Z, Z);
176
+ l.setSelectionRange(S, S);
180
177
  });
181
178
  }
182
179
  function ae(t) {
183
- i.value = "", M.value = null, s("update:modelValue", null), E(() => {
180
+ i.value = "", o("update:searchTerm", ""), M.value = null, o("update:modelValue", null), z(() => {
184
181
  if (!$.value) return;
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");
186
- l && (l.value = "", l.dispatchEvent(new Event("input", { bubbles: !0 }))), E(() => {
182
+ const l = $.value.querySelector(`[id="${C}"]`) || $.value.querySelector("input"), a = (l == null ? void 0 : l.tagName) === "INPUT" ? l : l == null ? void 0 : l.querySelector("input");
183
+ a && (a.value = "", a.dispatchEvent(new Event("input", { bubbles: !0 }))), z(() => {
187
184
  V.value = !1;
188
185
  });
189
- }), I.value = !0, s("validate", !1), s("clear"), V.value = !1;
186
+ }), I.value = !0, o("validate", !1), o("clear"), V.value = !1;
190
187
  }
191
188
  function re(t) {
192
189
  if (!t) {
193
- i.value = "", I.value = !0, s("update:modelValue", null);
190
+ i.value = "", o("update:searchTerm", ""), I.value = !0, o("update:modelValue", null);
194
191
  return;
195
192
  }
196
- s("update:modelValue", t), s("select", t);
197
- const l = (t.identifier || t.value || t.text || "").replace(/[^A-Z0-9]/gi, "");
198
- i.value = j(l), D(l), V.value = !1;
193
+ o("update:modelValue", t), o("select", t), i.value = t.text || t.label || t.identifier || t.value || "";
194
+ const l = (t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
195
+ o("update:searchTerm", l), D(l), V.value = !1;
199
196
  }
200
197
  function oe(t) {
201
- L.value = !0, s("blur", t);
202
- const a = i.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
203
- let l = !1;
204
- a.length === 11 ? l = x(a) : a.length === 14 && (l = T(a)), l && s("update:modelValue", e.toUpperCase ? a.toUpperCase() : a);
198
+ E.value = !0, o("blur", t);
199
+ const l = i.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
200
+ let a = !1;
201
+ l.length === 11 ? a = x(l) : l.length === 14 && (a = w(l)), a && o("update:modelValue", e.toUpperCase ? l.toUpperCase() : l);
205
202
  }
206
- return (t, a) => (n(), h("div", {
207
- class: S(r(F)("space-y-1.5 w-full", e.class)),
203
+ return (t, l) => (s(), g("div", {
204
+ class: U(r(F)("space-y-1.5 w-full", e.class)),
208
205
  ref_key: "wrapperRef",
209
206
  ref: $
210
207
  }, [
211
- e.label ? (n(), A(r(Me), {
208
+ e.label ? (s(), k(r(Me), {
212
209
  key: 0,
213
210
  for: r(C),
214
- class: S(
211
+ class: U(
215
212
  r(F)(
216
213
  "text-[#101011] font-normal text-[10px] leading-[10px]",
217
- g.value ? "text-[var(--alert-red-dark,#831511)]" : ""
214
+ h.value ? "text-[var(--alert-red-dark,#831511)]" : ""
218
215
  )
219
216
  )
220
217
  }, {
221
218
  default: m(() => [
222
- z(k(e.label), 1),
223
- e.required && !e.label.includes("(Obrigatório)") ? (n(), h("span", Be, " (Obrigatório)")) : v("", !0)
219
+ Z(A(e.label), 1),
220
+ e.required && !e.label.includes("(Obrigatório)") ? (s(), g("span", Be, " (Obrigatório)")) : v("", !0)
224
221
  ]),
225
222
  _: 1
226
223
  }, 8, ["for", "class"])) : v("", !0),
227
- f(r(we), pe(r(W), {
224
+ d(r(Te), pe(r(W), {
228
225
  "model-value": M.value,
229
226
  searchTerm: i.value,
230
- "onUpdate:searchTerm": a[3] || (a[3] = (l) => i.value = l),
227
+ "onUpdate:searchTerm": l[3] || (l[3] = (a) => i.value = a),
231
228
  open: V.value,
232
- "onUpdate:open": a[4] || (a[4] = (l) => V.value = l),
229
+ "onUpdate:open": l[4] || (l[4] = (a) => V.value = a),
233
230
  "reset-search-term-on-select": !1,
234
231
  "filter-function": () => !0,
235
232
  "onUpdate:modelValue": re
236
233
  }), {
237
234
  default: m(() => [
238
235
  _("div", Ue, [
239
- f(r(xe), { class: "w-full h-full" }, {
236
+ d(r(xe), { class: "w-full h-full" }, {
240
237
  default: m(() => [
241
- w(t.$slots, "input", {}, () => [
242
- f(r(Ve), {
238
+ T(t.$slots, "input", {}, () => [
239
+ d(r(Ve), {
243
240
  id: r(C),
244
241
  "display-value": P,
245
- placeholder: e.placeholder || te.value,
242
+ placeholder: e.placeholder ?? te.value,
246
243
  "with-icon": e.withIcon,
247
244
  "with-clear-button": !1,
248
245
  disabled: e.disabled,
249
- error: g.value,
250
- success: B.value,
251
- class: S(
246
+ error: h.value,
247
+ success: j.value,
248
+ class: U(
252
249
  r(F)(
253
250
  "pr-20",
254
- g.value || B.value ? "border-[#3E2E46]" : "",
251
+ h.value || j.value ? "border-[#3E2E46]" : "",
255
252
  e.inputClass
256
253
  )
257
254
  ),
258
255
  maxlength: ee.value,
259
256
  onInput: le,
260
257
  onBlur: oe,
261
- onFocus: a[0] || (a[0] = (l) => s("focus", l))
258
+ onFocus: l[0] || (l[0] = (a) => o("focus", a))
262
259
  }, null, 8, ["id", "placeholder", "with-icon", "disabled", "error", "success", "class", "maxlength"])
263
260
  ])
264
261
  ]),
265
262
  _: 3
266
263
  }),
267
264
  _("div", {
268
- class: S(["absolute right-9 flex items-center justify-center z-10 h-10 w-6", e.disabled ? "pointer-events-none opacity-40" : ""])
265
+ class: U(["absolute right-9 flex items-center justify-center z-10 h-10 w-6", e.disabled ? "pointer-events-none opacity-40" : ""])
269
266
  }, [
270
- g.value || e.modelValue && !B.value ? (n(), h("div", {
267
+ (h.value || e.modelValue && !j.value) && !e.disabled && e.withClearIcon ? (s(), g("div", {
271
268
  key: 0,
272
269
  class: "flex items-center justify-center w-full h-full cursor-pointer",
273
- onMousedown: a[1] || (a[1] = q((l) => !e.disabled && ae(), ["stop", "prevent"])),
274
- onClick: a[2] || (a[2] = q(() => {
270
+ onMousedown: l[1] || (l[1] = q((a) => !e.disabled && ae(), ["stop", "prevent"])),
271
+ onClick: l[2] || (l[2] = q(() => {
275
272
  }, ["stop", "prevent"]))
276
273
  }, [
277
- g.value ? (n(), A(r(R), {
274
+ h.value ? (s(), k(r(R), {
278
275
  key: 0,
279
276
  size: "20",
280
277
  class: "text-[var(--alert-red-dark,#831511)] transition-opacity hover:opacity-80"
281
- })) : (n(), A(r(ye), {
278
+ })) : (s(), k(r(ye), {
282
279
  key: 1,
283
280
  size: "20",
284
281
  class: "text-gray-400 transition-colors hover:text-[#831511]"
285
282
  }))
286
- ], 32)) : B.value ? (n(), A(r(he), {
283
+ ], 32)) : j.value ? (s(), k(r(ge), {
287
284
  key: 1,
288
285
  size: "20",
289
286
  class: "text-[#4b715c] pointer-events-none"
290
287
  })) : v("", !0)
291
288
  ], 2)
292
289
  ]),
293
- w(t.$slots, "list", {}, () => [
294
- f(r(Ie), null, {
290
+ T(t.$slots, "list", {}, () => [
291
+ d(r(Ie), null, {
295
292
  default: m(() => [
296
- e.loading && (e.loadingText || t.$slots.loading) ? (n(), h("div", Se, [
297
- w(t.$slots, "loading", {}, () => [
293
+ e.loading && (e.loadingText || t.$slots.loading) ? (s(), g("div", Se, [
294
+ T(t.$slots, "loading", {}, () => [
298
295
  _("div", Ze, [
299
- f(r(je), { class: "size-4 animate-spin" }),
300
- _("span", null, k(e.loadingText), 1)
296
+ d(r(je), { class: "size-4 animate-spin" }),
297
+ _("span", null, A(e.loadingText), 1)
301
298
  ])
302
299
  ])
303
- ])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (n(), A(r(Te), { key: 1 }, {
300
+ ])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (s(), k(r(we), { key: 1 }, {
304
301
  default: m(() => [
305
- w(t.$slots, "empty", {}, () => [
306
- z(k(e.notFoundText), 1)
302
+ T(t.$slots, "empty", {}, () => [
303
+ Z(A(e.notFoundText), 1)
307
304
  ])
308
305
  ]),
309
306
  _: 3
310
307
  })) : v("", !0),
311
- de(f(r($e), null, {
308
+ de(d(r($e), null, {
312
309
  default: m(() => [
313
- f(r(Ce), null, {
310
+ d(r(Ce), null, {
314
311
  default: m(() => [
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), {
317
- key: l[e.optionId] || c,
318
- value: l
312
+ T(t.$slots, "default", {}, () => [
313
+ e.options && e.options.length ? (s(!0), g(fe, { key: 0 }, me(e.options, (a, f) => (s(), k(r(be), {
314
+ key: a[e.optionId] || f,
315
+ value: a
319
316
  }, {
320
317
  default: m(() => [
321
- w(t.$slots, "option", { item: l }, () => [
322
- z(k(l.text || l.label || l), 1)
318
+ T(t.$slots, "option", { item: a }, () => [
319
+ Z(A(a.text || a.label || a), 1)
323
320
  ]),
324
- f(r(_e), { class: "ml-auto" }, {
321
+ d(r(_e), { class: "ml-auto" }, {
325
322
  default: m(() => [
326
- f(r(ve), { size: "16" })
323
+ d(r(ve), { size: "16" })
327
324
  ]),
328
325
  _: 1
329
326
  })
@@ -337,7 +334,7 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
337
334
  ]),
338
335
  _: 3
339
336
  }, 512), [
340
- [ge, !e.loading]
337
+ [he, !e.loading]
341
338
  ])
342
339
  ]),
343
340
  _: 3
@@ -346,21 +343,21 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
346
343
  ]),
347
344
  _: 3
348
345
  }, 16, ["model-value", "searchTerm", "open"]),
349
- e.description && !g.value ? (n(), h("div", {
346
+ e.description && !h.value ? (s(), g("div", {
350
347
  key: 1,
351
348
  id: K,
352
349
  class: "text-gray-500 text-[11px] leading-tight"
353
- }, k(e.description), 1)) : v("", !0),
354
- typeof e.error == "string" && g.value ? (n(), h("div", {
350
+ }, A(e.description), 1)) : v("", !0),
351
+ typeof e.error == "string" && h.value ? (s(), g("div", {
355
352
  key: 2,
356
353
  id: G,
357
354
  class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
358
355
  }, [
359
- f(r(R), {
356
+ d(r(R), {
360
357
  size: "14",
361
358
  class: "text-[var(--alert-red-dark,#831511)] shrink-0"
362
359
  }),
363
- _("span", null, k(e.error), 1)
360
+ _("span", null, A(e.error), 1)
364
361
  ])) : v("", !0)
365
362
  ], 2));
366
363
  }
@@ -1,23 +1,55 @@
1
1
  export type DocumentType = 'generic' | 'cnpj' | 'cpf' | 'cpf-cnpj';
2
2
  export interface DocumentInputProps {
3
+ /** ID único do componente. Se não informado, um ID aleatório será gerado. */
3
4
  id?: string;
5
+ /** Valor do campo (v-model). */
4
6
  modelValue?: string;
7
+ /**
8
+ * Tipo de documento. Define máscara e validação.
9
+ * @default 'cpf-cnpj'
10
+ */
5
11
  documentType?: DocumentType;
12
+ /** Texto do rótulo (label) acima do input. */
6
13
  label?: string;
14
+ /** Texto de ajuda ou descrição abaixo do input. */
7
15
  description?: string;
16
+ /** Indica se o campo é obrigatório. */
8
17
  required?: boolean;
18
+ /** Desabilita o campo e oculta o ícone de limpeza. */
9
19
  disabled?: boolean;
20
+ /**
21
+ * Estado de erro. Se for string, exibe a mensagem abaixo do campo.
22
+ * Se for true, apenas destaca o campo em vermelho.
23
+ */
10
24
  error?: boolean | string;
25
+ /** Exibe o ícone de sucesso (check) quando o documento é válido. */
11
26
  success?: boolean;
27
+ /** Permite caracteres alfanuméricos (letras) no CNPJ (Padrão Receita Federal 2026). */
12
28
  allowAlpha?: boolean;
29
+ /** Habilita a validação matemática automática (CPF/CNPJ) integrada. */
13
30
  withInternalValidation?: boolean;
31
+ /** Placeholder customizado. Se não informado, usa um padrão baseado no documentType. */
14
32
  placeholder?: string;
33
+ /** Limite máximo de caracteres (apenas para modo 'generic'). */
15
34
  maxLength?: number;
35
+ /** Converte automaticamente a digitação para letras maiúsculas (apenas para modo 'generic'). */
16
36
  toUpperCase?: boolean;
37
+ /**
38
+ * Se true (default), o v-model emitirá apenas os números/letras.
39
+ * Se false, emitirá o valor com a máscara formatada.
40
+ */
17
41
  unmask?: boolean;
42
+ /** Máscara customizada para o modo 'generic' (ex: '999.AAA-X'). */
18
43
  customMask?: string;
44
+ /** Classes CSS adicionais para o container principal. */
19
45
  class?: any;
46
+ /** Classes CSS adicionais para o elemento input interno. */
20
47
  inputClass?: any;
48
+ /**
49
+ * Controla a exibição do ícone de limpeza (X).
50
+ * @default true
51
+ */
52
+ withClearIcon?: boolean;
21
53
  }
22
54
  declare const _default: import('vue').DefineComponent<DocumentInputProps, {
23
55
  input: import('vue').Ref<any, any>;
@@ -45,6 +77,7 @@ declare const _default: import('vue').DefineComponent<DocumentInputProps, {
45
77
  documentType: DocumentType;
46
78
  withInternalValidation: boolean;
47
79
  unmask: boolean;
80
+ withClearIcon: boolean;
48
81
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
49
82
  inputRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('../input/Input.vue').InputProps> & Readonly<{
50
83
  "onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;