@agrotools1/at-components 2.0.32 → 2.0.34

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":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAmB3C,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"}
@@ -0,0 +1,4 @@
1
+ import { VersionData } from '../../types';
2
+ declare const v2_0_34: VersionData;
3
+ export default v2_0_34;
4
+ //# sourceMappingURL=v2.0.34.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.0.34.d.ts","sourceRoot":"","sources":["../../../../src/changelog/versions/components/v2.0.34.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,QAAA,MAAM,OAAO,EAAE,WA2Bd,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -7,7 +7,7 @@ interface Props {
7
7
  * Tipo de documento. Define máscara e validação.
8
8
  * @default 'cpf-cnpj'
9
9
  */
10
- documentType?: 'cpf' | 'cnpj' | 'cpf-cnpj' | 'generic';
10
+ documentType?: 'cpf' | 'cnpj' | 'cpf-cnpj' | 'generic' | 'custom';
11
11
  /** Texto do rótulo (label) acima do campo. */
12
12
  label?: string;
13
13
  /** Texto de ajuda ou descrição abaixo do campo. */
@@ -90,6 +90,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
90
90
  blur: (event: FocusEvent) => any;
91
91
  focus: (event: FocusEvent) => any;
92
92
  validate: (isValid: boolean) => any;
93
+ "update:searchTerm": (value: string) => any;
93
94
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
94
95
  onClear?: (() => any) | undefined;
95
96
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
@@ -97,6 +98,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
97
98
  onBlur?: ((event: FocusEvent) => any) | undefined;
98
99
  onFocus?: ((event: FocusEvent) => any) | undefined;
99
100
  onValidate?: ((isValid: boolean) => any) | undefined;
101
+ "onUpdate:searchTerm"?: ((value: string) => any) | undefined;
100
102
  }>, {
101
103
  disabled: boolean;
102
104
  toUpperCase: boolean;
@@ -104,7 +106,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
104
106
  error: boolean | string;
105
107
  withIcon: boolean;
106
108
  allowAlpha: boolean;
107
- documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic";
109
+ documentType: "cpf" | "cnpj" | "cpf-cnpj" | "generic" | "custom";
108
110
  withInternalValidation: boolean;
109
111
  unmask: boolean;
110
112
  withClearIcon: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentAutoComplete.vue.d.ts","sourceRoot":"","sources":["../../src/document-input/DocumentAutoComplete.vue"],"names":[],"mappings":"AAmnBA,UAAU,KAAK;IACb,8BAA8B;I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j2BR,OAAO;iBAeJ,OAAO;aARX,OAAO;WAFT,OAAO,GAAG,MAAM;cAuBb,OAAO;gBAnBL,OAAO;kBAjBL,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ;4BAsCxC,OAAO;YAVvB,OAAO;mBA4BA,OAAO;cALZ,MAAM;;;kBAg0BjB,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,14 +1,14 @@
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";
1
+ import { defineComponent as ie, useId as ue, ref as v, watch as ce, computed as U, createElementBlock as g, openBlock as i, normalizeClass as S, unref as a, createBlock as T, createCommentVNode as y, createVNode as d, withCtx as m, createTextVNode as Z, toDisplayString as k, mergeProps as pe, createElementVNode as _, renderSlot as A, 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";
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";
3
+ import { AtCheckCircleRegularIcon as ge } from "../packages/at-icons/dist/AtCheckCircleRegularIcon/index.js";
4
+ import { AtCheckSolidIcon as ye } from "../packages/at-icons/dist/AtCheckSolidIcon/index.js";
5
+ import { AtCircleXMarkRegularIcon as ve } 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";
7
+ import { reactiveOmit as Te } from "@vueuse/core";
8
8
  import { useForwardPropsEmits as ke } from "reka-ui";
9
- import we from "../combobox/Combobox.vue.js";
9
+ import Ae 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,12 +16,12 @@ 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,
23
23
  class: "py-6 flex items-center justify-center text-sm text-gray-500"
24
- }, Ze = { class: "flex items-center gap-2" }, at = /* @__PURE__ */ ie({
24
+ }, Ze = { class: "flex items-center gap-2" }, rt = /* @__PURE__ */ ie({
25
25
  __name: "DocumentAutoComplete",
26
26
  props: {
27
27
  id: {},
@@ -50,9 +50,9 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
50
50
  optionId: { default: "identifier" },
51
51
  withClearIcon: { type: Boolean, default: !0 }
52
52
  },
53
- emits: ["update:modelValue", "select", "validate", "blur", "focus", "clear"],
53
+ emits: ["update:modelValue", "update:searchTerm", "select", "validate", "blur", "focus", "clear"],
54
54
  setup(H, { emit: J }) {
55
- 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 = Te(
56
56
  e,
57
57
  "modelValue",
58
58
  "documentType",
@@ -76,52 +76,54 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
76
76
  "loadingText",
77
77
  "optionId",
78
78
  "modelValue"
79
- ), W = ke(Q, s), i = y(""), V = y(!1), I = y(!1), L = y(!1), $ = y(null), M = y(e.modelValue);
80
- function Y(t, a) {
81
- if (!a) return t;
82
- const l = t.replace(/[^0-9A-Za-z]/g, "");
83
- if (!l) return "";
84
- let c = "", o = 0;
85
- for (let p = 0; p < a.length && o < l.length; p++) {
86
- const u = a[p], d = l[o];
87
- 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 = ke(Q, o), s = v(""), V = v(!1), I = v(!1), E = v(!1), $ = v(null), M = v(e.modelValue);
80
+ function Y(t, l) {
81
+ if (!l) return t;
82
+ const r = t.replace(/[^0-9A-Za-z]/g, "");
83
+ if (!r) return "";
84
+ let f = "", n = 0;
85
+ for (let c = 0; c < l.length && n < r.length; c++) {
86
+ const u = l[c], p = r[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++);
88
88
  }
89
- return c;
89
+ return f;
90
90
  }
91
- function j(t) {
91
+ function L(t) {
92
92
  if (e.customMask && e.documentType === "generic")
93
93
  return Y(t, e.customMask);
94
- const a = /[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 && 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;
96
96
  }
97
97
  const P = (t) => {
98
- if (!t) return i.value || "";
98
+ if (!t) return s.value || "";
99
+ if (e.documentType === "custom")
100
+ return typeof t == "string" ? t : t.text || t.label || t.identifier || t.value || "";
99
101
  if (typeof t == "string") {
100
- const c = t.replace(
102
+ const l = t.replace(
101
103
  e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
102
104
  ""
103
105
  );
104
- return j(c);
106
+ return L(l);
105
107
  }
106
- const l = (t.identifier || t.value || t.text || "").replace(
107
- e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
108
- ""
109
- );
110
- return j(l);
108
+ return t.text || t.label || t.identifier || t.value || "";
111
109
  };
112
110
  ce(
113
111
  () => e.modelValue,
114
112
  (t) => {
115
113
  if (M.value = t, t == null || t === "") {
116
- i.value !== "" && (i.value = ""), M.value = void 0;
114
+ s.value !== "" && (s.value = ""), M.value = void 0;
117
115
  return;
118
116
  }
119
- const a = P(t);
120
- i.value !== a && (i.value = a);
117
+ const l = P(t);
118
+ s.value !== l && (s.value = l);
121
119
  },
122
120
  { immediate: !0 }
123
121
  );
124
- const ee = U(() => e.maxLength ? e.maxLength : e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18), te = U(() => {
122
+ const ee = U(() => {
123
+ if (e.maxLength) return e.maxLength;
124
+ if (e.documentType !== "custom")
125
+ return e.customMask && e.documentType === "generic" ? e.customMask.length : e.documentType === "cpf" ? 14 : 18;
126
+ }), te = U(() => {
125
127
  switch (e.documentType) {
126
128
  case "cnpj":
127
129
  return e.allowAlpha ? "AA.AAA.AAA/AAAA-DV" : "00.000.000/0000-00";
@@ -132,134 +134,147 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
132
134
  default:
133
135
  return;
134
136
  }
135
- }), g = U(() => {
137
+ }), h = U(() => {
136
138
  if (e.error) return !0;
139
+ if (e.documentType === "custom") return !1;
137
140
  if (e.withInternalValidation) {
138
141
  const t = e.modelValue;
139
142
  if (!t || I.value) return !1;
140
- const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
141
- if (!l) return !1;
142
- 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))
143
+ const r = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
144
+ if (!r) return !1;
145
+ if (r.length === 11 && !x(r) || r.length === 14 && !w(r) || E.value && (e.documentType === "cpf" && r.length !== 11 || e.documentType === "cnpj" && r.length !== 14 || e.documentType === "cpf-cnpj" && r.length !== 11 && r.length !== 14))
143
146
  return !0;
144
147
  }
145
148
  return !1;
146
- }), B = U(() => {
147
- if (g.value) return !1;
149
+ }), j = U(() => {
150
+ if (h.value) return !1;
148
151
  if (e.success) return !0;
152
+ if (e.documentType === "custom") return !1;
149
153
  if (e.withInternalValidation) {
150
154
  const t = e.modelValue;
151
155
  if (!t) return !1;
152
- const l = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
153
- if (e.documentType === "cpf") return x(l);
154
- if (e.documentType === "cnpj") return T(l);
156
+ const r = (typeof t == "string" ? t : t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
157
+ if (e.documentType === "cpf") return x(r);
158
+ if (e.documentType === "cnpj") return w(r);
155
159
  if (e.documentType === "cpf-cnpj")
156
- return l.length === 11 ? x(l) : T(l);
160
+ return r.length === 11 ? x(r) : w(r);
157
161
  }
158
162
  return !1;
159
163
  });
160
164
  function D(t) {
161
- let a = !1;
162
- 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);
165
+ if (e.documentType === "custom") {
166
+ o("validate", !!t);
167
+ return;
168
+ }
169
+ let l = !1;
170
+ 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);
163
171
  }
164
172
  function le(t) {
165
- const a = t.target;
166
- let l = a.value;
167
- const c = a.selectionStart || 0;
168
- I.value = !1, e.toUpperCase && (l = l.toUpperCase());
169
- let o = l.replace(
173
+ const l = t.target;
174
+ let r = l.value;
175
+ const f = l.selectionStart || 0;
176
+ if (I.value = !1, e.toUpperCase && (r = r.toUpperCase()), e.documentType === "custom") {
177
+ o("update:modelValue", r || void 0), o("update:searchTerm", r), s.value = r;
178
+ return;
179
+ }
180
+ let n = r.replace(
170
181
  e.documentType === "generic" && e.customMask || e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g,
171
182
  ""
172
- ), p = e.maxLength;
173
- p || (e.customMask && e.documentType === "generic" ? p = e.customMask.length : p = e.documentType === "cpf" ? 11 : 14), o = o.slice(0, p);
174
- 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;
175
- s("update:modelValue", se), D(o), i.value = u, E(() => {
176
- a.value = u;
177
- let Z = 0, N = 0;
178
- 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++)
183
+ ), c = e.maxLength;
184
+ c || (e.customMask && e.documentType === "generic" ? c = e.customMask.length : c = e.documentType === "cpf" ? 11 : 14), n = n.slice(0, c);
185
+ const u = L(n), p = e.allowAlpha ? /[A-Z0-9]/gi : /[0-9]/g, ne = (r.slice(0, f).match(p) || []).length, se = (e.unmask ? n : u) || void 0;
186
+ o("update:modelValue", se), o("update:searchTerm", n), D(n), s.value = u, z(() => {
187
+ l.value = u;
188
+ let B = 0, N = 0;
189
+ 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++, B = b + 1, !(N >= ne)); b++)
179
190
  ;
180
- a.setSelectionRange(Z, Z);
191
+ l.setSelectionRange(B, B);
181
192
  });
182
193
  }
183
- function ae(t) {
184
- i.value = "", M.value = null, s("update:modelValue", null), E(() => {
194
+ function re(t) {
195
+ s.value = "", o("update:searchTerm", ""), M.value = null, o("update:modelValue", null), z(() => {
185
196
  if (!$.value) return;
186
- 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");
187
- l && (l.value = "", l.dispatchEvent(new Event("input", { bubbles: !0 }))), E(() => {
197
+ const l = $.value.querySelector(`[id="${C}"]`) || $.value.querySelector("input"), r = (l == null ? void 0 : l.tagName) === "INPUT" ? l : l == null ? void 0 : l.querySelector("input");
198
+ r && (r.value = "", r.dispatchEvent(new Event("input", { bubbles: !0 }))), z(() => {
188
199
  V.value = !1;
189
200
  });
190
- }), I.value = !0, s("validate", !1), s("clear"), V.value = !1;
201
+ }), I.value = !0, o("validate", !1), o("clear"), V.value = !1;
191
202
  }
192
- function re(t) {
203
+ function ae(t) {
193
204
  if (!t) {
194
- i.value = "", I.value = !0, s("update:modelValue", null);
205
+ s.value = "", o("update:searchTerm", ""), I.value = !0, o("update:modelValue", null);
195
206
  return;
196
207
  }
197
- s("update:modelValue", t), s("select", t);
198
- const l = (t.identifier || t.value || t.text || "").replace(/[^A-Z0-9]/gi, "");
199
- i.value = j(l), D(l), V.value = !1;
208
+ if (o("update:modelValue", t), o("select", t), s.value = t.text || t.label || t.identifier || t.value || "", e.documentType === "custom")
209
+ o("update:searchTerm", s.value), o("validate", !0);
210
+ else {
211
+ const l = (t.identifier || t.value || "").replace(/[^A-Z0-9]/gi, "");
212
+ o("update:searchTerm", l), D(l);
213
+ }
214
+ V.value = !1;
200
215
  }
201
216
  function oe(t) {
202
- L.value = !0, s("blur", t);
203
- const a = i.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
204
- let l = !1;
205
- a.length === 11 ? l = x(a) : a.length === 14 && (l = T(a)), l && s("update:modelValue", e.toUpperCase ? a.toUpperCase() : a);
217
+ if (E.value = !0, o("blur", t), e.documentType === "custom") return;
218
+ const l = s.value.replace(e.allowAlpha ? /[^A-Z0-9]/gi : /[^0-9]/g, "");
219
+ let r = !1;
220
+ l.length === 11 ? r = x(l) : l.length === 14 && (r = w(l)), r && o("update:modelValue", e.toUpperCase ? l.toUpperCase() : l);
206
221
  }
207
- return (t, a) => (n(), h("div", {
208
- class: S(r(F)("space-y-1.5 w-full", e.class)),
222
+ return (t, l) => (i(), g("div", {
223
+ class: S(a(F)("space-y-1.5 w-full", e.class)),
209
224
  ref_key: "wrapperRef",
210
225
  ref: $
211
226
  }, [
212
- e.label ? (n(), A(r(Me), {
227
+ e.label ? (i(), T(a(Me), {
213
228
  key: 0,
214
- for: r(C),
229
+ for: a(C),
215
230
  class: S(
216
- r(F)(
231
+ a(F)(
217
232
  "text-[#101011] font-normal text-[10px] leading-[10px]",
218
- g.value ? "text-[var(--alert-red-dark,#831511)]" : ""
233
+ h.value ? "text-[var(--alert-red-dark,#831511)]" : ""
219
234
  )
220
235
  )
221
236
  }, {
222
237
  default: m(() => [
223
- z(k(e.label), 1),
224
- e.required && !e.label.includes("(Obrigatório)") ? (n(), h("span", Be, " (Obrigatório)")) : v("", !0)
238
+ Z(k(e.label), 1),
239
+ e.required && !e.label.includes("(Obrigatório)") ? (i(), g("span", Be, " (Obrigatório)")) : y("", !0)
225
240
  ]),
226
241
  _: 1
227
- }, 8, ["for", "class"])) : v("", !0),
228
- f(r(we), pe(r(W), {
242
+ }, 8, ["for", "class"])) : y("", !0),
243
+ d(a(Ae), pe(a(W), {
229
244
  "model-value": M.value,
230
- searchTerm: i.value,
231
- "onUpdate:searchTerm": a[3] || (a[3] = (l) => i.value = l),
245
+ searchTerm: s.value,
246
+ "onUpdate:searchTerm": l[3] || (l[3] = (r) => s.value = r),
232
247
  open: V.value,
233
- "onUpdate:open": a[4] || (a[4] = (l) => V.value = l),
248
+ "onUpdate:open": l[4] || (l[4] = (r) => V.value = r),
234
249
  "reset-search-term-on-select": !1,
235
250
  "filter-function": () => !0,
236
- "onUpdate:modelValue": re
251
+ "onUpdate:modelValue": ae
237
252
  }), {
238
253
  default: m(() => [
239
254
  _("div", Ue, [
240
- f(r(xe), { class: "w-full h-full" }, {
255
+ d(a(xe), { class: "w-full h-full" }, {
241
256
  default: m(() => [
242
- w(t.$slots, "input", {}, () => [
243
- f(r(Ve), {
244
- id: r(C),
257
+ A(t.$slots, "input", {}, () => [
258
+ d(a(Ve), {
259
+ id: a(C),
245
260
  "display-value": P,
246
- placeholder: e.placeholder || te.value,
261
+ placeholder: e.placeholder ?? te.value,
247
262
  "with-icon": e.withIcon,
248
263
  "with-clear-button": !1,
249
264
  disabled: e.disabled,
250
- error: g.value,
251
- success: B.value,
265
+ error: h.value,
266
+ success: j.value,
252
267
  class: S(
253
- r(F)(
268
+ a(F)(
254
269
  "pr-20",
255
- g.value || B.value ? "border-[#3E2E46]" : "",
270
+ h.value || j.value ? "border-[#3E2E46]" : "",
256
271
  e.inputClass
257
272
  )
258
273
  ),
259
274
  maxlength: ee.value,
260
275
  onInput: le,
261
276
  onBlur: oe,
262
- onFocus: a[0] || (a[0] = (l) => s("focus", l))
277
+ onFocus: l[0] || (l[0] = (r) => o("focus", r))
263
278
  }, null, 8, ["id", "placeholder", "with-icon", "disabled", "error", "success", "class", "maxlength"])
264
279
  ])
265
280
  ]),
@@ -268,69 +283,69 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
268
283
  _("div", {
269
284
  class: S(["absolute right-9 flex items-center justify-center z-10 h-10 w-6", e.disabled ? "pointer-events-none opacity-40" : ""])
270
285
  }, [
271
- (g.value || e.modelValue && !B.value) && !e.disabled && e.withClearIcon ? (n(), h("div", {
286
+ (h.value || e.modelValue && !j.value) && !e.disabled && e.withClearIcon ? (i(), g("div", {
272
287
  key: 0,
273
288
  class: "flex items-center justify-center w-full h-full cursor-pointer",
274
- onMousedown: a[1] || (a[1] = q((l) => !e.disabled && ae(), ["stop", "prevent"])),
275
- onClick: a[2] || (a[2] = q(() => {
289
+ onMousedown: l[1] || (l[1] = q((r) => !e.disabled && re(), ["stop", "prevent"])),
290
+ onClick: l[2] || (l[2] = q(() => {
276
291
  }, ["stop", "prevent"]))
277
292
  }, [
278
- g.value ? (n(), A(r(R), {
293
+ h.value ? (i(), T(a(R), {
279
294
  key: 0,
280
295
  size: "20",
281
296
  class: "text-[var(--alert-red-dark,#831511)] transition-opacity hover:opacity-80"
282
- })) : (n(), A(r(ye), {
297
+ })) : (i(), T(a(ve), {
283
298
  key: 1,
284
299
  size: "20",
285
300
  class: "text-gray-400 transition-colors hover:text-[#831511]"
286
301
  }))
287
- ], 32)) : B.value ? (n(), A(r(he), {
302
+ ], 32)) : j.value ? (i(), T(a(ge), {
288
303
  key: 1,
289
304
  size: "20",
290
305
  class: "text-[#4b715c] pointer-events-none"
291
- })) : v("", !0)
306
+ })) : y("", !0)
292
307
  ], 2)
293
308
  ]),
294
- w(t.$slots, "list", {}, () => [
295
- f(r(Ie), null, {
309
+ A(t.$slots, "list", {}, () => [
310
+ d(a(Ie), null, {
296
311
  default: m(() => [
297
- e.loading && (e.loadingText || t.$slots.loading) ? (n(), h("div", Se, [
298
- w(t.$slots, "loading", {}, () => [
312
+ e.loading && (e.loadingText || t.$slots.loading) ? (i(), g("div", Se, [
313
+ A(t.$slots, "loading", {}, () => [
299
314
  _("div", Ze, [
300
- f(r(je), { class: "size-4 animate-spin" }),
315
+ d(a(je), { class: "size-4 animate-spin" }),
301
316
  _("span", null, k(e.loadingText), 1)
302
317
  ])
303
318
  ])
304
- ])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (n(), A(r(Te), { key: 1 }, {
319
+ ])) : !e.loading && (e.notFoundText || t.$slots.empty) ? (i(), T(a(we), { key: 1 }, {
305
320
  default: m(() => [
306
- w(t.$slots, "empty", {}, () => [
307
- z(k(e.notFoundText), 1)
321
+ A(t.$slots, "empty", {}, () => [
322
+ Z(k(e.notFoundText), 1)
308
323
  ])
309
324
  ]),
310
325
  _: 3
311
- })) : v("", !0),
312
- de(f(r($e), null, {
326
+ })) : y("", !0),
327
+ de(d(a($e), null, {
313
328
  default: m(() => [
314
- f(r(Ce), null, {
329
+ d(a(Ce), null, {
315
330
  default: m(() => [
316
- w(t.$slots, "default", {}, () => [
317
- e.options && e.options.length ? (n(!0), h(fe, { key: 0 }, me(e.options, (l, c) => (n(), A(r(be), {
318
- key: l[e.optionId] || c,
319
- value: l
331
+ A(t.$slots, "default", {}, () => [
332
+ e.options && e.options.length ? (i(!0), g(fe, { key: 0 }, me(e.options, (r, f) => (i(), T(a(be), {
333
+ key: r[e.optionId] || f,
334
+ value: r
320
335
  }, {
321
336
  default: m(() => [
322
- w(t.$slots, "option", { item: l }, () => [
323
- z(k(l.text || l.label || l), 1)
337
+ A(t.$slots, "option", { item: r }, () => [
338
+ Z(k(r.text || r.label || r), 1)
324
339
  ]),
325
- f(r(_e), { class: "ml-auto" }, {
340
+ d(a(_e), { class: "ml-auto" }, {
326
341
  default: m(() => [
327
- f(r(ve), { size: "16" })
342
+ d(a(ye), { size: "16" })
328
343
  ]),
329
344
  _: 1
330
345
  })
331
346
  ]),
332
347
  _: 2
333
- }, 1032, ["value"]))), 128)) : v("", !0)
348
+ }, 1032, ["value"]))), 128)) : y("", !0)
334
349
  ])
335
350
  ]),
336
351
  _: 3
@@ -338,7 +353,7 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
338
353
  ]),
339
354
  _: 3
340
355
  }, 512), [
341
- [ge, !e.loading]
356
+ [he, !e.loading]
342
357
  ])
343
358
  ]),
344
359
  _: 3
@@ -347,25 +362,25 @@ const Be = { key: 0 }, Ue = { class: "relative flex items-center" }, Se = {
347
362
  ]),
348
363
  _: 3
349
364
  }, 16, ["model-value", "searchTerm", "open"]),
350
- e.description && !g.value ? (n(), h("div", {
365
+ e.description && !h.value ? (i(), g("div", {
351
366
  key: 1,
352
367
  id: K,
353
368
  class: "text-gray-500 text-[11px] leading-tight"
354
- }, k(e.description), 1)) : v("", !0),
355
- typeof e.error == "string" && g.value ? (n(), h("div", {
369
+ }, k(e.description), 1)) : y("", !0),
370
+ typeof e.error == "string" && h.value ? (i(), g("div", {
356
371
  key: 2,
357
372
  id: G,
358
373
  class: "text-[var(--alert-red-dark,#831511)] flex items-center gap-1 text-[11px] font-medium leading-tight pt-0.5"
359
374
  }, [
360
- f(r(R), {
375
+ d(a(R), {
361
376
  size: "14",
362
377
  class: "text-[var(--alert-red-dark,#831511)] shrink-0"
363
378
  }),
364
379
  _("span", null, k(e.error), 1)
365
- ])) : v("", !0)
380
+ ])) : y("", !0)
366
381
  ], 2));
367
382
  }
368
383
  });
369
384
  export {
370
- at as default
385
+ rt as default
371
386
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agrotools1/at-components",
3
3
  "type": "module",
4
- "version": "2.0.32",
4
+ "version": "2.0.34",
5
5
  "private": false,
6
6
  "description": "Componentes da Agrotools - Versão 2 (com re-export da V1)",
7
7
  "author": "Agrotools",
@@ -57,8 +57,8 @@
57
57
  "tw-animate-css": "^1.3.4",
58
58
  "vue-component-type-helpers": "^2.2.0",
59
59
  "vue-sonner": "^2.0.8",
60
- "@agrotools1/at-icons": "1.0.13",
61
- "@agrotools1/at-tailwind-config": "0.2.0"
60
+ "@agrotools1/at-tailwind-config": "0.2.0",
61
+ "@agrotools1/at-icons": "1.0.13"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@internationalized/date": "^3.8.2",