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

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(h, 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-field.js","sources":["../src/InputField.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T, V\">\nimport type { CheckedFormControlProps, FormControlEvents, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport { ref, useSlots } from 'vue';\n\ndefineOptions({\n inheritAttrs: false\n});\n\ndefineSlots<FormControlSlots<T>>();\n\nconst emit = defineEmits<FormControlEvents<T>>();\n\nconst props = withDefaults(defineProps<CheckedFormControlProps<T, V>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label'\n});\n\nconst { controlAttributes, formGroupClasses, model, onClick, onBlur, onFocus } = useFormControl(props, emit);\n\nconst field = ref<HTMLInputElement>();\n</script>\n\n<template>\n <div\n class=\"input-field\"\n :class=\"formGroupClasses\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n \n <div class=\"form-group-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ onClick, onBlur, onFocus, controlAttributes }\">\n <div\n v-if=\"useSlots().icon\"\n class=\"form-group-inner-icon\"\n @click=\"field.focus\">\n <slot name=\"icon\" />\n </div>\n <input\n ref=\"field\"\n v-model=\"model\"\n v-bind=\"controlAttributes\"\n @click=\"onClick\"\n @blur=\"onBlur\"\n @focus=\"onFocus\">\n </slot>\n\n <slot name=\"activity\">\n <Transition name=\"input-field-fade\">\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n ref=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\"> \n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"$attrs.id && String($attrs.id)\"\n v-slot=\"{ error }\"\n :name=\"$attrs.name && String($attrs.name)\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}<br>\n </div>\n </FormControlErrors>\n </slot>\n \n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n ref=\"help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>"],"names":["controlAttributes","formGroupClasses","model","onClick","onBlur","onFocus","useFormControl","props","emit","field","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBM,EAAE,mBAAAA,GAAmB,kBAAAC,GAAkB,OAAAC,GAAO,SAAAC,GAAS,QAAAC,GAAQ,SAAAC,MAAYC,EAAeC,GAAOC,CAAI,GAErGC,IAAQC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1,2 @@
1
- (function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.InputField={},u.Vue))})(this,function(u,i){"use strict";function a(e,t="px"){return e!=null&&e!==!1&&isFinite(e)?`${e}${t}`:e}const Y=i.defineComponent({props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:String,default:"indicators"},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},data:()=>({is:null}),setup(e){return{registryInstance:i.inject(e.registry||"indicators")}},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:a(this.width),maxWidth:a(this.maxWidth),minWidth:a(this.minWidth),height:a(this.height),maxHeight:a(this.maxHeight),minHeight:a(this.minHeight)}}},async mounted(){const e=await this.component();this.is=()=>e},methods:{async component(){let e=this.registryInstance.get(this.type);return e instanceof Promise?e:(typeof e=="function"&&(e=await e()),e.default?e.default:e)}}}),J=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},K={class:"activity-indicator-content"},Q={key:1,class:"activity-indicator-label"};function X(e,t,n,o,r,s){return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["activity-indicator",e.classes]),style:i.normalizeStyle(e.style)},[i.createElementVNode("div",K,[e.is?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e.is()),{key:0,class:"mx-auto"})):i.createCommentVNode("",!0),e.label?(i.openBlock(),i.createElementBlock("div",Q,i.toDisplayString(e.label),1)):i.createCommentVNode("",!0)])],6)}const ee=J(Y,[["render",X]]);var te=Object.defineProperty,ie=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ne=(e,t,n)=>(ie(e,typeof t!="symbol"?t+"":t,n),n),m=function(){return m=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},m.apply(this,arguments)};function re(e){return e.toLowerCase()}var oe=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],se=/[^A-Z0-9]+/gi;function ue(e,t){t===void 0&&(t={});for(var n=t.splitRegexp,o=n===void 0?oe:n,r=t.stripRegexp,s=r===void 0?se:r,g=t.transform,C=g===void 0?re:g,c=t.delimiter,Nt=c===void 0?" ":c,b=$($(e,o,"$1\0$2"),s,"\0"),E=0,S=b.length;b.charAt(E)==="\0";)E++;for(;b.charAt(S-1)==="\0";)S--;return b.slice(E,S).split("\0").map(C).join(Nt)}function $(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(o,r){return o.replace(r,n)},e)}function ae(e,t){return t===void 0&&(t={}),ue(e,m({delimiter:"."},t))}function y(e,t){return t===void 0&&(t={}),ae(e,m({delimiter:"-"},t))}class le{constructor(t={}){ne(this,"components"),this.components=new Map,Object.entries(t).forEach(([n,o])=>{this.register(n,o)})}get(t){const n=this.components.get(t=y(t));if(n)return n;throw new Error(`"${t}" has not been registered yet!`)}register(t,n){return typeof t=="object"?(Object.entries(t).forEach(([o,r])=>{this.register(y(o),r)}),this):(this.components.set(y(t),n),this)}remove(t){return this.components.delete(y(t)),this}reset(){return this.components=new Map,this}}function de(e={}){return new le(e)}de();const h={};function f(...e){if(!e.length)return h;const[t,n]=e;return typeof t=="string"?typeof h[t]<"u"?h[t]:n:Array.isArray(t)?t.reduce((o,r)=>Object.assign(o,{[r]:h[r]}),{}):Object.assign(h,...e)}const ce=i.defineComponent({props:{dropShadow:{type:[Boolean,String],default:void 0},dropShadowableClassPrefix:{type:String,default:"drop-shadow"},shadow:{type:[Boolean,String],default:void 0},shadowableClassPrefix:{type:String,default:"shadow"}},computed:{shadowableClass(){const e=this.dropShadow===!0?"":this.dropShadow&&`-${this.dropShadow}`,t=this.shadow===!0?"":this.shadow&&`-${this.shadow}`;return{[`${this.dropShadowableClassPrefix}${e}`]:!!this.dropShadow,[`${this.shadowableClassPrefix}${t}`]:!!this.shadow}}}});var he=typeof global=="object"&&global&&global.Object===Object&&global;const fe=he;var pe=typeof self=="object"&&self&&self.Object===Object&&self,me=fe||pe||Function("return this")(),ye=me.Symbol;const l=ye;var A=Object.prototype,ge=A.hasOwnProperty,be=A.toString,p=l?l.toStringTag:void 0;function ve(e){var t=ge.call(e,p),n=e[p];try{e[p]=void 0;var o=!0}catch{}var r=be.call(e);return o&&(t?e[p]=n:delete e[p]),r}var Ce=Object.prototype,Ee=Ce.toString;function Se(e){return Ee.call(e)}var $e="[object Null]",Ae="[object Undefined]",F=l?l.toStringTag:void 0;function Fe(e){return e==null?e===void 0?Ae:$e:F&&F in Object(e)?ve(e):Se(e)}function ke(e){return e!=null&&typeof e=="object"}var Be="[object Symbol]";function xe(e){return typeof e=="symbol"||ke(e)&&Fe(e)==Be}function je(e,t){for(var n=-1,o=e==null?0:e.length,r=Array(o);++n<o;)r[n]=t(e[n],n,e);return r}var De=Array.isArray;const we=De;var ze=1/0,k=l?l.prototype:void 0,B=k?k.toString:void 0;function x(e){if(typeof e=="string")return e;if(we(e))return je(e,x)+"";if(xe(e))return B?B.call(e):"";var t=e+"";return t=="0"&&1/e==-ze?"-0":t}function j(e){return e==null?"":x(e)}function Oe(e,t,n,o){var r=-1,s=e==null?0:e.length;for(o&&s&&(n=e[++r]);++r<s;)n=t(n,e[r],r,e);return n}function Ne(e){return function(t){return e==null?void 0:e[t]}}var Ie={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Te=Ne(Ie);const Le=Te;var Ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,He="\\u0300-\\u036f",Me="\\ufe20-\\ufe2f",Ze="\\u20d0-\\u20ff",Re=He+Me+Ze,Pe="["+Re+"]",Ue=RegExp(Pe,"g");function Ge(e){return e=j(e),e&&e.replace(Ve,Le).replace(Ue,"")}var We=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function _e(e){return e.match(We)||[]}var qe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ye(e){return qe.test(e)}var D="\\ud800-\\udfff",Je="\\u0300-\\u036f",Ke="\\ufe20-\\ufe2f",Qe="\\u20d0-\\u20ff",Xe=Je+Ke+Qe,w="\\u2700-\\u27bf",z="a-z\\xdf-\\xf6\\xf8-\\xff",et="\\xac\\xb1\\xd7\\xf7",tt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",it="\\u2000-\\u206f",nt=" \\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",O="A-Z\\xc0-\\xd6\\xd8-\\xde",rt="\\ufe0e\\ufe0f",N=et+tt+it+nt,I="['\u2019]",T="["+N+"]",ot="["+Xe+"]",L="\\d+",st="["+w+"]",V="["+z+"]",H="[^"+D+N+L+w+z+O+"]",ut="\\ud83c[\\udffb-\\udfff]",at="(?:"+ot+"|"+ut+")",lt="[^"+D+"]",M="(?:\\ud83c[\\udde6-\\uddff]){2}",Z="[\\ud800-\\udbff][\\udc00-\\udfff]",d="["+O+"]",dt="\\u200d",R="(?:"+V+"|"+H+")",ct="(?:"+d+"|"+H+")",P="(?:"+I+"(?:d|ll|m|re|s|t|ve))?",U="(?:"+I+"(?:D|LL|M|RE|S|T|VE))?",G=at+"?",W="["+rt+"]?",ht="(?:"+dt+"(?:"+[lt,M,Z].join("|")+")"+W+G+")*",ft="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",mt=W+G+ht,yt="(?:"+[st,M,Z].join("|")+")"+mt,gt=RegExp([d+"?"+V+"+"+P+"(?="+[T,d,"$"].join("|")+")",ct+"+"+U+"(?="+[T,d+R,"$"].join("|")+")",d+"?"+R+"+"+P,d+"+"+U,pt,ft,L,yt].join("|"),"g");function bt(e){return e.match(gt)||[]}function vt(e,t,n){return e=j(e),t=n?void 0:t,t===void 0?Ye(e)?bt(e):_e(e):e.match(t)||[]}var Ct="['\u2019]",Et=RegExp(Ct,"g");function St(e){return function(t){return Oe(vt(Ge(t).replace(Et,"")),e,"")}}var $t=St(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()});const _=$t;function v(e,t,n="-"){const o=String(t).replace(new RegExp(`^${e}${n}?`),"");return[_(o),e].filter(r=>!!r).join(n)}function q(e){return!Array.isArray(e)&&typeof e=="object"}function At(e){return e===void 0}const Ft=i.defineComponent({directives:{bindEvents:{beforeMount(e,t){var n,o;(o=(n=t.instance)==null?void 0:n.bindEvents)==null||o.call(n,e)}}},mixins:[ce],inheritAttrs:!1,props:{activity:{type:Boolean,default:!1},animated:{type:Boolean,default:()=>f("animated",!1)},nativeEvents:{type:Array,default(){return["focus","blur","change","click","keypress","keyup","keydown","progress","paste"]}},defaultControlClass:{type:String,default:()=>f("defaultControlClass","form-control")},error:{type:[String,Array,Boolean],default:void 0},errors:{type:[Array,Object,Boolean],default(){return{}}},feedback:{type:[String,Array],default:void 0},group:{type:Boolean,default:()=>f("group",!0)},helpText:{type:[Number,String],default:void 0},hideLabel:Boolean,indicator:{type:[String,Boolean],default:()=>f("indicator","spinner")},indicatorSize:{type:String,default:void 0},inline:Boolean,invalid:Boolean,label:{type:[Number,String],default:void 0},labelClass:{type:[Object,String],default:()=>f("labelClass","form-label")},modelValue:{default:void 0},pill:Boolean,plaintext:Boolean,size:{type:String,default:void 0},spacing:{type:String,default:void 0},valid:Boolean},data(){return{defaultEmpty:!1,hasChanged:!1,hasFocus:!1,isEmpty:!0}},computed:{id(){return this.$attrs.id||this.$attrs.name||(Math.random()+1).toString(36).substring(7)},componentName(){return this.$options.name},controlAttributes(){return Object.fromEntries(Object.entries(this.$attrs).concat([["id",this.id],["class",this.controlClasses]]))},controlClass(){return this.defaultControlClass},controlSizeClass(){return v(this.size,this.controlClass)},formGroupClasses(){return{[_(this.componentName)]:!!this.componentName,[this.size&&v(this.size,this.componentName)]:!!this.size,animated:this.animated,"default-empty":this.defaultEmpty,"form-group":this.group,[this.size&&v(this.size,"form-group")]:!!this.size,"has-activity":this.activity,"has-changed":this.hasChanged,"has-focus":this.hasFocus,"has-icon":!!this.$slots.icon,"is-empty":this.isEmpty,"is-invalid":!!(this.invalid||this.invalidFeedback),"is-valid":!!(this.valid||this.validFeedback),[this.$attrs.class]:!!this.$attrs.class,[this.$attrs.id]:!!this.$attrs.id}},controlClasses(){return Object.assign({[this.controlClass]:!!this.controlClass,[this.controlSizeClass]:!!this.controlSizeClass,"form-control-icon":!!this.$slots.icon,"is-valid":!!(this.valid||this.validFeedback),"is-invalid":!!(this.invalid||this.invalidFeedback),[this.pillClasses]:this.pill,[this.plaintextClass]:this.plaintext,[this.spacing]:!!this.spacing},this.shadowableClass)},hasDefaultSlot(){return!!this.$slots.default},invalidFeedback(){if(this.error==="")return null;if(this.error)return this.error;const e=this.getFieldErrors();return Array.isArray(e)?e.filter(t=>t&&typeof t=="string").join("<br>"):e},pillClasses(){return"rounded rounded-pill"},plaintextClass(){return"form-control-plaintext"},validFeedback(){return Array.isArray(this.feedback)?this.feedback.join("<br>"):this.feedback}},watch:{hasFocus(){this.shouldChangeOnFocus()&&(this.hasChanged=!0)},defaultEmpty(){this.hasChanged=!0}},methods:{bindEvents(e,t){var n;t||(t=this.onInput);const o=e instanceof HTMLSelectElement?(n=e.querySelectorAll("option"))==null?void 0:n[e.selectedIndex]:null;At(this.modelValue)?o&&(e.value=o==null?void 0:o.value):e.value=this.modelValue,e.value&&t(e.value),this.hasChanged=!!e.value,this.isEmpty=!e.value,e.addEventListener("focus",()=>{this.hasFocus=!0}),e.addEventListener("blur",()=>{this.hasFocus=!1}),e.addEventListener("input",()=>{this.isEmpty=!1,this.hasChanged=!0}),e.addEventListener(e.tagName==="SELECT"?"change":"input",()=>t(e.value)),this.nativeEvents.forEach(r=>{e.addEventListener(r,s=>{this.$emit(r,s)})})},blur(){this.getInputField()&&this.getInputField().blur()},focus(){this.getInputField()&&this.getInputField().focus()},getInputField(){return this.$el.querySelector(".form-control, input, select, textarea")},getFieldErrors(){let e=this.error||this.errors;return this.errors&&q(this.errors)&&(e=this.errors[this.$attrs.name||this.$attrs.id]),!e||Array.isArray(e)||q(e)?e:[e]},shouldChangeOnFocus(){return!this.getInputField().readOnly},onInput(e){this.$emit("update:modelValue",e)}}}),kt=i.defineComponent({components:{ActivityIndicator:ee},mixins:[Ft]}),Tt="",Bt=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},xt=["for","innerHTML"],jt={class:"form-group-inner"},Dt=["innerHTML"],wt=["innerHTML"];function zt(e,t,n,o,r,s){const g=i.resolveComponent("activity-indicator"),C=i.resolveDirective("bind-events");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(e.formGroupClasses)},[i.renderSlot(e.$slots,"label",{},()=>[e.label?(i.openBlock(),i.createElementBlock("label",{key:0,ref:"label",for:e.id,class:i.normalizeClass(e.labelClass),onClick:t[0]||(t[0]=(...c)=>e.focus&&e.focus(...c)),innerHTML:e.label},null,10,xt)):i.createCommentVNode("",!0)]),i.createElementVNode("div",jt,[i.renderSlot(e.$slots,"control",{bindEvents:e.bindEvents,controlAttributes:e.controlAttributes,focus:e.focus},()=>[e.$slots.icon?(i.openBlock(),i.createElementBlock("div",{key:0,class:"form-group-inner-icon",onClick:t[1]||(t[1]=(...c)=>e.focus&&e.focus(...c))},[i.renderSlot(e.$slots,"icon")])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.mergeProps({ref:"field"},e.controlAttributes),null,16),[[C]])]),i.renderSlot(e.$slots,"activity",{},()=>[i.createVNode(i.Transition,{name:"input-field-fade"},{default:i.withCtx(()=>[e.activity?(i.openBlock(),i.createBlock(g,{key:"activity",ref:"activity",type:e.indicator,size:e.indicatorSize||e.size},null,8,["type","size"])):i.createCommentVNode("",!0)]),_:1})])]),i.renderSlot(e.$slots,"feedback",{},()=>[e.invalidFeedback?(i.openBlock(),i.createElementBlock("div",{key:0,class:"invalid-feedback",invalid:"",innerHTML:e.invalidFeedback},null,8,Dt)):e.validFeedback?(i.openBlock(),i.createElementBlock("div",{key:1,class:"valid-feedback",valid:"",innerHTML:e.validFeedback},null,8,wt)):i.createCommentVNode("",!0)]),i.renderSlot(e.$slots,"help",{},()=>[e.helpText?(i.openBlock(),i.createElementBlock("small",{key:0,ref:"help"},i.toDisplayString(e.helpText),513)):i.createCommentVNode("",!0)])],2)}const Ot=Bt(kt,[["render",zt]]);u.InputField=Ot,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vue-interface/form-control")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/form-control"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.InputField={},n.Vue,n.VueInterfaceFormControl))})(this,function(n,e,l){"use strict";const m=["for"],c={class:"form-group-inner"},k={invalid:"",class:"invalid-feedback"},y=e.createElementVNode("br",null,null,-1),b={valid:"",class:"valid-feedback"},C=e.defineComponent({inheritAttrs:!1,__name:"InputField",props:{activity:{type:Boolean},disabled:{type:Boolean},error:{},errors:{},feedback:{},formControlClass:{default:"form-control"},helpText:{},id:{},indicator:{},indicatorSize:{},invalid:{type:Boolean},label:{},labelClass:{default:"form-label"},modelValue:{},name:{},plaintext:{type:Boolean},readonly:{type:Boolean},valid:{type:Boolean},value:{},checked:{type:Boolean}},emits:["update:modelValue"],setup(B,{emit:S}){const V=B,{controlAttributes:i,formGroupClasses:g,model:a,onClick:s,onBlur:d,onFocus:f}=l.useFormControl(V,S),p=e.ref();return(r,t)=>{const N=e.resolveComponent("ActivityIndicator");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-field",e.unref(g)])},[e.renderSlot(r.$slots,"label",{},()=>[r.label?(e.openBlock(),e.createElementBlock("label",{key:0,ref:"label",class:e.normalizeClass(r.labelClass),for:e.unref(i).id},e.toDisplayString(r.label),11,m)):e.createCommentVNode("",!0)]),e.createElementVNode("div",c,[e.renderSlot(r.$slots,"control",e.normalizeProps(e.guardReactiveProps({onClick:e.unref(s),onBlur:e.unref(d),onFocus:e.unref(f),controlAttributes:e.unref(i)})),()=>[e.useSlots().icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-group-inner-icon",onClick:t[0]||(t[0]=(...o)=>p.value.focus&&p.value.focus(...o))},[e.renderSlot(r.$slots,"icon")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref_key:"field",ref:p,"onUpdate:modelValue":t[1]||(t[1]=o=>e.isRef(a)?a.value=o:null)},e.unref(i),{onClick:t[2]||(t[2]=(...o)=>e.unref(s)&&e.unref(s)(...o)),onBlur:t[3]||(t[3]=(...o)=>e.unref(d)&&e.unref(d)(...o)),onFocus:t[4]||(t[4]=(...o)=>e.unref(f)&&e.unref(f)(...o))}),null,16),[[e.vModelDynamic,e.unref(a)]])]),e.renderSlot(r.$slots,"activity",{},()=>[e.createVNode(e.Transition,{name:"input-field-fade"},{default:e.withCtx(()=>[r.activity&&r.indicator?(e.openBlock(),e.createBlock(N,{key:"activity",ref:"activity",type:r.indicator,size:r.indicatorSize},null,8,["type","size"])):e.createCommentVNode("",!0)]),_:1})])]),e.renderSlot(r.$slots,"errors",e.normalizeProps(e.guardReactiveProps({error:r.error,errors:r.errors,id:r.$attrs.id,name:r.$attrs.name})),()=>[r.error||r.errors?(e.openBlock(),e.createBlock(e.unref(l.FormControlErrors),{key:0,id:r.$attrs.id&&String(r.$attrs.id),name:r.$attrs.name&&String(r.$attrs.name),error:r.error,errors:r.errors},{default:e.withCtx(({error:o})=>[e.createElementVNode("div",k,[e.createTextVNode(e.toDisplayString(o),1),y])]),_:1},8,["id","name","error","errors"])):e.createCommentVNode("",!0)]),e.renderSlot(r.$slots,"feedback",e.normalizeProps(e.guardReactiveProps({feedback:r.feedback})),()=>[e.createVNode(e.unref(l.FormControlFeedback),{feedback:r.feedback},{default:e.withCtx(({feedback:o})=>[e.createElementVNode("div",b,e.toDisplayString(o),1)]),_:1},8,["feedback"])]),e.renderSlot(r.$slots,"help",e.normalizeProps(e.guardReactiveProps({helpText:r.helpText})),()=>[r.helpText?(e.openBlock(),e.createElementBlock("small",{key:0,ref:"help"},e.toDisplayString(r.helpText),513)):e.createCommentVNode("",!0)])],2)}}});n.InputField=C,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=input-field.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-field.umd.cjs","sources":["../src/InputField.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T, V\">\nimport type { CheckedFormControlProps, FormControlEvents, FormControlSlots } from '@vue-interface/form-control';\nimport { FormControlErrors, FormControlFeedback, useFormControl } from '@vue-interface/form-control';\nimport { ref, useSlots } from 'vue';\n\ndefineOptions({\n inheritAttrs: false\n});\n\ndefineSlots<FormControlSlots<T>>();\n\nconst emit = defineEmits<FormControlEvents<T>>();\n\nconst props = withDefaults(defineProps<CheckedFormControlProps<T, V>>(), {\n formControlClass: 'form-control',\n labelClass: 'form-label'\n});\n\nconst { controlAttributes, formGroupClasses, model, onClick, onBlur, onFocus } = useFormControl(props, emit);\n\nconst field = ref<HTMLInputElement>();\n</script>\n\n<template>\n <div\n class=\"input-field\"\n :class=\"formGroupClasses\">\n <slot name=\"label\">\n <label\n v-if=\"label\"\n ref=\"label\"\n :class=\"labelClass\"\n :for=\"controlAttributes.id\">\n {{ label }}\n </label>\n </slot>\n \n <div class=\"form-group-inner\">\n <slot\n name=\"control\"\n v-bind=\"{ onClick, onBlur, onFocus, controlAttributes }\">\n <div\n v-if=\"useSlots().icon\"\n class=\"form-group-inner-icon\"\n @click=\"field.focus\">\n <slot name=\"icon\" />\n </div>\n <input\n ref=\"field\"\n v-model=\"model\"\n v-bind=\"controlAttributes\"\n @click=\"onClick\"\n @blur=\"onBlur\"\n @focus=\"onFocus\">\n </slot>\n\n <slot name=\"activity\">\n <Transition name=\"input-field-fade\">\n <ActivityIndicator\n v-if=\"activity && indicator\"\n key=\"activity\"\n ref=\"activity\"\n :type=\"indicator\"\n :size=\"indicatorSize\" />\n </Transition>\n </slot>\n </div>\n\n <slot\n name=\"errors\"\n v-bind=\"{ error, errors, id: $attrs.id, name: $attrs.name }\"> \n <FormControlErrors\n v-if=\"!!(error || errors)\"\n :id=\"$attrs.id && String($attrs.id)\"\n v-slot=\"{ error }\"\n :name=\"$attrs.name && String($attrs.name)\"\n :error=\"error\"\n :errors=\"errors\">\n <div\n invalid\n class=\"invalid-feedback\">\n {{ error }}<br>\n </div>\n </FormControlErrors>\n </slot>\n \n <slot\n name=\"feedback\"\n v-bind=\"{ feedback }\">\n <FormControlFeedback\n v-slot=\"{ feedback }\"\n :feedback=\"feedback\">\n <div\n valid\n class=\"valid-feedback\">\n {{ feedback }}\n </div>\n </FormControlFeedback>\n </slot>\n\n <slot\n name=\"help\"\n v-bind=\"{ helpText }\">\n <small\n v-if=\"helpText\"\n ref=\"help\">\n {{ helpText }}\n </small>\n </slot>\n </div>\n</template>"],"names":["controlAttributes","formGroupClasses","model","onClick","onBlur","onFocus","useFormControl","props","emit","field","ref"],"mappings":"m+BAkBM,CAAE,kBAAAA,EAAmB,iBAAAC,EAAkB,MAAAC,EAAO,QAAAC,EAAS,OAAAC,EAAQ,QAAAC,GAAYC,EAAAA,eAAeC,EAAOC,CAAI,EAErGC,EAAQC,EAAAA"}
@@ -1,249 +1,33 @@
1
- declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").DefineComponent<{
2
- activity: {
3
- type: BooleanConstructor;
4
- default: boolean;
5
- };
6
- animated: {
7
- type: BooleanConstructor;
8
- default: () => any;
9
- };
10
- nativeEvents: {
11
- type: ArrayConstructor;
12
- default(): string[];
13
- };
14
- defaultControlClass: {
15
- type: StringConstructor;
16
- default: () => any;
17
- };
18
- error: {
19
- type: (BooleanConstructor | StringConstructor | ArrayConstructor)[];
20
- default: undefined;
21
- };
22
- errors: {
23
- type: (BooleanConstructor | ArrayConstructor | ObjectConstructor)[];
24
- default(): {};
25
- };
26
- feedback: {
27
- type: (StringConstructor | ArrayConstructor)[];
28
- default: undefined;
29
- };
30
- group: {
31
- type: BooleanConstructor;
32
- default: () => any;
33
- };
34
- helpText: {
35
- type: (StringConstructor | NumberConstructor)[];
36
- default: undefined;
37
- };
38
- hideLabel: BooleanConstructor;
39
- indicator: {
40
- type: (BooleanConstructor | StringConstructor)[];
41
- default: () => any;
42
- };
43
- indicatorSize: {
44
- type: StringConstructor;
45
- default: undefined;
46
- };
47
- inline: BooleanConstructor;
48
- invalid: BooleanConstructor;
49
- label: {
50
- type: (StringConstructor | NumberConstructor)[];
51
- default: undefined;
52
- };
53
- labelClass: {
54
- type: (StringConstructor | ObjectConstructor)[];
55
- default: () => any;
56
- };
57
- modelValue: {
58
- default: undefined;
59
- };
60
- pill: BooleanConstructor;
61
- plaintext: BooleanConstructor;
62
- size: {
63
- type: StringConstructor;
64
- default: undefined;
65
- };
66
- spacing: {
67
- type: StringConstructor;
68
- default: undefined;
69
- };
70
- valid: BooleanConstructor;
71
- }, unknown, {
72
- defaultEmpty: boolean;
73
- hasChanged: boolean;
74
- hasFocus: boolean;
75
- isEmpty: boolean;
76
- }, {
77
- id(): any;
78
- componentName(): any;
79
- controlAttributes(): {
80
- [k: string]: unknown;
81
- };
82
- controlClass(): any;
83
- controlSizeClass(): string;
84
- formGroupClasses(): {
85
- [x: string]: any;
86
- [x: number]: boolean;
87
- animated: any;
88
- 'default-empty': any;
89
- 'form-group': any;
90
- 'has-activity': any;
91
- 'has-changed': any;
92
- 'has-focus': any;
93
- 'has-icon': boolean;
94
- 'is-empty': any;
95
- 'is-invalid': boolean;
96
- 'is-valid': boolean;
97
- };
98
- controlClasses(): any;
99
- hasDefaultSlot(): boolean;
100
- invalidFeedback(): any;
101
- pillClasses(): "rounded rounded-pill";
102
- plaintextClass(): "form-control-plaintext";
103
- validFeedback(): any;
104
- }, {
105
- bindEvents(el: HTMLOptionElement | HTMLSelectElement, fn: Function): void;
106
- blur(): void;
107
- focus(): void;
108
- getInputField(): any;
109
- getFieldErrors(): any;
110
- shouldChangeOnFocus(): boolean;
111
- onInput(value: any): void;
112
- }, import("vue").DefineComponent<{
113
- dropShadow: {
114
- type: (BooleanConstructor | StringConstructor)[];
115
- default: undefined;
116
- };
117
- dropShadowableClassPrefix: {
118
- type: StringConstructor;
119
- default: string;
120
- };
121
- shadow: {
122
- type: (BooleanConstructor | StringConstructor)[];
123
- default: undefined;
124
- };
125
- shadowableClassPrefix: {
126
- type: StringConstructor;
127
- default: string;
128
- };
129
- }, unknown, unknown, {
130
- shadowableClass(): {
131
- [x: string]: boolean;
132
- };
133
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
134
- dropShadow: {
135
- type: (BooleanConstructor | StringConstructor)[];
136
- default: undefined;
137
- };
138
- dropShadowableClassPrefix: {
139
- type: StringConstructor;
140
- default: string;
141
- };
142
- shadow: {
143
- type: (BooleanConstructor | StringConstructor)[];
144
- default: undefined;
145
- };
146
- shadowableClassPrefix: {
147
- type: StringConstructor;
148
- default: string;
149
- };
150
- }>>, {
151
- shadow: string | boolean;
152
- dropShadow: string | boolean;
153
- dropShadowableClassPrefix: string;
154
- shadowableClassPrefix: string;
155
- }>, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
156
- activity: {
157
- type: BooleanConstructor;
158
- default: boolean;
159
- };
160
- animated: {
161
- type: BooleanConstructor;
162
- default: () => any;
163
- };
164
- nativeEvents: {
165
- type: ArrayConstructor;
166
- default(): string[];
167
- };
168
- defaultControlClass: {
169
- type: StringConstructor;
170
- default: () => any;
171
- };
172
- error: {
173
- type: (BooleanConstructor | StringConstructor | ArrayConstructor)[];
174
- default: undefined;
175
- };
176
- errors: {
177
- type: (BooleanConstructor | ArrayConstructor | ObjectConstructor)[];
178
- default(): {};
179
- };
180
- feedback: {
181
- type: (StringConstructor | ArrayConstructor)[];
182
- default: undefined;
183
- };
184
- group: {
185
- type: BooleanConstructor;
186
- default: () => any;
187
- };
188
- helpText: {
189
- type: (StringConstructor | NumberConstructor)[];
190
- default: undefined;
191
- };
192
- hideLabel: BooleanConstructor;
193
- indicator: {
194
- type: (BooleanConstructor | StringConstructor)[];
195
- default: () => any;
196
- };
197
- indicatorSize: {
198
- type: StringConstructor;
199
- default: undefined;
200
- };
201
- inline: BooleanConstructor;
202
- invalid: BooleanConstructor;
203
- label: {
204
- type: (StringConstructor | NumberConstructor)[];
205
- default: undefined;
206
- };
207
- labelClass: {
208
- type: (StringConstructor | ObjectConstructor)[];
209
- default: () => any;
210
- };
211
- modelValue: {
212
- default: undefined;
213
- };
214
- pill: BooleanConstructor;
215
- plaintext: BooleanConstructor;
216
- size: {
217
- type: StringConstructor;
218
- default: undefined;
219
- };
220
- spacing: {
221
- type: StringConstructor;
222
- default: undefined;
223
- };
224
- valid: BooleanConstructor;
225
- }>>, {
226
- activity: boolean;
227
- animated: boolean;
228
- nativeEvents: unknown[];
229
- defaultControlClass: string;
230
- error: string | boolean | unknown[];
231
- errors: boolean | unknown[] | Record<string, any>;
232
- feedback: string | unknown[];
233
- group: boolean;
234
- helpText: string | number;
235
- hideLabel: boolean;
236
- indicator: string | boolean;
237
- indicatorSize: string;
238
- inline: boolean;
239
- invalid: boolean;
240
- label: string | number;
241
- labelClass: string | Record<string, any>;
242
- modelValue: undefined;
243
- pill: boolean;
244
- plaintext: boolean;
245
- size: string;
246
- spacing: string;
247
- valid: boolean;
248
- }>, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
249
- export default _sfc_main;
1
+ import type { FormControlEvents, FormControlSlots } from '@vue-interface/form-control';
2
+ declare const _default: <T, V>(__VLS_props: import("@vue-interface/form-control").FormControlProps<T, V> & {
3
+ checked?: boolean;
4
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
5
+ props: import("@vue-interface/form-control").FormControlProps<T, V> & {
6
+ checked?: boolean;
7
+ };
8
+ expose(exposed: {}): void;
9
+ attrs: any;
10
+ slots: FormControlSlots<T>;
11
+ emit: FormControlEvents<T>;
12
+ }, "attrs" | "emit" | "slots">, __VLS_setup?: Promise<{
13
+ props: import("@vue-interface/form-control").FormControlProps<T, V> & {
14
+ checked?: boolean;
15
+ };
16
+ expose(exposed: {}): void;
17
+ attrs: any;
18
+ slots: FormControlSlots<T>;
19
+ emit: FormControlEvents<T>;
20
+ }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }> & {
23
+ __ctx?: {
24
+ props: import("@vue-interface/form-control").FormControlProps<T, V> & {
25
+ checked?: boolean;
26
+ };
27
+ expose(exposed: {}): void;
28
+ attrs: any;
29
+ slots: FormControlSlots<T>;
30
+ emit: FormControlEvents<T>;
31
+ };
32
+ };
33
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-interface/input-field",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.20",
4
4
  "description": "A Vue input field component.",
5
5
  "files": [
6
6
  "dist"
@@ -19,13 +19,8 @@
19
19
  "browserslist": "last 2 versions, > 0.5%, ie >= 11",
20
20
  "scripts": {
21
21
  "dev": "vite",
22
- "build": "vite build",
23
- "preview": "vite preview",
24
- "pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
25
- "release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
26
- "release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
27
- "release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
28
- "release": "git add . -A; git commit; git push --tags origin; npm publish;"
22
+ "build": "vite build && vue-tsc",
23
+ "preview": "vite preview"
29
24
  },
30
25
  "repository": {
31
26
  "type": "git",
@@ -46,26 +41,32 @@
46
41
  },
47
42
  "homepage": "https://github.com/vue-interface/input-field/docs#readme",
48
43
  "dependencies": {
49
- "@vue-interface/activity-indicator": "^2.0.0-beta.0",
50
- "@vue-interface/form-control": "^1.0.0-beta.8"
44
+ "@vue-interface/activity-indicator": "^2.0.0-beta.15",
45
+ "@vue-interface/form-control": "^1.0.0-beta.38"
51
46
  },
52
47
  "peerDependencies": {
53
- "vue": "^3.0.0"
48
+ "vue": "^3.3.4"
54
49
  },
55
50
  "devDependencies": {
56
- "@rollup/plugin-babel": "^5.3.0",
57
- "@vitejs/plugin-vue": "^3.0.1",
58
- "autoprefixer": "^10.4.2",
59
- "babel-eslint": "^10.1.0",
60
- "babel-preset-vue": "^2.0.2",
51
+ "@commitlint/config-conventional": "^17.7.0",
52
+ "@semantic-release/changelog": "^6.0.3",
53
+ "@semantic-release/git": "^10.0.1",
54
+ "@semantic-release/npm": "^10.0.5",
55
+ "@vitejs/plugin-vue": "^4.3.3",
56
+ "@vue-interface/eslint-config": "1.0.0-beta.4",
57
+ "autoprefixer": "^10.4.15",
61
58
  "change-case": "^4.1.2",
62
- "eslint": "^6.7.2",
63
- "eslint-plugin-vue": "^6.2.2",
59
+ "commitlint": "^17.7.1",
60
+ "dotenv": "^16.3.1",
61
+ "eslint": "^8.47.0",
62
+ "husky": "^8.0.3",
64
63
  "pascalcase": "^2.0.0",
65
- "postcss": "^8.4.6",
66
- "tailwindcss": "^3.0.18",
67
- "vite": "^3.0.0",
68
- "vite-plugin-dts": "^1.7.1",
69
- "vue": "^3.2.37"
64
+ "postcss": "^8.4.28",
65
+ "semantic-release": "^21.1.1",
66
+ "tailwindcss": "^3.3.3",
67
+ "typescript": "^5.2.2",
68
+ "vite": "^4.4.9",
69
+ "vue": "^3.3.4",
70
+ "vue-tsc": "^1.8.8"
70
71
  }
71
72
  }
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- .input-field,.input-field .form-group-inner{position:relative;-webkit-transition:all .25s ease-in-out;transition:all .25s ease-in-out}.input-field .activity-indicator{position:absolute;right:0;top:50%;-webkit-transform:translate(-1rem,-50%);transform:translate(-1rem,-50%);-webkit-transition:all .15s ease-in;transition:all .15s ease-in}.input-field .activity-indicator-xs{font-size:.5em}.input-field.has-activity .form-control-xs{padding-right:3.75em}.input-field .activity-indicator-sm{font-size:.5em}.input-field.has-activity .form-control-sm{padding-right:3em}.input-field .activity-indicator-md{font-size:.666em}.input-field.has-activity .form-control-md{padding-right:3em}.input-field .activity-indicator-lg{font-size:.75em}.input-field.has-activity .form-control-lg{padding-right:3em}.input-field .activity-indicator-xl{font-size:1em}.input-field.has-activity .activity-indicator-xl~.form-control-xl{padding-right:3.75em}.input-field .activity-indicator{opacity:1}.input-field .input-field-fade-enter,.input-field .input-field-fade-leave-to{opacity:0}.input-field.is-valid .valid-feedback,.input-field.is-invalid .invalid-feedback{display:-webkit-box;display:-ms-flexbox;display:flex}.input-field .form-control-icon{padding-left:2em}.input-field .form-group-inner-icon{position:absolute;top:50%;left:.666em;width:1rem;font-size:1em;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.input-field-sm .form-group-inner-icon{position:absolute;top:50%;left:.666rem;width:.75em;font-size:1.5em;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.input-field-lg .form-group-inner-icon{position:absolute;top:50%;left:.666rem;width:1.25em;font-size:1em;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}