ablok-components 0.0.33 → 0.0.34

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,8 +1,8 @@
1
- import { defineComponent as b, openBlock as u, createElementBlock as c, normalizeClass as $, createElementVNode as i, renderSlot as f, computed as h, resolveComponent as S, createBlock as q, createCommentVNode as w, unref as p, toDisplayString as v, withDirectives as C, isRef as M, vModelDynamic as I, vModelText as T, ref as x, watch as V, onBeforeMount as L, Fragment as B, renderList as k, createTextVNode as O, withModifiers as N, reactive as A, createVNode as U } from "vue";
2
- const D = {
1
+ import { defineComponent as b, openBlock as u, createElementBlock as s, normalizeClass as v, createElementVNode as i, renderSlot as m, computed as g, resolveComponent as $, createBlock as O, createCommentVNode as q, unref as p, toDisplayString as h, withDirectives as M, isRef as U, vModelDynamic as T, vModelText as A, ref as B, watch as S, onBeforeMount as N, Fragment as k, renderList as w, createTextVNode as C, withModifiers as z, reactive as D, createVNode as L } from "vue";
2
+ const R = {
3
3
  class: "icon",
4
4
  preserveAspectRatio: "xMaxYMin"
5
- }, R = ["xlink:href"], Se = /* @__PURE__ */ b({
5
+ }, F = ["xlink:href"], Ve = /* @__PURE__ */ b({
6
6
  __name: "svg-icon",
7
7
  props: {
8
8
  basePath: {
@@ -23,23 +23,23 @@ const D = {
23
23
  }
24
24
  },
25
25
  setup(e) {
26
- return (s, l) => (u(), c("i", {
27
- class: $(["svg-icon", {
26
+ return (r, t) => (u(), s("i", {
27
+ class: v(["svg-icon", {
28
28
  [`svg-icon--${e.size}`]: e.size
29
29
  }])
30
30
  }, [
31
- (u(), c("svg", D, [
31
+ (u(), s("svg", R, [
32
32
  i("use", {
33
33
  "xlink:href": `${e.basePath}#${e.prefix}${e.symbol}`,
34
34
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
35
35
  x: "0",
36
36
  y: "0"
37
- }, null, 8, R)
37
+ }, null, 8, F)
38
38
  ]))
39
39
  ], 2));
40
40
  }
41
41
  });
42
- const F = { class: "loading-spinner d-block" }, P = { class: "loading-spinner__animation" }, H = {
42
+ const P = { class: "loading-spinner d-block" }, H = { class: "loading-spinner__animation" }, E = {
43
43
  class: "d-block",
44
44
  version: "1.1",
45
45
  id: "L9",
@@ -50,7 +50,7 @@ const F = { class: "loading-spinner d-block" }, P = { class: "loading-spinner__a
50
50
  viewBox: "0 0 100 100",
51
51
  "enable-background": "new 0 0 0 0",
52
52
  "xml:space": "preserve"
53
- }, E = ["fill"], j = /* @__PURE__ */ i("animateTransform", {
53
+ }, j = ["fill"], G = /* @__PURE__ */ i("animateTransform", {
54
54
  attributeName: "transform",
55
55
  attributeType: "XML",
56
56
  type: "rotate",
@@ -58,9 +58,9 @@ const F = { class: "loading-spinner d-block" }, P = { class: "loading-spinner__a
58
58
  from: "0 50 50",
59
59
  to: "360 50 50",
60
60
  repeatCount: "indefinite"
61
- }, null, -1), G = [
62
- j
63
- ], Ve = /* @__PURE__ */ b({
61
+ }, null, -1), J = [
62
+ G
63
+ ], xe = /* @__PURE__ */ b({
64
64
  __name: "loading-spinner",
65
65
  props: {
66
66
  color: {
@@ -69,20 +69,20 @@ const F = { class: "loading-spinner d-block" }, P = { class: "loading-spinner__a
69
69
  }
70
70
  },
71
71
  setup(e) {
72
- return (s, l) => (u(), c("span", F, [
73
- i("span", P, [
74
- (u(), c("svg", H, [
72
+ return (r, t) => (u(), s("span", P, [
73
+ i("span", H, [
74
+ (u(), s("svg", E, [
75
75
  i("path", {
76
76
  fill: e.color,
77
77
  d: "M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
78
- }, G, 8, E)
78
+ }, J, 8, j)
79
79
  ]))
80
80
  ]),
81
- f(s.$slots, "default")
81
+ m(r.$slots, "default")
82
82
  ]));
83
83
  }
84
84
  });
85
- const J = ["type", "disabled", "href", "to"], xe = /* @__PURE__ */ b({
85
+ const X = ["type", "disabled", "href", "to"], Be = /* @__PURE__ */ b({
86
86
  __name: "base-button",
87
87
  props: {
88
88
  type: null,
@@ -99,15 +99,15 @@ const J = ["type", "disabled", "href", "to"], xe = /* @__PURE__ */ b({
99
99
  fab: { type: Boolean }
100
100
  },
101
101
  setup(e) {
102
- const s = e, l = h(() => s.caption && !s.fab);
102
+ const r = e, t = g(() => r.caption && !r.fab);
103
103
  return (a, n) => {
104
- const d = S("svg-icon");
105
- return u(), c("button", {
104
+ const d = $("svg-icon");
105
+ return u(), s("button", {
106
106
  type: e.type,
107
107
  disabled: e.disabled,
108
108
  href: e.href,
109
109
  to: e.to,
110
- class: $(["base-button btn btn-primary", {
110
+ class: v(["base-button btn btn-primary", {
111
111
  disabled: e.disabled,
112
112
  pending: e.pending,
113
113
  rounded: e.rounded,
@@ -119,28 +119,28 @@ const J = ["type", "disabled", "href", "to"], xe = /* @__PURE__ */ b({
119
119
  "x-small": e.size === "x-small"
120
120
  }])
121
121
  }, [
122
- f(a.$slots, "default", {}, () => [
123
- e.icon ? (u(), q(d, {
122
+ m(a.$slots, "default", {}, () => [
123
+ e.icon ? (u(), O(d, {
124
124
  key: 0,
125
125
  id: e.icon,
126
126
  class: "base-button__caption"
127
- }, null, 8, ["id"])) : w("", !0),
128
- p(l) ? (u(), c("span", {
127
+ }, null, 8, ["id"])) : q("", !0),
128
+ p(t) ? (u(), s("span", {
129
129
  key: 1,
130
- class: $(["base-button__caption", { "icon-padding": e.icon }])
131
- }, v(e.caption), 3)) : w("", !0)
130
+ class: v(["base-button__caption", { "icon-padding": e.icon }])
131
+ }, h(e.caption), 3)) : q("", !0)
132
132
  ])
133
- ], 10, J);
133
+ ], 10, X);
134
134
  };
135
135
  }
136
136
  });
137
- function m() {
137
+ function y() {
138
138
  return (new Date().valueOf() + Math.random()).toString(36);
139
139
  }
140
- const X = { class: "input-group form-input__input-group" }, Y = ["type", "id", "name", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"], K = {
140
+ const Y = { class: "input-group form-input__input-group" }, K = ["type", "id", "name", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"], Q = {
141
141
  key: 0,
142
142
  class: "form-input__color-swatch"
143
- }, Q = ["name", "id", "disabled", "read-only", "required", "aria-label"], W = ["for", "innerHTML"], Be = /* @__PURE__ */ b({
143
+ }, W = ["name", "id", "disabled", "read-only", "required", "aria-label"], Z = ["for", "innerHTML"], ke = /* @__PURE__ */ b({
144
144
  __name: "form-input",
145
145
  props: {
146
146
  modelValue: {
@@ -153,11 +153,11 @@ const X = { class: "input-group form-input__input-group" }, Y = ["type", "id", "
153
153
  },
154
154
  name: {
155
155
  type: String,
156
- default: () => m()
156
+ default: () => y()
157
157
  },
158
158
  id: {
159
159
  type: String,
160
- default: () => m()
160
+ default: () => y()
161
161
  },
162
162
  label: {
163
163
  type: String,
@@ -196,22 +196,22 @@ const X = { class: "input-group form-input__input-group" }, Y = ["type", "id", "
196
196
  }
197
197
  },
198
198
  emits: ["update:modelValue"],
199
- setup(e, { emit: s }) {
200
- const l = e, a = h({
199
+ setup(e, { emit: r }) {
200
+ const t = e, a = g({
201
201
  get() {
202
- return l.modelValue;
202
+ return t.modelValue;
203
203
  },
204
204
  set(n) {
205
- s("update:modelValue", n);
205
+ r("update:modelValue", n);
206
206
  }
207
207
  });
208
- return (n, d) => (u(), c("div", {
209
- class: $(["form-input", `form-input--${e.type}`])
208
+ return (n, d) => (u(), s("div", {
209
+ class: v(["form-input", `form-input--${e.type}`])
210
210
  }, [
211
- i("div", X, [
212
- f(n.$slots, "input-prepend"),
213
- C(i("input", {
214
- "onUpdate:modelValue": d[0] || (d[0] = (t) => M(a) ? a.value = t : null),
211
+ i("div", Y, [
212
+ m(n.$slots, "input-prepend"),
213
+ M(i("input", {
214
+ "onUpdate:modelValue": d[0] || (d[0] = (l) => U(a) ? a.value = l : null),
215
215
  type: e.type === "color" ? "text" : e.type,
216
216
  id: e.id,
217
217
  name: e.name,
@@ -224,13 +224,13 @@ const X = { class: "input-group form-input__input-group" }, Y = ["type", "id", "
224
224
  checked: e.checked,
225
225
  class: "form-control",
226
226
  "aria-label": e.label
227
- }, null, 8, Y), [
228
- [I, p(a)]
227
+ }, null, 8, K), [
228
+ [T, p(a)]
229
229
  ]),
230
- f(n.$slots, "input-append", {}, () => [
231
- e.type === "color" ? (u(), c("span", K, [
232
- C(i("input", {
233
- "onUpdate:modelValue": d[1] || (d[1] = (t) => M(a) ? a.value = t : null),
230
+ m(n.$slots, "input-append", {}, () => [
231
+ e.type === "color" ? (u(), s("span", Q, [
232
+ M(i("input", {
233
+ "onUpdate:modelValue": d[1] || (d[1] = (l) => U(a) ? a.value = l : null),
234
234
  type: "color",
235
235
  name: `${e.name}-color`,
236
236
  id: `${e.id}-color`,
@@ -239,23 +239,23 @@ const X = { class: "input-group form-input__input-group" }, Y = ["type", "id", "
239
239
  required: e.required,
240
240
  class: "form-control",
241
241
  "aria-label": e.label
242
- }, null, 8, Q), [
243
- [T, p(a)]
242
+ }, null, 8, W), [
243
+ [A, p(a)]
244
244
  ])
245
- ])) : w("", !0)
245
+ ])) : q("", !0)
246
246
  ])
247
247
  ]),
248
- f(n.$slots, "label", {}, () => [
248
+ m(n.$slots, "label", {}, () => [
249
249
  i("label", {
250
250
  for: e.id,
251
251
  class: "form-input__label",
252
252
  innerHTML: `${e.label}${e.required ? " *" : ""}`
253
- }, null, 8, W)
253
+ }, null, 8, Z)
254
254
  ])
255
255
  ], 2));
256
256
  }
257
257
  });
258
- const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
258
+ const _ = { class: "radio-group" }, ee = ["for"], we = /* @__PURE__ */ b({
259
259
  __name: "check-group",
260
260
  props: {
261
261
  modelValue: {
@@ -267,11 +267,11 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
267
267
  },
268
268
  name: {
269
269
  type: String,
270
- default: () => m()
270
+ default: () => y()
271
271
  },
272
272
  id: {
273
273
  type: String,
274
- default: () => m()
274
+ default: () => y()
275
275
  },
276
276
  label: {
277
277
  type: String,
@@ -295,43 +295,43 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
295
295
  }
296
296
  },
297
297
  emits: ["change", "update:modelValue"],
298
- setup(e, { emit: s }) {
299
- const l = e, a = x([]);
300
- return V(() => l.modelValue, (n, d) => {
301
- a.value = l.options.map(
302
- (t) => t.value ? l.modelValue.some((o) => o["value "] === t.value) : l.modelValue.some((o) => o === t)
298
+ setup(e, { emit: r }) {
299
+ const t = e, a = B([]);
300
+ return S(() => t.modelValue, (n, d) => {
301
+ a.value = t.options.map(
302
+ (l) => l.value ? t.modelValue.some((o) => o["value "] === l.value) : t.modelValue.some((o) => o === l)
303
303
  );
304
- }, { immediate: !0 }), V(a, (n, d) => {
305
- const t = n.reduce((o, r, y) => {
306
- const g = r && l.options[y] ? [l.options[y] || l.options[y]] : [];
307
- return [...o, ...g];
304
+ }, { immediate: !0 }), S(a, (n, d) => {
305
+ const l = n.reduce((o, c, f) => {
306
+ const V = c && t.options[f] ? [t.options[f] || t.options[f]] : [];
307
+ return [...o, ...V];
308
308
  }, []);
309
- s("update:modelValue", t);
310
- }, { deep: !0 }), L(() => {
309
+ r("update:modelValue", l);
310
+ }, { deep: !0 }), N(() => {
311
311
  }), (n, d) => {
312
- const t = S("form-input");
313
- return u(), c("div", Z, [
314
- (u(!0), c(B, null, k(e.options, (o, r) => (u(), q(t, {
315
- key: r,
316
- modelValue: p(a)[r],
317
- "onUpdate:modelValue": (y) => p(a)[r] = y,
312
+ const l = $("form-input");
313
+ return u(), s("div", _, [
314
+ (u(!0), s(k, null, w(e.options, (o, c) => (u(), O(l, {
315
+ key: c,
316
+ modelValue: p(a)[c],
317
+ "onUpdate:modelValue": (f) => p(a)[c] = f,
318
318
  type: "checkbox",
319
319
  name: e.name,
320
- id: `${e.id}-${r}`,
320
+ id: `${e.id}-${c}`,
321
321
  label: `${o.text || o}${e.required ? " *" : ""}`,
322
322
  disabled: e.disabled,
323
323
  "read-only": e.readOnly,
324
324
  required: e.required
325
325
  }, null, 8, ["modelValue", "onUpdate:modelValue", "name", "id", "label", "disabled", "read-only", "required"]))), 128)),
326
326
  i("label", { for: e.id }, [
327
- f(n.$slots, "label", {}, () => [
328
- O(v(e.label), 1)
327
+ m(n.$slots, "label", {}, () => [
328
+ C(h(e.label), 1)
329
329
  ])
330
- ], 8, _)
330
+ ], 8, ee)
331
331
  ]);
332
332
  };
333
333
  }
334
- }), ee = { class: "radio-group" }, te = ["for"], we = /* @__PURE__ */ b({
334
+ }), te = { class: "radio-group" }, le = ["for"], qe = /* @__PURE__ */ b({
335
335
  __name: "radio-group",
336
336
  props: {
337
337
  modelValue: {
@@ -343,11 +343,11 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
343
343
  },
344
344
  name: {
345
345
  type: String,
346
- default: () => m()
346
+ default: () => y()
347
347
  },
348
348
  id: {
349
349
  type: String,
350
- default: () => m()
350
+ default: () => y()
351
351
  },
352
352
  label: {
353
353
  type: String,
@@ -371,41 +371,41 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
371
371
  }
372
372
  },
373
373
  emits: ["change", "update:modelValue"],
374
- setup(e, { emit: s }) {
375
- const l = e;
376
- x(l.options.map((n) => n.value === l.modelValue));
374
+ setup(e, { emit: r }) {
375
+ const t = e;
376
+ B(t.options.map((n) => n.value === t.modelValue));
377
377
  function a(n) {
378
- s("update:modelValue", n);
378
+ r("update:modelValue", n);
379
379
  }
380
- return L(() => {
380
+ return N(() => {
381
381
  }), (n, d) => {
382
- const t = S("form-input");
383
- return u(), c("div", ee, [
384
- (u(!0), c(B, null, k(e.options, (o, r) => (u(), q(t, {
385
- key: r,
382
+ const l = $("form-input");
383
+ return u(), s("div", te, [
384
+ (u(!0), s(k, null, w(e.options, (o, c) => (u(), O(l, {
385
+ key: c,
386
386
  type: "radio",
387
387
  name: e.name,
388
- id: `${e.id}-${r}`,
388
+ id: `${e.id}-${c}`,
389
389
  value: o.value || o,
390
390
  label: `${o.text || o}${e.required ? " *" : ""}`,
391
391
  checked: o.value ? o.value === e.modelValue : o === e.modelValue,
392
392
  disabled: e.disabled,
393
393
  "read-only": e.readOnly,
394
394
  required: e.required,
395
- onChange: (y) => a(o)
395
+ onChange: (f) => a(o)
396
396
  }, null, 8, ["name", "id", "value", "label", "checked", "disabled", "read-only", "required", "onChange"]))), 128)),
397
397
  i("label", { for: e.id }, [
398
- f(n.$slots, "label", {}, () => [
399
- O(v(e.label), 1)
398
+ m(n.$slots, "label", {}, () => [
399
+ C(h(e.label), 1)
400
400
  ])
401
- ], 8, te)
401
+ ], 8, le)
402
402
  ]);
403
403
  };
404
404
  }
405
- }), le = { class: "input input-dropdown" }, ae = { class: "dropdown" }, ne = {
405
+ }), ae = { class: "input input-dropdown" }, ne = { class: "dropdown" }, de = {
406
406
  class: "btn-group",
407
407
  role: "group"
408
- }, de = ["id", "disabled"], oe = ["aria-labelledby"], ie = ["onClick"], ue = ["for"], qe = /* @__PURE__ */ b({
408
+ }, oe = ["id", "disabled"], ie = ["aria-labelledby"], ue = ["onClick"], re = ["for"], Oe = /* @__PURE__ */ b({
409
409
  __name: "input-dropdown",
410
410
  props: {
411
411
  modelValue: {
@@ -414,11 +414,11 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
414
414
  },
415
415
  name: {
416
416
  type: String,
417
- default: () => m()
417
+ default: () => y()
418
418
  },
419
419
  id: {
420
420
  type: String,
421
- default: () => m()
421
+ default: () => y()
422
422
  },
423
423
  label: {
424
424
  type: String,
@@ -462,32 +462,32 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
462
462
  }
463
463
  },
464
464
  emits: ["update:modelValue"],
465
- setup(e, { emit: s }) {
466
- const l = e;
467
- h({
465
+ setup(e, { emit: r }) {
466
+ const t = e;
467
+ g({
468
468
  get() {
469
- return l.modelValue;
469
+ return t.modelValue;
470
470
  },
471
- set(t) {
472
- s("update:modelValue", t);
471
+ set(l) {
472
+ r("update:modelValue", l);
473
473
  }
474
474
  });
475
- function a(t) {
476
- s("update:modelValue", t);
475
+ function a(l) {
476
+ r("update:modelValue", l);
477
477
  }
478
- const n = h(() => [
478
+ const n = g(() => [
479
479
  {
480
480
  text: "Please select"
481
481
  },
482
- ...l.options.map(
483
- (t) => typeof t == "string" ? { value: t, text: t } : t
482
+ ...t.options.map(
483
+ (l) => typeof l == "string" ? { value: l, text: l } : l
484
484
  )
485
- ]), d = h(() => [...l.options].find((t) => JSON.stringify(t.value) === JSON.stringify(l.modelValue)));
486
- return (t, o) => (u(), c("div", le, [
487
- i("div", ae, [
488
- i("div", ne, [
485
+ ]), d = g(() => [...t.options].find((l) => JSON.stringify(l.value) === JSON.stringify(t.modelValue)));
486
+ return (l, o) => (u(), s("div", ae, [
487
+ i("div", ne, [
488
+ i("div", de, [
489
489
  i("button", {
490
- class: $(["btn dropdown-toggle", {
490
+ class: v(["btn dropdown-toggle", {
491
491
  [`btn-${e.variant}`]: e.variant,
492
492
  [`btn-${e.color}`]: e.color,
493
493
  [`btn-${e.disabled}`]: e.disabled,
@@ -498,30 +498,30 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
498
498
  "data-bs-toggle": "dropdown",
499
499
  "aria-expanded": "false",
500
500
  disabled: e.disabled
501
- }, v(p(d) ? p(d).text : e.placeholder), 11, de),
501
+ }, h(p(d) ? p(d).text : e.placeholder), 11, oe),
502
502
  i("ul", {
503
503
  class: "dropdown-menu",
504
504
  "aria-labelledby": e.id
505
505
  }, [
506
- (u(!0), c(B, null, k(p(n), (r, y) => (u(), c("li", { key: y }, [
507
- f(t.$slots, "option", {}, () => [
506
+ (u(!0), s(k, null, w(p(n), (c, f) => (u(), s("li", { key: f }, [
507
+ m(l.$slots, "option", {}, () => [
508
508
  i("a", {
509
509
  class: "dropdown-item",
510
- onClick: N((g) => a(r.value), ["prevent"])
511
- }, v(r.text), 9, ie)
510
+ onClick: z((V) => a(c.value), ["prevent"])
511
+ }, h(c.text), 9, ue)
512
512
  ])
513
513
  ]))), 128))
514
- ], 8, oe)
514
+ ], 8, ie)
515
515
  ])
516
516
  ]),
517
517
  i("label", { for: e.id }, [
518
- f(t.$slots, "label", {}, () => [
519
- O(v(e.label), 1)
518
+ m(l.$slots, "label", {}, () => [
519
+ C(h(e.label), 1)
520
520
  ])
521
- ], 8, ue)
521
+ ], 8, re)
522
522
  ]));
523
523
  }
524
- }), se = ["id", "name", "multiple", "accept"], re = { class: "form-input__input-group input-group" }, ce = ["value", "id", "name"], fe = ["for"], me = ["for", "innerHTML"], Oe = /* @__PURE__ */ b({
524
+ }), se = ["id", "name", "multiple", "accept"], ce = { class: "form-input__input-group input-group" }, fe = ["value", "id", "name"], me = ["for"], ye = ["for", "innerHTML"], Ce = /* @__PURE__ */ b({
525
525
  __name: "file-input",
526
526
  props: {
527
527
  modelValue: {
@@ -530,11 +530,11 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
530
530
  },
531
531
  name: {
532
532
  type: String,
533
- default: () => m()
533
+ default: () => y()
534
534
  },
535
535
  id: {
536
536
  type: String,
537
- default: () => m()
537
+ default: () => y()
538
538
  },
539
539
  label: {
540
540
  type: String,
@@ -573,61 +573,61 @@ const Z = { class: "radio-group" }, _ = ["for"], ke = /* @__PURE__ */ b({
573
573
  }
574
574
  },
575
575
  emits: ["update:modelValue"],
576
- setup(e, { emit: s }) {
577
- function l(d) {
578
- const t = d.target && d.target.files;
579
- t && (a.splice(0, a.length), Array.from(t).forEach((o) => {
576
+ setup(e, { emit: r }) {
577
+ function t(d) {
578
+ const l = d.target && d.target.files;
579
+ l && (a.splice(0, a.length), Array.from(l).forEach((o) => {
580
580
  a.push(o);
581
581
  }));
582
582
  }
583
- const a = A([]), n = h(() => a && a.map((d) => d.name));
584
- return h(() => a.map((d) => URL.createObjectURL(d))), V(() => a, (d, t) => {
585
- console.log("file input", d), s("update:modelValue", d);
586
- }, { deep: !0 }), (d, t) => (u(), c("div", {
587
- class: $(["form-input file-input", "file-input--primary"])
583
+ const a = D([]), n = g(() => a && a.map((d) => d.name));
584
+ return g(() => a.map((d) => URL.createObjectURL(d))), S(() => a, (d, l) => {
585
+ console.log("file input", d), r("update:modelValue", d);
586
+ }, { deep: !0 }), (d, l) => (u(), s("div", {
587
+ class: v(["form-input file-input", "file-input--primary"])
588
588
  }, [
589
589
  i("input", {
590
590
  type: "file",
591
591
  id: e.id,
592
592
  name: e.name,
593
593
  class: "d-none",
594
- onChange: l,
594
+ onChange: t,
595
595
  multiple: e.multiple,
596
596
  accept: e.accept
597
597
  }, null, 40, se),
598
- i("div", re, [
599
- f(d.$slots, "input-prepend"),
598
+ i("div", ce, [
599
+ m(d.$slots, "input-prepend"),
600
600
  i("input", {
601
601
  type: "text",
602
602
  value: p(n),
603
603
  id: e.id,
604
604
  name: e.name,
605
605
  class: "form-control"
606
- }, null, 8, ce),
607
- f(d.$slots, "input-append", {}, () => [
606
+ }, null, 8, fe),
607
+ m(d.$slots, "input-append", {}, () => [
608
608
  i("label", {
609
609
  for: e.id,
610
610
  class: "btn btn-outline-dark"
611
- }, " Select Image ", 8, fe)
611
+ }, " Select Image ", 8, me)
612
612
  ])
613
613
  ]),
614
- f(d.$slots, "label", {}, () => [
614
+ m(d.$slots, "label", {}, () => [
615
615
  i("label", {
616
616
  for: e.id,
617
617
  class: "form-input__label",
618
618
  innerHTML: `${e.label}${e.required ? " *" : ""}`
619
- }, null, 8, me)
619
+ }, null, 8, ye)
620
620
  ])
621
621
  ]));
622
622
  }
623
- }), ye = { class: "media-upload" }, pe = ["src"], be = ["onClick"], ge = ["for"];
624
- async function he(e) {
625
- return await new Promise((s) => {
626
- let l = new FileReader();
627
- l.onload = () => s(l.result), l.readAsDataURL(e);
623
+ }), pe = { class: "media-upload" }, be = ["src"], ge = ["onClick"], he = ["for"];
624
+ async function ve(e) {
625
+ return await new Promise((r) => {
626
+ let t = new FileReader();
627
+ t.onload = () => r(t.result), t.readAsDataURL(e);
628
628
  });
629
629
  }
630
- const Ce = /* @__PURE__ */ b({
630
+ const Me = /* @__PURE__ */ b({
631
631
  __name: "media-upload",
632
632
  props: {
633
633
  modelValue: {
@@ -639,11 +639,11 @@ const Ce = /* @__PURE__ */ b({
639
639
  },
640
640
  name: {
641
641
  type: String,
642
- default: () => m()
642
+ default: () => y()
643
643
  },
644
644
  id: {
645
645
  type: String,
646
- default: () => m()
646
+ default: () => y()
647
647
  },
648
648
  label: {
649
649
  type: String,
@@ -683,43 +683,43 @@ const Ce = /* @__PURE__ */ b({
683
683
  }
684
684
  },
685
685
  emits: ["update:modelValue", "update:src"],
686
- setup(e, { emit: s }) {
687
- const l = e, a = x([]), n = x([]);
688
- V(() => a, async (t, o) => {
686
+ setup(e, { emit: r }) {
687
+ const t = e, a = B([]), n = B([]), d = g(() => t.modelValue.length ? t.modelValue : t.src ? [{ type: "", src: t.src }] : n.value);
688
+ S(() => a, async (o, c) => {
689
689
  n.value = await Promise.all(
690
- t.value.map(async (r) => ({
691
- src: await he(r),
692
- type: r.type
690
+ o.value.map(async (f) => ({
691
+ src: await ve(f),
692
+ type: f.type
693
693
  }))
694
694
  );
695
- }, { deep: !0 }), V(() => n, async (t, o) => {
696
- const r = l.multiple ? n.value : [n.value[0]];
697
- s("update:modelValue", r), l.multiple || s("update:src", n.value[0] && n.value[0].src);
695
+ }, { deep: !0 }), S(() => n, async (o, c) => {
696
+ const f = t.multiple ? n.value : [n.value[0]];
697
+ r("update:modelValue", f), t.multiple || r("update:src", n.value[0] && n.value[0].src);
698
698
  }, { deep: !0 });
699
- function d(t) {
700
- a.value.splice(t, 1);
699
+ function l(o) {
700
+ a.value.splice(o, 1);
701
701
  }
702
- return (t, o) => {
703
- const r = S("svg-icon"), y = S("file-input");
704
- return u(), c("div", ye, [
705
- (u(!0), c(B, null, k(n.value, (g, z) => (u(), c("div", {
706
- key: g.src,
702
+ return (o, c) => {
703
+ const f = $("svg-icon"), V = $("file-input");
704
+ return u(), s("div", pe, [
705
+ (u(!0), s(k, null, w(p(d), (x, I) => (u(), s("div", {
706
+ key: x.src,
707
707
  class: "media-upload__thumbnail"
708
708
  }, [
709
709
  i("img", {
710
- src: g.src,
710
+ src: x.src,
711
711
  class: "img-thumbnail rounded"
712
- }, null, 8, pe),
712
+ }, null, 8, be),
713
713
  i("button", {
714
- onClick: N((ve) => d(z), ["prevent"]),
714
+ onClick: z(($e) => l(I), ["prevent"]),
715
715
  class: "btn btn--close"
716
716
  }, [
717
- U(r, { symbol: "close" })
718
- ], 8, be)
717
+ L(f, { symbol: "x" })
718
+ ], 8, ge)
719
719
  ]))), 128)),
720
- U(y, {
720
+ L(V, {
721
721
  modelValue: a.value,
722
- "onUpdate:modelValue": o[0] || (o[0] = (g) => a.value = g),
722
+ "onUpdate:modelValue": c[0] || (c[0] = (x) => a.value = x),
723
723
  id: e.id,
724
724
  name: e.name,
725
725
  accept: e.accept,
@@ -728,19 +728,19 @@ const Ce = /* @__PURE__ */ b({
728
728
  i("label", {
729
729
  for: e.id,
730
730
  class: "btn btn-outline-dark"
731
- }, " Select Image ", 8, ge)
731
+ }, " Select Image ", 8, he)
732
732
  ]);
733
733
  };
734
734
  }
735
735
  });
736
736
  export {
737
- xe as BaseButton,
738
- ke as CheckGroup,
739
- Oe as FileInput,
740
- Be as FormInput,
741
- qe as InputDropdown,
742
- Ve as LoadingSpinner,
743
- Ce as MediaUpload,
744
- we as RadioGroup,
745
- Se as SvgIcon
737
+ Be as BaseButton,
738
+ we as CheckGroup,
739
+ Ce as FileInput,
740
+ ke as FormInput,
741
+ Oe as InputDropdown,
742
+ xe as LoadingSpinner,
743
+ Me as MediaUpload,
744
+ qe as RadioGroup,
745
+ Ve as SvgIcon
746
746
  };
@@ -1 +1 @@
1
- (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.AblokComponents={},s.Vue))})(this,function(s,e){"use strict";const p={class:"icon",preserveAspectRatio:"xMaxYMin"},y=["xlink:href"],g=e.defineComponent({__name:"svg-icon",props:{basePath:{type:String,default:"/symbol-defs.svg"},prefix:{type:String,default:"icon-"},symbol:{type:String,default:""},size:{type:String,default:"default"}},setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["svg-icon",{[`svg-icon--${t.size}`]:t.size}])},[(e.openBlock(),e.createElementBlock("svg",p,[e.createElementVNode("use",{"xlink:href":`${t.basePath}#${t.prefix}${t.symbol}`,"xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0",y:"0"},null,8,y)]))],2))}}),ae="",b={class:"loading-spinner d-block"},h={class:"loading-spinner__animation"},B={class:"d-block",version:"1.1",id:"L9",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 100 100","enable-background":"new 0 0 0 0","xml:space":"preserve"},k=["fill"],$=[e.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",dur:"1s",from:"0 50 50",to:"360 50 50",repeatCount:"indefinite"},null,-1)],S=e.defineComponent({__name:"loading-spinner",props:{color:{type:String,default:"#fff"}},setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("span",b,[e.createElementVNode("span",h,[(e.openBlock(),e.createElementBlock("svg",B,[e.createElementVNode("path",{fill:t.color,d:"M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"},$,8,k)]))]),e.renderSlot(r.$slots,"default")]))}}),de="",V=["type","disabled","href","to"],E=e.defineComponent({__name:"base-button",props:{type:null,caption:null,variant:null,size:null,icon:null,href:null,to:null,disabled:{type:Boolean},pending:{type:Boolean},outlined:{type:Boolean},rounded:{type:Boolean},fab:{type:Boolean}},setup(t){const r=t,n=e.computed(()=>r.caption&&!r.fab);return(a,o)=>{const d=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("button",{type:t.type,disabled:t.disabled,href:t.href,to:t.to,class:e.normalizeClass(["base-button btn btn-primary",{disabled:t.disabled,pending:t.pending,rounded:t.rounded,outlined:t.outlined,fab:t.fab,"x-large":t.size==="x-large",large:t.size==="large",small:t.size==="small","x-small":t.size==="x-small"}])},[e.renderSlot(a.$slots,"default",{},()=>[t.icon?(e.openBlock(),e.createBlock(d,{key:0,id:t.icon,class:"base-button__caption"},null,8,["id"])):e.createCommentVNode("",!0),e.unref(n)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["base-button__caption",{"icon-padding":t.icon}])},e.toDisplayString(t.caption),3)):e.createCommentVNode("",!0)])],10,V)}}}),ie="";function m(){return(new Date().valueOf()+Math.random()).toString(36)}const w={class:"input-group form-input__input-group"},N=["type","id","name","placeholder","pattern","disabled","read-only","required","maxlength","checked","aria-label"],C={key:0,class:"form-input__color-swatch"},x=["name","id","disabled","read-only","required","aria-label"],q=["for","innerHTML"],M=e.defineComponent({__name:"form-input",props:{modelValue:{type:[String,Number,Boolean],default:""},type:{type:String,default:"text"},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxlength:{type:Number},pattern:{type:String,default:null},checked:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:r}){const n=t,a=e.computed({get(){return n.modelValue},set(o){r("update:modelValue",o)}});return(o,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["form-input",`form-input--${t.type}`])},[e.createElementVNode("div",w,[e.renderSlot(o.$slots,"input-prepend"),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=l=>e.isRef(a)?a.value=l:null),type:t.type==="color"?"text":t.type,id:t.id,name:t.name,placeholder:t.placeholder,pattern:t.pattern,disabled:t.disabled,"read-only":t.readOnly,required:t.required,maxlength:t.maxlength,checked:t.checked,class:"form-control","aria-label":t.label},null,8,N),[[e.vModelDynamic,e.unref(a)]]),e.renderSlot(o.$slots,"input-append",{},()=>[t.type==="color"?(e.openBlock(),e.createElementBlock("span",C,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=l=>e.isRef(a)?a.value=l:null),type:"color",name:`${t.name}-color`,id:`${t.id}-color`,disabled:t.disabled,"read-only":t.readOnly,required:t.required,class:"form-control","aria-label":t.label},null,8,x),[[e.vModelText,e.unref(a)]])])):e.createCommentVNode("",!0)])]),e.renderSlot(o.$slots,"label",{},()=>[e.createElementVNode("label",{for:t.id,class:"form-input__label",innerHTML:`${t.label}${t.required?" *":""}`},null,8,q)])],2))}}),re="",O={class:"radio-group"},z=["for"],D=e.defineComponent({__name:"check-group",props:{modelValue:{default:[]},options:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:r}){const n=t,a=e.ref([]);return e.watch(()=>n.modelValue,(o,d)=>{a.value=n.options.map(l=>l.value?n.modelValue.some(i=>i["value "]===l.value):n.modelValue.some(i=>i===l))},{immediate:!0}),e.watch(a,(o,d)=>{const l=o.reduce((i,c,u)=>{const f=c&&n.options[u]?[n.options[u]||n.options[u]]:[];return[...i,...f]},[]);r("update:modelValue",l)},{deep:!0}),e.onBeforeMount(()=>{}),(o,d)=>{const l=e.resolveComponent("form-input");return e.openBlock(),e.createElementBlock("div",O,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(i,c)=>(e.openBlock(),e.createBlock(l,{key:c,modelValue:e.unref(a)[c],"onUpdate:modelValue":u=>e.unref(a)[c]=u,type:"checkbox",name:t.name,id:`${t.id}-${c}`,label:`${i.text||i}${t.required?" *":""}`,disabled:t.disabled,"read-only":t.readOnly,required:t.required},null,8,["modelValue","onUpdate:modelValue","name","id","label","disabled","read-only","required"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(o.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,z)])}}}),L={class:"radio-group"},T=["for"],U=e.defineComponent({__name:"radio-group",props:{modelValue:{default:!1},options:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:r}){const n=t;e.ref(n.options.map(o=>o.value===n.modelValue));function a(o){r("update:modelValue",o)}return e.onBeforeMount(()=>{}),(o,d)=>{const l=e.resolveComponent("form-input");return e.openBlock(),e.createElementBlock("div",L,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(i,c)=>(e.openBlock(),e.createBlock(l,{key:c,type:"radio",name:t.name,id:`${t.id}-${c}`,value:i.value||i,label:`${i.text||i}${t.required?" *":""}`,checked:i.value?i.value===t.modelValue:i===t.modelValue,disabled:t.disabled,"read-only":t.readOnly,required:t.required,onChange:u=>a(i)},null,8,["name","id","value","label","checked","disabled","read-only","required","onChange"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(o.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,T)])}}}),A={class:"input input-dropdown"},F={class:"dropdown"},I={class:"btn-group",role:"group"},R=["id","disabled"],P=["aria-labelledby"],j=["onClick"],H=["for"],G=e.defineComponent({__name:"input-dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],default:""},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:"Please select"},options:{type:Array,default:[]},variant:{type:String,default:""},color:{type:String,default:""},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1},outline:{type:Boolean,default:!0},resetOption:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:r}){const n=t;e.computed({get(){return n.modelValue},set(l){r("update:modelValue",l)}});function a(l){r("update:modelValue",l)}const o=e.computed(()=>[{text:"Please select"},...n.options.map(l=>typeof l=="string"?{value:l,text:l}:l)]),d=e.computed(()=>[...n.options].find(l=>JSON.stringify(l.value)===JSON.stringify(n.modelValue)));return(l,i)=>(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",F,[e.createElementVNode("div",I,[e.createElementVNode("button",{class:e.normalizeClass(["btn dropdown-toggle",{[`btn-${t.variant}`]:t.variant,[`btn-${t.color}`]:t.color,[`btn-${t.disabled}`]:t.disabled,[`btn-outline-${t.color||"dark"}`]:t.outline}]),type:"button",id:t.id,"data-bs-toggle":"dropdown","aria-expanded":"false",disabled:t.disabled},e.toDisplayString(e.unref(d)?e.unref(d).text:t.placeholder),11,R),e.createElementVNode("ul",{class:"dropdown-menu","aria-labelledby":t.id},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),(c,u)=>(e.openBlock(),e.createElementBlock("li",{key:u},[e.renderSlot(l.$slots,"option",{},()=>[e.createElementVNode("a",{class:"dropdown-item",onClick:e.withModifiers(f=>a(c.value),["prevent"])},e.toDisplayString(c.text),9,j)])]))),128))],8,P)])]),e.createElementVNode("label",{for:t.id},[e.renderSlot(l.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,H)]))}}),J=["id","name","multiple","accept"],X={class:"form-input__input-group input-group"},Y=["value","id","name"],K=["for"],Q=["for","innerHTML"],W=e.defineComponent({__name:"file-input",props:{modelValue:{type:Array,default:[]},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},pattern:{type:String,default:null},multiple:{type:Boolean,default:!1},accept:{type:String}},emits:["update:modelValue"],setup(t,{emit:r}){function n(d){const l=d.target&&d.target.files;l&&(a.splice(0,a.length),Array.from(l).forEach(i=>{a.push(i)}))}const a=e.reactive([]),o=e.computed(()=>a&&a.map(d=>d.name));return e.computed(()=>a.map(d=>URL.createObjectURL(d))),e.watch(()=>a,(d,l)=>{console.log("file input",d),r("update:modelValue",d)},{deep:!0}),(d,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["form-input file-input","file-input--primary"])},[e.createElementVNode("input",{type:"file",id:t.id,name:t.name,class:"d-none",onChange:n,multiple:t.multiple,accept:t.accept},null,40,J),e.createElementVNode("div",X,[e.renderSlot(d.$slots,"input-prepend"),e.createElementVNode("input",{type:"text",value:e.unref(o),id:t.id,name:t.name,class:"form-control"},null,8,Y),e.renderSlot(d.$slots,"input-append",{},()=>[e.createElementVNode("label",{for:t.id,class:"btn btn-outline-dark"}," Select Image ",8,K)])]),e.renderSlot(d.$slots,"label",{},()=>[e.createElementVNode("label",{for:t.id,class:"form-input__label",innerHTML:`${t.label}${t.required?" *":""}`},null,8,Q)])]))}}),Z={class:"media-upload"},_=["src"],v=["onClick"],ee=["for"];async function te(t){return await new Promise(r=>{let n=new FileReader;n.onload=()=>r(n.result),n.readAsDataURL(t)})}const le=e.defineComponent({__name:"media-upload",props:{modelValue:{type:Array,default:[]},src:{type:String},name:{type:String,default:()=>m()},id:{type:String,default:()=>m()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},pattern:{type:String,default:null},multiple:{type:Boolean,default:!1},accept:{type:String,default:"image/*"}},emits:["update:modelValue","update:src"],setup(t,{emit:r}){const n=t,a=e.ref([]),o=e.ref([]);e.watch(()=>a,async(l,i)=>{o.value=await Promise.all(l.value.map(async c=>({src:await te(c),type:c.type})))},{deep:!0}),e.watch(()=>o,async(l,i)=>{const c=n.multiple?o.value:[o.value[0]];r("update:modelValue",c),n.multiple||r("update:src",o.value[0]&&o.value[0].src)},{deep:!0});function d(l){a.value.splice(l,1)}return(l,i)=>{const c=e.resolveComponent("svg-icon"),u=e.resolveComponent("file-input");return e.openBlock(),e.createElementBlock("div",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(f,ne)=>(e.openBlock(),e.createElementBlock("div",{key:f.src,class:"media-upload__thumbnail"},[e.createElementVNode("img",{src:f.src,class:"img-thumbnail rounded"},null,8,_),e.createElementVNode("button",{onClick:e.withModifiers(se=>d(ne),["prevent"]),class:"btn btn--close"},[e.createVNode(c,{symbol:"close"})],8,v)]))),128)),e.createVNode(u,{modelValue:a.value,"onUpdate:modelValue":i[0]||(i[0]=f=>a.value=f),id:t.id,name:t.name,accept:t.accept,class:"d-none"},null,8,["modelValue","id","name","accept"]),e.createElementVNode("label",{for:t.id,class:"btn btn-outline-dark"}," Select Image ",8,ee)])}}}),ce="";s.BaseButton=E,s.CheckGroup=D,s.FileInput=W,s.FormInput=M,s.InputDropdown=G,s.LoadingSpinner=S,s.MediaUpload=le,s.RadioGroup=U,s.SvgIcon=g,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.AblokComponents={},s.Vue))})(this,function(s,e){"use strict";const y={class:"icon",preserveAspectRatio:"xMaxYMin"},g=["xlink:href"],b=e.defineComponent({__name:"svg-icon",props:{basePath:{type:String,default:"/symbol-defs.svg"},prefix:{type:String,default:"icon-"},symbol:{type:String,default:""},size:{type:String,default:"default"}},setup(t){return(r,l)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(["svg-icon",{[`svg-icon--${t.size}`]:t.size}])},[(e.openBlock(),e.createElementBlock("svg",y,[e.createElementVNode("use",{"xlink:href":`${t.basePath}#${t.prefix}${t.symbol}`,"xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0",y:"0"},null,8,g)]))],2))}}),oe="",h={class:"loading-spinner d-block"},B={class:"loading-spinner__animation"},k={class:"d-block",version:"1.1",id:"L9",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 100 100","enable-background":"new 0 0 0 0","xml:space":"preserve"},$=["fill"],S=[e.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",dur:"1s",from:"0 50 50",to:"360 50 50",repeatCount:"indefinite"},null,-1)],V=e.defineComponent({__name:"loading-spinner",props:{color:{type:String,default:"#fff"}},setup(t){return(r,l)=>(e.openBlock(),e.createElementBlock("span",h,[e.createElementVNode("span",B,[(e.openBlock(),e.createElementBlock("svg",k,[e.createElementVNode("path",{fill:t.color,d:"M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"},S,8,$)]))]),e.renderSlot(r.$slots,"default")]))}}),ie="",E=["type","disabled","href","to"],w=e.defineComponent({__name:"base-button",props:{type:null,caption:null,variant:null,size:null,icon:null,href:null,to:null,disabled:{type:Boolean},pending:{type:Boolean},outlined:{type:Boolean},rounded:{type:Boolean},fab:{type:Boolean}},setup(t){const r=t,l=e.computed(()=>r.caption&&!r.fab);return(a,o)=>{const d=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("button",{type:t.type,disabled:t.disabled,href:t.href,to:t.to,class:e.normalizeClass(["base-button btn btn-primary",{disabled:t.disabled,pending:t.pending,rounded:t.rounded,outlined:t.outlined,fab:t.fab,"x-large":t.size==="x-large",large:t.size==="large",small:t.size==="small","x-small":t.size==="x-small"}])},[e.renderSlot(a.$slots,"default",{},()=>[t.icon?(e.openBlock(),e.createBlock(d,{key:0,id:t.icon,class:"base-button__caption"},null,8,["id"])):e.createCommentVNode("",!0),e.unref(l)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["base-button__caption",{"icon-padding":t.icon}])},e.toDisplayString(t.caption),3)):e.createCommentVNode("",!0)])],10,E)}}}),re="";function u(){return(new Date().valueOf()+Math.random()).toString(36)}const N={class:"input-group form-input__input-group"},C=["type","id","name","placeholder","pattern","disabled","read-only","required","maxlength","checked","aria-label"],x={key:0,class:"form-input__color-swatch"},q=["name","id","disabled","read-only","required","aria-label"],M=["for","innerHTML"],O=e.defineComponent({__name:"form-input",props:{modelValue:{type:[String,Number,Boolean],default:""},type:{type:String,default:"text"},name:{type:String,default:()=>u()},id:{type:String,default:()=>u()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxlength:{type:Number},pattern:{type:String,default:null},checked:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:r}){const l=t,a=e.computed({get(){return l.modelValue},set(o){r("update:modelValue",o)}});return(o,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["form-input",`form-input--${t.type}`])},[e.createElementVNode("div",N,[e.renderSlot(o.$slots,"input-prepend"),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=n=>e.isRef(a)?a.value=n:null),type:t.type==="color"?"text":t.type,id:t.id,name:t.name,placeholder:t.placeholder,pattern:t.pattern,disabled:t.disabled,"read-only":t.readOnly,required:t.required,maxlength:t.maxlength,checked:t.checked,class:"form-control","aria-label":t.label},null,8,C),[[e.vModelDynamic,e.unref(a)]]),e.renderSlot(o.$slots,"input-append",{},()=>[t.type==="color"?(e.openBlock(),e.createElementBlock("span",x,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=n=>e.isRef(a)?a.value=n:null),type:"color",name:`${t.name}-color`,id:`${t.id}-color`,disabled:t.disabled,"read-only":t.readOnly,required:t.required,class:"form-control","aria-label":t.label},null,8,q),[[e.vModelText,e.unref(a)]])])):e.createCommentVNode("",!0)])]),e.renderSlot(o.$slots,"label",{},()=>[e.createElementVNode("label",{for:t.id,class:"form-input__label",innerHTML:`${t.label}${t.required?" *":""}`},null,8,M)])],2))}}),ce="",z={class:"radio-group"},D=["for"],L=e.defineComponent({__name:"check-group",props:{modelValue:{default:[]},options:{type:Array,default:[]},name:{type:String,default:()=>u()},id:{type:String,default:()=>u()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:r}){const l=t,a=e.ref([]);return e.watch(()=>l.modelValue,(o,d)=>{a.value=l.options.map(n=>n.value?l.modelValue.some(i=>i["value "]===n.value):l.modelValue.some(i=>i===n))},{immediate:!0}),e.watch(a,(o,d)=>{const n=o.reduce((i,c,m)=>{const f=c&&l.options[m]?[l.options[m]||l.options[m]]:[];return[...i,...f]},[]);r("update:modelValue",n)},{deep:!0}),e.onBeforeMount(()=>{}),(o,d)=>{const n=e.resolveComponent("form-input");return e.openBlock(),e.createElementBlock("div",z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(i,c)=>(e.openBlock(),e.createBlock(n,{key:c,modelValue:e.unref(a)[c],"onUpdate:modelValue":m=>e.unref(a)[c]=m,type:"checkbox",name:t.name,id:`${t.id}-${c}`,label:`${i.text||i}${t.required?" *":""}`,disabled:t.disabled,"read-only":t.readOnly,required:t.required},null,8,["modelValue","onUpdate:modelValue","name","id","label","disabled","read-only","required"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(o.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,D)])}}}),T={class:"radio-group"},U=["for"],A=e.defineComponent({__name:"radio-group",props:{modelValue:{default:!1},options:{type:Array,default:[]},name:{type:String,default:()=>u()},id:{type:String,default:()=>u()},label:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(t,{emit:r}){const l=t;e.ref(l.options.map(o=>o.value===l.modelValue));function a(o){r("update:modelValue",o)}return e.onBeforeMount(()=>{}),(o,d)=>{const n=e.resolveComponent("form-input");return e.openBlock(),e.createElementBlock("div",T,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(i,c)=>(e.openBlock(),e.createBlock(n,{key:c,type:"radio",name:t.name,id:`${t.id}-${c}`,value:i.value||i,label:`${i.text||i}${t.required?" *":""}`,checked:i.value?i.value===t.modelValue:i===t.modelValue,disabled:t.disabled,"read-only":t.readOnly,required:t.required,onChange:m=>a(i)},null,8,["name","id","value","label","checked","disabled","read-only","required","onChange"]))),128)),e.createElementVNode("label",{for:t.id},[e.renderSlot(o.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,U)])}}}),F={class:"input input-dropdown"},I={class:"dropdown"},R={class:"btn-group",role:"group"},P=["id","disabled"],j=["aria-labelledby"],H=["onClick"],G=["for"],J=e.defineComponent({__name:"input-dropdown",props:{modelValue:{type:[String,Number,Boolean,Object],default:""},name:{type:String,default:()=>u()},id:{type:String,default:()=>u()},label:{type:String,default:""},placeholder:{type:String,default:"Please select"},options:{type:Array,default:[]},variant:{type:String,default:""},color:{type:String,default:""},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},required:{type:Boolean,default:!1},outline:{type:Boolean,default:!0},resetOption:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:r}){const l=t;e.computed({get(){return l.modelValue},set(n){r("update:modelValue",n)}});function a(n){r("update:modelValue",n)}const o=e.computed(()=>[{text:"Please select"},...l.options.map(n=>typeof n=="string"?{value:n,text:n}:n)]),d=e.computed(()=>[...l.options].find(n=>JSON.stringify(n.value)===JSON.stringify(l.modelValue)));return(n,i)=>(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",I,[e.createElementVNode("div",R,[e.createElementVNode("button",{class:e.normalizeClass(["btn dropdown-toggle",{[`btn-${t.variant}`]:t.variant,[`btn-${t.color}`]:t.color,[`btn-${t.disabled}`]:t.disabled,[`btn-outline-${t.color||"dark"}`]:t.outline}]),type:"button",id:t.id,"data-bs-toggle":"dropdown","aria-expanded":"false",disabled:t.disabled},e.toDisplayString(e.unref(d)?e.unref(d).text:t.placeholder),11,P),e.createElementVNode("ul",{class:"dropdown-menu","aria-labelledby":t.id},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),(c,m)=>(e.openBlock(),e.createElementBlock("li",{key:m},[e.renderSlot(n.$slots,"option",{},()=>[e.createElementVNode("a",{class:"dropdown-item",onClick:e.withModifiers(f=>a(c.value),["prevent"])},e.toDisplayString(c.text),9,H)])]))),128))],8,j)])]),e.createElementVNode("label",{for:t.id},[e.renderSlot(n.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])],8,G)]))}}),X=["id","name","multiple","accept"],Y={class:"form-input__input-group input-group"},K=["value","id","name"],Q=["for"],W=["for","innerHTML"],Z=e.defineComponent({__name:"file-input",props:{modelValue:{type:Array,default:[]},name:{type:String,default:()=>u()},id:{type:String,default:()=>u()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},pattern:{type:String,default:null},multiple:{type:Boolean,default:!1},accept:{type:String}},emits:["update:modelValue"],setup(t,{emit:r}){function l(d){const n=d.target&&d.target.files;n&&(a.splice(0,a.length),Array.from(n).forEach(i=>{a.push(i)}))}const a=e.reactive([]),o=e.computed(()=>a&&a.map(d=>d.name));return e.computed(()=>a.map(d=>URL.createObjectURL(d))),e.watch(()=>a,(d,n)=>{console.log("file input",d),r("update:modelValue",d)},{deep:!0}),(d,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["form-input file-input","file-input--primary"])},[e.createElementVNode("input",{type:"file",id:t.id,name:t.name,class:"d-none",onChange:l,multiple:t.multiple,accept:t.accept},null,40,X),e.createElementVNode("div",Y,[e.renderSlot(d.$slots,"input-prepend"),e.createElementVNode("input",{type:"text",value:e.unref(o),id:t.id,name:t.name,class:"form-control"},null,8,K),e.renderSlot(d.$slots,"input-append",{},()=>[e.createElementVNode("label",{for:t.id,class:"btn btn-outline-dark"}," Select Image ",8,Q)])]),e.renderSlot(d.$slots,"label",{},()=>[e.createElementVNode("label",{for:t.id,class:"form-input__label",innerHTML:`${t.label}${t.required?" *":""}`},null,8,W)])]))}}),_={class:"media-upload"},v=["src"],ee=["onClick"],te=["for"];async function le(t){return await new Promise(r=>{let l=new FileReader;l.onload=()=>r(l.result),l.readAsDataURL(t)})}const ne=e.defineComponent({__name:"media-upload",props:{modelValue:{type:Array,default:[]},src:{type:String},name:{type:String,default:()=>u()},id:{type:String,default:()=>u()},label:{type:String,default:""},placeholder:{type:String,default:""},variant:{type:String,default:""},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},pattern:{type:String,default:null},multiple:{type:Boolean,default:!1},accept:{type:String,default:"image/*"}},emits:["update:modelValue","update:src"],setup(t,{emit:r}){const l=t,a=e.ref([]),o=e.ref([]),d=e.computed(()=>l.modelValue.length?l.modelValue:l.src?[{type:"",src:l.src}]:o.value);e.watch(()=>a,async(i,c)=>{o.value=await Promise.all(i.value.map(async m=>({src:await le(m),type:m.type})))},{deep:!0}),e.watch(()=>o,async(i,c)=>{const m=l.multiple?o.value:[o.value[0]];r("update:modelValue",m),l.multiple||r("update:src",o.value[0]&&o.value[0].src)},{deep:!0});function n(i){a.value.splice(i,1)}return(i,c)=>{const m=e.resolveComponent("svg-icon"),f=e.resolveComponent("file-input");return e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(d),(p,ae)=>(e.openBlock(),e.createElementBlock("div",{key:p.src,class:"media-upload__thumbnail"},[e.createElementVNode("img",{src:p.src,class:"img-thumbnail rounded"},null,8,v),e.createElementVNode("button",{onClick:e.withModifiers(me=>n(ae),["prevent"]),class:"btn btn--close"},[e.createVNode(m,{symbol:"x"})],8,ee)]))),128)),e.createVNode(f,{modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=p=>a.value=p),id:t.id,name:t.name,accept:t.accept,class:"d-none"},null,8,["modelValue","id","name","accept"]),e.createElementVNode("label",{for:t.id,class:"btn btn-outline-dark"}," Select Image ",8,te)])}}}),se="";s.BaseButton=w,s.CheckGroup=L,s.FileInput=Z,s.FormInput=O,s.InputDropdown=J,s.LoadingSpinner=V,s.MediaUpload=ne,s.RadioGroup=A,s.SvgIcon=b,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -7,10 +7,10 @@ declare const _default: {
7
7
  label: string;
8
8
  pattern: string;
9
9
  required: boolean;
10
- modelValue: (string | [{
11
- type: string;
10
+ modelValue: [{
11
+ type?: string | undefined;
12
12
  src: string;
13
- }])[];
13
+ }][];
14
14
  variant: string;
15
15
  name: string;
16
16
  id: string;
@@ -22,28 +22,28 @@ declare const _default: {
22
22
  }> & Omit<Readonly<import("vue").ExtractPropTypes<{
23
23
  modelValue: {
24
24
  type: {
25
- (arrayLength: number): (string | [{
26
- type: string;
25
+ (arrayLength: number): [{
26
+ type?: string | undefined;
27
27
  src: string;
28
- }])[];
29
- (...items: (string | [{
30
- type: string;
28
+ }][];
29
+ (...items: [{
30
+ type?: string | undefined;
31
31
  src: string;
32
- }])[]): (string | [{
33
- type: string;
32
+ }][]): [{
33
+ type?: string | undefined;
34
34
  src: string;
35
- }])[];
36
- new (arrayLength: number): (string | [{
37
- type: string;
35
+ }][];
36
+ new (arrayLength: number): [{
37
+ type?: string | undefined;
38
38
  src: string;
39
- }])[];
40
- new (...items: (string | [{
41
- type: string;
39
+ }][];
40
+ new (...items: [{
41
+ type?: string | undefined;
42
42
  src: string;
43
- }])[]): (string | [{
44
- type: string;
43
+ }][]): [{
44
+ type?: string | undefined;
45
45
  src: string;
46
- }])[];
46
+ }][];
47
47
  isArray(arg: any): arg is any[];
48
48
  readonly prototype: any[];
49
49
  from<T>(arrayLike: ArrayLike<T>): T[];
@@ -122,28 +122,28 @@ declare const _default: {
122
122
  $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
123
123
  modelValue: {
124
124
  type: {
125
- (arrayLength: number): (string | [{
126
- type: string;
125
+ (arrayLength: number): [{
126
+ type?: string | undefined;
127
127
  src: string;
128
- }])[];
129
- (...items: (string | [{
130
- type: string;
128
+ }][];
129
+ (...items: [{
130
+ type?: string | undefined;
131
131
  src: string;
132
- }])[]): (string | [{
133
- type: string;
132
+ }][]): [{
133
+ type?: string | undefined;
134
134
  src: string;
135
- }])[];
136
- new (arrayLength: number): (string | [{
137
- type: string;
135
+ }][];
136
+ new (arrayLength: number): [{
137
+ type?: string | undefined;
138
138
  src: string;
139
- }])[];
140
- new (...items: (string | [{
141
- type: string;
139
+ }][];
140
+ new (...items: [{
141
+ type?: string | undefined;
142
142
  src: string;
143
- }])[]): (string | [{
144
- type: string;
143
+ }][]): [{
144
+ type?: string | undefined;
145
145
  src: string;
146
- }])[];
146
+ }][];
147
147
  isArray(arg: any): arg is any[];
148
148
  readonly prototype: any[];
149
149
  from<T>(arrayLike: ArrayLike<T>): T[];
@@ -209,10 +209,10 @@ declare const _default: {
209
209
  label: string;
210
210
  pattern: string;
211
211
  required: boolean;
212
- modelValue: (string | [{
213
- type: string;
212
+ modelValue: [{
213
+ type?: string | undefined;
214
214
  src: string;
215
- }])[];
215
+ }][];
216
216
  variant: string;
217
217
  name: string;
218
218
  id: string;
@@ -244,28 +244,28 @@ declare const _default: {
244
244
  } & Readonly<import("vue").ExtractPropTypes<{
245
245
  modelValue: {
246
246
  type: {
247
- (arrayLength: number): (string | [{
248
- type: string;
247
+ (arrayLength: number): [{
248
+ type?: string | undefined;
249
249
  src: string;
250
- }])[];
251
- (...items: (string | [{
252
- type: string;
250
+ }][];
251
+ (...items: [{
252
+ type?: string | undefined;
253
253
  src: string;
254
- }])[]): (string | [{
255
- type: string;
254
+ }][]): [{
255
+ type?: string | undefined;
256
256
  src: string;
257
- }])[];
258
- new (arrayLength: number): (string | [{
259
- type: string;
257
+ }][];
258
+ new (arrayLength: number): [{
259
+ type?: string | undefined;
260
260
  src: string;
261
- }])[];
262
- new (...items: (string | [{
263
- type: string;
261
+ }][];
262
+ new (...items: [{
263
+ type?: string | undefined;
264
264
  src: string;
265
- }])[]): (string | [{
266
- type: string;
265
+ }][]): [{
266
+ type?: string | undefined;
267
267
  src: string;
268
- }])[];
268
+ }][];
269
269
  isArray(arg: any): arg is any[];
270
270
  readonly prototype: any[];
271
271
  from<T>(arrayLike: ArrayLike<T>): T[];
@@ -334,28 +334,28 @@ declare const _default: {
334
334
  } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
335
335
  modelValue: {
336
336
  type: {
337
- (arrayLength: number): (string | [{
338
- type: string;
337
+ (arrayLength: number): [{
338
+ type?: string | undefined;
339
339
  src: string;
340
- }])[];
341
- (...items: (string | [{
342
- type: string;
340
+ }][];
341
+ (...items: [{
342
+ type?: string | undefined;
343
343
  src: string;
344
- }])[]): (string | [{
345
- type: string;
344
+ }][]): [{
345
+ type?: string | undefined;
346
346
  src: string;
347
- }])[];
348
- new (arrayLength: number): (string | [{
349
- type: string;
347
+ }][];
348
+ new (arrayLength: number): [{
349
+ type?: string | undefined;
350
350
  src: string;
351
- }])[];
352
- new (...items: (string | [{
353
- type: string;
351
+ }][];
352
+ new (...items: [{
353
+ type?: string | undefined;
354
354
  src: string;
355
- }])[]): (string | [{
356
- type: string;
355
+ }][]): [{
356
+ type?: string | undefined;
357
357
  src: string;
358
- }])[];
358
+ }][];
359
359
  isArray(arg: any): arg is any[];
360
360
  readonly prototype: any[];
361
361
  from<T>(arrayLike: ArrayLike<T>): T[];
@@ -421,10 +421,10 @@ declare const _default: {
421
421
  label: string;
422
422
  pattern: string;
423
423
  required: boolean;
424
- modelValue: (string | [{
425
- type: string;
424
+ modelValue: [{
425
+ type?: string | undefined;
426
426
  src: string;
427
- }])[];
427
+ }][];
428
428
  variant: string;
429
429
  name: string;
430
430
  id: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.0.33",
4
+ "version": "0.0.34",
5
5
  "scripts": {
6
6
  "dev": "vite",
7
7
  "build": "vue-tsc --noEmit && vite build",