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

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,534 +1,271 @@
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
- };
1
+ import { defineComponent as j, inject as O, toRaw as R, openBlock as s, createElementBlock as c, normalizeClass as F, normalizeStyle as H, createElementVNode as u, createBlock as E, resolveDynamicComponent as W, toDisplayString as p, createCommentVNode as d, resolveComponent as C, resolveDirective as B, renderSlot as a, normalizeProps as w, guardReactiveProps as z, withDirectives as D, mergeProps as P, vModelDynamic as V, createVNode as A, Transition as I, withCtx as S, createTextVNode as T } from "vue";
2
+ import { FormControl as Z } from "@vue-interface/form-control";
3
+ var M = Object.defineProperty, G = (e, t, r) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, q = (e, t, r) => (G(e, typeof t != "symbol" ? t + "" : t, r), r), v = function() {
4
+ return v = Object.assign || function(e) {
5
+ for (var t, r = 1, i = arguments.length; r < i; r++) {
6
+ t = arguments[r];
7
+ for (var o in t)
8
+ Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
54
9
  }
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"
10
+ return e;
11
+ }, v.apply(this, arguments);
74
12
  };
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);
13
+ function L(e) {
14
+ return e.toLowerCase();
88
15
  }
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);
16
+ var U = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], J = /[^A-Z0-9]+/gi;
17
+ function K(e, t) {
18
+ t === void 0 && (t = {});
19
+ for (var r = t.splitRegexp, i = r === void 0 ? U : r, o = t.stripRegexp, y = o === void 0 ? J : o, m = t.transform, b = m === void 0 ? L : m, f = t.delimiter, g = f === void 0 ? " " : f, n = N(N(e, i, "$1\0$2"), y, "\0"), $ = 0, k = n.length; n.charAt($) === "\0"; )
20
+ $++;
21
+ for (; n.charAt(k - 1) === "\0"; )
22
+ k--;
23
+ return n.slice($, k).split("\0").map(b).join(g);
111
24
  }
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);
25
+ function N(e, t, r) {
26
+ return t instanceof RegExp ? e.replace(t, r) : t.reduce(function(i, o) {
27
+ return i.replace(o, r);
28
+ }, e);
116
29
  }
117
- function it(t, e) {
118
- return e === void 0 && (e = {}), et(t, $({ delimiter: "." }, e));
30
+ function Q(e, t) {
31
+ return t === void 0 && (t = {}), K(e, v({ delimiter: "." }, t));
119
32
  }
120
- function b(t, e) {
121
- return e === void 0 && (e = {}), it(t, $({ delimiter: "-" }, e));
33
+ function h(e, t) {
34
+ return t === void 0 && (t = {}), Q(e, v({ delimiter: "-" }, t));
122
35
  }
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);
36
+ class X {
37
+ constructor(t = {}) {
38
+ q(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([r, i]) => {
39
+ this.register(r, i);
127
40
  });
128
41
  }
129
- get(e) {
130
- const i = this.components.get(
131
- e = b(e)
42
+ get(t) {
43
+ const r = this.components.get(
44
+ t = h(t)
132
45
  );
133
- if (i)
134
- return i;
135
- throw new Error(`"${e}" has not been registered yet!`);
46
+ if (r)
47
+ return r;
48
+ throw new Error(`"${t}" has not been registered yet!`);
136
49
  }
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);
50
+ register(t, r) {
51
+ return typeof t == "object" ? (Object.entries(t).forEach(([i, o]) => {
52
+ this.register(h(i), o);
53
+ }), this) : (this.components.set(h(t), r), this);
141
54
  }
142
- remove(e) {
143
- return this.components.delete(b(e)), this;
55
+ remove(t) {
56
+ return this.components.delete(h(t)), this;
144
57
  }
145
58
  reset() {
146
59
  return this.components = /* @__PURE__ */ new Map(), this;
147
60
  }
148
61
  }
149
- function nt(t = {}) {
150
- return new st(t);
62
+ function Y(e = {}) {
63
+ return new X(e);
151
64
  }
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);
65
+ const _ = Y();
66
+ function l(e, t = "px") {
67
+ return e != null && e !== !1 && isFinite(e) ? `${e}${t}` : e;
161
68
  }
162
- const rt = S({
69
+ const x = j({
163
70
  props: {
164
- dropShadow: {
165
- type: [Boolean, String],
166
- default: void 0
167
- },
168
- dropShadowableClassPrefix: {
71
+ absolute: Boolean,
72
+ center: Boolean,
73
+ label: {
169
74
  type: String,
170
- default: "drop-shadow"
171
- },
172
- shadow: {
173
- type: [Boolean, String],
174
75
  default: void 0
175
76
  },
176
- shadowableClassPrefix: {
77
+ size: {
177
78
  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
- }
79
+ default: "md"
264
80
  },
265
- defaultControlClass: {
81
+ registry: {
266
82
  type: String,
267
- default: () => y("defaultControlClass", "form-control")
268
- },
269
- error: {
270
- type: [String, Array, Boolean],
271
- default: void 0
83
+ default: "indicators"
272
84
  },
273
- errors: {
274
- type: [Array, Object, Boolean],
275
- default() {
276
- return {};
277
- }
85
+ type: {
86
+ type: [Object, String],
87
+ required: !0
278
88
  },
279
- feedback: {
280
- type: [String, Array],
89
+ height: {
90
+ type: [String, Number],
281
91
  default: void 0
282
92
  },
283
- group: {
284
- type: Boolean,
285
- default: () => y("group", !0)
286
- },
287
- helpText: {
288
- type: [Number, String],
93
+ maxHeight: {
94
+ type: [String, Number],
289
95
  default: void 0
290
96
  },
291
- hideLabel: Boolean,
292
- indicator: {
293
- type: String,
294
- default: () => y("indicator", "spinner")
295
- },
296
- indicatorSize: {
297
- type: String,
97
+ minHeight: {
98
+ type: [String, Number],
298
99
  default: void 0
299
100
  },
300
- inline: Boolean,
301
- invalid: Boolean,
302
- label: {
303
- type: [Number, String],
101
+ width: {
102
+ type: [String, Number],
304
103
  default: void 0
305
104
  },
306
- labelClass: {
307
- type: [Object, String],
308
- default: () => y("labelClass", "form-label")
309
- },
310
- modelValue: {
105
+ maxWidth: {
106
+ type: [String, Number],
311
107
  default: void 0
312
108
  },
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
- };
109
+ minWidth: {
110
+ type: [String, Number],
111
+ default: void 0
112
+ }
326
113
  },
114
+ data: () => ({
115
+ is: null
116
+ }),
327
117
  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() {
118
+ classes() {
349
119
  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
120
+ "activity-indicator-center": this.center,
121
+ "activity-indicator-absolute": this.absolute,
122
+ [this.size && `activity-indicator-${this.size}`]: !!this.size
365
123
  };
366
124
  },
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;
125
+ style() {
126
+ return {
127
+ width: l(this.width),
128
+ maxWidth: l(this.maxWidth),
129
+ minWidth: l(this.minWidth),
130
+ height: l(this.height),
131
+ maxHeight: l(this.maxHeight),
132
+ minHeight: l(this.minHeight)
133
+ };
406
134
  }
407
135
  },
136
+ // async mounted() {
137
+ // const component = await this.component();
138
+ // this.is = () => component;
139
+ // },
408
140
  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;
141
+ componentFromRegistry(e) {
142
+ var t;
143
+ try {
144
+ return (t = O(this.registry || "indicators", _)) == null ? void 0 : t.get(e);
145
+ } catch {
146
+ }
445
147
  },
446
- onInput(t) {
447
- this.$emit("update:modelValue", t);
148
+ component() {
149
+ return typeof this.type == "string" ? this.componentFromRegistry(this.type) : R(this.type);
448
150
  }
449
151
  }
450
- }), pt = S({
152
+ }), ee = (e, t) => {
153
+ const r = e.__vccOpts || e;
154
+ for (const [i, o] of t)
155
+ r[i] = o;
156
+ return r;
157
+ }, te = { class: "activity-indicator-content" }, re = {
158
+ key: 0,
159
+ class: "activity-indicator-label"
160
+ };
161
+ function oe(e, t, r, i, o, y) {
162
+ return s(), c("div", {
163
+ class: F(["activity-indicator", e.classes]),
164
+ style: H(e.style)
165
+ }, [
166
+ u("div", te, [
167
+ (s(), E(W(e.component()), { class: "mx-auto" })),
168
+ e.label ? (s(), c("div", re, p(e.label), 1)) : d("", !0)
169
+ ])
170
+ ], 6);
171
+ }
172
+ const ie = /* @__PURE__ */ ee(x, [["render", oe]]), ne = j({
173
+ name: "InputField",
451
174
  components: {
452
- ActivityIndicator: J
175
+ ActivityIndicator: ie
453
176
  },
454
- mixins: [
455
- ht
456
- ]
177
+ extends: Z
457
178
  });
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)
179
+ const se = (e, t) => {
180
+ const r = e.__vccOpts || e;
181
+ for (const [i, o] of t)
182
+ r[i] = o;
183
+ return r;
184
+ }, ae = ["for"], le = { class: "form-group-inner" }, de = {
185
+ invalid: "",
186
+ class: "invalid-feedback"
187
+ }, ce = /* @__PURE__ */ u("br", null, null, -1), ue = {
188
+ valid: "",
189
+ class: "valid-feedback"
190
+ };
191
+ function pe(e, t, r, i, o, y) {
192
+ const m = C("activity-indicator"), b = C("FormControlErrors"), f = C("FormControlFeedback"), g = B("bind-events");
193
+ return s(), c("div", {
194
+ class: F(["input-field", e.formGroupClasses])
468
195
  }, [
469
- f(t.$slots, "label", {}, () => [
470
- t.label ? (r(), l("label", {
196
+ a(e.$slots, "label", {}, () => [
197
+ e.label ? (s(), c("label", {
471
198
  key: 0,
472
199
  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)
200
+ class: F(e.labelClass),
201
+ for: e.id
202
+ }, p(e.label), 11, ae)) : d("", !0)
478
203
  ]),
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", {
204
+ u("div", le, [
205
+ a(e.$slots, "control", w(z({ bindEvents: e.bindEvents, controlAttributes: e.controlAttributes })), () => [
206
+ e.$slots.icon ? (s(), c("div", {
486
207
  key: 0,
487
208
  class: "form-group-inner-icon",
488
- onClick: e[1] || (e[1] = (...o) => t.focus && t.focus(...o))
209
+ onClick: t[0] || (t[0] = (...n) => e.focus && e.focus(...n))
489
210
  }, [
490
- f(t.$slots, "icon")
491
- ])) : p("", !0),
492
- P(A("input", Z({ ref: "field" }, t.controlAttributes), null, 16), [
493
- [m]
211
+ a(e.$slots, "icon")
212
+ ])) : d("", !0),
213
+ D(u("input", P({
214
+ ref: "field",
215
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => e.model = n)
216
+ }, e.controlAttributes), null, 16), [
217
+ [V, e.model],
218
+ [g]
494
219
  ])
495
220
  ]),
496
- f(t.$slots, "activity", {}, () => [
497
- x(R, { name: "input-field-fade" }, {
498
- default: V(() => [
499
- t.activity ? (r(), O(u, {
221
+ a(e.$slots, "activity", {}, () => [
222
+ A(I, { name: "input-field-fade" }, {
223
+ default: S(() => [
224
+ e.activity ? (s(), E(m, {
500
225
  key: "activity",
501
226
  ref: "activity",
502
- type: t.indicator,
503
- size: t.indicatorSize || t.size
504
- }, null, 8, ["type", "size"])) : p("", !0)
227
+ type: e.indicator,
228
+ size: e.indicatorSize || e.size
229
+ }, null, 8, ["type", "size"])) : d("", !0)
505
230
  ]),
506
231
  _: 1
507
232
  })
508
233
  ])
509
234
  ]),
510
- f(t.$slots, "feedback", {}, () => [
511
- t.invalidFeedback ? (r(), l("div", {
235
+ a(e.$slots, "errors", w(z({ error: e.error, errors: e.errors, id: e.$attrs.id, name: e.$attrs.name })), () => [
236
+ e.error || e.errors ? (s(), E(b, {
512
237
  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)
238
+ id: e.$attrs.id,
239
+ name: e.$attrs.name,
240
+ error: e.error,
241
+ errors: e.errors
242
+ }, {
243
+ default: S(({ error: n }) => [
244
+ u("div", de, [
245
+ T(p(n), 1),
246
+ ce
247
+ ])
248
+ ]),
249
+ _: 1
250
+ }, 8, ["id", "name", "error", "errors"])) : d("", !0)
251
+ ]),
252
+ a(e.$slots, "feedback", w(z({ feedback: e.feedback })), () => [
253
+ A(f, { feedback: e.feedback }, {
254
+ default: S(({ feedback: n }) => [
255
+ u("div", ue, p(n), 1)
256
+ ]),
257
+ _: 1
258
+ }, 8, ["feedback"])
522
259
  ]),
523
- f(t.$slots, "help", {}, () => [
524
- t.helpText ? (r(), l("small", {
260
+ a(e.$slots, "help", {}, () => [
261
+ e.helpText ? (s(), c("small", {
525
262
  key: 0,
526
263
  ref: "help"
527
- }, B(t.helpText), 513)) : p("", !0)
264
+ }, p(e.helpText), 513)) : d("", !0)
528
265
  ])
529
266
  ], 2);
530
267
  }
531
- const Ct = /* @__PURE__ */ ft(pt, [["render", bt]]);
268
+ const he = /* @__PURE__ */ se(ne, [["render", pe]]);
532
269
  export {
533
- Ct as InputField
270
+ he as InputField
534
271
  };
@@ -1 +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"}})});
1
+ (function(l,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vue-interface/form-control")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/form-control"],t):(l=typeof globalThis<"u"?globalThis:l||self,t(l.InputField={},l.Vue,l.formControl))})(this,function(l,t,k){"use strict";var C=Object.defineProperty,S=(e,r,o)=>r in e?C(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,$=(e,r,o)=>(S(e,typeof r!="symbol"?r+"":r,o),o),d=function(){return d=Object.assign||function(e){for(var r,o=1,i=arguments.length;o<i;o++){r=arguments[o];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d.apply(this,arguments)};function B(e){return e.toLowerCase()}var E=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],N=/[^A-Z0-9]+/gi;function z(e,r){r===void 0&&(r={});for(var o=r.splitRegexp,i=o===void 0?E:o,n=r.stripRegexp,f=n===void 0?N:n,m=r.transform,h=m===void 0?B:m,p=r.delimiter,y=p===void 0?" ":p,s=u(u(e,i,"$1\0$2"),f,"\0"),g=0,b=s.length;s.charAt(g)==="\0";)g++;for(;s.charAt(b-1)==="\0";)b--;return s.slice(g,b).split("\0").map(h).join(y)}function u(e,r,o){return r instanceof RegExp?e.replace(r,o):r.reduce(function(i,n){return i.replace(n,o)},e)}function V(e,r){return r===void 0&&(r={}),z(e,d({delimiter:"."},r))}function c(e,r){return r===void 0&&(r={}),V(e,d({delimiter:"-"},r))}class w{constructor(r={}){$(this,"components"),this.components=new Map,Object.entries(r).forEach(([o,i])=>{this.register(o,i)})}get(r){const o=this.components.get(r=c(r));if(o)return o;throw new Error(`"${r}" has not been registered yet!`)}register(r,o){return typeof r=="object"?(Object.entries(r).forEach(([i,n])=>{this.register(c(i),n)}),this):(this.components.set(c(r),o),this)}remove(r){return this.components.delete(c(r)),this}reset(){return this.components=new Map,this}}function F(e={}){return new w(e)}const j=F();function a(e,r="px"){return e!=null&&e!==!1&&isFinite(e)?`${e}${r}`:e}const P=t.defineComponent({props:{absolute:Boolean,center:Boolean,label:{type:String,default:void 0},size:{type:String,default:"md"},registry:{type:String,default:"indicators"},type:{type:[Object,String],required:!0},height:{type:[String,Number],default:void 0},maxHeight:{type:[String,Number],default:void 0},minHeight:{type:[String,Number],default:void 0},width:{type:[String,Number],default:void 0},maxWidth:{type:[String,Number],default:void 0},minWidth:{type:[String,Number],default:void 0}},data:()=>({is:null}),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)}}},methods:{componentFromRegistry(e){var r;try{return(r=t.inject(this.registry||"indicators",j))==null?void 0:r.get(e)}catch{}},component(){return typeof this.type=="string"?this.componentFromRegistry(this.type):t.toRaw(this.type)}}}),A=(e,r)=>{const o=e.__vccOpts||e;for(const[i,n]of r)o[i]=n;return o},D={class:"activity-indicator-content"},O={key:0,class:"activity-indicator-label"};function R(e,r,o,i,n,f){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["activity-indicator",e.classes]),style:t.normalizeStyle(e.style)},[t.createElementVNode("div",D,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.component()),{class:"mx-auto"})),e.label?(t.openBlock(),t.createElementBlock("div",O,t.toDisplayString(e.label),1)):t.createCommentVNode("",!0)])],6)}const T=A(P,[["render",R]]),H=t.defineComponent({name:"InputField",components:{ActivityIndicator:T},extends:k.FormControl}),U="",I=(e,r)=>{const o=e.__vccOpts||e;for(const[i,n]of r)o[i]=n;return o},W=["for"],M={class:"form-group-inner"},Z={invalid:"",class:"invalid-feedback"},v=t.createElementVNode("br",null,null,-1),q={valid:"",class:"valid-feedback"};function G(e,r,o,i,n,f){const m=t.resolveComponent("activity-indicator"),h=t.resolveComponent("FormControlErrors"),p=t.resolveComponent("FormControlFeedback"),y=t.resolveDirective("bind-events");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["input-field",e.formGroupClasses])},[t.renderSlot(e.$slots,"label",{},()=>[e.label?(t.openBlock(),t.createElementBlock("label",{key:0,ref:"label",class:t.normalizeClass(e.labelClass),for:e.id},t.toDisplayString(e.label),11,W)):t.createCommentVNode("",!0)]),t.createElementVNode("div",M,[t.renderSlot(e.$slots,"control",t.normalizeProps(t.guardReactiveProps({bindEvents:e.bindEvents,controlAttributes:e.controlAttributes})),()=>[e.$slots.icon?(t.openBlock(),t.createElementBlock("div",{key:0,class:"form-group-inner-icon",onClick:r[0]||(r[0]=(...s)=>e.focus&&e.focus(...s))},[t.renderSlot(e.$slots,"icon")])):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("input",t.mergeProps({ref:"field","onUpdate:modelValue":r[1]||(r[1]=s=>e.model=s)},e.controlAttributes),null,16),[[t.vModelDynamic,e.model],[y]])]),t.renderSlot(e.$slots,"activity",{},()=>[t.createVNode(t.Transition,{name:"input-field-fade"},{default:t.withCtx(()=>[e.activity?(t.openBlock(),t.createBlock(m,{key:"activity",ref:"activity",type:e.indicator,size:e.indicatorSize||e.size},null,8,["type","size"])):t.createCommentVNode("",!0)]),_:1})])]),t.renderSlot(e.$slots,"errors",t.normalizeProps(t.guardReactiveProps({error:e.error,errors:e.errors,id:e.$attrs.id,name:e.$attrs.name})),()=>[e.error||e.errors?(t.openBlock(),t.createBlock(h,{key:0,id:e.$attrs.id,name:e.$attrs.name,error:e.error,errors:e.errors},{default:t.withCtx(({error:s})=>[t.createElementVNode("div",Z,[t.createTextVNode(t.toDisplayString(s),1),v])]),_:1},8,["id","name","error","errors"])):t.createCommentVNode("",!0)]),t.renderSlot(e.$slots,"feedback",t.normalizeProps(t.guardReactiveProps({feedback:e.feedback})),()=>[t.createVNode(p,{feedback:e.feedback},{default:t.withCtx(({feedback:s})=>[t.createElementVNode("div",q,t.toDisplayString(s),1)]),_:1},8,["feedback"])]),t.renderSlot(e.$slots,"help",{},()=>[e.helpText?(t.openBlock(),t.createElementBlock("small",{key:0,ref:"help"},t.toDisplayString(e.helpText),513)):t.createCommentVNode("",!0)])],2)}const L=I(H,[["render",G]]);l.InputField=L,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
@@ -1,4 +1,4 @@
1
- declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").DefineComponent<{
1
+ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").DefineComponent<{
2
2
  activity: {
3
3
  type: BooleanConstructor;
4
4
  default: boolean;
@@ -7,26 +7,26 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
7
7
  type: BooleanConstructor;
8
8
  default: () => any;
9
9
  };
10
- nativeEvents: {
11
- type: ArrayConstructor;
12
- default(): string[];
13
- };
14
- defaultControlClass: {
15
- type: StringConstructor;
16
- default: () => any;
10
+ controlClass: {
11
+ type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
12
+ default: undefined;
17
13
  };
18
14
  error: {
19
15
  type: (BooleanConstructor | StringConstructor | ArrayConstructor)[];
20
16
  default: undefined;
21
17
  };
22
18
  errors: {
23
- type: (BooleanConstructor | ArrayConstructor | ObjectConstructor)[];
19
+ type: (BooleanConstructor | ObjectConstructor | ArrayConstructor)[];
24
20
  default(): {};
25
21
  };
26
22
  feedback: {
27
23
  type: (StringConstructor | ArrayConstructor)[];
28
24
  default: undefined;
29
25
  };
26
+ formControlClass: {
27
+ type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
28
+ default: () => any;
29
+ };
30
30
  group: {
31
31
  type: BooleanConstructor;
32
32
  default: () => any;
@@ -35,16 +35,14 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
35
35
  type: (StringConstructor | NumberConstructor)[];
36
36
  default: undefined;
37
37
  };
38
- hideLabel: BooleanConstructor;
39
38
  indicator: {
40
- type: StringConstructor;
39
+ type: (BooleanConstructor | StringConstructor | ObjectConstructor)[];
41
40
  default: () => any;
42
41
  };
43
42
  indicatorSize: {
44
43
  type: StringConstructor;
45
44
  default: undefined;
46
45
  };
47
- inline: BooleanConstructor;
48
46
  invalid: BooleanConstructor;
49
47
  label: {
50
48
  type: (StringConstructor | NumberConstructor)[];
@@ -55,54 +53,56 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
55
53
  default: () => any;
56
54
  };
57
55
  modelValue: {
56
+ type: (BooleanConstructor | StringConstructor | ObjectConstructor | NumberConstructor | ArrayConstructor)[];
58
57
  default: undefined;
59
58
  };
60
- pill: BooleanConstructor;
61
59
  plaintext: BooleanConstructor;
62
- size: StringConstructor;
63
- spacing: StringConstructor;
60
+ size: {
61
+ type: StringConstructor;
62
+ default: undefined;
63
+ };
64
64
  valid: BooleanConstructor;
65
65
  }, unknown, {
66
- defaultEmpty: boolean;
66
+ currentValue: null;
67
67
  hasChanged: boolean;
68
68
  hasFocus: boolean;
69
- isEmpty: boolean;
69
+ isDirty: boolean;
70
70
  }, {
71
- id(): any;
71
+ model: {
72
+ get(): any;
73
+ set(value: any): void;
74
+ };
75
+ id(): string | undefined;
76
+ isEmpty(): boolean;
77
+ isInvalid(): boolean;
78
+ isValid(): boolean;
72
79
  componentName(): any;
73
- controlAttributes(): {
74
- [k: string]: unknown;
75
- };
76
- controlClass(): any;
80
+ controlAttributes(): any;
81
+ controlClasses(): any;
77
82
  controlSizeClass(): string;
78
83
  formGroupClasses(): {
79
- [x: string]: any;
80
84
  [x: number]: boolean;
81
85
  animated: any;
82
- 'default-empty': any;
83
86
  'form-group': any;
84
87
  'has-activity': any;
85
88
  'has-changed': any;
86
89
  'has-focus': any;
87
90
  'has-icon': boolean;
91
+ 'is-dirty': any;
88
92
  'is-empty': any;
89
- 'is-invalid': boolean;
90
- 'is-valid': boolean;
91
- };
92
- controlClasses(): any;
93
- hasDefaultSlot(): boolean;
94
- invalidFeedback(): any;
95
- pillClasses(): "rounded rounded-pill";
93
+ 'is-invalid': any;
94
+ 'is-valid': any;
95
+ } & (false | {
96
+ [x: string]: boolean;
97
+ });
96
98
  plaintextClass(): "form-control-plaintext";
97
- validFeedback(): any;
98
99
  }, {
99
- bindEvents(el: HTMLOptionElement | HTMLSelectElement, fn: Function): void;
100
+ bindEvents(el: HTMLElement): void;
100
101
  blur(): void;
101
102
  focus(): void;
102
- getInputField(): any;
103
103
  getFieldErrors(): any;
104
- shouldChangeOnFocus(): boolean;
105
- onInput(value: any): void;
104
+ getModelValue(): any;
105
+ setModelValue(value: any): void;
106
106
  }, import("vue").DefineComponent<{
107
107
  dropShadow: {
108
108
  type: (BooleanConstructor | StringConstructor)[];
@@ -146,7 +146,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
146
146
  dropShadow: string | boolean;
147
147
  dropShadowableClassPrefix: string;
148
148
  shadowableClassPrefix: string;
149
- }>, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
149
+ }>, import("vue").ComponentOptionsMixin, ("focus" | "blur" | "change" | "click" | "keypress" | "keyup" | "keydown" | "progress" | "paste" | "update:modelValue")[], "focus" | "blur" | "change" | "click" | "keypress" | "keyup" | "keydown" | "progress" | "paste" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
150
150
  activity: {
151
151
  type: BooleanConstructor;
152
152
  default: boolean;
@@ -155,26 +155,26 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
155
155
  type: BooleanConstructor;
156
156
  default: () => any;
157
157
  };
158
- nativeEvents: {
159
- type: ArrayConstructor;
160
- default(): string[];
161
- };
162
- defaultControlClass: {
163
- type: StringConstructor;
164
- default: () => any;
158
+ controlClass: {
159
+ type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
160
+ default: undefined;
165
161
  };
166
162
  error: {
167
163
  type: (BooleanConstructor | StringConstructor | ArrayConstructor)[];
168
164
  default: undefined;
169
165
  };
170
166
  errors: {
171
- type: (BooleanConstructor | ArrayConstructor | ObjectConstructor)[];
167
+ type: (BooleanConstructor | ObjectConstructor | ArrayConstructor)[];
172
168
  default(): {};
173
169
  };
174
170
  feedback: {
175
171
  type: (StringConstructor | ArrayConstructor)[];
176
172
  default: undefined;
177
173
  };
174
+ formControlClass: {
175
+ type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
176
+ default: () => any;
177
+ };
178
178
  group: {
179
179
  type: BooleanConstructor;
180
180
  default: () => any;
@@ -183,16 +183,14 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
183
183
  type: (StringConstructor | NumberConstructor)[];
184
184
  default: undefined;
185
185
  };
186
- hideLabel: BooleanConstructor;
187
186
  indicator: {
188
- type: StringConstructor;
187
+ type: (BooleanConstructor | StringConstructor | ObjectConstructor)[];
189
188
  default: () => any;
190
189
  };
191
190
  indicatorSize: {
192
191
  type: StringConstructor;
193
192
  default: undefined;
194
193
  };
195
- inline: BooleanConstructor;
196
194
  invalid: BooleanConstructor;
197
195
  label: {
198
196
  type: (StringConstructor | NumberConstructor)[];
@@ -203,33 +201,44 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
203
201
  default: () => any;
204
202
  };
205
203
  modelValue: {
204
+ type: (BooleanConstructor | StringConstructor | ObjectConstructor | NumberConstructor | ArrayConstructor)[];
206
205
  default: undefined;
207
206
  };
208
- pill: BooleanConstructor;
209
207
  plaintext: BooleanConstructor;
210
- size: StringConstructor;
211
- spacing: StringConstructor;
208
+ size: {
209
+ type: StringConstructor;
210
+ default: undefined;
211
+ };
212
212
  valid: BooleanConstructor;
213
- }>>, {
214
- activity: boolean;
215
- animated: boolean;
216
- nativeEvents: unknown[];
217
- defaultControlClass: string;
213
+ }>> & {
214
+ onFocus?: ((...args: any[]) => any) | undefined;
215
+ onBlur?: ((...args: any[]) => any) | undefined;
216
+ onChange?: ((...args: any[]) => any) | undefined;
217
+ onClick?: ((...args: any[]) => any) | undefined;
218
+ onKeypress?: ((...args: any[]) => any) | undefined;
219
+ onKeyup?: ((...args: any[]) => any) | undefined;
220
+ onKeydown?: ((...args: any[]) => any) | undefined;
221
+ onProgress?: ((...args: any[]) => any) | undefined;
222
+ onPaste?: ((...args: any[]) => any) | undefined;
223
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
224
+ }, {
218
225
  error: string | boolean | unknown[];
219
226
  errors: boolean | unknown[] | Record<string, any>;
220
227
  feedback: string | unknown[];
228
+ activity: boolean;
229
+ animated: boolean;
230
+ controlClass: string | unknown[] | Record<string, any>;
231
+ formControlClass: string | unknown[] | Record<string, any>;
221
232
  group: boolean;
222
233
  helpText: string | number;
223
- hideLabel: boolean;
224
- indicator: string;
234
+ indicator: string | boolean | Record<string, any>;
225
235
  indicatorSize: string;
226
- inline: boolean;
227
236
  invalid: boolean;
228
237
  label: string | number;
229
238
  labelClass: string | Record<string, any>;
230
- modelValue: undefined;
231
- pill: boolean;
239
+ modelValue: string | number | boolean | unknown[] | Record<string, any>;
232
240
  plaintext: boolean;
241
+ size: string;
233
242
  valid: boolean;
234
- }>, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
243
+ }>, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
235
244
  export default _sfc_main;
package/dist/style.css CHANGED
@@ -1 +1 @@
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}
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:.5em;width:1em;font-size:1.25em;-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{font-size:1em}.input-field-lg .form-group-inner-icon{left:.4em;font-size:1.75em}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-interface/input-field",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "A Vue input field component.",
5
5
  "files": [
6
6
  "dist"
@@ -8,24 +8,21 @@
8
8
  "type": "module",
9
9
  "main": "./dist/input-field.umd.cjs",
10
10
  "module": "./dist/input-field.js",
11
+ "style": "./dist/style.css",
11
12
  "types": "./dist/index.d.ts",
12
13
  "exports": {
13
14
  ".": {
14
15
  "import": "./dist/input-field.js",
15
16
  "require": "./dist/input-field.umd.js",
16
17
  "types": "./dist/index.d.ts"
17
- }
18
+ },
19
+ "./dist/style.css": "./dist/style.css"
18
20
  },
19
21
  "browserslist": "last 2 versions, > 0.5%, ie >= 11",
20
22
  "scripts": {
21
23
  "dev": "vite",
22
24
  "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;"
25
+ "preview": "vite preview"
29
26
  },
30
27
  "repository": {
31
28
  "type": "git",
@@ -46,25 +43,25 @@
46
43
  },
47
44
  "homepage": "https://github.com/vue-interface/input-field/docs#readme",
48
45
  "dependencies": {
49
- "@vue-interface/activity-indicator": "^2.0.0-beta.0",
50
- "@vue-interface/form-control": "^1.0.0-beta.4"
46
+ "@vue-interface/activity-indicator": "^2.0.0-beta.10",
47
+ "@vue-interface/form-control": "^1.0.0-beta.10"
51
48
  },
52
49
  "peerDependencies": {
53
50
  "vue": "^3.0.0"
54
51
  },
55
52
  "devDependencies": {
56
- "@rollup/plugin-babel": "^5.3.0",
57
- "@vitejs/plugin-vue": "^3.0.1",
53
+ "@vitejs/plugin-vue": "^4.0.0",
54
+ "@vue/eslint-config-typescript": "^11.0.2",
58
55
  "autoprefixer": "^10.4.2",
59
- "babel-eslint": "^10.1.0",
60
- "babel-preset-vue": "^2.0.2",
61
56
  "change-case": "^4.1.2",
62
- "eslint": "^6.7.2",
63
- "eslint-plugin-vue": "^6.2.2",
57
+ "eslint": "^8.28.0",
58
+ "eslint-plugin-vue": "^9.8.0",
64
59
  "pascalcase": "^2.0.0",
65
60
  "postcss": "^8.4.6",
66
61
  "tailwindcss": "^3.0.18",
67
- "vite": "^3.0.0",
62
+ "tsup": "^6.6.2",
63
+ "typescript": "^4.0.0",
64
+ "vite": "^4.0.0",
68
65
  "vite-plugin-dts": "^1.7.1",
69
66
  "vue": "^3.2.37"
70
67
  }