@vue-interface/input-field 1.0.0-beta.0 → 1.0.0-beta.1

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,5 +1,2 @@
1
1
  import InputField from './src/InputField.vue';
2
-
3
- export {
4
- InputField
5
- };
2
+ export { InputField };
@@ -0,0 +1,534 @@
1
+ import { defineComponent as S, inject as N, openBlock as r, createElementBlock as l, normalizeClass as k, normalizeStyle as I, createElementVNode as A, createBlock as O, resolveDynamicComponent as H, createCommentVNode as p, toDisplayString as B, resolveComponent as M, resolveDirective as T, renderSlot as f, withDirectives as P, mergeProps as Z, createVNode as x, Transition as R, withCtx as V } from "vue";
2
+ function v(t, e = "px") {
3
+ return t != null && t !== !1 && isFinite(t) ? `${t}${e}` : t;
4
+ }
5
+ const W = S({
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: N(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: v(this.width),
48
+ maxWidth: v(this.maxWidth),
49
+ minWidth: v(this.minWidth),
50
+ height: v(this.height),
51
+ maxHeight: v(this.maxHeight),
52
+ minHeight: v(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
+ }), D = (t, e) => {
67
+ const i = t.__vccOpts || t;
68
+ for (const [n, s] of e)
69
+ i[n] = s;
70
+ return i;
71
+ }, q = { class: "activity-indicator-content" }, G = {
72
+ key: 1,
73
+ class: "activity-indicator-label"
74
+ };
75
+ function _(t, e, i, n, s, d) {
76
+ return r(), l("div", {
77
+ class: k(["activity-indicator", t.classes]),
78
+ style: I(t.style)
79
+ }, [
80
+ A("div", q, [
81
+ t.is ? (r(), O(H(t.is()), {
82
+ key: 0,
83
+ class: "mx-auto"
84
+ })) : p("", !0),
85
+ t.label ? (r(), l("div", G, B(t.label), 1)) : p("", !0)
86
+ ])
87
+ ], 6);
88
+ }
89
+ const J = /* @__PURE__ */ D(W, [["render", _]]);
90
+ var K = Object.defineProperty, Q = (t, e, i) => e in t ? K(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, U = (t, e, i) => (Q(t, typeof e != "symbol" ? e + "" : e, i), i), $ = function() {
91
+ return $ = Object.assign || function(t) {
92
+ for (var e, i = 1, n = arguments.length; i < n; i++) {
93
+ e = arguments[i];
94
+ for (var s in e)
95
+ Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
96
+ }
97
+ return t;
98
+ }, $.apply(this, arguments);
99
+ };
100
+ function X(t) {
101
+ return t.toLowerCase();
102
+ }
103
+ var Y = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], tt = /[^A-Z0-9]+/gi;
104
+ function et(t, e) {
105
+ e === void 0 && (e = {});
106
+ for (var i = e.splitRegexp, n = i === void 0 ? Y : i, s = e.stripRegexp, d = s === void 0 ? tt : s, u = e.transform, m = u === void 0 ? X : u, o = e.delimiter, w = o === void 0 ? " " : o, a = F(F(t, n, "$1\0$2"), d, "\0"), c = 0, h = a.length; a.charAt(c) === "\0"; )
107
+ c++;
108
+ for (; a.charAt(h - 1) === "\0"; )
109
+ h--;
110
+ return a.slice(c, h).split("\0").map(m).join(w);
111
+ }
112
+ function F(t, e, i) {
113
+ return e instanceof RegExp ? t.replace(e, i) : e.reduce(function(n, s) {
114
+ return n.replace(s, i);
115
+ }, t);
116
+ }
117
+ function it(t, e) {
118
+ return e === void 0 && (e = {}), et(t, $({ delimiter: "." }, e));
119
+ }
120
+ function b(t, e) {
121
+ return e === void 0 && (e = {}), it(t, $({ delimiter: "-" }, e));
122
+ }
123
+ class st {
124
+ constructor(e = {}) {
125
+ U(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(e).forEach(([i, n]) => {
126
+ this.register(i, n);
127
+ });
128
+ }
129
+ get(e) {
130
+ const i = this.components.get(
131
+ e = b(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(([n, s]) => {
139
+ this.register(b(n), s);
140
+ }), this) : (this.components.set(b(e), i), this);
141
+ }
142
+ remove(e) {
143
+ return this.components.delete(b(e)), this;
144
+ }
145
+ reset() {
146
+ return this.components = /* @__PURE__ */ new Map(), this;
147
+ }
148
+ }
149
+ function nt(t = {}) {
150
+ return new st(t);
151
+ }
152
+ nt();
153
+ const g = {};
154
+ function y(...t) {
155
+ if (!t.length)
156
+ return g;
157
+ const [e, i] = t;
158
+ return typeof e == "string" ? typeof g[e] < "u" ? g[e] : i : Array.isArray(e) ? e.reduce((n, s) => Object.assign(n, {
159
+ [s]: g[s]
160
+ }), {}) : Object.assign(g, ...t);
161
+ }
162
+ const rt = S({
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 C = function() {
192
+ return C = Object.assign || function(t) {
193
+ for (var e, i = 1, n = arguments.length; i < n; i++) {
194
+ e = arguments[i];
195
+ for (var s in e)
196
+ Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
197
+ }
198
+ return t;
199
+ }, C.apply(this, arguments);
200
+ };
201
+ function ot(t) {
202
+ return t.toLowerCase();
203
+ }
204
+ var at = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], lt = /[^A-Z0-9]+/gi;
205
+ function dt(t, e) {
206
+ e === void 0 && (e = {});
207
+ for (var i = e.splitRegexp, n = i === void 0 ? at : i, s = e.stripRegexp, d = s === void 0 ? lt : s, u = e.transform, m = u === void 0 ? ot : u, o = e.delimiter, w = o === void 0 ? " " : o, a = z(z(t, n, "$1\0$2"), d, "\0"), c = 0, h = a.length; a.charAt(c) === "\0"; )
208
+ c++;
209
+ for (; a.charAt(h - 1) === "\0"; )
210
+ h--;
211
+ return a.slice(c, h).split("\0").map(m).join(w);
212
+ }
213
+ function z(t, e, i) {
214
+ return e instanceof RegExp ? t.replace(e, i) : e.reduce(function(n, s) {
215
+ return n.replace(s, i);
216
+ }, t);
217
+ }
218
+ function ut(t, e) {
219
+ return e === void 0 && (e = {}), dt(t, C({ delimiter: "." }, e));
220
+ }
221
+ function L(t, e) {
222
+ return e === void 0 && (e = {}), ut(t, C({ delimiter: "-" }, e));
223
+ }
224
+ function E(t, e, i = "-") {
225
+ const n = e.toString().replace(new RegExp(`^${t}${i}?`), "");
226
+ return [
227
+ L(n),
228
+ t
229
+ ].filter((s) => !!s).join(i);
230
+ }
231
+ function j(t) {
232
+ return !Array.isArray(t) && typeof t == "object";
233
+ }
234
+ function ct(t) {
235
+ return t === void 0;
236
+ }
237
+ const ht = S({
238
+ directives: {
239
+ bindEvents: {
240
+ beforeMount(t, e) {
241
+ var i, n;
242
+ (n = (i = e.instance) == null ? void 0 : i.bindEvents) == null || n.call(i, t);
243
+ }
244
+ }
245
+ },
246
+ mixins: [
247
+ rt
248
+ ],
249
+ inheritAttrs: !1,
250
+ props: {
251
+ activity: {
252
+ type: Boolean,
253
+ default: !1
254
+ },
255
+ animated: {
256
+ type: Boolean,
257
+ default: () => y("animated", !1)
258
+ },
259
+ nativeEvents: {
260
+ type: Array,
261
+ default() {
262
+ return ["focus", "blur", "change", "click", "keypress", "keyup", "keydown", "progress", "paste"];
263
+ }
264
+ },
265
+ defaultControlClass: {
266
+ type: String,
267
+ default: () => y("defaultControlClass", "form-control")
268
+ },
269
+ error: {
270
+ type: [String, Array, Boolean],
271
+ default: void 0
272
+ },
273
+ errors: {
274
+ type: [Array, Object, Boolean],
275
+ default() {
276
+ return {};
277
+ }
278
+ },
279
+ feedback: {
280
+ type: [String, Array],
281
+ default: void 0
282
+ },
283
+ group: {
284
+ type: Boolean,
285
+ default: () => y("group", !0)
286
+ },
287
+ helpText: {
288
+ type: [Number, String],
289
+ default: void 0
290
+ },
291
+ hideLabel: Boolean,
292
+ indicator: {
293
+ type: String,
294
+ default: () => y("indicator", "spinner")
295
+ },
296
+ indicatorSize: {
297
+ type: String,
298
+ default: void 0
299
+ },
300
+ inline: Boolean,
301
+ invalid: Boolean,
302
+ label: {
303
+ type: [Number, String],
304
+ default: void 0
305
+ },
306
+ labelClass: {
307
+ type: [Object, String],
308
+ default: () => y("labelClass", "form-label")
309
+ },
310
+ modelValue: {
311
+ default: void 0
312
+ },
313
+ pill: Boolean,
314
+ plaintext: Boolean,
315
+ size: String,
316
+ spacing: String,
317
+ valid: Boolean
318
+ },
319
+ data() {
320
+ return {
321
+ defaultEmpty: !1,
322
+ hasChanged: !1,
323
+ hasFocus: !1,
324
+ isEmpty: !0
325
+ };
326
+ },
327
+ computed: {
328
+ id() {
329
+ return this.$attrs.id || this.$attrs.name || (Math.random() + 1).toString(36).substring(7);
330
+ },
331
+ componentName() {
332
+ return this.$options.name;
333
+ },
334
+ controlAttributes() {
335
+ return Object.fromEntries(
336
+ Object.entries(this.$attrs).concat([
337
+ ["id", this.id],
338
+ ["class", this.controlClasses]
339
+ ])
340
+ );
341
+ },
342
+ controlClass() {
343
+ return this.defaultControlClass;
344
+ },
345
+ controlSizeClass() {
346
+ return E(this.size, this.controlClass);
347
+ },
348
+ formGroupClasses() {
349
+ return {
350
+ [L(this.componentName)]: !!this.componentName,
351
+ [this.size && E(this.size, this.componentName)]: !!this.size,
352
+ animated: this.animated,
353
+ "default-empty": this.defaultEmpty,
354
+ "form-group": this.group,
355
+ [this.size && E(this.size, "form-group")]: !!this.size,
356
+ "has-activity": this.activity,
357
+ "has-changed": this.hasChanged,
358
+ "has-focus": this.hasFocus,
359
+ "has-icon": !!this.$slots.icon,
360
+ "is-empty": this.isEmpty,
361
+ "is-invalid": !!(this.invalid || this.invalidFeedback),
362
+ "is-valid": !!(this.valid || this.validFeedback),
363
+ [this.$attrs.class]: !!this.$attrs.class,
364
+ [this.$attrs.id]: !!this.$attrs.id
365
+ };
366
+ },
367
+ controlClasses() {
368
+ return Object.assign({
369
+ [this.controlClass]: !!this.controlClass,
370
+ [this.controlSizeClass]: !!this.controlSizeClass,
371
+ "form-control-icon": !!this.$slots.icon,
372
+ "is-valid": !!(this.valid || this.validFeedback),
373
+ "is-invalid": !!(this.invalid || this.invalidFeedback),
374
+ [this.pillClasses]: this.pill,
375
+ [this.plaintextClass]: this.plaintext,
376
+ [this.spacing]: !!this.spacing
377
+ }, this.shadowableClass);
378
+ },
379
+ hasDefaultSlot() {
380
+ return !!this.$slots.default;
381
+ },
382
+ invalidFeedback() {
383
+ if (this.error === "")
384
+ return null;
385
+ if (this.error)
386
+ return this.error;
387
+ const t = this.getFieldErrors();
388
+ return Array.isArray(t) ? t.filter((e) => e && typeof e == "string").join("<br>") : t;
389
+ },
390
+ pillClasses() {
391
+ return "rounded rounded-pill";
392
+ },
393
+ plaintextClass() {
394
+ return "form-control-plaintext";
395
+ },
396
+ validFeedback() {
397
+ return Array.isArray(this.feedback) ? this.feedback.join("<br>") : this.feedback;
398
+ }
399
+ },
400
+ watch: {
401
+ hasFocus() {
402
+ this.shouldChangeOnFocus() && (this.hasChanged = !0);
403
+ },
404
+ defaultEmpty() {
405
+ this.hasChanged = !0;
406
+ }
407
+ },
408
+ methods: {
409
+ bindEvents(t, e) {
410
+ var i;
411
+ e || (e = this.onInput);
412
+ const n = t instanceof HTMLSelectElement ? (i = t.querySelectorAll("option")) == null ? void 0 : i[t.selectedIndex] : null;
413
+ ct(this.modelValue) ? n && (t.value = n == null ? void 0 : n.value) : t.value = this.modelValue, t.value && e(t.value), this.hasChanged = !!t.value, this.isEmpty = !t.value, t.addEventListener("focus", () => {
414
+ this.hasFocus = !0;
415
+ }), t.addEventListener("blur", () => {
416
+ this.hasFocus = !1;
417
+ }), t.addEventListener("input", (s) => {
418
+ this.isEmpty = !1, this.hasChanged = !0;
419
+ }), t.addEventListener(
420
+ t.tagName === "SELECT" ? "change" : "input",
421
+ () => e(t.value)
422
+ ), this.nativeEvents.forEach((s) => {
423
+ t.addEventListener(s, (d) => {
424
+ this.$emit(s, d);
425
+ });
426
+ });
427
+ },
428
+ blur() {
429
+ this.getInputField() && this.getInputField().blur();
430
+ },
431
+ focus() {
432
+ this.getInputField() && this.getInputField().focus();
433
+ },
434
+ getInputField() {
435
+ return this.$el.querySelector(
436
+ ".form-control, input, select, textarea"
437
+ );
438
+ },
439
+ getFieldErrors() {
440
+ let t = this.error || this.errors;
441
+ return this.errors && j(this.errors) && (t = this.errors[this.$attrs.name || this.$attrs.id]), !t || Array.isArray(t) || j(t) ? t : [t];
442
+ },
443
+ shouldChangeOnFocus() {
444
+ return !this.getInputField().readOnly;
445
+ },
446
+ onInput(t) {
447
+ this.$emit("update:modelValue", t);
448
+ }
449
+ }
450
+ }), pt = S({
451
+ components: {
452
+ ActivityIndicator: J
453
+ },
454
+ mixins: [
455
+ ht
456
+ ]
457
+ });
458
+ const ft = (t, e) => {
459
+ const i = t.__vccOpts || t;
460
+ for (const [n, s] of e)
461
+ i[n] = s;
462
+ return i;
463
+ }, vt = ["for", "innerHTML"], mt = { class: "form-group-inner" }, gt = ["innerHTML"], yt = ["innerHTML"];
464
+ function bt(t, e, i, n, s, d) {
465
+ const u = M("activity-indicator"), m = T("bind-events");
466
+ return r(), l("div", {
467
+ class: k(t.formGroupClasses)
468
+ }, [
469
+ f(t.$slots, "label", {}, () => [
470
+ t.label ? (r(), l("label", {
471
+ key: 0,
472
+ ref: "label",
473
+ for: t.id,
474
+ class: k(t.labelClass),
475
+ onClick: e[0] || (e[0] = (...o) => t.focus && t.focus(...o)),
476
+ innerHTML: t.label
477
+ }, null, 10, vt)) : p("", !0)
478
+ ]),
479
+ A("div", mt, [
480
+ f(t.$slots, "control", {
481
+ bindEvents: t.bindEvents,
482
+ controlAttributes: t.controlAttributes,
483
+ focus: t.focus
484
+ }, () => [
485
+ t.$slots.icon ? (r(), l("div", {
486
+ key: 0,
487
+ class: "form-group-inner-icon",
488
+ onClick: e[1] || (e[1] = (...o) => t.focus && t.focus(...o))
489
+ }, [
490
+ f(t.$slots, "icon")
491
+ ])) : p("", !0),
492
+ P(A("input", Z({ ref: "field" }, t.controlAttributes), null, 16), [
493
+ [m]
494
+ ])
495
+ ]),
496
+ f(t.$slots, "activity", {}, () => [
497
+ x(R, { name: "input-field-fade" }, {
498
+ default: V(() => [
499
+ t.activity ? (r(), O(u, {
500
+ key: "activity",
501
+ ref: "activity",
502
+ type: t.indicator,
503
+ size: t.indicatorSize || t.size
504
+ }, null, 8, ["type", "size"])) : p("", !0)
505
+ ]),
506
+ _: 1
507
+ })
508
+ ])
509
+ ]),
510
+ f(t.$slots, "feedback", {}, () => [
511
+ t.invalidFeedback ? (r(), l("div", {
512
+ key: 0,
513
+ class: "invalid-feedback",
514
+ invalid: "",
515
+ innerHTML: t.invalidFeedback
516
+ }, null, 8, gt)) : t.validFeedback ? (r(), l("div", {
517
+ key: 1,
518
+ class: "valid-feedback",
519
+ valid: "",
520
+ innerHTML: t.validFeedback
521
+ }, null, 8, yt)) : p("", !0)
522
+ ]),
523
+ f(t.$slots, "help", {}, () => [
524
+ t.helpText ? (r(), l("small", {
525
+ key: 0,
526
+ ref: "help"
527
+ }, B(t.helpText), 513)) : p("", !0)
528
+ ])
529
+ ], 2);
530
+ }
531
+ const Ct = /* @__PURE__ */ ft(pt, [["render", bt]]);
532
+ export {
533
+ Ct as InputField
534
+ };
@@ -0,0 +1 @@
1
+ (function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.InputField={},l.Vue))})(this,function(l,i){"use strict";function p(e,t="px"){return e!=null&&e!==!1&&isFinite(e)?`${e}${t}`:e}const B=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:p(this.width),maxWidth:p(this.maxWidth),minWidth:p(this.minWidth),height:p(this.height),maxHeight:p(this.maxHeight),minHeight:p(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)}}}),A=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},F={class:"activity-indicator-content"},z={key:1,class:"activity-indicator-label"};function j(e,t,n,r,s,d){return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["activity-indicator",e.classes]),style:i.normalizeStyle(e.style)},[i.createElementVNode("div",F,[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",z,i.toDisplayString(e.label),1)):i.createCommentVNode("",!0)])],6)}const N=A(B,[["render",j]]);var O=Object.defineProperty,I=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t,n)=>(I(e,typeof t!="symbol"?t+"":t,n),n),y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},y.apply(this,arguments)};function L(e){return e.toLowerCase()}var T=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],H=/[^A-Z0-9]+/gi;function M(e,t){t===void 0&&(t={});for(var n=t.splitRegexp,r=n===void 0?T:n,s=t.stripRegexp,d=s===void 0?H:s,c=t.transform,g=c===void 0?L:c,o=t.delimiter,S=o===void 0?" ":o,a=k(k(e,r,"$1\0$2"),d,"\0"),h=0,u=a.length;a.charAt(h)==="\0";)h++;for(;a.charAt(u-1)==="\0";)u--;return a.slice(h,u).split("\0").map(g).join(S)}function k(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(r,s){return r.replace(s,n)},e)}function P(e,t){return t===void 0&&(t={}),M(e,y({delimiter:"."},t))}function b(e,t){return t===void 0&&(t={}),P(e,y({delimiter:"-"},t))}class x{constructor(t={}){V(this,"components"),this.components=new Map,Object.entries(t).forEach(([n,r])=>{this.register(n,r)})}get(t){const n=this.components.get(t=b(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(([r,s])=>{this.register(b(r),s)}),this):(this.components.set(b(t),n),this)}remove(t){return this.components.delete(b(t)),this}reset(){return this.components=new Map,this}}function Z(e={}){return new x(e)}Z();const f={};function m(...e){if(!e.length)return f;const[t,n]=e;return typeof t=="string"?typeof f[t]<"u"?f[t]:n:Array.isArray(t)?t.reduce((r,s)=>Object.assign(r,{[s]:f[s]}),{}):Object.assign(f,...e)}const R=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 v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},v.apply(this,arguments)};function D(e){return e.toLowerCase()}var W=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],q=/[^A-Z0-9]+/gi;function G(e,t){t===void 0&&(t={});for(var n=t.splitRegexp,r=n===void 0?W:n,s=t.stripRegexp,d=s===void 0?q:s,c=t.transform,g=c===void 0?D:c,o=t.delimiter,S=o===void 0?" ":o,a=$($(e,r,"$1\0$2"),d,"\0"),h=0,u=a.length;a.charAt(h)==="\0";)h++;for(;a.charAt(u-1)==="\0";)u--;return a.slice(h,u).split("\0").map(g).join(S)}function $(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(r,s){return r.replace(s,n)},e)}function _(e,t){return t===void 0&&(t={}),G(e,v({delimiter:"."},t))}function E(e,t){return t===void 0&&(t={}),_(e,v({delimiter:"-"},t))}function C(e,t,n="-"){const r=t.toString().replace(new RegExp(`^${e}${n}?`),"");return[E(r),e].filter(s=>!!s).join(n)}function w(e){return!Array.isArray(e)&&typeof e=="object"}function J(e){return e===void 0}const K=i.defineComponent({directives:{bindEvents:{beforeMount(e,t){var n,r;(r=(n=t.instance)==null?void 0:n.bindEvents)==null||r.call(n,e)}}},mixins:[R],inheritAttrs:!1,props:{activity:{type:Boolean,default:!1},animated:{type:Boolean,default:()=>m("animated",!1)},nativeEvents:{type:Array,default(){return["focus","blur","change","click","keypress","keyup","keydown","progress","paste"]}},defaultControlClass:{type:String,default:()=>m("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:()=>m("group",!0)},helpText:{type:[Number,String],default:void 0},hideLabel:Boolean,indicator:{type:String,default:()=>m("indicator","spinner")},indicatorSize:{type:String,default:void 0},inline:Boolean,invalid:Boolean,label:{type:[Number,String],default:void 0},labelClass:{type:[Object,String],default:()=>m("labelClass","form-label")},modelValue:{default:void 0},pill:Boolean,plaintext:Boolean,size:String,spacing:String,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 C(this.size,this.controlClass)},formGroupClasses(){return{[E(this.componentName)]:!!this.componentName,[this.size&&C(this.size,this.componentName)]:!!this.size,animated:this.animated,"default-empty":this.defaultEmpty,"form-group":this.group,[this.size&&C(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 r=e instanceof HTMLSelectElement?(n=e.querySelectorAll("option"))==null?void 0:n[e.selectedIndex]:null;J(this.modelValue)?r&&(e.value=r==null?void 0:r.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",s=>{this.isEmpty=!1,this.hasChanged=!0}),e.addEventListener(e.tagName==="SELECT"?"change":"input",()=>t(e.value)),this.nativeEvents.forEach(s=>{e.addEventListener(s,d=>{this.$emit(s,d)})})},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&&w(this.errors)&&(e=this.errors[this.$attrs.name||this.$attrs.id]),!e||Array.isArray(e)||w(e)?e:[e]},shouldChangeOnFocus(){return!this.getInputField().readOnly},onInput(e){this.$emit("update:modelValue",e)}}}),Q=i.defineComponent({components:{ActivityIndicator:N},mixins:[K]}),se="",U=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},X=["for","innerHTML"],Y={class:"form-group-inner"},ee=["innerHTML"],te=["innerHTML"];function ie(e,t,n,r,s,d){const c=i.resolveComponent("activity-indicator"),g=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]=(...o)=>e.focus&&e.focus(...o)),innerHTML:e.label},null,10,X)):i.createCommentVNode("",!0)]),i.createElementVNode("div",Y,[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]=(...o)=>e.focus&&e.focus(...o))},[i.renderSlot(e.$slots,"icon")])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.mergeProps({ref:"field"},e.controlAttributes),null,16),[[g]])]),i.renderSlot(e.$slots,"activity",{},()=>[i.createVNode(i.Transition,{name:"input-field-fade"},{default:i.withCtx(()=>[e.activity?(i.openBlock(),i.createBlock(c,{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,ee)):e.validFeedback?(i.openBlock(),i.createElementBlock("div",{key:1,class:"valid-feedback",valid:"",innerHTML:e.validFeedback},null,8,te)):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 ne=U(Q,[["render",ie]]);l.InputField=ne,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});