@agrotools1/at-components 0.6.69 → 0.6.72

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.
@@ -103,6 +103,10 @@ declare const _default: import('vue').DefineComponent<{
103
103
  type: BooleanConstructor;
104
104
  default: boolean;
105
105
  };
106
+ useSideClearButton: {
107
+ type: BooleanConstructor;
108
+ default: boolean;
109
+ };
106
110
  forceEventClearButton: {
107
111
  type: BooleanConstructor;
108
112
  default: boolean;
@@ -6227,6 +6231,7 @@ declare const _default: import('vue').DefineComponent<{
6227
6231
  };
6228
6232
  clickedClear: import('vue').Ref<boolean>;
6229
6233
  showClearButton: import('vue').ComputedRef<boolean | "" | undefined>;
6234
+ showSideClearButton: import('vue').ComputedRef<boolean | "" | undefined>;
6230
6235
  clearInput: () => void;
6231
6236
  containerItemsEl: import('vue').Ref<HTMLDivElement | null>;
6232
6237
  onInput: (event: InputEvent) => void;
@@ -6335,6 +6340,10 @@ declare const _default: import('vue').DefineComponent<{
6335
6340
  type: BooleanConstructor;
6336
6341
  default: boolean;
6337
6342
  };
6343
+ useSideClearButton: {
6344
+ type: BooleanConstructor;
6345
+ default: boolean;
6346
+ };
6338
6347
  forceEventClearButton: {
6339
6348
  type: BooleanConstructor;
6340
6349
  default: boolean;
@@ -6368,6 +6377,7 @@ declare const _default: import('vue').DefineComponent<{
6368
6377
  cursor: string;
6369
6378
  selectedItems: import('../Select/Item/Item').SelectItemProps[];
6370
6379
  useClearButton: boolean;
6380
+ useSideClearButton: boolean;
6371
6381
  forceEventClearButton: boolean;
6372
6382
  }, {}>;
6373
6383
  export default _default;
@@ -1,60 +1,60 @@
1
- import m from "./Input.core.vue2.js";
2
- import { resolveComponent as I, openBlock as n, createElementBlock as l, createElementVNode as r, createTextVNode as u, toDisplayString as i, createCommentVNode as d, Fragment as v, renderList as k, mergeProps as C, normalizeClass as T, createBlock as p, resolveDynamicComponent as y } from "vue";
1
+ import I from "./Input.core.vue2.js";
2
+ import { resolveComponent as k, openBlock as n, createElementBlock as l, createElementVNode as i, createTextVNode as a, toDisplayString as t, createCommentVNode as r, Fragment as C, renderList as v, mergeProps as T, normalizeClass as m, createBlock as d, resolveDynamicComponent as y } from "vue";
3
3
  import "./Input.core.vue3.js";
4
- import f from "../_virtual/_plugin-vue_export-helper.js";
5
- const $ = ["data-mode", "disabled"], h = ["for"], A = {
4
+ import $ from "../_virtual/_plugin-vue_export-helper.js";
5
+ const f = ["data-mode", "disabled"], A = ["for"], N = {
6
6
  key: 0,
7
7
  class: "AT-INPUT_required"
8
- }, F = ["title"], N = { class: "AT-INPUT_item_slot" }, O = ["onClick"], b = {
8
+ }, b = ["title"], F = { class: "AT-INPUT_item_slot" }, O = ["onClick"], P = {
9
9
  key: 0,
10
10
  class: "AT-INPUT_items_length"
11
- }, g = ["id", "disabled", "readonly", "type", "placeholder", "name", "value"], P = {
11
+ }, g = ["id", "disabled", "readonly", "type", "placeholder", "name", "value"], h = {
12
12
  key: 0,
13
13
  class: "AT-INPUT_error-message"
14
- }, M = ["src"];
15
- function U(e, s, B, E, z, S) {
16
- const a = I("AtCircleXMarkSolidIcon");
14
+ }, U = ["src"];
15
+ function B(e, s, M, S, z, E) {
16
+ const u = k("AtCircleXMarkSolidIcon");
17
17
  return n(), l("div", null, [
18
- r("div", {
18
+ i("div", {
19
19
  ref: "wrapperEl",
20
20
  "data-mode": e.currentMode,
21
21
  disabled: e.$props.disabled || void 0,
22
22
  class: "AT-INPUT_core",
23
- onMouseover: s[7] || (s[7] = (...o) => e.handleMouseOver && e.handleMouseOver(...o)),
24
- onMouseleave: s[8] || (s[8] = (...o) => e.handleMouseLeave && e.handleMouseLeave(...o))
23
+ onMouseover: s[9] || (s[9] = (...o) => e.handleMouseOver && e.handleMouseOver(...o)),
24
+ onMouseleave: s[10] || (s[10] = (...o) => e.handleMouseLeave && e.handleMouseLeave(...o))
25
25
  }, [
26
- r("label", {
26
+ i("label", {
27
27
  for: e.id,
28
28
  onClick: s[0] || (s[0] = (...o) => e.handleOnFocus && e.handleOnFocus(...o))
29
29
  }, [
30
- u(i(e.label) + " ", 1),
31
- e.$props.required ? (n(), l("span", A, "*")) : d("", !0)
32
- ], 8, h),
30
+ a(t(e.label) + " ", 1),
31
+ e.$props.required ? (n(), l("span", N, "*")) : r("", !0)
32
+ ], 8, A),
33
33
  e.separator ? (n(), l("div", {
34
34
  key: 0,
35
35
  ref: "containerItemsEl",
36
36
  class: "AT-INPUT_items",
37
37
  onClick: s[1] || (s[1] = (...o) => e.handleOnFocus && e.handleOnFocus(...o))
38
38
  }, [
39
- (n(!0), l(v, null, k(e.selectedItemsController.itemsToRender, (o) => (n(), l("span", {
39
+ (n(!0), l(C, null, v(e.selectedItemsController.itemsToRender, (o) => (n(), l("span", {
40
40
  key: o.value,
41
41
  ref_for: !0,
42
42
  ref: "selectedItemsEl",
43
43
  title: o.text,
44
44
  class: "AT-INPUT_item"
45
45
  }, [
46
- r("span", N, i(o.text), 1),
47
- r("span", {
46
+ i("span", F, t(o.text), 1),
47
+ i("span", {
48
48
  class: "AT-INPUT_item_slot_x",
49
49
  style: { padding: "1px 5px" },
50
50
  onClick: () => {
51
- var t;
52
- (t = e.onSelectedItemClick) == null || t.call(e, o == null ? void 0 : o.value);
51
+ var p;
52
+ (p = e.onSelectedItemClick) == null || p.call(e, o == null ? void 0 : o.value);
53
53
  }
54
54
  }, "x", 8, O)
55
- ], 8, F))), 128)),
56
- e.selectedItems.length > e.selectedItemsController.supportedItems ? (n(), l("span", b, "+ " + i(e.selectedItems.length - e.selectedItemsController.supportedItems), 1)) : d("", !0)
57
- ], 512)) : (n(), l("input", C({ key: 1 }, e.$attrs, {
55
+ ], 8, b))), 128)),
56
+ e.selectedItems.length > e.selectedItemsController.supportedItems ? (n(), l("span", P, "+ " + t(e.selectedItems.length - e.selectedItemsController.supportedItems), 1)) : r("", !0)
57
+ ], 512)) : (n(), l("input", T({ key: 1 }, e.$attrs, {
58
58
  id: e.id,
59
59
  ref: "inputEl",
60
60
  style: { cursor: e.cursor },
@@ -70,30 +70,41 @@ function U(e, s, B, E, z, S) {
70
70
  }), null, 16, g)),
71
71
  e.$props.icon ? (n(), l("div", {
72
72
  key: 2,
73
- class: T(["AT_INPUT_icon_slot", { clickable: e.useClearButton && e.isFocused }]),
74
- onClick: s[6] || (s[6] = (o) => e.showClearButton ? e.clearInput() : null)
73
+ class: m(["AT_INPUT_side_icon_slot", { clickable: e.useSideClearButton }]),
74
+ onClick: s[6] || (s[6] = (o) => e.showSideClearButton ? e.clearInput() : null)
75
75
  }, [
76
- e.showClearButton ? (n(), p(a, {
76
+ e.showSideClearButton ? (n(), d(u, {
77
77
  key: 0,
78
78
  size: "20",
79
79
  onClick: s[5] || (s[5] = (o) => e.clearInput())
80
- })) : (n(), p(y(e.icons[e.$props.icon.name]), {
80
+ })) : r("", !0)
81
+ ], 2)) : r("", !0),
82
+ e.$props.icon ? (n(), l("div", {
83
+ key: 3,
84
+ class: m(["AT_INPUT_icon_slot", { clickable: e.useClearButton && e.isFocused }]),
85
+ onClick: s[8] || (s[8] = (o) => e.showClearButton ? e.clearInput() : null)
86
+ }, [
87
+ e.showClearButton ? (n(), d(u, {
88
+ key: 0,
89
+ size: "20",
90
+ onClick: s[7] || (s[7] = (o) => e.clearInput())
91
+ })) : (n(), d(y(e.icons[e.$props.icon.name]), {
81
92
  key: 1,
82
93
  size: e.$props.icon.size || "20",
83
94
  color: e.iconColor
84
95
  }, null, 8, ["size", "color"]))
85
- ], 2)) : d("", !0)
86
- ], 40, $),
87
- e.error.value ? (n(), l("span", P, [
88
- r("img", {
96
+ ], 2)) : r("", !0)
97
+ ], 40, f),
98
+ e.error.value ? (n(), l("span", h, [
99
+ i("img", {
89
100
  src: e.icons.error,
90
101
  alt: "error icon"
91
- }, null, 8, M),
92
- u(" " + i(e.error.message), 1)
93
- ])) : d("", !0)
102
+ }, null, 8, U),
103
+ a(" " + t(e.error.message), 1)
104
+ ])) : r("", !0)
94
105
  ]);
95
106
  }
96
- const D = /* @__PURE__ */ f(m, [["render", U], ["__scopeId", "data-v-e61ec0fd"]]);
107
+ const X = /* @__PURE__ */ $(I, [["render", B], ["__scopeId", "data-v-d7890dba"]]);
97
108
  export {
98
- D as default
109
+ X as default
99
110
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as j, ref as u, computed as c, onMounted as z, onBeforeUnmount as N, watchEffect as U, watch as T, nextTick as D } from "vue";
2
- import { AtCircleXMarkSolidIcon as P } from "../node_modules/.pnpm/@agrotools1_at-icons@0.2.11/node_modules/@agrotools1/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
3
- import X from "../Icons/icons.js";
4
- import H from "./imgs/error.svg.js";
5
- const Y = j({
1
+ import { defineComponent as z, ref as u, computed as s, onMounted as N, onBeforeUnmount as U, watchEffect as D, watch as T, nextTick as P } from "vue";
2
+ import { AtCircleXMarkSolidIcon as X } from "../node_modules/.pnpm/@agrotools1_at-icons@0.2.11/node_modules/@agrotools1/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
3
+ import H from "../Icons/icons.js";
4
+ import G from "./imgs/error.svg.js";
5
+ const Z = z({
6
6
  name: "AtCoreInput",
7
7
  components: {
8
- AtCircleXMarkSolidIcon: P
8
+ AtCircleXMarkSolidIcon: X
9
9
  },
10
10
  props: {
11
11
  modelValue: {
@@ -85,6 +85,10 @@ const Y = j({
85
85
  type: Boolean,
86
86
  default: !1
87
87
  },
88
+ useSideClearButton: {
89
+ type: Boolean,
90
+ default: !1
91
+ },
88
92
  forceEventClearButton: {
89
93
  type: Boolean,
90
94
  default: !1
@@ -97,34 +101,36 @@ const Y = j({
97
101
  "clearInput",
98
102
  "mouseover"
99
103
  ],
100
- setup(e, { emit: d }) {
101
- const A = { ...X }, b = u(null), V = u(null), f = u(null), E = u(null), O = c(() => e.error), a = u(!1), i = u(""), s = u(!1), k = c(
102
- () => e.useClearButton && a.value && e.modelValue && !s.value
104
+ setup(e, { emit: c }) {
105
+ const A = { ...H }, B = u(null), V = u(null), f = u(null), b = u(null), O = s(() => e.error), a = u(!1), i = u(""), d = u(!1), E = s(
106
+ () => e.useClearButton && a.value && e.modelValue && !d.value
107
+ ), q = s(
108
+ () => e.useSideClearButton && !e.useClearButton && e.modelValue && !d.value
103
109
  ), y = u({
104
110
  supportedItems: e.selectedItems.length,
105
111
  isCounterActive: !1,
106
112
  itemsToRender: e.selectedItems
107
- }), q = Math.random().toString(36).substring(2), r = u(!1), F = () => {
108
- r.value = !0;
109
- }, M = () => {
110
- r.value = !1;
113
+ }), F = Math.random().toString(36).substring(2), o = u(!1), M = () => {
114
+ o.value = !0;
115
+ }, L = () => {
116
+ o.value = !1;
111
117
  }, g = () => {
112
118
  a.value = !0;
113
119
  }, v = () => {
114
- e.forceFocus || (e.forceEventClearButton ? a.value = !0 : w(() => {
120
+ e.forceFocus || (e.forceEventClearButton ? a.value = !0 : k(() => {
115
121
  a.value = !1;
116
122
  }, 100)());
117
123
  }, m = async () => {
118
- var S;
119
- y.value.itemsToRender = e.selectedItems, await D();
120
- const t = (S = f.value) == null ? void 0 : S.clientWidth;
124
+ var w;
125
+ y.value.itemsToRender = e.selectedItems, await P();
126
+ const t = (w = f.value) == null ? void 0 : w.clientWidth;
121
127
  if (t === void 0)
122
128
  return;
123
129
  let l = 50, n = 0;
124
- const o = E.value;
125
- if (o)
126
- for (let I = 0; I < o.length; I++)
127
- l += o[I].clientWidth + 10, l <= t && (n = I + 1);
130
+ const r = b.value;
131
+ if (r)
132
+ for (let I = 0; I < r.length; I++)
133
+ l += r[I].clientWidth + 10, l <= t && (n = I + 1);
128
134
  let C;
129
135
  l >= t ? C = {
130
136
  isCounterActive: l > (t || 0),
@@ -135,37 +141,37 @@ const Y = j({
135
141
  supportedItems: e.selectedItems.length,
136
142
  itemsToRender: e.selectedItems
137
143
  }, y.value = C;
138
- }, B = (t) => {
144
+ }, S = (t) => {
139
145
  var l, n;
140
- !((l = b.value) != null && l.contains(t.target)) && !((n = V.value) != null && n.contains(t.target)) && !k.value && !s.value && (v(), a.value = !1, d("clickOutside"));
146
+ !((l = B.value) != null && l.contains(t.target)) && !((n = V.value) != null && n.contains(t.target)) && !E.value && !d.value && (v(), a.value = !1, c("clickOutside"));
141
147
  };
142
- z(() => {
148
+ N(() => {
143
149
  var t;
144
- (e.modelValue !== void 0 && ((t = e.modelValue) != null && t.length) || e.forceFocus) && g(), document.addEventListener("click", B), window.addEventListener("resize", m);
145
- }), N(() => {
146
- document.removeEventListener("click", B), window.removeEventListener("resize", m);
150
+ (e.modelValue !== void 0 && ((t = e.modelValue) != null && t.length) || e.forceFocus) && g(), document.addEventListener("click", S), window.addEventListener("resize", m);
151
+ }), U(() => {
152
+ document.removeEventListener("click", S), window.removeEventListener("resize", m);
147
153
  });
148
- const L = (t) => {
154
+ const _ = (t) => {
149
155
  e.preventInputEvent && t.preventDefault();
150
156
  const l = t.target.value;
151
- d("input", t), e.debounce > 0 ? w(() => h(l), e.debounce)() : h(l);
157
+ c("input", t), e.debounce > 0 ? k(() => h(l), e.debounce)() : h(l);
152
158
  }, h = (t) => {
153
- d("update:modelValue", t), e.modelValue === void 0 && (i.value = t);
159
+ c("update:modelValue", t), e.modelValue === void 0 && (i.value = t);
154
160
  };
155
- function w(t, l) {
161
+ function k(t, l) {
156
162
  let n;
157
163
  return function() {
158
164
  clearTimeout(n), n = setTimeout(t, l);
159
165
  };
160
166
  }
161
- const _ = () => {
162
- s.value = !0, a.value = !1, d("clearInput"), setTimeout(() => {
163
- e.forceEventClearButton || h(""), s.value = !1;
167
+ const x = () => {
168
+ d.value = !0, a.value = !1, c("clearInput"), setTimeout(() => {
169
+ e.forceEventClearButton || h(""), d.value = !1;
164
170
  }, 100);
165
171
  };
166
- U(() => {
172
+ D(() => {
167
173
  var t, l;
168
- e.separator && ((e.modelValue !== void 0 ? e.modelValue.split(e.separator).filter((o) => o.length > 1) : i.value.split(e.separator).filter((o) => o.length > 1)).length ? (t = f.value) == null || t.classList.remove("AT-INPUT_items_empty") : ((l = f.value) == null || l.classList.add("AT-INPUT_items_empty"), v(), a.value = !1)), e.forceFocus ? g() : (v(), a.value = !1);
174
+ e.separator && ((e.modelValue !== void 0 ? e.modelValue.split(e.separator).filter((r) => r.length > 1) : i.value.split(e.separator).filter((r) => r.length > 1)).length ? (t = f.value) == null || t.classList.remove("AT-INPUT_items_empty") : ((l = f.value) == null || l.classList.add("AT-INPUT_items_empty"), v(), a.value = !1)), e.forceFocus ? g() : (v(), a.value = !1);
169
175
  }), T(
170
176
  () => e.selectedItems,
171
177
  async () => {
@@ -173,44 +179,45 @@ const Y = j({
173
179
  },
174
180
  { deep: !0 }
175
181
  ), T(
176
- () => r.value,
182
+ () => o.value,
177
183
  () => {
178
- d("mouseover", r.value);
184
+ c("mouseover", o.value);
179
185
  }
180
186
  );
181
- const x = c(() => {
187
+ const R = s(() => {
182
188
  var t;
183
- return e.disabled ? "var(--at-medium-grey)" : e.selectedItems.length > 0 ? "var(--at-black)" : a.value ? "var(--at-primary-color-2)" : e.error.value ? "var(--at-error)" : r.value || (t = e.icon) != null && t.color || e.modelValue !== void 0 && e.modelValue.length > 0 || i.value.length > 0 ? "var(--at-black)" : "var(--at-dark-grey)";
184
- }), R = c(() => e.disabled ? "disabled" : e.selectedItems.length > 0 ? "filled" : a.value ? "focused" : e.error.value ? "error" : r.value ? "hover" : e.modelValue !== void 0 && e.modelValue.length > 0 || i.value.length > 0 ? "filled" : "default"), W = c(() => e.modelValue !== void 0 ? e.modelValue : i.value ? i.value : null);
189
+ return e.disabled ? "var(--at-medium-grey)" : e.selectedItems.length > 0 ? "var(--at-black)" : a.value ? "var(--at-primary-color-2)" : e.error.value ? "var(--at-error)" : o.value || (t = e.icon) != null && t.color || e.modelValue !== void 0 && e.modelValue.length > 0 || i.value.length > 0 ? "var(--at-black)" : "var(--at-dark-grey)";
190
+ }), W = s(() => e.disabled ? "disabled" : e.selectedItems.length > 0 ? "filled" : a.value ? "focused" : e.error.value ? "error" : o.value ? "hover" : e.modelValue !== void 0 && e.modelValue.length > 0 || i.value.length > 0 ? "filled" : "default"), j = s(() => e.modelValue !== void 0 ? e.modelValue : i.value ? i.value : null);
185
191
  return {
186
- wrapperEl: b,
192
+ wrapperEl: B,
187
193
  inputEl: V,
188
194
  inputError: O,
189
- inputId: e.id ?? q,
195
+ inputId: e.id ?? F,
190
196
  handleOnFocus: g,
191
197
  handleOnFocusOut: v,
192
198
  icons: {
193
- error: H,
199
+ error: G,
194
200
  ...A
195
201
  },
196
- clickedClear: s,
197
- showClearButton: k,
198
- clearInput: _,
202
+ clickedClear: d,
203
+ showClearButton: E,
204
+ showSideClearButton: q,
205
+ clearInput: x,
199
206
  containerItemsEl: f,
200
- onInput: L,
201
- iconColor: x,
207
+ onInput: _,
208
+ iconColor: R,
202
209
  isFocused: a,
203
- handleMouseOver: F,
204
- handleMouseLeave: M,
205
- isHovered: r,
206
- inputComputedValue: W,
207
- currentMode: R,
208
- selectedItemsEl: E,
210
+ handleMouseOver: M,
211
+ handleMouseLeave: L,
212
+ isHovered: o,
213
+ inputComputedValue: j,
214
+ currentMode: W,
215
+ selectedItemsEl: b,
209
216
  selectedItemsController: y,
210
217
  resizeSelectedItems: m
211
218
  };
212
219
  }
213
220
  });
214
221
  export {
215
- Y as default
222
+ Z as default
216
223
  };
@@ -1,4 +1,4 @@
1
- const e = "";
1
+ const _ = "";
2
2
  export {
3
- e as default
3
+ _ as default
4
4
  };
@@ -90,6 +90,10 @@ export declare const AtInput: {
90
90
  type: BooleanConstructor;
91
91
  default: boolean;
92
92
  };
93
+ useSideClearButton: {
94
+ type: BooleanConstructor;
95
+ default: boolean;
96
+ };
93
97
  forceEventClearButton: {
94
98
  type: BooleanConstructor;
95
99
  default: boolean;
@@ -6214,6 +6218,7 @@ export declare const AtInput: {
6214
6218
  };
6215
6219
  clickedClear: import('vue').Ref<boolean>;
6216
6220
  showClearButton: import('vue').ComputedRef<boolean | "" | undefined>;
6221
+ showSideClearButton: import('vue').ComputedRef<boolean | "" | undefined>;
6217
6222
  clearInput: () => void;
6218
6223
  containerItemsEl: import('vue').Ref<HTMLDivElement | null>;
6219
6224
  onInput: (event: InputEvent) => void;
@@ -6328,6 +6333,10 @@ export declare const AtInput: {
6328
6333
  type: BooleanConstructor;
6329
6334
  default: boolean;
6330
6335
  };
6336
+ useSideClearButton: {
6337
+ type: BooleanConstructor;
6338
+ default: boolean;
6339
+ };
6331
6340
  forceEventClearButton: {
6332
6341
  type: BooleanConstructor;
6333
6342
  default: boolean;
@@ -6361,6 +6370,7 @@ export declare const AtInput: {
6361
6370
  cursor: string;
6362
6371
  selectedItems: import('../Select/Item/Item').SelectItemProps[];
6363
6372
  useClearButton: boolean;
6373
+ useSideClearButton: boolean;
6364
6374
  forceEventClearButton: boolean;
6365
6375
  }, {}>;
6366
6376
  };
@@ -87,7 +87,7 @@ declare const _default: import('vue').DefineComponent<{
87
87
  clear: () => void;
88
88
  openList: () => void;
89
89
  closeList: () => void;
90
- handleChangeValue: (value: string) => Promise<void>;
90
+ handleChangeValue: (value: string) => void;
91
91
  handleSelectedItem: (item: DropdownListItem) => void;
92
92
  }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("update:modelValue" | "onSelectedItem" | "onClear")[], "update:modelValue" | "onSelectedItem" | "onClear", import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<{
93
93
  label: {
@@ -46,7 +46,7 @@ function h(e, f, b, g, I, C) {
46
46
  }, 8, ["id", "drop-down-list", "is-open", "show-no-result-message", "msg-no-result", "onOnSave"])
47
47
  ], 2);
48
48
  }
49
- const V = /* @__PURE__ */ m(l, [["render", h], ["__scopeId", "data-v-8725bfbc"]]);
49
+ const V = /* @__PURE__ */ m(l, [["render", h], ["__scopeId", "data-v-17f99334"]]);
50
50
  export {
51
51
  V as default
52
52
  };
@@ -1,16 +1,16 @@
1
- import { defineComponent as B, ref as s, computed as n } from "vue";
2
- import { AtCircleXMarkSolidIcon as O } from "../node_modules/.pnpm/@agrotools1_at-icons@0.2.11/node_modules/@agrotools1/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
3
- import { AtSearchIcon as b } from "../node_modules/.pnpm/@agrotools1_at-icons@0.2.11/node_modules/@agrotools1/at-icons/dist/AtSearchIcon/index.js";
4
- import { AtInput as x } from "../Input/index.js";
5
- import E from "../List/components/List.vue.js";
1
+ import { defineComponent as B, ref as n, computed as u } from "vue";
2
+ import { AtCircleXMarkSolidIcon as b } from "../node_modules/.pnpm/@agrotools1_at-icons@0.2.11/node_modules/@agrotools1/at-icons/dist/AtCircleXMarkSolidIcon/index.js";
3
+ import { AtSearchIcon as E } from "../node_modules/.pnpm/@agrotools1_at-icons@0.2.11/node_modules/@agrotools1/at-icons/dist/AtSearchIcon/index.js";
4
+ import { AtInput as O } from "../Input/index.js";
5
+ import x from "../List/components/List.vue.js";
6
6
  const F = {
7
- AtSearchIcon: b,
8
- AtCircleXMarkSolidIcon: O
9
- }, N = B({
7
+ AtSearchIcon: E,
8
+ AtCircleXMarkSolidIcon: b
9
+ }, R = B({
10
10
  name: "AtSearch",
11
11
  components: {
12
- AtInput: x.Text,
13
- AtLista: E,
12
+ AtInput: O.Text,
13
+ AtLista: x,
14
14
  ...F
15
15
  },
16
16
  props: {
@@ -74,69 +74,71 @@ const F = {
74
74
  },
75
75
  emits: ["update:modelValue", "onSelectedItem", "onClear"],
76
76
  setup(t, { emit: a }) {
77
- const r = s([]), c = s(!1), u = s(null), v = n(
77
+ const r = n([]), c = n(!1), s = n(null), i = n(null), S = u(
78
78
  () => {
79
79
  var e;
80
80
  return c.value && t.hasAutoComplete && (!!t.modelValue || t.hasFilterOption) && !(!((e = p.value) != null && e.length) && I.value);
81
81
  }
82
- ), m = (e = "false") => {
82
+ ), h = (e = "false") => {
83
83
  var l;
84
84
  if (t.arrowIcon) {
85
- const d = (l = u.value) == null ? void 0 : l.querySelector(".AT_INPUT_icon_slot");
86
- if (!(d instanceof HTMLElement))
85
+ const f = (l = s.value) == null ? void 0 : l.querySelector(".AT_INPUT_icon_slot");
86
+ if (!(f instanceof HTMLElement))
87
87
  return;
88
- d.setAttribute("data-rotate", e);
88
+ f.setAttribute("data-rotate", e);
89
89
  }
90
- }, S = n(
90
+ }, y = u(
91
91
  () => t.arrowIcon ? { name: "AtAngleDownSolidIcon" } : { name: "AtSearchIcon" }
92
- ), y = () => {
92
+ ), g = () => {
93
93
  var e;
94
- c.value = !0, (e = u.value) == null || e.classList.add("focused"), m("true");
95
- }, g = () => {
94
+ c.value = !0, (e = s.value) == null || e.classList.add("focused"), h("true");
95
+ }, A = () => {
96
96
  var e;
97
97
  setTimeout(() => {
98
98
  c.value = !1;
99
- }, 200), (e = u.value) == null || e.classList.remove("focused"), m();
100
- }, o = s(!1), A = async (e) => {
101
- a("update:modelValue", e), t.searchEndpoint && (o.value = !0, r.value = await t.searchEndpoint(e), o.value = !1);
102
- }, p = n(() => {
99
+ }, 200), (e = s.value) == null || e.classList.remove("focused"), h();
100
+ }, o = n(!1), L = (e) => {
101
+ a("update:modelValue", e), t.searchEndpoint && (i.value && clearTimeout(i.value), i.value = setTimeout(async () => {
102
+ o.value = !0, t.searchEndpoint && (r.value = await t.searchEndpoint(e)), o.value = !1;
103
+ }, 300));
104
+ }, p = u(() => {
103
105
  var e;
104
106
  if (t.hasFilterOption) {
105
- const l = (f, h) => f.text.toUpperCase().includes(h.toUpperCase());
107
+ const l = (m, v) => m.text.toUpperCase().includes(v.toUpperCase());
106
108
  return t.autoCompleteList.filter(
107
- (f) => l(f, t.modelValue)
109
+ (m) => l(m, t.modelValue)
108
110
  );
109
111
  }
110
112
  return (e = r.value) != null && e.length ? r.value : t.autoCompleteList;
111
- }), i = s(), L = (e) => {
113
+ }), d = n(), C = (e) => {
112
114
  const l = e.text;
113
- i.value = e, a("onSelectedItem", e), a("update:modelValue", l);
114
- }, C = () => {
115
- a("onSelectedItem", null), a("onClear"), a("update:modelValue", ""), o.value = !1, i.value = null;
116
- }, I = n(
117
- () => t.withIcon && o.value && !i.value || t.isLoading
118
- ), V = n(
115
+ d.value = e, a("onSelectedItem", e), a("update:modelValue", l);
116
+ }, V = () => {
117
+ a("onSelectedItem", null), a("onClear"), a("update:modelValue", ""), o.value = !1, d.value = null;
118
+ }, I = u(
119
+ () => t.withIcon && o.value && !d.value || t.isLoading
120
+ ), w = u(
119
121
  () => t.isDisabled ? "var(--at-medium-grey)" : ""
120
- ), w = n(
122
+ ), T = u(
121
123
  () => !!t.modelValue && !o.value
122
124
  );
123
125
  return {
124
- atSearch: u,
125
- autocompleteListIsOpen: v,
126
+ atSearch: s,
127
+ autocompleteListIsOpen: S,
126
128
  autoCompleteListFiltered: p,
127
129
  isLoading: o,
128
130
  showSearchIcon: I,
129
- getShowNoResultMessage: w,
130
- getSearchIconColor: V,
131
- getInputIcon: S,
132
- clear: C,
133
- openList: y,
134
- closeList: g,
135
- handleChangeValue: A,
136
- handleSelectedItem: L
131
+ getShowNoResultMessage: T,
132
+ getSearchIconColor: w,
133
+ getInputIcon: y,
134
+ clear: V,
135
+ openList: g,
136
+ closeList: A,
137
+ handleChangeValue: L,
138
+ handleSelectedItem: C
137
139
  };
138
140
  }
139
141
  });
140
142
  export {
141
- N as default
143
+ R as default
142
144
  };