ablok-components 0.0.31 → 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 g, openBlock as u, createElementBlock as s, normalizeClass as v, createElementVNode as i, renderSlot as f, computed as p, resolveComponent as $, createBlock as k, createCommentVNode as S, unref as y, toDisplayString as h, withDirectives as x, isRef as V, vModelDynamic as I, vModelText as C, ref as N, watch as B, onBeforeMount as z, Fragment as w, renderList as q, createTextVNode as O, withModifiers as L, reactive as T, createVNode as A } 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
- }, U = ["xlink:href"], ye = /* @__PURE__ */ g({
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 (r, n) => (u(), s("i", {
26
+ return (r, t) => (u(), s("i", {
27
27
  class: v(["svg-icon", {
28
28
  [`svg-icon--${e.size}`]: e.size
29
29
  }])
30
30
  }, [
31
- (u(), s("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, U)
37
+ }, null, 8, F)
38
38
  ]))
39
39
  ], 2));
40
40
  }
41
41
  });
42
- const F = { class: "loading-spinner d-block" }, H = { class: "loading-spinner__animation" }, P = {
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" }, H = { 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"], R = /* @__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" }, H = { 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
- R
63
- ], be = /* @__PURE__ */ g({
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" }, H = { class: "loading-spinner__a
69
69
  }
70
70
  },
71
71
  setup(e) {
72
- return (r, n) => (u(), s("span", F, [
72
+ return (r, t) => (u(), s("span", P, [
73
73
  i("span", H, [
74
- (u(), s("svg", P, [
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(r.$slots, "default")
81
+ m(r.$slots, "default")
82
82
  ]));
83
83
  }
84
84
  });
85
- const J = ["type", "disabled", "href", "to"], ge = /* @__PURE__ */ g({
85
+ const X = ["type", "disabled", "href", "to"], Be = /* @__PURE__ */ b({
86
86
  __name: "base-button",
87
87
  props: {
88
88
  type: null,
@@ -99,9 +99,9 @@ const J = ["type", "disabled", "href", "to"], ge = /* @__PURE__ */ g({
99
99
  fab: { type: Boolean }
100
100
  },
101
101
  setup(e) {
102
- const r = e, n = p(() => r.caption && !r.fab);
103
- return (a, d) => {
104
- const l = $("svg-icon");
102
+ const r = e, t = g(() => r.caption && !r.fab);
103
+ return (a, n) => {
104
+ const d = $("svg-icon");
105
105
  return u(), s("button", {
106
106
  type: e.type,
107
107
  disabled: e.disabled,
@@ -119,28 +119,28 @@ const J = ["type", "disabled", "href", "to"], ge = /* @__PURE__ */ g({
119
119
  "x-small": e.size === "x-small"
120
120
  }])
121
121
  }, [
122
- f(a.$slots, "default", {}, () => [
123
- e.icon ? (u(), k(l, {
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"])) : S("", !0),
128
- y(n) ? (u(), s("span", {
127
+ }, null, 8, ["id"])) : q("", !0),
128
+ p(t) ? (u(), s("span", {
129
129
  key: 1,
130
130
  class: v(["base-button__caption", { "icon-padding": e.icon }])
131
- }, h(e.caption), 3)) : S("", !0)
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 j = { class: "input-group form-input__input-group" }, X = ["type", "id", "name", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"], Y = {
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
- }, K = ["name", "id", "disabled", "read-only", "required", "aria-label"], Q = ["for", "innerHTML"], pe = /* @__PURE__ */ g({
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 j = { class: "input-group form-input__input-group" }, X = ["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,
@@ -197,21 +197,21 @@ const j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
197
197
  },
198
198
  emits: ["update:modelValue"],
199
199
  setup(e, { emit: r }) {
200
- const n = e, a = p({
200
+ const t = e, a = g({
201
201
  get() {
202
- return n.modelValue;
202
+ return t.modelValue;
203
203
  },
204
- set(d) {
205
- r("update:modelValue", d);
204
+ set(n) {
205
+ r("update:modelValue", n);
206
206
  }
207
207
  });
208
- return (d, l) => (u(), s("div", {
208
+ return (n, d) => (u(), s("div", {
209
209
  class: v(["form-input", `form-input--${e.type}`])
210
210
  }, [
211
- i("div", j, [
212
- f(d.$slots, "input-prepend"),
213
- x(i("input", {
214
- "onUpdate:modelValue": l[0] || (l[0] = (t) => V(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 j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
224
224
  checked: e.checked,
225
225
  class: "form-control",
226
226
  "aria-label": e.label
227
- }, null, 8, X), [
228
- [I, y(a)]
227
+ }, null, 8, K), [
228
+ [T, p(a)]
229
229
  ]),
230
- f(d.$slots, "input-append", {}, () => [
231
- e.type === "color" ? (u(), s("span", Y, [
232
- x(i("input", {
233
- "onUpdate:modelValue": l[1] || (l[1] = (t) => V(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 j = { class: "input-group form-input__input-group" }, X = ["type", "id", "
239
239
  required: e.required,
240
240
  class: "form-control",
241
241
  "aria-label": e.label
242
- }, null, 8, K), [
243
- [C, y(a)]
242
+ }, null, 8, W), [
243
+ [A, p(a)]
244
244
  ])
245
- ])) : S("", !0)
245
+ ])) : q("", !0)
246
246
  ])
247
247
  ]),
248
- f(d.$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, Q)
253
+ }, null, 8, Z)
254
254
  ])
255
255
  ], 2));
256
256
  }
257
257
  });
258
- const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
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 W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
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,
@@ -296,25 +296,25 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
296
296
  },
297
297
  emits: ["change", "update:modelValue"],
298
298
  setup(e, { emit: r }) {
299
- const n = e, a = N([]);
300
- return B(() => n.modelValue, (d, l) => {
301
- a.value = n.options.map(
302
- (t) => t.value ? n.modelValue.some((o) => o["value "] === t.value) : n.modelValue.some((o) => o === t)
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 }), B(a, (d, l) => {
305
- const t = d.reduce((o, c, b) => {
306
- const M = c && n.options[b] ? [n.options[b] || n.options[b]] : [];
307
- return [...o, ...M];
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
- r("update:modelValue", t);
310
- }, { deep: !0 }), z(() => {
311
- }), (d, l) => {
312
- const t = $("form-input");
313
- return u(), s("div", W, [
314
- (u(!0), s(w, null, q(e.options, (o, c) => (u(), k(t, {
309
+ r("update:modelValue", l);
310
+ }, { deep: !0 }), N(() => {
311
+ }), (n, d) => {
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
315
  key: c,
316
- modelValue: y(a)[c],
317
- "onUpdate:modelValue": (b) => y(a)[c] = b,
316
+ modelValue: p(a)[c],
317
+ "onUpdate:modelValue": (f) => p(a)[c] = f,
318
318
  type: "checkbox",
319
319
  name: e.name,
320
320
  id: `${e.id}-${c}`,
@@ -324,14 +324,14 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
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(d.$slots, "label", {}, () => [
328
- O(h(e.label), 1)
327
+ m(n.$slots, "label", {}, () => [
328
+ C(h(e.label), 1)
329
329
  ])
330
- ], 8, Z)
330
+ ], 8, ee)
331
331
  ]);
332
332
  };
333
333
  }
334
- }), _ = { class: "radio-group" }, ee = ["for"], ve = /* @__PURE__ */ g({
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 W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
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,
@@ -372,16 +372,16 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
372
372
  },
373
373
  emits: ["change", "update:modelValue"],
374
374
  setup(e, { emit: r }) {
375
- const n = e;
376
- N(n.options.map((d) => d.value === n.modelValue));
377
- function a(d) {
378
- r("update:modelValue", d);
375
+ const t = e;
376
+ B(t.options.map((n) => n.value === t.modelValue));
377
+ function a(n) {
378
+ r("update:modelValue", n);
379
379
  }
380
- return z(() => {
381
- }), (d, l) => {
382
- const t = $("form-input");
383
- return u(), s("div", _, [
384
- (u(!0), s(w, null, q(e.options, (o, c) => (u(), k(t, {
380
+ return N(() => {
381
+ }), (n, d) => {
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
385
  key: c,
386
386
  type: "radio",
387
387
  name: e.name,
@@ -392,20 +392,20 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
392
392
  disabled: e.disabled,
393
393
  "read-only": e.readOnly,
394
394
  required: e.required,
395
- onChange: (b) => 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(d.$slots, "label", {}, () => [
399
- O(h(e.label), 1)
398
+ m(n.$slots, "label", {}, () => [
399
+ C(h(e.label), 1)
400
400
  ])
401
- ], 8, ee)
401
+ ], 8, le)
402
402
  ]);
403
403
  };
404
404
  }
405
- }), te = { class: "input input-dropdown" }, le = { class: "dropdown" }, ae = {
405
+ }), ae = { class: "input input-dropdown" }, ne = { class: "dropdown" }, de = {
406
406
  class: "btn-group",
407
407
  role: "group"
408
- }, ne = ["id", "disabled"], de = ["aria-labelledby"], oe = ["onClick"], ie = ["for"], $e = /* @__PURE__ */ g({
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 W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
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,
@@ -463,29 +463,29 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
463
463
  },
464
464
  emits: ["update:modelValue"],
465
465
  setup(e, { emit: r }) {
466
- const n = e;
467
- p({
466
+ const t = e;
467
+ g({
468
468
  get() {
469
- return n.modelValue;
469
+ return t.modelValue;
470
470
  },
471
- set(t) {
472
- r("update:modelValue", t);
471
+ set(l) {
472
+ r("update:modelValue", l);
473
473
  }
474
474
  });
475
- function a(t) {
476
- r("update:modelValue", t);
475
+ function a(l) {
476
+ r("update:modelValue", l);
477
477
  }
478
- const d = p(() => [
478
+ const n = g(() => [
479
479
  {
480
480
  text: "Please select"
481
481
  },
482
- ...n.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
- ]), l = p(() => [...n.options].find((t) => JSON.stringify(t.value) === JSON.stringify(n.modelValue)));
486
- return (t, o) => (u(), s("div", te, [
487
- i("div", le, [
488
- i("div", ae, [
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
490
  class: v(["btn dropdown-toggle", {
491
491
  [`btn-${e.variant}`]: e.variant,
@@ -498,47 +498,43 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
498
498
  "data-bs-toggle": "dropdown",
499
499
  "aria-expanded": "false",
500
500
  disabled: e.disabled
501
- }, h(y(l) ? y(l).text : e.placeholder), 11, ne),
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), s(w, null, q(y(d), (c, b) => (u(), s("li", { key: b }, [
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: L((M) => a(c.value), ["prevent"])
511
- }, h(c.text), 9, oe)
510
+ onClick: z((V) => a(c.value), ["prevent"])
511
+ }, h(c.text), 9, ue)
512
512
  ])
513
513
  ]))), 128))
514
- ], 8, de)
514
+ ], 8, ie)
515
515
  ])
516
516
  ]),
517
517
  i("label", { for: e.id }, [
518
- f(t.$slots, "label", {}, () => [
519
- O(h(e.label), 1)
518
+ m(l.$slots, "label", {}, () => [
519
+ C(h(e.label), 1)
520
520
  ])
521
- ], 8, ie)
521
+ ], 8, re)
522
522
  ]));
523
523
  }
524
- }), ue = { class: "input-group" }, re = ["v-model", "id", "name"], se = ["name", "id", "placeholder", "pattern", "disabled", "read-only", "required", "maxlength", "checked", "aria-label"], ce = ["for"], fe = ["for", "innerHTML"], Se = /* @__PURE__ */ g({
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: {
528
- type: [String, Number, Boolean],
529
- default: ""
530
- },
531
- type: {
532
- type: String,
533
- default: "text"
528
+ type: Array,
529
+ default: []
534
530
  },
535
531
  name: {
536
532
  type: String,
537
- default: () => m()
533
+ default: () => y()
538
534
  },
539
535
  id: {
540
536
  type: String,
541
- default: () => m()
537
+ default: () => y()
542
538
  },
543
539
  label: {
544
540
  type: String,
@@ -564,88 +560,187 @@ const W = { class: "radio-group" }, Z = ["for"], he = /* @__PURE__ */ g({
564
560
  type: Boolean,
565
561
  default: !1
566
562
  },
567
- maxlength: {
568
- type: Number
569
- },
570
563
  pattern: {
571
564
  type: String,
572
565
  default: null
573
566
  },
574
- checked: {
567
+ multiple: {
575
568
  type: Boolean,
576
569
  default: !1
570
+ },
571
+ accept: {
572
+ type: String
577
573
  }
578
574
  },
579
575
  emits: ["update:modelValue"],
580
576
  setup(e, { emit: r }) {
581
- function n(l) {
582
- const t = l.target && l.target.files;
583
- t && (a.splice(0, a.length), Array.from(t).forEach((o) => {
577
+ function t(d) {
578
+ const l = d.target && d.target.files;
579
+ l && (a.splice(0, a.length), Array.from(l).forEach((o) => {
584
580
  a.push(o);
585
581
  }));
586
582
  }
587
- const a = T([]), d = p(() => a.map((l) => l.name));
588
- return B(() => a, (l, t) => {
589
- l !== t && r("update:modelValue", l);
590
- }, { deep: !0 }), (l, t) => {
591
- const o = $("svg-icon");
592
- return u(), s("div", {
593
- class: v(["file-input", "file-input--primary"])
594
- }, [
595
- i("div", ue, [
596
- f(l.$slots, "input-prepend"),
597
- i("input", {
598
- "v-model": a,
599
- type: "file",
600
- id: e.id,
601
- name: e.name,
602
- onChange: n,
603
- class: "d-none"
604
- }, null, 40, re),
605
- x(i("input", {
606
- "onUpdate:modelValue": t[0] || (t[0] = (c) => V(d) ? d.value = c : null),
607
- type: "text",
608
- name: `${e.name}--text`,
609
- id: `${e.name}--text`,
610
- placeholder: e.placeholder,
611
- pattern: e.pattern,
612
- disabled: e.disabled,
613
- "read-only": e.readOnly,
614
- required: e.required,
615
- maxlength: e.maxlength,
616
- checked: e.checked,
617
- class: "form-control",
618
- "aria-label": e.label
619
- }, null, 8, se), [
620
- [C, y(d)]
621
- ]),
622
- f(l.$slots, "input-append", {}, () => [
623
- i("label", {
624
- for: e.id,
625
- class: "input-group-text"
626
- }, [
627
- A(o, { symbol: "upload" })
628
- ], 8, ce)
629
- ])
630
- ]),
631
- f(l.$slots, "label", {}, () => [
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
+ }, [
589
+ i("input", {
590
+ type: "file",
591
+ id: e.id,
592
+ name: e.name,
593
+ class: "d-none",
594
+ onChange: t,
595
+ multiple: e.multiple,
596
+ accept: e.accept
597
+ }, null, 40, se),
598
+ i("div", ce, [
599
+ m(d.$slots, "input-prepend"),
600
+ i("input", {
601
+ type: "text",
602
+ value: p(n),
603
+ id: e.id,
604
+ name: e.name,
605
+ class: "form-control"
606
+ }, null, 8, fe),
607
+ m(d.$slots, "input-append", {}, () => [
632
608
  i("label", {
633
609
  for: e.id,
634
- class: "form-input__label",
635
- innerHTML: `${e.label}${e.required ? " *" : ""}`
636
- }, null, 8, fe)
610
+ class: "btn btn-outline-dark"
611
+ }, " Select Image ", 8, me)
637
612
  ])
613
+ ]),
614
+ m(d.$slots, "label", {}, () => [
615
+ i("label", {
616
+ for: e.id,
617
+ class: "form-input__label",
618
+ innerHTML: `${e.label}${e.required ? " *" : ""}`
619
+ }, null, 8, ye)
620
+ ])
621
+ ]));
622
+ }
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
+ });
629
+ }
630
+ const Me = /* @__PURE__ */ b({
631
+ __name: "media-upload",
632
+ props: {
633
+ modelValue: {
634
+ type: Array,
635
+ default: []
636
+ },
637
+ src: {
638
+ type: String
639
+ },
640
+ name: {
641
+ type: String,
642
+ default: () => y()
643
+ },
644
+ id: {
645
+ type: String,
646
+ default: () => y()
647
+ },
648
+ label: {
649
+ type: String,
650
+ default: ""
651
+ },
652
+ placeholder: {
653
+ type: String,
654
+ default: ""
655
+ },
656
+ variant: {
657
+ type: String,
658
+ default: ""
659
+ },
660
+ disabled: {
661
+ type: Boolean,
662
+ default: !1
663
+ },
664
+ readOnly: {
665
+ type: Boolean,
666
+ default: !1
667
+ },
668
+ required: {
669
+ type: Boolean,
670
+ default: !1
671
+ },
672
+ pattern: {
673
+ type: String,
674
+ default: null
675
+ },
676
+ multiple: {
677
+ type: Boolean,
678
+ default: !1
679
+ },
680
+ accept: {
681
+ type: String,
682
+ default: "image/*"
683
+ }
684
+ },
685
+ emits: ["update:modelValue", "update:src"],
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
+ n.value = await Promise.all(
690
+ o.value.map(async (f) => ({
691
+ src: await ve(f),
692
+ type: f.type
693
+ }))
694
+ );
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
+ }, { deep: !0 });
699
+ function l(o) {
700
+ a.value.splice(o, 1);
701
+ }
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
+ class: "media-upload__thumbnail"
708
+ }, [
709
+ i("img", {
710
+ src: x.src,
711
+ class: "img-thumbnail rounded"
712
+ }, null, 8, be),
713
+ i("button", {
714
+ onClick: z(($e) => l(I), ["prevent"]),
715
+ class: "btn btn--close"
716
+ }, [
717
+ L(f, { symbol: "x" })
718
+ ], 8, ge)
719
+ ]))), 128)),
720
+ L(V, {
721
+ modelValue: a.value,
722
+ "onUpdate:modelValue": c[0] || (c[0] = (x) => a.value = x),
723
+ id: e.id,
724
+ name: e.name,
725
+ accept: e.accept,
726
+ class: "d-none"
727
+ }, null, 8, ["modelValue", "id", "name", "accept"]),
728
+ i("label", {
729
+ for: e.id,
730
+ class: "btn btn-outline-dark"
731
+ }, " Select Image ", 8, he)
638
732
  ]);
639
733
  };
640
734
  }
641
735
  });
642
736
  export {
643
- ge as BaseButton,
644
- he as CheckGroup,
645
- Se as FileInput,
646
- pe as FormInput,
647
- $e as InputDropdown,
648
- be as LoadingSpinner,
649
- ve as RadioGroup,
650
- ye 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
651
746
  };