adverich-kun-ui 0.1.124 → 0.1.125

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,177 +1,175 @@
1
- import { getCurrentInstance as $, useSlots as D, resolveComponent as z, createElementBlock as l, openBlock as o, createCommentVNode as n, createElementVNode as d, normalizeClass as p, unref as t, toDisplayString as u, mergeProps as E, createBlock as g, renderSlot as w, Fragment as C, renderList as P } from "vue";
2
- import { KunNumberFieldProps as H } from "../composables/KunNumberFieldProps.js";
3
- import { useKunNumberField as L } from "../composables/useKunNumberFieldComposable.js";
4
- const q = { class: "w-full flex flex-col relative" }, G = {
1
+ import { getCurrentInstance as K, useSlots as D, createElementBlock as l, openBlock as r, createCommentVNode as n, createElementVNode as i, normalizeClass as p, unref as t, toDisplayString as u, mergeProps as z, createBlock as v, renderSlot as g, Fragment as w, renderList as E } from "vue";
2
+ import { KunNumberFieldProps as P } from "../composables/KunNumberFieldProps.js";
3
+ import { useKunNumberField as H } from "../composables/useKunNumberFieldComposable.js";
4
+ import C from "../../../KunIcon/src/components/KunIcon.vue.js";
5
+ const L = { class: "w-full flex flex-col relative" }, q = {
5
6
  key: 0,
6
7
  class: "h-full"
7
- }, J = ["disabled"], O = {
8
+ }, G = ["disabled"], J = {
8
9
  key: 1,
9
10
  class: "mr-2"
10
- }, Q = {
11
+ }, O = {
11
12
  key: 2,
12
13
  class: "flex items-center justify-center min-w-[32px] h-full px-1"
13
- }, R = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], T = ["disabled"], U = {
14
+ }, Q = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], R = ["disabled"], T = {
14
15
  key: 0,
15
16
  class: "flex items-center h-full"
16
- }, W = ["disabled"], X = ["disabled"], Y = {
17
+ }, U = ["disabled"], W = ["disabled"], X = {
17
18
  key: 1,
18
19
  class: "flex flex-col items-center justify-center border-l border-slate-600"
19
- }, Z = ["disabled"], _ = ["disabled"], ee = {
20
+ }, Y = ["disabled"], Z = ["disabled"], _ = {
20
21
  key: 5,
21
22
  class: "flex items-center justify-center min-w-[32px] h-full px-1"
22
- }, te = {
23
+ }, ee = {
23
24
  key: 6,
24
25
  class: "h-full"
25
- }, oe = ["disabled"], re = {
26
+ }, te = ["disabled"], re = {
26
27
  key: 7,
27
28
  class: "ml-2"
28
- }, se = {
29
+ }, oe = {
29
30
  key: 0,
30
31
  class: "h-[1.25rem]"
31
- }, le = {
32
+ }, se = {
32
33
  key: 0,
33
34
  class: "text-red-500 text-sm text-center"
34
- }, ne = { key: 0 }, de = { key: 1 }, ie = {
35
+ }, le = { key: 0 }, ne = { key: 1 }, ie = {
35
36
  key: 1,
36
37
  class: "text-xs text-center"
37
38
  }, be = {
38
39
  __name: "KunNumberField",
39
- props: H,
40
+ props: P,
40
41
  emits: ["update:modelValue"],
41
42
  setup(I, { emit: x }) {
42
- const V = I, j = x, b = `number-input-${$().uid}`, y = D(), A = !!y["prepend-icon"], F = !!y["append-icon"], {
43
+ const V = I, j = x, b = `number-input-${K().uid}`, y = D(), A = !!y["prepend-icon"], F = !!y["append-icon"], {
43
44
  inputValue: c,
44
- numberInput: K,
45
- inputKey: B,
46
- updateValue: M,
47
- onIncrement: i,
45
+ numberInput: B,
46
+ inputKey: M,
47
+ updateValue: N,
48
+ onIncrement: d,
48
49
  onDecrement: a,
49
- onClear: k,
50
- focus: f,
50
+ onClear: f,
51
+ focus: k,
51
52
  handleFocus: h,
52
- isActive: N,
53
+ isActive: S,
53
54
  handleBlur: m
54
- } = L(V, j);
55
- return (e, s) => {
56
- const v = z("KunIcon");
57
- return o(), l("div", q, [
58
- e.label ? (o(), l("label", {
59
- key: 0,
60
- for: b,
61
- class: p([
62
- e.labelColor,
63
- "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
64
- t(N) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
65
- ])
66
- }, u(e.label), 3)) : n("", !0),
67
- d("div", E({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
68
- d("div", {
69
- class: p(["flex items-center w-full h-full border", [
70
- e.bgInput,
71
- e.rounded,
72
- t(f) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
73
- e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
74
- e.error ? "bg-red-200 dark:bg-red-900" : ""
75
- ]])
76
- }, [
77
- !e.noArrows && e.controlVariant === "split" ? (o(), l("div", G, [
78
- d("button", {
55
+ } = H(V, j);
56
+ return (e, s) => (r(), l("div", L, [
57
+ e.label ? (r(), l("label", {
58
+ key: 0,
59
+ for: b,
60
+ class: p([
61
+ e.labelColor,
62
+ "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
63
+ t(S) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
64
+ ])
65
+ }, u(e.label), 3)) : n("", !0),
66
+ i("div", z({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
67
+ i("div", {
68
+ class: p(["flex items-center w-full h-full border", [
69
+ e.bgInput,
70
+ e.rounded,
71
+ t(k) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
72
+ e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
73
+ e.error ? "bg-red-200 dark:bg-red-900" : ""
74
+ ]])
75
+ }, [
76
+ !e.noArrows && e.controlVariant === "split" ? (r(), l("div", q, [
77
+ i("button", {
78
+ type: "button",
79
+ class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
80
+ onClick: s[0] || (s[0] = (...o) => t(a) && t(a)(...o)),
81
+ disabled: e.disabled || e.readonly
82
+ }, "−", 8, G)
83
+ ])) : n("", !0),
84
+ e.prefix ? (r(), l("div", J, u(e.prefix), 1)) : n("", !0),
85
+ e.prependIcon || A ? (r(), l("div", O, [
86
+ e.prependIcon ? (r(), v(C, { key: 0 })) : g(e.$slots, "prepend-icon", { key: 1 })
87
+ ])) : n("", !0),
88
+ (r(), l("input", {
89
+ id: b,
90
+ ref_key: "numberInput",
91
+ ref: B,
92
+ key: t(M),
93
+ type: "text",
94
+ value: t(c),
95
+ placeholder: e.placeholder,
96
+ readonly: e.readonly,
97
+ disabled: e.disabled,
98
+ maxlength: e.maxlength,
99
+ autocomplete: "off",
100
+ class: p(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
101
+ "aria-invalid": e.error ? "true" : "false",
102
+ onInput: s[1] || (s[1] = (o) => t(N)(o.target.value)),
103
+ onFocus: s[2] || (s[2] = (...o) => t(h) && t(h)(...o)),
104
+ onBlur: s[3] || (s[3] = (...o) => t(m) && t(m)(...o))
105
+ }, null, 42, Q)),
106
+ e.clearable && t(c) != null ? (r(), l("button", {
107
+ key: 3,
108
+ type: "button",
109
+ onClick: s[4] || (s[4] = (...o) => t(f) && t(f)(...o)),
110
+ class: p(["ml-2", e.textColor]),
111
+ disabled: e.disabled || e.readonly
112
+ }, " × ", 10, R)) : n("", !0),
113
+ e.noArrows ? n("", !0) : (r(), l(w, { key: 4 }, [
114
+ e.controlVariant === "default" ? (r(), l("div", T, [
115
+ i("button", {
79
116
  type: "button",
80
- class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
81
- onClick: s[0] || (s[0] = (...r) => t(a) && t(a)(...r)),
117
+ class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
118
+ onClick: s[5] || (s[5] = (...o) => t(d) && t(d)(...o)),
82
119
  disabled: e.disabled || e.readonly
83
- }, "", 8, J)
84
- ])) : n("", !0),
85
- e.prefix ? (o(), l("div", O, u(e.prefix), 1)) : n("", !0),
86
- e.prependIcon || A ? (o(), l("div", Q, [
87
- e.prependIcon ? (o(), g(v, { key: 0 })) : w(e.$slots, "prepend-icon", { key: 1 })
120
+ }, "", 8, U),
121
+ i("button", {
122
+ type: "button",
123
+ class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
124
+ onClick: s[6] || (s[6] = (...o) => t(a) && t(a)(...o)),
125
+ disabled: e.disabled || e.readonly
126
+ }, " ▼ ", 8, W)
88
127
  ])) : n("", !0),
89
- (o(), l("input", {
90
- id: b,
91
- ref_key: "numberInput",
92
- ref: K,
93
- key: t(B),
94
- type: "text",
95
- value: t(c),
96
- placeholder: e.placeholder,
97
- readonly: e.readonly,
98
- disabled: e.disabled,
99
- maxlength: e.maxlength,
100
- autocomplete: "off",
101
- class: p(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
102
- "aria-invalid": e.error ? "true" : "false",
103
- onInput: s[1] || (s[1] = (r) => t(M)(r.target.value)),
104
- onFocus: s[2] || (s[2] = (...r) => t(h) && t(h)(...r)),
105
- onBlur: s[3] || (s[3] = (...r) => t(m) && t(m)(...r))
106
- }, null, 42, R)),
107
- e.clearable && t(c) != null ? (o(), l("button", {
108
- key: 3,
109
- type: "button",
110
- onClick: s[4] || (s[4] = (...r) => t(k) && t(k)(...r)),
111
- class: p(["ml-2", e.textColor]),
112
- disabled: e.disabled || e.readonly
113
- }, " × ", 10, T)) : n("", !0),
114
- e.noArrows ? n("", !0) : (o(), l(C, { key: 4 }, [
115
- e.controlVariant === "default" ? (o(), l("div", U, [
116
- d("button", {
128
+ e.controlVariant === "stacked" ? (r(), l("div", X, [
129
+ i("div", {
130
+ class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
131
+ onClick: s[7] || (s[7] = (...o) => t(d) && t(d)(...o))
132
+ }, [
133
+ i("button", {
117
134
  type: "button",
118
- class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
119
- onClick: s[5] || (s[5] = (...r) => t(i) && t(i)(...r)),
135
+ class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
120
136
  disabled: e.disabled || e.readonly
121
- }, " ", 8, W),
122
- d("button", {
137
+ }, "▲", 8, Y)
138
+ ]),
139
+ i("div", {
140
+ class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
141
+ onClick: s[8] || (s[8] = (...o) => t(a) && t(a)(...o))
142
+ }, [
143
+ i("button", {
123
144
  type: "button",
124
- class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
125
- onClick: s[6] || (s[6] = (...r) => t(a) && t(a)(...r)),
145
+ class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
126
146
  disabled: e.disabled || e.readonly
127
- }, " ", 8, X)
128
- ])) : n("", !0),
129
- e.controlVariant === "stacked" ? (o(), l("div", Y, [
130
- d("div", {
131
- class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
132
- onClick: s[7] || (s[7] = (...r) => t(i) && t(i)(...r))
133
- }, [
134
- d("button", {
135
- type: "button",
136
- class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
137
- disabled: e.disabled || e.readonly
138
- }, "▲", 8, Z)
139
- ]),
140
- d("div", {
141
- class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
142
- onClick: s[8] || (s[8] = (...r) => t(a) && t(a)(...r))
143
- }, [
144
- d("button", {
145
- type: "button",
146
- class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
147
- disabled: e.disabled || e.readonly
148
- }, "", 8, _)
149
- ])
150
- ])) : n("", !0)
151
- ], 64)),
152
- e.appendIcon || F ? (o(), l("div", ee, [
153
- e.appendIcon ? (o(), g(v, { key: 0 })) : w(e.$slots, "append-icon", { key: 1 })
154
- ])) : n("", !0),
155
- !e.noArrows && e.controlVariant === "split" ? (o(), l("div", te, [
156
- d("button", {
157
- type: "button",
158
- class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
159
- onClick: s[9] || (s[9] = (...r) => t(i) && t(i)(...r)),
160
- disabled: e.disabled || e.readonly
161
- }, "+", 8, oe)
162
- ])) : n("", !0),
163
- e.suffix ? (o(), l("div", re, u(e.suffix), 1)) : n("", !0)
164
- ], 2),
165
- e.hideDetails ? n("", !0) : (o(), l("div", se, [
166
- e.error || e.errorMessages ? (o(), l("div", le, [
167
- Array.isArray(e.errorMessages) ? (o(), l("div", ne, [
168
- (o(!0), l(C, null, P(e.errorMessages, (r, S) => (o(), l("div", { key: S }, u(r), 1))), 128))
169
- ])) : typeof e.errorMessages == "string" ? (o(), l("div", de, u(e.errorMessages), 1)) : n("", !0)
170
- ])) : e.hint && (e.persistentHint || t(f)) ? (o(), l("div", ie, u(e.hint), 1)) : n("", !0)
171
- ]))
172
- ], 16)
173
- ]);
174
- };
147
+ }, "▼", 8, Z)
148
+ ])
149
+ ])) : n("", !0)
150
+ ], 64)),
151
+ e.appendIcon || F ? (r(), l("div", _, [
152
+ e.appendIcon ? (r(), v(C, { key: 0 })) : g(e.$slots, "append-icon", { key: 1 })
153
+ ])) : n("", !0),
154
+ !e.noArrows && e.controlVariant === "split" ? (r(), l("div", ee, [
155
+ i("button", {
156
+ type: "button",
157
+ class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
158
+ onClick: s[9] || (s[9] = (...o) => t(d) && t(d)(...o)),
159
+ disabled: e.disabled || e.readonly
160
+ }, "+", 8, te)
161
+ ])) : n("", !0),
162
+ e.suffix ? (r(), l("div", re, u(e.suffix), 1)) : n("", !0)
163
+ ], 2),
164
+ e.hideDetails ? n("", !0) : (r(), l("div", oe, [
165
+ e.error || e.errorMessages ? (r(), l("div", se, [
166
+ Array.isArray(e.errorMessages) ? (r(), l("div", le, [
167
+ (r(!0), l(w, null, E(e.errorMessages, (o, $) => (r(), l("div", { key: $ }, u(o), 1))), 128))
168
+ ])) : typeof e.errorMessages == "string" ? (r(), l("div", ne, u(e.errorMessages), 1)) : n("", !0)
169
+ ])) : e.hint && (e.persistentHint || t(k)) ? (r(), l("div", ie, u(e.hint), 1)) : n("", !0)
170
+ ]))
171
+ ], 16)
172
+ ]));
175
173
  }
176
174
  };
177
175
  export {
@@ -1,9 +1,9 @@
1
- import { getCurrentInstance as M, computed as d, useSlots as U, ref as H, createElementBlock as s, openBlock as o, createCommentVNode as r, createElementVNode as b, normalizeClass as a, toDisplayString as i, mergeProps as q, unref as t, renderSlot as c, withModifiers as G, createVNode as J } from "vue";
2
- import { icons as F } from "../../../../icons/index.js";
1
+ import { getCurrentInstance as R, computed as d, useSlots as U, ref as H, createElementBlock as s, openBlock as r, createCommentVNode as o, createElementVNode as h, normalizeClass as a, toDisplayString as i, mergeProps as q, unref as t, renderSlot as c, withModifiers as G, createVNode as J } from "vue";
2
+ import { icons as P } from "../../../../icons/index.js";
3
3
  import L from "../composables/KunTextFieldProps.js";
4
4
  import Q from "../composables/useKunTextFieldComposable.js";
5
- import R from "../../../KunIcon/src/components/KunIcon.vue.js";
6
- const W = { class: "w-full flex flex-col relative" }, X = {
5
+ import W from "../../../KunIcon/src/components/KunIcon.vue.js";
6
+ const X = {
7
7
  key: 0,
8
8
  class: "mr-2"
9
9
  }, Y = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "aria-invalid", "aria-describedby"], Z = ["disabled"], _ = {
@@ -32,65 +32,71 @@ const W = { class: "w-full flex flex-col relative" }, X = {
32
32
  "keyDown",
33
33
  "keyUp"
34
34
  ],
35
- setup(P, { expose: V, emit: j }) {
36
- const u = P, p = j, {
35
+ setup(V, { expose: j, emit: B }) {
36
+ const u = V, p = B, {
37
37
  inputField: k,
38
38
  inputValue: f,
39
- inputFocused: h,
40
- validationError: B,
39
+ rootRef: w,
40
+ inputFocused: b,
41
+ validationError: D,
41
42
  hasError: m,
42
- handleInput: w,
43
- handleBlur: g,
44
- focusInput: C,
45
- validate: D,
46
- reset: E,
47
- resetValidation: K,
48
- clearInput: I
43
+ handleInput: g,
44
+ handleBlur: C,
45
+ focusInput: I,
46
+ validate: E,
47
+ reset: K,
48
+ resetValidation: S,
49
+ clearInput: $
49
50
  } = Q(u, p);
50
- V({
51
- validate: D,
52
- reset: E,
53
- resetValidation: K,
54
- inputField: k
51
+ j({
52
+ validate: E,
53
+ reset: K,
54
+ resetValidation: S,
55
+ inputField: k,
56
+ rootRef: w
55
57
  });
56
- const y = `input-${M().uid}`, S = d(() => h.value || !!f.value || u.dirty), x = U(), T = d(() => !!x["prepend-inner"]), N = d(() => !!x["append-inner"]), v = H(!1), O = d(() => v.value ? F.eyeOffOutline : F.eyeOutline);
57
- function z() {
58
+ const y = `input-${R().uid}`, T = d(() => b.value || !!f.value || u.dirty), x = U(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = H(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
59
+ function A() {
58
60
  v.value = !v.value;
59
61
  }
60
- const A = d(() => u.type === "password" ? v.value ? "text" : "password" : u.type);
62
+ const M = d(() => u.type === "password" ? v.value ? "text" : "password" : u.type);
61
63
  return (e, l) => {
62
- var $;
63
- return o(), s("div", W, [
64
- e.label ? (o(), s("label", {
64
+ var F;
65
+ return r(), s("div", {
66
+ class: "w-full flex flex-col relative",
67
+ ref_key: "rootRef",
68
+ ref: w
69
+ }, [
70
+ e.label ? (r(), s("label", {
65
71
  key: 0,
66
72
  for: y,
67
73
  class: a([
68
74
  e.labelColor,
69
75
  "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
70
- S.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
76
+ T.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
71
77
  ])
72
- }, i(e.label), 3)) : r("", !0),
73
- b("div", q({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
74
- b("div", {
78
+ }, i(e.label), 3)) : o("", !0),
79
+ h("div", q({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
80
+ h("div", {
75
81
  class: a(["flex flex-row items-center w-full h-full border", [
76
82
  e.bgInput,
77
83
  e.rounded,
78
- t(h) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
84
+ t(b) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
79
85
  e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
80
86
  t(m) ? "bg-red-200 dark:bg-red-900" : ""
81
87
  ]])
82
88
  }, [
83
- e.prefix ? (o(), s("div", X, i(e.prefix), 1)) : r("", !0),
84
- T.value ? (o(), s("div", {
89
+ e.prefix ? (r(), s("div", X, i(e.prefix), 1)) : o("", !0),
90
+ N.value ? (r(), s("div", {
85
91
  key: 1,
86
92
  class: a([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
87
93
  }, [
88
94
  c(e.$slots, "prepend-inner")
89
- ], 2)) : r("", !0),
90
- b("input", {
95
+ ], 2)) : o("", !0),
96
+ h("input", {
91
97
  ref_key: "inputField",
92
98
  ref: k,
93
- type: A.value,
99
+ type: M.value,
94
100
  value: t(f),
95
101
  id: y,
96
102
  placeholder: e.placeholder,
@@ -98,48 +104,48 @@ const W = { class: "w-full flex flex-col relative" }, X = {
98
104
  readonly: e.readonly,
99
105
  maxlength: e.maxlength,
100
106
  autocomplete: "off",
101
- class: a(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
107
+ class: a(["w-full h-full bg-transparent focus:outline-none p-3", [e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
102
108
  "aria-invalid": t(m) ? "true" : "false",
103
109
  "aria-describedby": t(m) ? `error-${y}` : null,
104
- onInput: l[0] || (l[0] = (...n) => t(w) && t(w)(...n)),
105
- onBlur: l[1] || (l[1] = (...n) => t(g) && t(g)(...n)),
106
- onFocus: l[2] || (l[2] = (...n) => t(C) && t(C)(...n)),
110
+ onInput: l[0] || (l[0] = (...n) => t(g) && t(g)(...n)),
111
+ onBlur: l[1] || (l[1] = (...n) => t(C) && t(C)(...n)),
112
+ onFocus: l[2] || (l[2] = (...n) => t(I) && t(I)(...n)),
107
113
  onClick: l[3] || (l[3] = G((n) => p("handleClick"), ["stop"])),
108
114
  onKeydown: l[4] || (l[4] = (n) => p("keyDown", n)),
109
115
  onKeyup: l[5] || (l[5] = (n) => p("keyUp", n))
110
116
  }, null, 42, Y),
111
- e.clearable && t(f) ? (o(), s("button", {
117
+ e.clearable && t(f) ? (r(), s("button", {
112
118
  key: 2,
113
119
  type: "button",
114
- onClick: l[6] || (l[6] = (...n) => t(I) && t(I)(...n)),
120
+ onClick: l[6] || (l[6] = (...n) => t($) && t($)(...n)),
115
121
  class: a(["ml-2", e.textColor]),
116
122
  disabled: e.disabled || e.readonly
117
- }, " × ", 10, Z)) : r("", !0),
123
+ }, " × ", 10, Z)) : o("", !0),
118
124
  c(e.$slots, "default"),
119
- e.type === "password" && e.showPasswordToggle ? (o(), s("div", _, [
120
- J(R, {
121
- icon: O.value,
122
- onClick: z
125
+ e.type === "password" && e.showPasswordToggle ? (r(), s("div", _, [
126
+ J(W, {
127
+ icon: z.value,
128
+ onClick: A
123
129
  }, null, 8, ["icon"])
124
- ])) : r("", !0),
125
- N.value ? (o(), s("div", {
130
+ ])) : o("", !0),
131
+ O.value ? (r(), s("div", {
126
132
  key: 4,
127
133
  class: a([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
128
134
  }, [
129
135
  c(e.$slots, "append-inner")
130
- ], 2)) : r("", !0),
131
- e.suffix ? (o(), s("div", ee, i(e.suffix), 1)) : r("", !0)
136
+ ], 2)) : o("", !0),
137
+ e.suffix ? (r(), s("div", ee, i(e.suffix), 1)) : o("", !0)
132
138
  ], 2),
133
- e.hideDetails ? r("", !0) : (o(), s("div", te, [
134
- t(m) ? (o(), s("div", {
139
+ e.hideDetails ? o("", !0) : (r(), s("div", te, [
140
+ t(m) ? (r(), s("div", {
135
141
  key: 0,
136
142
  id: `error-${y}`,
137
143
  class: "text-red-500 text-sm text-center"
138
- }, i(t(B) || e.errorMessage), 9, le)) : e.hint && (e.persistentHint || t(h)) ? (o(), s("div", ne, i(e.hint), 1)) : r("", !0),
139
- e.counter && e.maxlength ? (o(), s("div", se, i((($ = t(f)) == null ? void 0 : $.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
144
+ }, i(t(D) || e.errorMessage), 9, le)) : e.hint && (e.persistentHint || t(b)) ? (r(), s("div", ne, i(e.hint), 1)) : o("", !0),
145
+ e.counter && e.maxlength ? (r(), s("div", se, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : o("", !0)
140
146
  ]))
141
147
  ], 16)
142
- ]);
148
+ ], 512);
143
149
  };
144
150
  }
145
151
  };
@@ -1,13 +1,13 @@
1
- import { ref as n, inject as V, computed as x, watch as F, onUnmounted as E } from "vue";
2
- import { debounce as T } from "../../../../utils/utils.js";
3
- function P(u, r) {
4
- const t = n(u.modelValue), o = n(!1), l = n(""), a = n(!1), g = n(null), s = n(!1), d = V("registerField", null), v = V("unregisterField", null), h = x(() => u.error || !!l.value && a.value), c = async () => {
1
+ import { ref as a, inject as V, computed as E, watch as F, onUnmounted as T } from "vue";
2
+ import { debounce as j } from "../../../../utils/utils.js";
3
+ function R(u, r) {
4
+ const t = a(u.modelValue), o = a(!1), l = a(""), n = a(!1), g = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), y = E(() => u.error || !!l.value && n.value), c = async () => {
5
5
  for (const e of u.rules) {
6
6
  const m = await Promise.resolve(e(t.value));
7
7
  if (m !== !0) return m;
8
8
  }
9
9
  return !0;
10
- }, f = T(async () => {
10
+ }, f = j(async () => {
11
11
  const e = await c();
12
12
  l.value = e === !0 ? "" : e;
13
13
  }, u.debounce ?? 300);
@@ -18,45 +18,46 @@ function P(u, r) {
18
18
  s.value = !1;
19
19
  return;
20
20
  }
21
- a.value = !0, r("update:modelValue", t.value), u.validateOnBlur || f();
21
+ n.value = !0, r("update:modelValue", t.value), u.validateOnBlur || f();
22
22
  });
23
- const y = (e) => {
23
+ const I = (e) => {
24
24
  t.value = e.target.value;
25
- }, I = async () => {
25
+ }, b = async () => {
26
26
  if (o.value = !1, r("blurInput"), u.validateOnBlur) {
27
27
  const e = await c();
28
28
  l.value = e === !0 ? "" : e;
29
29
  }
30
- }, b = () => {
31
- o.value = !0, r("focusInput");
32
30
  }, w = () => {
33
- t.value = "", r("update:modelValue", ""), a.value = !0, u.validateOnBlur || f();
31
+ o.value = !0, r("focusInput");
32
+ }, B = () => {
33
+ t.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
34
34
  }, i = async () => {
35
- a.value = !0;
35
+ n.value = !0;
36
36
  const e = await c();
37
37
  return l.value = e === !0 ? "" : e, e === !0;
38
- }, B = () => {
39
- t.value = u.modelValue, a.value = !1, l.value = "";
40
38
  }, O = () => {
41
- a.value = !1, l.value = "";
39
+ t.value = u.modelValue, n.value = !1, l.value = "";
40
+ }, x = () => {
41
+ n.value = !1, l.value = "";
42
42
  };
43
- return d && d({ validate: i }), E(() => {
43
+ return d && d({ validate: i }), T(() => {
44
44
  v && v({ validate: i });
45
45
  }), {
46
46
  inputField: g,
47
47
  inputValue: t,
48
+ rootRef: h,
48
49
  inputFocused: o,
49
50
  validationError: l,
50
- hasError: h,
51
- handleInput: y,
52
- handleBlur: I,
53
- focusInput: b,
51
+ hasError: y,
52
+ handleInput: I,
53
+ handleBlur: b,
54
+ focusInput: w,
54
55
  validate: i,
55
- reset: B,
56
- resetValidation: O,
57
- clearInput: w
56
+ reset: O,
57
+ resetValidation: x,
58
+ clearInput: B
58
59
  };
59
60
  }
60
61
  export {
61
- P as default
62
+ R as default
62
63
  };