ablok-components 0.0.38 → 0.0.41

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.
Files changed (22) hide show
  1. package/dist/ablok-components.es.js +189 -182
  2. package/dist/ablok-components.umd.js +1 -1
  3. package/dist/components/{base-button.vue.d.ts → form/base-button/base-button.vue.d.ts} +0 -0
  4. package/dist/components/{base-form.vue.d.ts → form/base-form/base-form.vue.d.ts} +0 -0
  5. package/dist/components/{check-group.vue.d.ts → form/check-group/check-group.vue.d.ts} +0 -0
  6. package/dist/components/{file-input.vue.d.ts → form/file-input/file-input.vue.d.ts} +0 -0
  7. package/dist/components/{form-input.vue.d.ts → form/form-input/form-input.vue.d.ts} +0 -0
  8. package/dist/components/{input-dropdown.vue.d.ts → form/input-dropdown/input-dropdown.vue.d.ts} +0 -0
  9. package/dist/components/{input-textarea.vue.d.ts → form/input-textarea/input-textarea.vue.d.ts} +0 -0
  10. package/dist/components/{media-upload.vue.d.ts → form/media-upload/media-upload.vue.d.ts} +0 -0
  11. package/dist/components/{radio-group.vue.d.ts → form/radio-group/radio-group.vue.d.ts} +0 -0
  12. package/dist/components/{loading-spinner.vue.d.ts → icon/loading-spinner/loading-spinner.vue.d.ts} +0 -0
  13. package/dist/components/{svg-icon.vue.d.ts → icon/svg-icon/svg-icon.vue.d.ts} +0 -0
  14. package/dist/components/{base-headline.vue.d.ts → text/base-headline/base-headline.vue.d.ts} +4 -0
  15. package/dist/components/{base-paragraph.vue.d.ts → text/base-paragraph/base-paragraph.vue.d.ts} +0 -0
  16. package/dist/env.d.ts +8 -0
  17. package/dist/index.d.ts +12 -12
  18. package/dist/style.css +1 -1
  19. package/dist/symbol-defs.svg +769 -224
  20. package/dist/{components → utilities}/helpers.d.ts +0 -0
  21. package/package.json +2 -1
  22. package/dist/components/base-button.story.vue.d.ts +0 -48
@@ -1,4 +1,4 @@
1
- import { defineComponent as g, openBlock as r, createElementBlock as s, normalizeClass as p, createElementVNode as o, renderSlot as f, createBlock as C, resolveDynamicComponent as D, withCtx as A, createTextVNode as x, toDisplayString as v, computed as h, resolveComponent as $, createCommentVNode as k, unref as b, withDirectives as w, isRef as q, vModelDynamic as H, vModelText as U, ref as O, watch as S, onBeforeMount as L, Fragment as M, renderList as N, withModifiers as T, reactive as P, createVNode as z } from "vue";
1
+ import { defineComponent as g, openBlock as r, createElementBlock as c, normalizeClass as b, createElementVNode as u, renderSlot as m, computed as h, createBlock as C, resolveDynamicComponent as D, unref as p, withCtx as A, createTextVNode as V, toDisplayString as v, resolveComponent as S, createCommentVNode as w, withDirectives as q, isRef as O, vModelDynamic as H, vModelText as U, ref as x, watch as $, onBeforeMount as L, Fragment as M, renderList as N, withModifiers as T, reactive as P, createVNode as z } from "vue";
2
2
  const R = {
3
3
  class: "icon",
4
4
  preserveAspectRatio: "xMaxYMin"
@@ -23,13 +23,13 @@ const R = {
23
23
  }
24
24
  },
25
25
  setup(e) {
26
- return (i, t) => (r(), s("i", {
27
- class: p(["svg-icon", {
26
+ return (o, t) => (r(), c("i", {
27
+ class: b(["svg-icon", {
28
28
  [`svg-icon--${e.size}`]: e.size
29
29
  }])
30
30
  }, [
31
- (r(), s("svg", R, [
32
- o("use", {
31
+ (r(), c("svg", R, [
32
+ u("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",
@@ -50,7 +50,7 @@ const E = { class: "loading-spinner d-block" }, j = { 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
- }, J = ["fill"], X = /* @__PURE__ */ o("animateTransform", {
53
+ }, J = ["fill"], X = /* @__PURE__ */ u("animateTransform", {
54
54
  attributeName: "transform",
55
55
  attributeType: "XML",
56
56
  type: "rotate",
@@ -69,16 +69,16 @@ const E = { class: "loading-spinner d-block" }, j = { class: "loading-spinner__a
69
69
  }
70
70
  },
71
71
  setup(e) {
72
- return (i, t) => (r(), s("span", E, [
73
- o("span", j, [
74
- (r(), s("svg", G, [
75
- o("path", {
72
+ return (o, t) => (r(), c("span", E, [
73
+ u("span", j, [
74
+ (r(), c("svg", G, [
75
+ u("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
78
  }, Y, 8, J)
79
79
  ]))
80
80
  ]),
81
- f(i.$slots, "default")
81
+ m(o.$slots, "default")
82
82
  ]));
83
83
  }
84
84
  });
@@ -88,15 +88,17 @@ const Ne = /* @__PURE__ */ g({
88
88
  tag: null,
89
89
  size: null,
90
90
  variant: null,
91
- text: null
91
+ text: null,
92
+ className: null
92
93
  },
93
94
  setup(e) {
94
- return (i, t) => (r(), C(D(e.tag), {
95
- class: p(["headline", `headline--${e.size}`])
95
+ const o = e, t = h(() => o.tag || "p");
96
+ return (d, a) => (r(), C(D(p(t)), {
97
+ class: b(["headline", `headline--${e.size}${e.className || ""}`])
96
98
  }, {
97
99
  default: A(() => [
98
- f(i.$slots, "default", {}, () => [
99
- x(v(e.text), 1)
100
+ m(d.$slots, "default", {}, () => [
101
+ V(v(e.text), 1)
100
102
  ])
101
103
  ]),
102
104
  _: 3
@@ -111,11 +113,11 @@ const Ne = /* @__PURE__ */ g({
111
113
  className: null
112
114
  },
113
115
  setup(e) {
114
- return (i, t) => (r(), s("p", {
115
- class: p(["base-paragraph", `base-paragraph--${e.size} ${e.className}`])
116
+ return (o, t) => (r(), c("p", {
117
+ class: b(["base-paragraph", `base-paragraph--${e.size}${e.className || ""}`])
116
118
  }, [
117
- f(i.$slots, "default", {}, () => [
118
- x(v(e.text), 1)
119
+ m(o.$slots, "default", {}, () => [
120
+ V(v(e.text), 1)
119
121
  ])
120
122
  ], 2));
121
123
  }
@@ -136,15 +138,15 @@ const Ne = /* @__PURE__ */ g({
136
138
  fab: { type: Boolean }
137
139
  },
138
140
  setup(e) {
139
- const i = e, t = h(() => i.caption && !i.fab);
140
- return (a, n) => {
141
- const d = $("svg-icon");
142
- return r(), s("button", {
141
+ const o = e, t = h(() => o.caption && !o.fab);
142
+ return (d, a) => {
143
+ const i = S("svg-icon");
144
+ return r(), c("button", {
143
145
  type: e.type,
144
146
  disabled: e.disabled,
145
147
  href: e.href,
146
148
  to: e.to,
147
- class: p(["base-button btn btn-primary", {
149
+ class: b(["base-button btn btn-primary", {
148
150
  disabled: e.disabled,
149
151
  pending: e.pending,
150
152
  rounded: e.rounded,
@@ -156,16 +158,16 @@ const Ne = /* @__PURE__ */ g({
156
158
  "x-small": e.size === "x-small"
157
159
  }])
158
160
  }, [
159
- f(a.$slots, "default", {}, () => [
160
- e.icon ? (r(), C(d, {
161
+ m(d.$slots, "default", {}, () => [
162
+ e.icon ? (r(), C(i, {
161
163
  key: 0,
162
164
  id: e.icon,
163
165
  class: "base-button__caption"
164
- }, null, 8, ["id"])) : k("", !0),
165
- b(t) ? (r(), s("span", {
166
+ }, null, 8, ["id"])) : w("", !0),
167
+ p(t) ? (r(), c("span", {
166
168
  key: 1,
167
- class: p(["base-button__caption", { "icon-padding": e.icon }])
168
- }, v(e.caption), 3)) : k("", !0)
169
+ class: b(["base-button__caption", { "icon-padding": e.icon }])
170
+ }, v(e.caption), 3)) : w("", !0)
169
171
  ])
170
172
  ], 10, K);
171
173
  };
@@ -233,22 +235,22 @@ const Q = { class: "input-group form-input__input-group" }, W = ["type", "id", "
233
235
  }
234
236
  },
235
237
  emits: ["update:modelValue"],
236
- setup(e, { emit: i }) {
237
- const t = e, a = h({
238
+ setup(e, { emit: o }) {
239
+ const t = e, d = h({
238
240
  get() {
239
241
  return t.modelValue;
240
242
  },
241
- set(n) {
242
- i("update:modelValue", n);
243
+ set(a) {
244
+ o("update:modelValue", a);
243
245
  }
244
246
  });
245
- return (n, d) => (r(), s("div", {
246
- class: p(["form-input", `form-input--${e.type}`])
247
+ return (a, i) => (r(), c("div", {
248
+ class: b(["form-input", `form-input--${e.type}`])
247
249
  }, [
248
- o("div", Q, [
249
- f(n.$slots, "input-prepend"),
250
- w(o("input", {
251
- "onUpdate:modelValue": d[0] || (d[0] = (l) => q(a) ? a.value = l : null),
250
+ u("div", Q, [
251
+ m(a.$slots, "input-prepend"),
252
+ q(u("input", {
253
+ "onUpdate:modelValue": i[0] || (i[0] = (n) => O(d) ? d.value = n : null),
252
254
  type: e.type === "color" ? "text" : e.type,
253
255
  id: e.id,
254
256
  name: e.name,
@@ -259,17 +261,17 @@ const Q = { class: "input-group form-input__input-group" }, W = ["type", "id", "
259
261
  required: e.required,
260
262
  maxlength: e.maxlength,
261
263
  checked: e.checked,
262
- class: p(["form-control", {
264
+ class: b(["form-control", {
263
265
  "form-check-input": e.type === "checkbox"
264
266
  }]),
265
267
  "aria-label": e.label
266
268
  }, null, 10, W), [
267
- [H, b(a)]
269
+ [H, p(d)]
268
270
  ]),
269
- f(n.$slots, "input-append", {}, () => [
270
- e.type === "color" ? (r(), s("span", Z, [
271
- w(o("input", {
272
- "onUpdate:modelValue": d[1] || (d[1] = (l) => q(a) ? a.value = l : null),
271
+ m(a.$slots, "input-append", {}, () => [
272
+ e.type === "color" ? (r(), c("span", Z, [
273
+ q(u("input", {
274
+ "onUpdate:modelValue": i[1] || (i[1] = (n) => O(d) ? d.value = n : null),
273
275
  type: "color",
274
276
  name: `${e.name}-color`,
275
277
  id: `${e.id}-color`,
@@ -279,15 +281,15 @@ const Q = { class: "input-group form-input__input-group" }, W = ["type", "id", "
279
281
  class: "form-control",
280
282
  "aria-label": e.label
281
283
  }, null, 8, _), [
282
- [U, b(a)]
284
+ [U, p(d)]
283
285
  ])
284
- ])) : k("", !0)
286
+ ])) : w("", !0)
285
287
  ])
286
288
  ]),
287
- f(n.$slots, "label", {}, () => [
288
- o("label", {
289
+ m(a.$slots, "label", {}, () => [
290
+ u("label", {
289
291
  for: e.id,
290
- class: p(["form-input__label", {
292
+ class: b(["form-input__label", {
291
293
  "form-check-label": e.type === "checkbox"
292
294
  }]),
293
295
  innerHTML: `${e.label}${e.required ? " *" : ""}`
@@ -355,19 +357,19 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
355
357
  }
356
358
  },
357
359
  emits: ["update:modelValue"],
358
- setup(e, { emit: i }) {
359
- const t = e, a = h({
360
+ setup(e, { emit: o }) {
361
+ const t = e, d = h({
360
362
  get() {
361
363
  return t.modelValue;
362
364
  },
363
- set(n) {
364
- i("update:modelValue", n);
365
+ set(a) {
366
+ o("update:modelValue", a);
365
367
  }
366
368
  });
367
- return (n, d) => (r(), s("div", te, [
368
- f(n.$slots, "input-prepend"),
369
- w(o("textarea", {
370
- "onUpdate:modelValue": d[0] || (d[0] = (l) => q(a) ? a.value = l : null),
369
+ return (a, i) => (r(), c("div", te, [
370
+ m(a.$slots, "input-prepend"),
371
+ q(u("textarea", {
372
+ "onUpdate:modelValue": i[0] || (i[0] = (n) => O(d) ? d.value = n : null),
371
373
  type: e.type === "color" ? "text" : e.type,
372
374
  id: e.id,
373
375
  name: e.name,
@@ -377,15 +379,15 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
377
379
  "read-only": e.readOnly,
378
380
  required: e.required,
379
381
  maxlength: e.maxlength,
380
- class: p(["form-control", {}]),
382
+ class: b(["form-control", {}]),
381
383
  "aria-label": e.label
382
384
  }, null, 8, le), [
383
- [U, b(a)]
385
+ [U, p(d)]
384
386
  ]),
385
- f(n.$slots, "input-append", {}, () => [
386
- e.type === "color" ? (r(), s("span", ae, [
387
- w(o("input", {
388
- "onUpdate:modelValue": d[1] || (d[1] = (l) => q(a) ? a.value = l : null),
387
+ m(a.$slots, "input-append", {}, () => [
388
+ e.type === "color" ? (r(), c("span", ae, [
389
+ q(u("input", {
390
+ "onUpdate:modelValue": i[1] || (i[1] = (n) => O(d) ? d.value = n : null),
389
391
  type: "color",
390
392
  name: `${e.name}-color`,
391
393
  id: `${e.id}-color`,
@@ -395,14 +397,14 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
395
397
  class: "form-control",
396
398
  "aria-label": e.label
397
399
  }, null, 8, ne), [
398
- [U, b(a)]
400
+ [U, p(d)]
399
401
  ])
400
- ])) : k("", !0)
402
+ ])) : w("", !0)
401
403
  ]),
402
- f(n.$slots, "label", {}, () => [
403
- o("label", {
404
+ m(a.$slots, "label", {}, () => [
405
+ u("label", {
404
406
  for: e.id,
405
- class: p(["form-input__label", {
407
+ class: b(["form-input__label", {
406
408
  "form-check-label": e.type === "checkbox"
407
409
  }]),
408
410
  innerHTML: `${e.label}${e.required ? " *" : ""}`
@@ -450,37 +452,37 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
450
452
  }
451
453
  },
452
454
  emits: ["change", "update:modelValue"],
453
- setup(e, { emit: i }) {
454
- const t = e, a = O([]);
455
- return S(() => t.modelValue, (n, d) => {
456
- a.value = t.options.map(
457
- (l) => l.value ? t.modelValue.some((u) => u["value "] === l.value) : t.modelValue.some((u) => u === l)
455
+ setup(e, { emit: o }) {
456
+ const t = e, d = x([]);
457
+ return $(() => t.modelValue, (a, i) => {
458
+ d.value = t.options.map(
459
+ (n) => n.value ? t.modelValue.some((l) => l["value "] === n.value) : t.modelValue.some((l) => l === n)
458
460
  );
459
- }, { immediate: !0 }), S(a, (n, d) => {
460
- const l = n.reduce((u, c, m) => {
461
- const V = c && t.options[m] ? [t.options[m] || t.options[m]] : [];
462
- return [...u, ...V];
461
+ }, { immediate: !0 }), $(d, (a, i) => {
462
+ const n = a.reduce((l, s, f) => {
463
+ const k = s && t.options[f] ? [t.options[f] || t.options[f]] : [];
464
+ return [...l, ...k];
463
465
  }, []);
464
- i("update:modelValue", l);
466
+ o("update:modelValue", n);
465
467
  }, { deep: !0 }), L(() => {
466
- }), (n, d) => {
467
- const l = $("form-input");
468
- return r(), s("div", ie, [
469
- (r(!0), s(M, null, N(e.options, (u, c) => (r(), C(l, {
470
- key: c,
471
- modelValue: b(a)[c],
472
- "onUpdate:modelValue": (m) => b(a)[c] = m,
468
+ }), (a, i) => {
469
+ const n = S("form-input");
470
+ return r(), c("div", ie, [
471
+ (r(!0), c(M, null, N(e.options, (l, s) => (r(), C(n, {
472
+ key: s,
473
+ modelValue: p(d)[s],
474
+ "onUpdate:modelValue": (f) => p(d)[s] = f,
473
475
  type: "checkbox",
474
476
  name: e.name,
475
- id: `${e.id}-${c}`,
476
- label: `${u.text || u}${e.required ? " *" : ""}`,
477
+ id: `${e.id}-${s}`,
478
+ label: `${l.text || l}${e.required ? " *" : ""}`,
477
479
  disabled: e.disabled,
478
480
  "read-only": e.readOnly,
479
481
  required: e.required
480
482
  }, null, 8, ["modelValue", "onUpdate:modelValue", "name", "id", "label", "disabled", "read-only", "required"]))), 128)),
481
- o("label", { for: e.id }, [
482
- f(n.$slots, "label", {}, () => [
483
- x(v(e.label), 1)
483
+ u("label", { for: e.id }, [
484
+ m(a.$slots, "label", {}, () => [
485
+ V(v(e.label), 1)
484
486
  ])
485
487
  ], 8, oe)
486
488
  ]);
@@ -526,32 +528,32 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
526
528
  }
527
529
  },
528
530
  emits: ["change", "update:modelValue"],
529
- setup(e, { emit: i }) {
531
+ setup(e, { emit: o }) {
530
532
  const t = e;
531
- O(t.options.map((n) => n.value === t.modelValue));
532
- function a(n) {
533
- i("update:modelValue", n);
533
+ x(t.options.map((a) => a.value === t.modelValue));
534
+ function d(a) {
535
+ o("update:modelValue", a);
534
536
  }
535
537
  return L(() => {
536
- }), (n, d) => {
537
- const l = $("form-input");
538
- return r(), s("div", ue, [
539
- (r(!0), s(M, null, N(e.options, (u, c) => (r(), C(l, {
540
- key: c,
538
+ }), (a, i) => {
539
+ const n = S("form-input");
540
+ return r(), c("div", ue, [
541
+ (r(!0), c(M, null, N(e.options, (l, s) => (r(), C(n, {
542
+ key: s,
541
543
  type: "radio",
542
544
  name: e.name,
543
- id: `${e.id}-${c}`,
544
- value: u.value || u,
545
- label: `${u.text || u}${e.required ? " *" : ""}`,
546
- checked: u.value ? u.value === e.modelValue : u === e.modelValue,
545
+ id: `${e.id}-${s}`,
546
+ value: l.value || l,
547
+ label: `${l.text || l}${e.required ? " *" : ""}`,
548
+ checked: l.value ? l.value === e.modelValue : l === e.modelValue,
547
549
  disabled: e.disabled,
548
550
  "read-only": e.readOnly,
549
551
  required: e.required,
550
- onChange: (m) => a(u)
552
+ onChange: (f) => d(l)
551
553
  }, null, 8, ["name", "id", "value", "label", "checked", "disabled", "read-only", "required", "onChange"]))), 128)),
552
- o("label", { for: e.id }, [
553
- f(n.$slots, "label", {}, () => [
554
- x(v(e.label), 1)
554
+ u("label", { for: e.id }, [
555
+ m(a.$slots, "label", {}, () => [
556
+ V(v(e.label), 1)
555
557
  ])
556
558
  ], 8, re)
557
559
  ]);
@@ -617,32 +619,32 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
617
619
  }
618
620
  },
619
621
  emits: ["update:modelValue"],
620
- setup(e, { emit: i }) {
622
+ setup(e, { emit: o }) {
621
623
  const t = e;
622
624
  h({
623
625
  get() {
624
626
  return t.modelValue;
625
627
  },
626
- set(l) {
627
- i("update:modelValue", l);
628
+ set(n) {
629
+ o("update:modelValue", n);
628
630
  }
629
631
  });
630
- function a(l) {
631
- i("update:modelValue", l);
632
+ function d(n) {
633
+ o("update:modelValue", n);
632
634
  }
633
- const n = h(() => [
635
+ const a = h(() => [
634
636
  {
635
637
  text: "Please select"
636
638
  },
637
639
  ...t.options.map(
638
- (l) => typeof l == "string" ? { value: l, text: l } : l
640
+ (n) => typeof n == "string" ? { value: n, text: n } : n
639
641
  )
640
- ]), d = h(() => [...t.options].find((l) => JSON.stringify(l.value) === JSON.stringify(t.modelValue)));
641
- return (l, u) => (r(), s("div", se, [
642
- o("div", ce, [
643
- o("div", fe, [
644
- o("button", {
645
- class: p(["btn dropdown-toggle", {
642
+ ]), i = h(() => [...t.options].find((n) => JSON.stringify(n.value) === JSON.stringify(t.modelValue)));
643
+ return (n, l) => (r(), c("div", se, [
644
+ u("div", ce, [
645
+ u("div", fe, [
646
+ u("button", {
647
+ class: b(["btn dropdown-toggle", {
646
648
  [`btn-${e.variant}`]: e.variant,
647
649
  [`btn-${e.color}`]: e.color,
648
650
  [`btn-${e.disabled}`]: e.disabled,
@@ -653,25 +655,25 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
653
655
  "data-bs-toggle": "dropdown",
654
656
  "aria-expanded": "false",
655
657
  disabled: e.disabled
656
- }, v(b(d) ? b(d).text : e.placeholder), 11, me),
657
- o("ul", {
658
+ }, v(p(i) ? p(i).text : e.placeholder), 11, me),
659
+ u("ul", {
658
660
  class: "dropdown-menu",
659
661
  "aria-labelledby": e.id
660
662
  }, [
661
- (r(!0), s(M, null, N(b(n), (c, m) => (r(), s("li", { key: m }, [
662
- f(l.$slots, "option", {}, () => [
663
- o("a", {
663
+ (r(!0), c(M, null, N(p(a), (s, f) => (r(), c("li", { key: f }, [
664
+ m(n.$slots, "option", {}, () => [
665
+ u("a", {
664
666
  class: "dropdown-item",
665
- onClick: T((V) => a(c.value), ["prevent"])
666
- }, v(c.text), 9, pe)
667
+ onClick: T((k) => d(s.value), ["prevent"])
668
+ }, v(s.text), 9, pe)
667
669
  ])
668
670
  ]))), 128))
669
671
  ], 8, ye)
670
672
  ])
671
673
  ]),
672
- o("label", { for: e.id }, [
673
- f(l.$slots, "label", {}, () => [
674
- x(v(e.label), 1)
674
+ u("label", { for: e.id }, [
675
+ m(n.$slots, "label", {}, () => [
676
+ V(v(e.label), 1)
675
677
  ])
676
678
  ], 8, be)
677
679
  ]));
@@ -728,46 +730,51 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
728
730
  }
729
731
  },
730
732
  emits: ["update:modelValue"],
731
- setup(e, { emit: i }) {
732
- function t(d) {
733
- const l = d.target && d.target.files;
734
- l && (a.splice(0, a.length), Array.from(l).forEach((u) => {
735
- a.push(u);
733
+ setup(e, { emit: o }) {
734
+ const t = e;
735
+ function d(l) {
736
+ const s = l.target && l.target.files;
737
+ s && (i.splice(0, i.length), Array.from(s).forEach((f) => {
738
+ i.push(f);
736
739
  }));
737
740
  }
738
- const a = P([]), n = h(() => a && a.map((d) => d.name));
739
- return h(() => a.map((d) => URL.createObjectURL(d))), S(() => a, (d, l) => {
740
- console.log("file input", d), i("update:modelValue", d);
741
- }, { deep: !0 }), (d, l) => (r(), s("div", {
742
- class: p(["form-input file-input", "file-input--primary"])
741
+ const a = x(), i = P([]), n = h(() => i && i.map((l) => l.name));
742
+ return h(() => i.map((l) => URL.createObjectURL(l))), $(() => t.modelValue, (l, s) => {
743
+ l.length === 0 && (a.value.value = null);
744
+ }, { deep: !0 }), $(() => i, (l, s) => {
745
+ o("update:modelValue", l);
746
+ }, { deep: !0 }), (l, s) => (r(), c("div", {
747
+ class: b(["form-input file-input", "file-input--primary"])
743
748
  }, [
744
- o("input", {
749
+ u("input", {
750
+ ref_key: "input",
751
+ ref: a,
745
752
  type: "file",
746
753
  id: e.id,
747
754
  name: e.name,
748
755
  class: "d-none",
749
- onChange: t,
756
+ onChange: d,
750
757
  multiple: e.multiple,
751
758
  accept: e.accept
752
759
  }, null, 40, ge),
753
- o("div", he, [
754
- f(d.$slots, "input-prepend"),
755
- o("input", {
760
+ u("div", he, [
761
+ m(l.$slots, "input-prepend"),
762
+ u("input", {
756
763
  type: "text",
757
- value: b(n),
764
+ value: p(n),
758
765
  id: e.id,
759
766
  name: e.name,
760
767
  class: "form-control"
761
768
  }, null, 8, ve),
762
- f(d.$slots, "input-append", {}, () => [
763
- o("label", {
769
+ m(l.$slots, "input-append", {}, () => [
770
+ u("label", {
764
771
  for: e.id,
765
772
  class: "btn btn-outline-dark"
766
773
  }, " Select Image ", 8, $e)
767
774
  ])
768
775
  ]),
769
- f(d.$slots, "label", {}, () => [
770
- o("label", {
776
+ m(l.$slots, "label", {}, () => [
777
+ u("label", {
771
778
  for: e.id,
772
779
  class: "form-input__label",
773
780
  innerHTML: `${e.label}${e.required ? " *" : ""}`
@@ -775,11 +782,11 @@ const te = { class: "form-input form-input--textarea" }, le = ["type", "id", "na
775
782
  ])
776
783
  ]));
777
784
  }
778
- }), xe = { class: "media-upload" }, Ve = ["src"], Be = ["onClick"], ke = ["for"];
785
+ }), xe = { class: "media-upload" }, Ve = ["src"], ke = ["onClick"], Be = ["for"];
779
786
  async function we(e) {
780
- return await new Promise((i) => {
787
+ return await new Promise((o) => {
781
788
  let t = new FileReader();
782
- t.onload = () => i(t.result), t.readAsDataURL(e);
789
+ t.onload = () => o(t.result), t.readAsDataURL(e);
783
790
  });
784
791
  }
785
792
  const Pe = /* @__PURE__ */ g({
@@ -838,52 +845,52 @@ const Pe = /* @__PURE__ */ g({
838
845
  }
839
846
  },
840
847
  emits: ["update:modelValue", "update:src"],
841
- setup(e, { emit: i }) {
842
- const t = e, a = O([]), n = O([]), d = h(() => t.modelValue.length ? t.modelValue : t.src ? [{ type: "", src: t.src }] : n.value);
843
- S(() => a, async (u, c) => {
844
- n.value = await Promise.all(
845
- u.value.map(async (m) => ({
846
- src: await we(m),
847
- type: m.type
848
+ setup(e, { emit: o }) {
849
+ const t = e, d = x([]), a = x([]), i = h(() => t.modelValue.length ? t.modelValue : t.src ? [{ type: "", src: t.src }] : a.value);
850
+ $(() => d, async (l, s) => {
851
+ a.value = await Promise.all(
852
+ l.value.map(async (f) => ({
853
+ src: await we(f),
854
+ type: f.type
848
855
  }))
849
856
  );
850
- }, { deep: !0 }), S(() => n, async (u, c) => {
851
- const m = t.multiple ? n.value : [n.value[0]];
852
- i("update:modelValue", m), t.multiple || i("update:src", n.value[0] && n.value[0].src);
857
+ }, { deep: !0 }), $(() => a, async (l, s) => {
858
+ const f = t.multiple ? a.value : a.value[0];
859
+ o("update:modelValue", f), t.multiple || o("update:src", a.value[0] && a.value[0].src);
853
860
  }, { deep: !0 });
854
- function l(u) {
855
- a.value.splice(u, 1);
861
+ function n(l) {
862
+ d.value.splice(l, 1);
856
863
  }
857
- return (u, c) => {
858
- const m = $("svg-icon"), V = $("file-input");
859
- return r(), s("div", xe, [
860
- (r(!0), s(M, null, N(b(d), (B, I) => (r(), s("div", {
864
+ return (l, s) => {
865
+ const f = S("svg-icon"), k = S("file-input");
866
+ return r(), c("div", xe, [
867
+ (r(!0), c(M, null, N(p(i), (B, I) => (r(), c("div", {
861
868
  key: B.src,
862
869
  class: "media-upload__thumbnail"
863
870
  }, [
864
- o("img", {
871
+ u("img", {
865
872
  src: B.src,
866
873
  class: "img-thumbnail rounded"
867
874
  }, null, 8, Ve),
868
- o("button", {
869
- onClick: T((qe) => l(I), ["prevent"]),
875
+ u("button", {
876
+ onClick: T((qe) => n(I), ["prevent"]),
870
877
  class: "btn btn--close"
871
878
  }, [
872
- z(m, { symbol: "x" })
873
- ], 8, Be)
879
+ z(f, { symbol: "x" })
880
+ ], 8, ke)
874
881
  ]))), 128)),
875
- z(V, {
876
- modelValue: a.value,
877
- "onUpdate:modelValue": c[0] || (c[0] = (B) => a.value = B),
882
+ z(k, {
883
+ modelValue: d.value,
884
+ "onUpdate:modelValue": s[0] || (s[0] = (B) => d.value = B),
878
885
  id: e.id,
879
886
  name: e.name,
880
887
  accept: e.accept,
881
888
  class: "d-none"
882
889
  }, null, 8, ["modelValue", "id", "name", "accept"]),
883
- o("label", {
890
+ u("label", {
884
891
  for: e.id,
885
892
  class: "btn btn-outline-dark"
886
- }, " Select Image ", 8, ke)
893
+ }, " Select Image ", 8, Be)
887
894
  ]);
888
895
  };
889
896
  }