@vue-interface/input-field 1.0.0-beta.2 → 1.0.0-beta.21

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,802 +1,127 @@
1
- import { defineComponent as E, inject as nt, openBlock as u, createElementBlock as o, normalizeClass as x, normalizeStyle as rt, createElementVNode as j, createBlock as T, resolveDynamicComponent as ut, createCommentVNode as a, toDisplayString as H, resolveComponent as st, resolveDirective as ot, renderSlot as d, withDirectives as at, mergeProps as lt, createVNode as dt, Transition as ct, withCtx as ht } from "vue";
2
- function c(t, e = "px") {
3
- return t != null && t !== !1 && isFinite(t) ? `${t}${e}` : t;
4
- }
5
- const ft = E({
6
- props: {
7
- absolute: Boolean,
8
- center: Boolean,
9
- label: String,
10
- size: {
11
- type: String,
12
- default: "md"
13
- },
14
- registry: {
15
- type: String,
16
- default: "indicators"
17
- },
18
- type: {
19
- type: String,
20
- required: !0
21
- },
22
- height: [String, Number],
23
- maxHeight: [String, Number],
24
- minHeight: [String, Number],
25
- width: [String, Number],
26
- maxWidth: [String, Number],
27
- minWidth: [String, Number]
28
- },
29
- data: () => ({
30
- is: null
31
- }),
32
- setup(t) {
33
- return {
34
- registryInstance: nt(t.registry || "indicators")
35
- };
36
- },
37
- computed: {
38
- classes() {
39
- return {
40
- "activity-indicator-center": this.center,
41
- "activity-indicator-absolute": this.absolute,
42
- [this.size && `activity-indicator-${this.size}`]: !!this.size
43
- };
44
- },
45
- style() {
46
- return {
47
- width: c(this.width),
48
- maxWidth: c(this.maxWidth),
49
- minWidth: c(this.minWidth),
50
- height: c(this.height),
51
- maxHeight: c(this.maxHeight),
52
- minHeight: c(this.minHeight)
53
- };
54
- }
55
- },
56
- async mounted() {
57
- const t = await this.component();
58
- this.is = () => t;
59
- },
60
- methods: {
61
- async component() {
62
- let t = this.registryInstance.get(this.type);
63
- return t instanceof Promise ? t : (typeof t == "function" && (t = await t()), t.default ? t.default : t);
64
- }
65
- }
66
- }), pt = (t, e) => {
67
- const i = t.__vccOpts || t;
68
- for (const [r, n] of e)
69
- i[r] = n;
70
- return i;
71
- }, vt = { class: "activity-indicator-content" }, gt = {
72
- key: 1,
73
- class: "activity-indicator-label"
74
- };
75
- function yt(t, e, i, r, n, s) {
76
- return u(), o("div", {
77
- class: x(["activity-indicator", t.classes]),
78
- style: rt(t.style)
79
- }, [
80
- j("div", vt, [
81
- t.is ? (u(), T(ut(t.is()), {
82
- key: 0,
83
- class: "mx-auto"
84
- })) : a("", !0),
85
- t.label ? (u(), o("div", gt, H(t.label), 1)) : a("", !0)
86
- ])
87
- ], 6);
88
- }
89
- const bt = /* @__PURE__ */ pt(ft, [["render", yt]]);
90
- var mt = Object.defineProperty, Ct = (t, e, i) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, Et = (t, e, i) => (Ct(t, typeof e != "symbol" ? e + "" : e, i), i), C = function() {
91
- return C = Object.assign || function(t) {
92
- for (var e, i = 1, r = arguments.length; i < r; i++) {
93
- e = arguments[i];
94
- for (var n in e)
95
- Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
96
- }
97
- return t;
98
- }, C.apply(this, arguments);
99
- };
100
- function $t(t) {
101
- return t.toLowerCase();
102
- }
103
- var At = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], St = /[^A-Z0-9]+/gi;
104
- function Ft(t, e) {
105
- e === void 0 && (e = {});
106
- for (var i = e.splitRegexp, r = i === void 0 ? At : i, n = e.stripRegexp, s = n === void 0 ? St : n, y = e.transform, $ = y === void 0 ? $t : y, l = e.delimiter, it = l === void 0 ? " " : l, b = w(w(t, r, "$1\0$2"), s, "\0"), A = 0, S = b.length; b.charAt(A) === "\0"; )
107
- A++;
108
- for (; b.charAt(S - 1) === "\0"; )
109
- S--;
110
- return b.slice(A, S).split("\0").map($).join(it);
111
- }
112
- function w(t, e, i) {
113
- return e instanceof RegExp ? t.replace(e, i) : e.reduce(function(r, n) {
114
- return r.replace(n, i);
115
- }, t);
116
- }
117
- function xt(t, e) {
118
- return e === void 0 && (e = {}), Ft(t, C({ delimiter: "." }, e));
119
- }
120
- function m(t, e) {
121
- return e === void 0 && (e = {}), xt(t, C({ delimiter: "-" }, e));
122
- }
123
- class jt {
124
- constructor(e = {}) {
125
- Et(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(e).forEach(([i, r]) => {
126
- this.register(i, r);
127
- });
128
- }
129
- get(e) {
130
- const i = this.components.get(
131
- e = m(e)
132
- );
133
- if (i)
134
- return i;
135
- throw new Error(`"${e}" has not been registered yet!`);
136
- }
137
- register(e, i) {
138
- return typeof e == "object" ? (Object.entries(e).forEach(([r, n]) => {
139
- this.register(m(r), n);
140
- }), this) : (this.components.set(m(e), i), this);
141
- }
142
- remove(e) {
143
- return this.components.delete(m(e)), this;
144
- }
145
- reset() {
146
- return this.components = /* @__PURE__ */ new Map(), this;
147
- }
148
- }
149
- function wt(t = {}) {
150
- return new jt(t);
151
- }
152
- wt();
153
- const p = {};
154
- function v(...t) {
155
- if (!t.length)
156
- return p;
157
- const [e, i] = t;
158
- return typeof e == "string" ? typeof p[e] < "u" ? p[e] : i : Array.isArray(e) ? e.reduce((r, n) => Object.assign(r, {
159
- [n]: p[n]
160
- }), {}) : Object.assign(p, ...t);
161
- }
162
- const Dt = E({
163
- props: {
164
- dropShadow: {
165
- type: [Boolean, String],
166
- default: void 0
167
- },
168
- dropShadowableClassPrefix: {
169
- type: String,
170
- default: "drop-shadow"
171
- },
172
- shadow: {
173
- type: [Boolean, String],
174
- default: void 0
175
- },
176
- shadowableClassPrefix: {
177
- type: String,
178
- default: "shadow"
179
- }
180
- },
181
- computed: {
182
- shadowableClass() {
183
- const t = this.dropShadow === !0 ? "" : this.dropShadow && `-${this.dropShadow}`, e = this.shadow === !0 ? "" : this.shadow && `-${this.shadow}`;
184
- return {
185
- [`${this.dropShadowableClassPrefix}${t}`]: !!this.dropShadow,
186
- [`${this.shadowableClassPrefix}${e}`]: !!this.shadow
187
- };
188
- }
189
- }
190
- });
191
- var kt = typeof global == "object" && global && global.Object === Object && global;
192
- const Ot = kt;
193
- var zt = typeof self == "object" && self && self.Object === Object && self, Bt = Ot || zt || Function("return this")();
194
- const It = Bt;
195
- var Lt = It.Symbol;
196
- const f = Lt;
197
- var Z = Object.prototype, Nt = Z.hasOwnProperty, Tt = Z.toString, g = f ? f.toStringTag : void 0;
198
- function Ht(t) {
199
- var e = Nt.call(t, g), i = t[g];
200
- try {
201
- t[g] = void 0;
202
- var r = !0;
203
- } catch {
204
- }
205
- var n = Tt.call(t);
206
- return r && (e ? t[g] = i : delete t[g]), n;
207
- }
208
- var Zt = Object.prototype, Mt = Zt.toString;
209
- function Rt(t) {
210
- return Mt.call(t);
211
- }
212
- var Ut = "[object Null]", Pt = "[object Undefined]", D = f ? f.toStringTag : void 0;
213
- function Vt(t) {
214
- return t == null ? t === void 0 ? Pt : Ut : D && D in Object(t) ? Ht(t) : Rt(t);
215
- }
216
- function Wt(t) {
217
- return t != null && typeof t == "object";
218
- }
219
- var Gt = "[object Symbol]";
220
- function qt(t) {
221
- return typeof t == "symbol" || Wt(t) && Vt(t) == Gt;
222
- }
223
- function Yt(t, e) {
224
- for (var i = -1, r = t == null ? 0 : t.length, n = Array(r); ++i < r; )
225
- n[i] = e(t[i], i, t);
226
- return n;
227
- }
228
- var _t = Array.isArray;
229
- const Jt = _t;
230
- var Kt = 1 / 0, k = f ? f.prototype : void 0, O = k ? k.toString : void 0;
231
- function M(t) {
232
- if (typeof t == "string")
233
- return t;
234
- if (Jt(t))
235
- return Yt(t, M) + "";
236
- if (qt(t))
237
- return O ? O.call(t) : "";
238
- var e = t + "";
239
- return e == "0" && 1 / t == -Kt ? "-0" : e;
240
- }
241
- function R(t) {
242
- return t == null ? "" : M(t);
243
- }
244
- function Qt(t, e, i, r) {
245
- var n = -1, s = t == null ? 0 : t.length;
246
- for (r && s && (i = t[++n]); ++n < s; )
247
- i = e(i, t[n], n, t);
248
- return i;
249
- }
250
- function Xt(t) {
251
- return function(e) {
252
- return t == null ? void 0 : t[e];
253
- };
254
- }
255
- var te = {
256
- \u00C0: "A",
257
- \u00C1: "A",
258
- \u00C2: "A",
259
- \u00C3: "A",
260
- \u00C4: "A",
261
- \u00C5: "A",
262
- \u00E0: "a",
263
- \u00E1: "a",
264
- \u00E2: "a",
265
- \u00E3: "a",
266
- \u00E4: "a",
267
- \u00E5: "a",
268
- \u00C7: "C",
269
- \u00E7: "c",
270
- \u00D0: "D",
271
- \u00F0: "d",
272
- \u00C8: "E",
273
- \u00C9: "E",
274
- \u00CA: "E",
275
- \u00CB: "E",
276
- \u00E8: "e",
277
- \u00E9: "e",
278
- \u00EA: "e",
279
- \u00EB: "e",
280
- \u00CC: "I",
281
- \u00CD: "I",
282
- \u00CE: "I",
283
- \u00CF: "I",
284
- \u00EC: "i",
285
- \u00ED: "i",
286
- \u00EE: "i",
287
- \u00EF: "i",
288
- \u00D1: "N",
289
- \u00F1: "n",
290
- \u00D2: "O",
291
- \u00D3: "O",
292
- \u00D4: "O",
293
- \u00D5: "O",
294
- \u00D6: "O",
295
- \u00D8: "O",
296
- \u00F2: "o",
297
- \u00F3: "o",
298
- \u00F4: "o",
299
- \u00F5: "o",
300
- \u00F6: "o",
301
- \u00F8: "o",
302
- \u00D9: "U",
303
- \u00DA: "U",
304
- \u00DB: "U",
305
- \u00DC: "U",
306
- \u00F9: "u",
307
- \u00FA: "u",
308
- \u00FB: "u",
309
- \u00FC: "u",
310
- \u00DD: "Y",
311
- \u00FD: "y",
312
- \u00FF: "y",
313
- \u00C6: "Ae",
314
- \u00E6: "ae",
315
- \u00DE: "Th",
316
- \u00FE: "th",
317
- \u00DF: "ss",
318
- \u0100: "A",
319
- \u0102: "A",
320
- \u0104: "A",
321
- \u0101: "a",
322
- \u0103: "a",
323
- \u0105: "a",
324
- \u0106: "C",
325
- \u0108: "C",
326
- \u010A: "C",
327
- \u010C: "C",
328
- \u0107: "c",
329
- \u0109: "c",
330
- \u010B: "c",
331
- \u010D: "c",
332
- \u010E: "D",
333
- \u0110: "D",
334
- \u010F: "d",
335
- \u0111: "d",
336
- \u0112: "E",
337
- \u0114: "E",
338
- \u0116: "E",
339
- \u0118: "E",
340
- \u011A: "E",
341
- \u0113: "e",
342
- \u0115: "e",
343
- \u0117: "e",
344
- \u0119: "e",
345
- \u011B: "e",
346
- \u011C: "G",
347
- \u011E: "G",
348
- \u0120: "G",
349
- \u0122: "G",
350
- \u011D: "g",
351
- \u011F: "g",
352
- \u0121: "g",
353
- \u0123: "g",
354
- \u0124: "H",
355
- \u0126: "H",
356
- \u0125: "h",
357
- \u0127: "h",
358
- \u0128: "I",
359
- \u012A: "I",
360
- \u012C: "I",
361
- \u012E: "I",
362
- \u0130: "I",
363
- \u0129: "i",
364
- \u012B: "i",
365
- \u012D: "i",
366
- \u012F: "i",
367
- \u0131: "i",
368
- \u0134: "J",
369
- \u0135: "j",
370
- \u0136: "K",
371
- \u0137: "k",
372
- \u0138: "k",
373
- \u0139: "L",
374
- \u013B: "L",
375
- \u013D: "L",
376
- \u013F: "L",
377
- \u0141: "L",
378
- \u013A: "l",
379
- \u013C: "l",
380
- \u013E: "l",
381
- \u0140: "l",
382
- \u0142: "l",
383
- \u0143: "N",
384
- \u0145: "N",
385
- \u0147: "N",
386
- \u014A: "N",
387
- \u0144: "n",
388
- \u0146: "n",
389
- \u0148: "n",
390
- \u014B: "n",
391
- \u014C: "O",
392
- \u014E: "O",
393
- \u0150: "O",
394
- \u014D: "o",
395
- \u014F: "o",
396
- \u0151: "o",
397
- \u0154: "R",
398
- \u0156: "R",
399
- \u0158: "R",
400
- \u0155: "r",
401
- \u0157: "r",
402
- \u0159: "r",
403
- \u015A: "S",
404
- \u015C: "S",
405
- \u015E: "S",
406
- \u0160: "S",
407
- \u015B: "s",
408
- \u015D: "s",
409
- \u015F: "s",
410
- \u0161: "s",
411
- \u0162: "T",
412
- \u0164: "T",
413
- \u0166: "T",
414
- \u0163: "t",
415
- \u0165: "t",
416
- \u0167: "t",
417
- \u0168: "U",
418
- \u016A: "U",
419
- \u016C: "U",
420
- \u016E: "U",
421
- \u0170: "U",
422
- \u0172: "U",
423
- \u0169: "u",
424
- \u016B: "u",
425
- \u016D: "u",
426
- \u016F: "u",
427
- \u0171: "u",
428
- \u0173: "u",
429
- \u0174: "W",
430
- \u0175: "w",
431
- \u0176: "Y",
432
- \u0177: "y",
433
- \u0178: "Y",
434
- \u0179: "Z",
435
- \u017B: "Z",
436
- \u017D: "Z",
437
- \u017A: "z",
438
- \u017C: "z",
439
- \u017E: "z",
440
- \u0132: "IJ",
441
- \u0133: "ij",
442
- \u0152: "Oe",
443
- \u0153: "oe",
444
- \u0149: "'n",
445
- \u017F: "s"
446
- }, ee = Xt(te);
447
- const ie = ee;
448
- var ne = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, re = "\\u0300-\\u036f", ue = "\\ufe20-\\ufe2f", se = "\\u20d0-\\u20ff", oe = re + ue + se, ae = "[" + oe + "]", le = RegExp(ae, "g");
449
- function de(t) {
450
- return t = R(t), t && t.replace(ne, ie).replace(le, "");
451
- }
452
- var ce = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
453
- function he(t) {
454
- return t.match(ce) || [];
455
- }
456
- var fe = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
457
- function pe(t) {
458
- return fe.test(t);
459
- }
460
- var U = "\\ud800-\\udfff", ve = "\\u0300-\\u036f", ge = "\\ufe20-\\ufe2f", ye = "\\u20d0-\\u20ff", be = ve + ge + ye, P = "\\u2700-\\u27bf", V = "a-z\\xdf-\\xf6\\xf8-\\xff", me = "\\xac\\xb1\\xd7\\xf7", Ce = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ee = "\\u2000-\\u206f", $e = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", W = "A-Z\\xc0-\\xd6\\xd8-\\xde", Ae = "\\ufe0e\\ufe0f", G = me + Ce + Ee + $e, q = "['\u2019]", z = "[" + G + "]", Se = "[" + be + "]", Y = "\\d+", Fe = "[" + P + "]", _ = "[" + V + "]", J = "[^" + U + G + Y + P + V + W + "]", xe = "\\ud83c[\\udffb-\\udfff]", je = "(?:" + Se + "|" + xe + ")", we = "[^" + U + "]", K = "(?:\\ud83c[\\udde6-\\uddff]){2}", Q = "[\\ud800-\\udbff][\\udc00-\\udfff]", h = "[" + W + "]", De = "\\u200d", B = "(?:" + _ + "|" + J + ")", ke = "(?:" + h + "|" + J + ")", I = "(?:" + q + "(?:d|ll|m|re|s|t|ve))?", L = "(?:" + q + "(?:D|LL|M|RE|S|T|VE))?", X = je + "?", tt = "[" + Ae + "]?", Oe = "(?:" + De + "(?:" + [we, K, Q].join("|") + ")" + tt + X + ")*", ze = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", Be = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", Ie = tt + X + Oe, Le = "(?:" + [Fe, K, Q].join("|") + ")" + Ie, Ne = RegExp([
461
- h + "?" + _ + "+" + I + "(?=" + [z, h, "$"].join("|") + ")",
462
- ke + "+" + L + "(?=" + [z, h + B, "$"].join("|") + ")",
463
- h + "?" + B + "+" + I,
464
- h + "+" + L,
465
- Be,
466
- ze,
467
- Y,
468
- Le
469
- ].join("|"), "g");
470
- function Te(t) {
471
- return t.match(Ne) || [];
472
- }
473
- function He(t, e, i) {
474
- return t = R(t), e = i ? void 0 : e, e === void 0 ? pe(t) ? Te(t) : he(t) : t.match(e) || [];
475
- }
476
- var Ze = "['\u2019]", Me = RegExp(Ze, "g");
477
- function Re(t) {
478
- return function(e) {
479
- return Qt(He(de(e).replace(Me, "")), t, "");
480
- };
481
- }
482
- var Ue = Re(function(t, e, i) {
483
- return t + (i ? "-" : "") + e.toLowerCase();
484
- });
485
- const et = Ue;
486
- function F(t, e, i = "-") {
487
- const r = String(e).replace(new RegExp(`^${t}${i}?`), "");
488
- return [
489
- et(r),
490
- t
491
- ].filter((n) => !!n).join(i);
492
- }
493
- function N(t) {
494
- return !Array.isArray(t) && typeof t == "object";
495
- }
496
- function Pe(t) {
497
- return t === void 0;
498
- }
499
- const Ve = E({
500
- directives: {
501
- bindEvents: {
502
- beforeMount(t, e) {
503
- var i, r;
504
- (r = (i = e.instance) == null ? void 0 : i.bindEvents) == null || r.call(i, t);
505
- }
506
- }
507
- },
508
- mixins: [
509
- Dt
510
- ],
1
+ import { defineComponent as V, ref as z, resolveComponent as A, openBlock as i, createElementBlock as a, normalizeClass as C, unref as o, renderSlot as t, toDisplayString as d, createCommentVNode as n, createElementVNode as s, normalizeProps as u, guardReactiveProps as p, useSlots as I, withDirectives as N, mergeProps as D, isRef as E, vModelDynamic as P, createVNode as B, Transition as w, withCtx as b, createBlock as $, createTextVNode as R } from "vue";
2
+ import { useFormControl as G, FormControlErrors as M, FormControlFeedback as U } from "@vue-interface/form-control";
3
+ const j = ["for"], q = { class: "form-group-inner" }, H = {
4
+ invalid: "",
5
+ class: "invalid-feedback"
6
+ }, J = /* @__PURE__ */ s("br", null, null, -1), K = {
7
+ valid: "",
8
+ class: "valid-feedback"
9
+ }, Q = /* @__PURE__ */ V({
511
10
  inheritAttrs: !1,
11
+ __name: "InputField",
512
12
  props: {
513
- activity: {
514
- type: Boolean,
515
- default: !1
516
- },
517
- animated: {
518
- type: Boolean,
519
- default: () => v("animated", !1)
520
- },
521
- nativeEvents: {
522
- type: Array,
523
- default() {
524
- return ["focus", "blur", "change", "click", "keypress", "keyup", "keydown", "progress", "paste"];
525
- }
526
- },
527
- defaultControlClass: {
528
- type: String,
529
- default: () => v("defaultControlClass", "form-control")
530
- },
531
- error: {
532
- type: [String, Array, Boolean],
533
- default: void 0
534
- },
535
- errors: {
536
- type: [Array, Object, Boolean],
537
- default() {
538
- return {};
539
- }
540
- },
541
- feedback: {
542
- type: [String, Array],
543
- default: void 0
544
- },
545
- group: {
546
- type: Boolean,
547
- default: () => v("group", !0)
548
- },
549
- helpText: {
550
- type: [Number, String],
551
- default: void 0
552
- },
553
- hideLabel: Boolean,
554
- indicator: {
555
- type: [String, Boolean],
556
- default: () => v("indicator", "spinner")
557
- },
558
- indicatorSize: {
559
- type: String,
560
- default: void 0
561
- },
562
- inline: Boolean,
563
- invalid: Boolean,
564
- label: {
565
- type: [Number, String],
566
- default: void 0
567
- },
568
- labelClass: {
569
- type: [Object, String],
570
- default: () => v("labelClass", "form-label")
571
- },
572
- modelValue: {
573
- default: void 0
574
- },
575
- pill: Boolean,
576
- plaintext: Boolean,
577
- size: {
578
- type: String,
579
- default: void 0
580
- },
581
- spacing: {
582
- type: String,
583
- default: void 0
584
- },
585
- valid: Boolean
586
- },
587
- data() {
588
- return {
589
- defaultEmpty: !1,
590
- hasChanged: !1,
591
- hasFocus: !1,
592
- isEmpty: !0
593
- };
13
+ activity: { type: Boolean },
14
+ disabled: { type: Boolean },
15
+ error: {},
16
+ errors: {},
17
+ feedback: {},
18
+ formControlClass: { default: "form-control" },
19
+ helpText: {},
20
+ id: {},
21
+ indicator: {},
22
+ indicatorSize: {},
23
+ invalid: { type: Boolean },
24
+ label: {},
25
+ labelClass: { default: "form-label" },
26
+ modelValue: {},
27
+ name: {},
28
+ plaintext: { type: Boolean },
29
+ readonly: { type: Boolean },
30
+ valid: { type: Boolean },
31
+ value: {},
32
+ checked: { type: Boolean }
594
33
  },
595
- computed: {
596
- id() {
597
- return this.$attrs.id || this.$attrs.name || (Math.random() + 1).toString(36).substring(7);
598
- },
599
- componentName() {
600
- return this.$options.name;
601
- },
602
- controlAttributes() {
603
- return Object.fromEntries(
604
- Object.entries(this.$attrs).concat([
605
- ["id", this.id],
606
- ["class", this.controlClasses]
34
+ emits: ["update:modelValue"],
35
+ setup(F, { emit: g }) {
36
+ const h = F, { controlAttributes: f, formGroupClasses: S, model: m, onClick: v, onBlur: y, onFocus: c } = G({ props: h, emit: g }), k = z();
37
+ return (e, l) => {
38
+ const T = A("ActivityIndicator");
39
+ return i(), a("div", {
40
+ class: C(["input-field", o(S)])
41
+ }, [
42
+ t(e.$slots, "label", {}, () => [
43
+ e.label ? (i(), a("label", {
44
+ key: 0,
45
+ ref: "label",
46
+ class: C(e.labelClass),
47
+ for: o(f).id
48
+ }, d(e.label), 11, j)) : n("", !0)
49
+ ]),
50
+ s("div", q, [
51
+ t(e.$slots, "control", u(p({ onClick: o(v), onBlur: o(y), onFocus: o(c), controlAttributes: o(f) })), () => [
52
+ I().icon ? (i(), a("div", {
53
+ key: 0,
54
+ class: "form-group-inner-icon",
55
+ onClick: l[0] || (l[0] = //@ts-ignore
56
+ (...r) => k.value.focus && k.value.focus(...r))
57
+ }, [
58
+ t(e.$slots, "icon")
59
+ ])) : n("", !0),
60
+ N(s("input", D({
61
+ ref_key: "field",
62
+ ref: k,
63
+ "onUpdate:modelValue": l[1] || (l[1] = (r) => E(m) ? m.value = r : null)
64
+ }, o(f), {
65
+ onClick: l[2] || (l[2] = //@ts-ignore
66
+ (...r) => o(v) && o(v)(...r)),
67
+ onBlur: l[3] || (l[3] = //@ts-ignore
68
+ (...r) => o(y) && o(y)(...r)),
69
+ onFocus: l[4] || (l[4] = //@ts-ignore
70
+ (...r) => o(c) && o(c)(...r))
71
+ }), null, 16), [
72
+ [P, o(m)]
73
+ ])
74
+ ]),
75
+ t(e.$slots, "activity", {}, () => [
76
+ B(w, { name: "input-field-fade" }, {
77
+ default: b(() => [
78
+ e.activity && e.indicator ? (i(), $(T, {
79
+ key: "activity",
80
+ ref: "activity",
81
+ type: e.indicator,
82
+ size: e.indicatorSize
83
+ }, null, 8, ["type", "size"])) : n("", !0)
84
+ ]),
85
+ _: 1
86
+ })
87
+ ])
88
+ ]),
89
+ t(e.$slots, "errors", u(p({ error: e.error, errors: e.errors, id: e.$attrs.id, name: e.$attrs.name })), () => [
90
+ e.error || e.errors ? (i(), $(o(M), {
91
+ key: 0,
92
+ id: e.$attrs.id && String(e.$attrs.id),
93
+ name: e.$attrs.name && String(e.$attrs.name),
94
+ error: e.error,
95
+ errors: e.errors
96
+ }, {
97
+ default: b(({ error: r }) => [
98
+ s("div", H, [
99
+ R(d(r), 1),
100
+ J
101
+ ])
102
+ ]),
103
+ _: 1
104
+ }, 8, ["id", "name", "error", "errors"])) : n("", !0)
105
+ ]),
106
+ t(e.$slots, "feedback", u(p({ feedback: e.feedback })), () => [
107
+ B(o(U), { feedback: e.feedback }, {
108
+ default: b(({ feedback: r }) => [
109
+ s("div", K, d(r), 1)
110
+ ]),
111
+ _: 1
112
+ }, 8, ["feedback"])
113
+ ]),
114
+ t(e.$slots, "help", u(p({ helpText: e.helpText })), () => [
115
+ e.helpText ? (i(), a("small", {
116
+ key: 0,
117
+ ref: "help"
118
+ }, d(e.helpText), 513)) : n("", !0)
607
119
  ])
608
- );
609
- },
610
- controlClass() {
611
- return this.defaultControlClass;
612
- },
613
- controlSizeClass() {
614
- return F(this.size, this.controlClass);
615
- },
616
- formGroupClasses() {
617
- return {
618
- [et(this.componentName)]: !!this.componentName,
619
- [this.size && F(this.size, this.componentName)]: !!this.size,
620
- animated: this.animated,
621
- "default-empty": this.defaultEmpty,
622
- "form-group": this.group,
623
- [this.size && F(this.size, "form-group")]: !!this.size,
624
- "has-activity": this.activity,
625
- "has-changed": this.hasChanged,
626
- "has-focus": this.hasFocus,
627
- "has-icon": !!this.$slots.icon,
628
- "is-empty": this.isEmpty,
629
- "is-invalid": !!(this.invalid || this.invalidFeedback),
630
- "is-valid": !!(this.valid || this.validFeedback),
631
- [this.$attrs.class]: !!this.$attrs.class,
632
- [this.$attrs.id]: !!this.$attrs.id
633
- };
634
- },
635
- controlClasses() {
636
- return Object.assign({
637
- [this.controlClass]: !!this.controlClass,
638
- [this.controlSizeClass]: !!this.controlSizeClass,
639
- "form-control-icon": !!this.$slots.icon,
640
- "is-valid": !!(this.valid || this.validFeedback),
641
- "is-invalid": !!(this.invalid || this.invalidFeedback),
642
- [this.pillClasses]: this.pill,
643
- [this.plaintextClass]: this.plaintext,
644
- [this.spacing]: !!this.spacing
645
- }, this.shadowableClass);
646
- },
647
- hasDefaultSlot() {
648
- return !!this.$slots.default;
649
- },
650
- invalidFeedback() {
651
- if (this.error === "")
652
- return null;
653
- if (this.error)
654
- return this.error;
655
- const t = this.getFieldErrors();
656
- return Array.isArray(t) ? t.filter((e) => e && typeof e == "string").join("<br>") : t;
657
- },
658
- pillClasses() {
659
- return "rounded rounded-pill";
660
- },
661
- plaintextClass() {
662
- return "form-control-plaintext";
663
- },
664
- validFeedback() {
665
- return Array.isArray(this.feedback) ? this.feedback.join("<br>") : this.feedback;
666
- }
667
- },
668
- watch: {
669
- hasFocus() {
670
- this.shouldChangeOnFocus() && (this.hasChanged = !0);
671
- },
672
- defaultEmpty() {
673
- this.hasChanged = !0;
674
- }
675
- },
676
- methods: {
677
- bindEvents(t, e) {
678
- var i;
679
- e || (e = this.onInput);
680
- const r = t instanceof HTMLSelectElement ? (i = t.querySelectorAll("option")) == null ? void 0 : i[t.selectedIndex] : null;
681
- Pe(this.modelValue) ? r && (t.value = r == null ? void 0 : r.value) : t.value = this.modelValue, t.value && e(t.value), this.hasChanged = !!t.value, this.isEmpty = !t.value, t.addEventListener("focus", () => {
682
- this.hasFocus = !0;
683
- }), t.addEventListener("blur", () => {
684
- this.hasFocus = !1;
685
- }), t.addEventListener("input", () => {
686
- this.isEmpty = !1, this.hasChanged = !0;
687
- }), t.addEventListener(
688
- t.tagName === "SELECT" ? "change" : "input",
689
- () => e(t.value)
690
- ), this.nativeEvents.forEach((n) => {
691
- t.addEventListener(n, (s) => {
692
- this.$emit(n, s);
693
- });
694
- });
695
- },
696
- blur() {
697
- this.getInputField() && this.getInputField().blur();
698
- },
699
- focus() {
700
- this.getInputField() && this.getInputField().focus();
701
- },
702
- getInputField() {
703
- return this.$el.querySelector(
704
- ".form-control, input, select, textarea"
705
- );
706
- },
707
- getFieldErrors() {
708
- let t = this.error || this.errors;
709
- return this.errors && N(this.errors) && (t = this.errors[this.$attrs.name || this.$attrs.id]), !t || Array.isArray(t) || N(t) ? t : [t];
710
- },
711
- shouldChangeOnFocus() {
712
- return !this.getInputField().readOnly;
713
- },
714
- onInput(t) {
715
- this.$emit("update:modelValue", t);
716
- }
120
+ ], 2);
121
+ };
717
122
  }
718
- }), We = E({
719
- components: {
720
- ActivityIndicator: bt
721
- },
722
- mixins: [
723
- Ve
724
- ]
725
123
  });
726
- const Ge = (t, e) => {
727
- const i = t.__vccOpts || t;
728
- for (const [r, n] of e)
729
- i[r] = n;
730
- return i;
731
- }, qe = ["for", "innerHTML"], Ye = { class: "form-group-inner" }, _e = ["innerHTML"], Je = ["innerHTML"];
732
- function Ke(t, e, i, r, n, s) {
733
- const y = st("activity-indicator"), $ = ot("bind-events");
734
- return u(), o("div", {
735
- class: x(t.formGroupClasses)
736
- }, [
737
- d(t.$slots, "label", {}, () => [
738
- t.label ? (u(), o("label", {
739
- key: 0,
740
- ref: "label",
741
- for: t.id,
742
- class: x(t.labelClass),
743
- onClick: e[0] || (e[0] = (...l) => t.focus && t.focus(...l)),
744
- innerHTML: t.label
745
- }, null, 10, qe)) : a("", !0)
746
- ]),
747
- j("div", Ye, [
748
- d(t.$slots, "control", {
749
- bindEvents: t.bindEvents,
750
- controlAttributes: t.controlAttributes,
751
- focus: t.focus
752
- }, () => [
753
- t.$slots.icon ? (u(), o("div", {
754
- key: 0,
755
- class: "form-group-inner-icon",
756
- onClick: e[1] || (e[1] = (...l) => t.focus && t.focus(...l))
757
- }, [
758
- d(t.$slots, "icon")
759
- ])) : a("", !0),
760
- at(j("input", lt({ ref: "field" }, t.controlAttributes), null, 16), [
761
- [$]
762
- ])
763
- ]),
764
- d(t.$slots, "activity", {}, () => [
765
- dt(ct, { name: "input-field-fade" }, {
766
- default: ht(() => [
767
- t.activity ? (u(), T(y, {
768
- key: "activity",
769
- ref: "activity",
770
- type: t.indicator,
771
- size: t.indicatorSize || t.size
772
- }, null, 8, ["type", "size"])) : a("", !0)
773
- ]),
774
- _: 1
775
- })
776
- ])
777
- ]),
778
- d(t.$slots, "feedback", {}, () => [
779
- t.invalidFeedback ? (u(), o("div", {
780
- key: 0,
781
- class: "invalid-feedback",
782
- invalid: "",
783
- innerHTML: t.invalidFeedback
784
- }, null, 8, _e)) : t.validFeedback ? (u(), o("div", {
785
- key: 1,
786
- class: "valid-feedback",
787
- valid: "",
788
- innerHTML: t.validFeedback
789
- }, null, 8, Je)) : a("", !0)
790
- ]),
791
- d(t.$slots, "help", {}, () => [
792
- t.helpText ? (u(), o("small", {
793
- key: 0,
794
- ref: "help"
795
- }, H(t.helpText), 513)) : a("", !0)
796
- ])
797
- ], 2);
798
- }
799
- const Xe = /* @__PURE__ */ Ge(We, [["render", Ke]]);
800
124
  export {
801
- Xe as InputField
125
+ Q as InputField
802
126
  };
127
+ //# sourceMappingURL=input-field.js.map