ablok-components 0.3.78 → 0.3.80

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,9 +1,20 @@
1
+ import { PropType } from '../../../../vue/dist/vue.esm-bundler.js';
2
+ import { LocalUrlFormat } from '../../../composables/useLocalFileUrl';
1
3
  declare function __VLS_template(): {
2
4
  attrs: Partial<{}>;
3
5
  slots: {
6
+ 'preview-item'?(_: {
7
+ url: {
8
+ type?: string;
9
+ src?: string;
10
+ };
11
+ index: number;
12
+ }): any;
4
13
  button?(_: {}): any;
5
14
  };
6
- refs: {};
15
+ refs: {
16
+ root: HTMLDivElement;
17
+ };
7
18
  rootEl: HTMLDivElement;
8
19
  };
9
20
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
@@ -124,6 +135,10 @@ declare const __VLS_component: import('../../../../vue/dist/vue.esm-bundler.js')
124
135
  type: BooleanConstructor;
125
136
  default: boolean;
126
137
  };
138
+ localUrlFormat: {
139
+ type: PropType<LocalUrlFormat>;
140
+ default: string;
141
+ };
127
142
  }>, {}, {}, {}, {}, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {
128
143
  "update:modelValue": (...args: any[]) => void;
129
144
  "update:src": (...args: any[]) => void;
@@ -244,6 +259,10 @@ declare const __VLS_component: import('../../../../vue/dist/vue.esm-bundler.js')
244
259
  type: BooleanConstructor;
245
260
  default: boolean;
246
261
  };
262
+ localUrlFormat: {
263
+ type: PropType<LocalUrlFormat>;
264
+ default: string;
265
+ };
247
266
  }>> & Readonly<{
248
267
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
249
268
  "onUpdate:src"?: ((...args: any[]) => any) | undefined;
@@ -270,7 +289,10 @@ declare const __VLS_component: import('../../../../vue/dist/vue.esm-bundler.js')
270
289
  enablePreview: boolean;
271
290
  previewWidth: number;
272
291
  dropFiles: boolean;
273
- }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, HTMLDivElement>;
292
+ localUrlFormat: LocalUrlFormat;
293
+ }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {
294
+ root: HTMLDivElement;
295
+ }, HTMLDivElement>;
274
296
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
275
297
  export default _default;
276
298
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,13 +1,16 @@
1
- import { defineComponent as C, watch as y, openBlock as a, createElementBlock as n, normalizeClass as b, unref as i, Fragment as g, renderList as U, createElementVNode as o, withModifiers as v, createVNode as u, isRef as z, renderSlot as D, Transition as N, withCtx as P, createCommentVNode as T } from "vue";
2
- import h from "../../atoms/svg-icon/svg-icon.vue.js";
1
+ import { defineComponent as L, ref as f, toRef as N, computed as P, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as y, Fragment as V, renderList as T, renderSlot as S, createElementVNode as c, withModifiers as w, createVNode as p, Transition as M, withCtx as H, createCommentVNode as W } from "vue";
2
+ import k from "../../atoms/svg-icon/svg-icon.vue.js";
3
3
  /* empty css */
4
- import L from "../../atoms/input-file/input-file.vue.js";
5
- import { useFileUpload as x } from "../../../composables/useFileUpload.js";
6
- import { fileToDataUrl as M, uniqueId as S } from "../../../utilities/helpers.js";
7
- const W = ["src"], _ = ["onClick"], q = ["onClick"], E = ["for"], H = ["innerHTML"], R = {
4
+ import q from "../../atoms/input-file/input-file.vue.js";
5
+ import { useDragAndDrop as E } from "../../../composables/useDragAndDrop.js";
6
+ import { useUploadTransport as I } from "../../../composables/useUploadTransport.js";
7
+ import { useLocalFileUrl as R } from "../../../composables/useLocalFileUrl.js";
8
+ import { sanitizeHtml as O } from "../../../composables/useSanitize.js";
9
+ import { uniqueId as F } from "../../../utilities/helpers.js";
10
+ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTML"], K = {
8
11
  key: 0,
9
12
  class: "file-upload__loading-spinner"
10
- }, K = /* @__PURE__ */ C({
13
+ }, ne = /* @__PURE__ */ L({
11
14
  __name: "file-upload",
12
15
  props: {
13
16
  modelValue: {
@@ -19,11 +22,11 @@ const W = ["src"], _ = ["onClick"], q = ["onClick"], E = ["for"], H = ["innerHTM
19
22
  },
20
23
  name: {
21
24
  type: String,
22
- default: () => S()
25
+ default: () => F()
23
26
  },
24
27
  id: {
25
28
  type: String,
26
- default: () => S()
29
+ default: () => F()
27
30
  },
28
31
  label: {
29
32
  type: String,
@@ -92,86 +95,116 @@ const W = ["src"], _ = ["onClick"], q = ["onClick"], E = ["for"], H = ["innerHTM
92
95
  dropFiles: {
93
96
  type: Boolean,
94
97
  default: !1
98
+ },
99
+ localUrlFormat: {
100
+ type: String,
101
+ default: "dataUrl"
95
102
  }
96
103
  },
97
104
  emits: ["update:modelValue", "update:src"],
98
- setup(e, { emit: w }) {
99
- const s = e, m = w, { pending: k, files: r, dataUrls: c, isDragging: F, thumbnails: B, uploadFile: V, removeFile: p } = x(s, m);
100
- return y(() => r.value, async (l) => {
101
- c.value = await Promise.all(
102
- l.map(async (t) => ({
103
- src: s.toDataUrl ? await M(t) : await V(t),
104
- type: t.type
105
+ setup(a, { emit: U }) {
106
+ const e = a, i = U, v = f(), m = f([]), n = f([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: C } = R(N(e, "localUrlFormat")), { isDragging: z } = E(v, {
107
+ enabled: () => e.dropFiles,
108
+ onDrop: (t) => {
109
+ m.value = t;
110
+ }
111
+ }), A = P(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : n.value);
112
+ function g(t) {
113
+ const l = typeof t == "string" ? parseInt(t, 10) : t, o = Array.isArray(e.modelValue) && e.modelValue.length > 0, r = Array.isArray(n.value) && n.value.length > 0;
114
+ if (r && l < n.value.length && (C(n.value[l]?.src), n.value.splice(l, 1)), o) {
115
+ const s = [...e.modelValue];
116
+ l < s.length && s.splice(l, 1), i("update:modelValue", s), e.multiple || i("update:src", s[0]?.src || "");
117
+ } else if (r) {
118
+ const s = e.multiple ? n.value : n.value[0];
119
+ i("update:modelValue", s), e.multiple || i("update:src", n.value[0]?.src || "");
120
+ } else
121
+ i("update:modelValue", e.multiple ? [] : void 0), i("update:src", "");
122
+ m.value.splice(l, 1);
123
+ }
124
+ return b(() => m.value, async (t) => {
125
+ const l = await Promise.all(
126
+ t.map(async (o) => ({
127
+ src: e.toDataUrl ? await D(o) : await B(o),
128
+ type: o.type
105
129
  }))
106
130
  );
107
- }, { deep: !0 }), y(() => c.value, async (l) => {
108
- const t = s.multiple ? l : l[0];
109
- m("update:modelValue", t), s.multiple || m("update:src", l[0] && l[0].src);
110
- }, { deep: !0 }), (l, t) => (a(), n("div", {
111
- class: b(["file-upload", {
112
- "has-dragging": e.dropFiles,
113
- "is-dragging": i(F)
131
+ n.value = l.filter((o) => o !== null);
132
+ }, { deep: !0 }), b(() => n.value, async (t) => {
133
+ const l = e.multiple ? t : t[0];
134
+ i("update:modelValue", l), e.multiple || i("update:src", t[0] && t[0].src);
135
+ }, { deep: !0 }), (t, l) => (u(), d("div", {
136
+ ref_key: "root",
137
+ ref: v,
138
+ class: h(["file-upload", {
139
+ "has-dragging": a.dropFiles,
140
+ "is-dragging": y(z)
114
141
  }])
115
142
  }, [
116
- (a(!0), n(g, null, U(i(B), (d, f) => (a(), n("div", {
117
- key: d.src,
118
- class: b(e.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
143
+ (u(!0), d(V, null, T(A.value, (o, r) => (u(), d("div", {
144
+ key: o.src,
145
+ class: h(a.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
119
146
  }, [
120
- e.enablePreview ? (a(), n(g, { key: 0 }, [
121
- o("img", {
122
- src: `${d.src}${e.previewWidth ? `?width=${e.previewWidth}` : ""}`,
123
- class: "img-thumbnail rounded"
124
- }, null, 8, W),
125
- o("button", {
126
- onClick: v(($) => i(p)(f), ["prevent"]),
127
- class: "btn btn--close"
147
+ S(t.$slots, "preview-item", {
148
+ url: o,
149
+ index: r
150
+ }, () => [
151
+ a.enablePreview ? (u(), d(V, { key: 0 }, [
152
+ c("img", {
153
+ src: `${o.src}${a.previewWidth ? `?width=${a.previewWidth}` : ""}`,
154
+ class: "img-thumbnail rounded"
155
+ }, null, 8, _),
156
+ c("button", {
157
+ onClick: w((s) => g(r), ["prevent"]),
158
+ class: "btn btn--close"
159
+ }, [
160
+ p(k, { symbol: "x" })
161
+ ], 8, j)
162
+ ], 64)) : (u(), d("button", {
163
+ key: 1,
164
+ onClick: w((s) => g(r), ["prevent"]),
165
+ class: "btn btn--close btn-outline-contrast"
128
166
  }, [
129
- u(h, { symbol: "x" })
130
- ], 8, _)
131
- ], 64)) : (a(), n("button", {
132
- key: 1,
133
- onClick: v(($) => i(p)(f), ["prevent"]),
134
- class: "btn btn--close btn-outline-contrast"
135
- }, [
136
- u(h, { symbol: "x" })
137
- ], 8, q))
167
+ p(k, { symbol: "x" })
168
+ ], 8, x))
169
+ ])
138
170
  ], 2))), 128)),
139
- u(L, {
140
- modelValue: i(r),
141
- "onUpdate:modelValue": t[0] || (t[0] = (d) => z(r) ? r.value = d : null),
142
- id: e.id,
143
- name: e.name,
144
- accept: e.accept,
145
- "max-file-size": e.maxFileSize,
171
+ p(q, {
172
+ modelValue: m.value,
173
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => m.value = o),
174
+ id: a.id,
175
+ name: a.name,
176
+ accept: a.accept,
177
+ "max-file-size": a.maxFileSize,
178
+ multiple: a.multiple,
146
179
  class: "d-none"
147
- }, null, 8, ["modelValue", "id", "name", "accept", "max-file-size"]),
148
- o("label", {
149
- for: e.id,
180
+ }, null, 8, ["modelValue", "id", "name", "accept", "max-file-size", "multiple"]),
181
+ c("label", {
182
+ for: a.id,
150
183
  class: "file-upload__label"
151
184
  }, [
152
- D(l.$slots, "button", {}, () => [
153
- o("span", {
185
+ S(t.$slots, "button", {}, () => [
186
+ c("span", {
154
187
  class: "btn btn-outline-contrast",
155
- innerHTML: e.label || l.$t("common.selectFile")
156
- }, null, 8, H)
188
+ innerHTML: y(O)(a.label || t.$t("common.selectFile"))
189
+ }, null, 8, J)
157
190
  ]),
158
- u(N, { name: "fade" }, {
159
- default: P(() => [
160
- i(k) ? (a(), n("span", R, [...t[1] || (t[1] = [
161
- o("span", {
191
+ p(M, { name: "fade" }, {
192
+ default: H(() => [
193
+ y($) ? (u(), d("span", K, [...l[1] || (l[1] = [
194
+ c("span", {
162
195
  class: "spinner-border",
163
196
  role: "status"
164
197
  }, [
165
- o("span", { class: "visually-hidden" }, "Loading...")
198
+ c("span", { class: "visually-hidden" }, "Loading...")
166
199
  ], -1)
167
- ])])) : T("", !0)
200
+ ])])) : W("", !0)
168
201
  ]),
169
202
  _: 1
170
203
  })
171
- ], 8, E)
204
+ ], 8, G)
172
205
  ], 2));
173
206
  }
174
207
  });
175
208
  export {
176
- K as default
209
+ ne as default
177
210
  };
@@ -1,10 +1,14 @@
1
+ import { PropType } from '../../../../vue/dist/vue.esm-bundler.js';
2
+ import { LocalUrlFormat } from '../../../composables/useLocalFileUrl';
1
3
  import { IMediaObject } from '../../../types/media';
2
4
  declare function __VLS_template(): {
3
5
  attrs: Partial<{}>;
4
6
  slots: {
5
7
  button?(_: {}): any;
6
8
  };
7
- refs: {};
9
+ refs: {
10
+ root: HTMLDivElement;
11
+ };
8
12
  rootEl: HTMLDivElement;
9
13
  };
10
14
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
@@ -98,6 +102,10 @@ declare const __VLS_component: import('../../../../vue/dist/vue.esm-bundler.js')
98
102
  default: number;
99
103
  };
100
104
  aspectRatio: NumberConstructor;
105
+ localUrlFormat: {
106
+ type: PropType<LocalUrlFormat>;
107
+ default: string;
108
+ };
101
109
  }>, {}, {}, {}, {}, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {
102
110
  "update:modelValue": (...args: any[]) => void;
103
111
  "update:src": (...args: any[]) => void;
@@ -191,6 +199,10 @@ declare const __VLS_component: import('../../../../vue/dist/vue.esm-bundler.js')
191
199
  default: number;
192
200
  };
193
201
  aspectRatio: NumberConstructor;
202
+ localUrlFormat: {
203
+ type: PropType<LocalUrlFormat>;
204
+ default: string;
205
+ };
194
206
  }>> & Readonly<{
195
207
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
196
208
  "onUpdate:src"?: ((...args: any[]) => any) | undefined;
@@ -214,9 +226,12 @@ declare const __VLS_component: import('../../../../vue/dist/vue.esm-bundler.js')
214
226
  enablePreview: boolean;
215
227
  previewWidth: number;
216
228
  dropFiles: boolean;
229
+ localUrlFormat: LocalUrlFormat;
217
230
  enableReview: boolean;
218
231
  maxImageWidth: number;
219
- }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, HTMLDivElement>;
232
+ }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {
233
+ root: HTMLDivElement;
234
+ }, HTMLDivElement>;
220
235
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
221
236
  export default _default;
222
237
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,21 +1,24 @@
1
- import { defineComponent as L, ref as b, computed as P, watch as v, onMounted as Q, onBeforeUnmount as q, openBlock as s, createElementBlock as m, normalizeClass as U, unref as g, Fragment as A, createVNode as r, normalizeStyle as E, isRef as D, createElementVNode as o, withModifiers as w, createCommentVNode as h, renderSlot as H, Transition as O, withCtx as $, createBlock as j, toDisplayString as G } from "vue";
2
- import J from "../image-crop-resize/image-crop-resize.vue.js";
3
- import K from "../../atoms/base-image/base-image.vue.js";
1
+ import { defineComponent as P, ref as u, toRef as Q, computed as H, watch as v, onBeforeUnmount as O, openBlock as s, createElementBlock as p, normalizeClass as C, unref as $, Fragment as q, createVNode as d, normalizeStyle as E, createElementVNode as n, withModifiers as h, createCommentVNode as V, renderSlot as j, Transition as A, withCtx as B, createBlock as G, toDisplayString as J } from "vue";
2
+ import K from "../image-crop-resize/image-crop-resize.vue.js";
3
+ import X from "../../atoms/base-image/base-image.vue.js";
4
4
  /* empty css */
5
- import k from "../../atoms/svg-icon/svg-icon.vue.js";
5
+ import z from "../../atoms/svg-icon/svg-icon.vue.js";
6
6
  /* empty css */
7
- import X from "../../atoms/input-file/input-file.vue.js";
8
- import Y from "../../templates/modal-dialog/modal-dialog.vue.js";
7
+ import Y from "../../atoms/input-file/input-file.vue.js";
8
+ import Z from "../../templates/modal-dialog/modal-dialog.vue.js";
9
9
  /* empty css */
10
- import { useFileUpload as Z } from "../../../composables/useFileUpload.js";
11
- import { resizeImageFileByMaxWidth as _, fileToDataUrl as R, uniqueId as W, srcToFile as ee } from "../../../utilities/helpers.js";
12
- const te = { class: "image-upload__controls" }, ae = { class: "d-flex gap-1 align-items-center" }, le = {
10
+ import { useDragAndDrop as _ } from "../../../composables/useDragAndDrop.js";
11
+ import { useUploadTransport as ee } from "../../../composables/useUploadTransport.js";
12
+ import { useLocalFileUrl as te } from "../../../composables/useLocalFileUrl.js";
13
+ import { sanitizeHtml as ae } from "../../../composables/useSanitize.js";
14
+ import { resizeImageFileByMaxWidth as le, uniqueId as N, srcToFile as oe } from "../../../utilities/helpers.js";
15
+ const ie = { class: "image-upload__controls" }, ne = { class: "d-flex gap-1 align-items-center" }, re = {
13
16
  key: 1,
14
17
  class: "image-upload__controls"
15
- }, ne = ["for"], ie = ["innerHTML"], oe = {
18
+ }, ue = ["for"], se = ["innerHTML"], de = {
16
19
  key: 0,
17
20
  class: "image-upload__loading-spinner"
18
- }, ge = /* @__PURE__ */ L({
21
+ }, ke = /* @__PURE__ */ P({
19
22
  __name: "image-upload",
20
23
  props: {
21
24
  modelValue: {
@@ -27,11 +30,11 @@ const te = { class: "image-upload__controls" }, ae = { class: "d-flex gap-1 alig
27
30
  },
28
31
  name: {
29
32
  type: String,
30
- default: () => W()
33
+ default: () => N()
31
34
  },
32
35
  id: {
33
36
  type: String,
34
- default: () => W()
37
+ default: () => N()
35
38
  },
36
39
  label: {
37
40
  type: String,
@@ -106,163 +109,175 @@ const te = { class: "image-upload__controls" }, ae = { class: "d-flex gap-1 alig
106
109
  type: Number,
107
110
  default: 4096
108
111
  },
109
- aspectRatio: Number
112
+ aspectRatio: Number,
113
+ localUrlFormat: {
114
+ type: String,
115
+ default: "dataUrl"
116
+ }
110
117
  },
111
118
  emits: ["update:modelValue", "update:src"],
112
- setup(a, { emit: z }) {
113
- const i = a, p = z, u = b(!1), d = b(null), l = b(null), V = b(null), {
114
- pending: C,
115
- files: f,
116
- // dataUrls,
117
- imgLoaded: c,
118
- isDragging: N,
119
- uploadFile: F,
120
- setupDragAndDrop: T,
121
- cleanupDragAndDrop: x
122
- } = Z(i, p), y = P(() => i.modelValue ? i.modelValue : i.src ? { type: "", src: i.src } : d.value);
123
- function S() {
124
- d.value = null, f.value = [], c.value = !1, p("update:modelValue", void 0), p("update:src", "");
119
+ setup(a, { emit: T }) {
120
+ const o = a, y = T, D = u(), f = u([]), b = u(!1), r = u(!1), m = u(null), l = u(null), F = u(null);
121
+ let c = !1;
122
+ const { pending: L, uploadFile: R } = ee(o), { toLocalUrl: S, revoke: g } = te(Q(o, "localUrlFormat")), { isDragging: x } = _(D, {
123
+ enabled: () => o.dropFiles,
124
+ onDrop: (t) => {
125
+ f.value = t;
126
+ }
127
+ }), w = H(() => o.modelValue ? o.modelValue : o.src ? { type: "", src: o.src } : m.value);
128
+ function U(t) {
129
+ g(m.value?.src), m.value = t;
130
+ }
131
+ function k() {
132
+ U(null), f.value = [], b.value = !1, y("update:modelValue", void 0), y("update:src", "");
125
133
  }
126
- function B() {
127
- S();
134
+ function W() {
135
+ k();
128
136
  }
129
137
  v(() => f.value, async (t) => {
130
138
  if (!t || !t.length || !t[0]) return;
131
- c.value = !1;
132
- const e = await _(t[0], i.maxImageWidth);
133
- i.enableReview ? (l.value = {
134
- src: await R(e),
139
+ b.value = !1;
140
+ const e = await le(t[0], o.maxImageWidth);
141
+ o.enableReview ? (l.value = {
142
+ src: await S(e),
135
143
  type: e.type
136
- }, u.value = !0) : d.value = {
137
- src: i.toDataUrl ? await R(e) : await F(e),
144
+ }, c = !0, r.value = !0) : U({
145
+ src: o.toDataUrl ? await S(e) : await R(e),
138
146
  type: e.type
139
- };
140
- }), v(() => d.value, (t) => {
141
- p("update:modelValue", t || void 0), p("update:src", t?.src || "");
142
- }), v(() => V.value, async (t) => {
143
- t && (d.value = {
144
- src: await F(t),
145
- type: t.type
146
- }, V.value = null);
147
- }), v(() => u.value, (t, e) => {
148
- !t && e && l.value && (l.value = null, B());
149
- }), v(() => i.src, (t) => {
150
- !t && d.value && B();
147
+ });
148
+ }), v(() => m.value, (t) => {
149
+ y("update:modelValue", t || void 0), y("update:src", t?.src || "");
150
+ }), v(() => F.value, async (t) => {
151
+ if (t) {
152
+ try {
153
+ U({
154
+ src: o.toDataUrl ? await S(t) : await R(t),
155
+ type: t.type
156
+ });
157
+ } catch (e) {
158
+ console.error(`Failed to process file "${t.name}"`, e);
159
+ }
160
+ F.value = null;
161
+ }
162
+ }), v(() => r.value, (t, e) => {
163
+ !t && e && l.value && (c && g(l.value.src), c = !1, l.value = null, W());
164
+ }), v(() => o.src, (t) => {
165
+ !t && m.value && W();
151
166
  });
152
- function M(t, e) {
153
- l.value = { src: t, type: e }, u.value = !0;
167
+ function I(t, e) {
168
+ c = !1, l.value = { src: t, type: e }, r.value = !0;
154
169
  }
155
- async function I() {
156
- l.value && (V.value = await ee(
170
+ async function M() {
171
+ l.value && (F.value = await oe(
157
172
  l.value.src,
158
173
  "file",
159
174
  l.value.type
160
- )), l.value = null, u.value = !1;
175
+ ), c && g(l.value.src)), c = !1, l.value = null, r.value = !1;
161
176
  }
162
- return Q(() => {
163
- T();
164
- }), q(() => {
165
- x();
166
- }), (t, e) => (s(), m("div", {
167
- class: U(["image-upload", {
177
+ return O(() => {
178
+ g(m.value?.src);
179
+ }), (t, e) => (s(), p("div", {
180
+ ref_key: "root",
181
+ ref: D,
182
+ class: C(["image-upload", {
168
183
  "has-dragging": a.dropFiles,
169
- "is-dragging": g(N)
184
+ "is-dragging": $(x)
170
185
  }])
171
186
  }, [
172
- !u.value && y.value ? (s(), m("div", {
187
+ !r.value && w.value ? (s(), p("div", {
173
188
  key: 0,
174
- class: U(["mb-2", a.enablePreview ? "image-upload__thumbnail" : "image-upload__reset"])
189
+ class: C(["mb-2", a.enablePreview ? "image-upload__thumbnail" : "image-upload__reset"])
175
190
  }, [
176
- a.enablePreview ? (s(), m(A, { key: 0 }, [
177
- r(K, {
178
- src: `${y.value.src}${a.previewWidth ? `?width=${a.previewWidth}` : ""}`,
191
+ a.enablePreview ? (s(), p(q, { key: 0 }, [
192
+ d(X, {
193
+ src: `${w.value.src}${a.previewWidth ? `?width=${a.previewWidth}` : ""}`,
179
194
  class: "img-thumbnail rounded",
180
- ready: g(c),
181
- "onUpdate:ready": e[0] || (e[0] = (n) => D(c) ? c.value = n : null),
195
+ ready: b.value,
196
+ "onUpdate:ready": e[0] || (e[0] = (i) => b.value = i),
182
197
  animate: !1,
183
198
  style: E({ maxWidth: a.previewWidth ? `${a.previewWidth}px` : "auto", height: "auto" })
184
199
  }, null, 8, ["src", "ready", "style"]),
185
- o("div", te, [
186
- o("div", ae, [
187
- o("button", {
200
+ n("div", ie, [
201
+ n("div", ne, [
202
+ n("button", {
188
203
  type: "button",
189
- onClick: e[1] || (e[1] = w((n) => M(y.value.src, y.value.type), ["prevent", "stop"])),
204
+ onClick: e[1] || (e[1] = h((i) => I(w.value.src, w.value.type), ["prevent", "stop"])),
190
205
  class: "btn btn--edit btn-sm btn-light"
191
206
  }, [
192
- r(k, { symbol: "edit-2" })
207
+ d(z, { symbol: "edit-2" })
193
208
  ]),
194
- o("button", {
209
+ n("button", {
195
210
  type: "button",
196
- onClick: e[2] || (e[2] = w((n) => S(), ["prevent", "stop"])),
211
+ onClick: e[2] || (e[2] = h((i) => k(), ["prevent", "stop"])),
197
212
  class: "btn btn--close btn-sm btn-light"
198
213
  }, [
199
- r(k, { symbol: "x" })
214
+ d(z, { symbol: "x" })
200
215
  ])
201
216
  ])
202
217
  ])
203
- ], 64)) : (s(), m("div", le, [
204
- o("button", {
205
- onClick: e[3] || (e[3] = w((n) => S(), ["prevent", "stop"])),
218
+ ], 64)) : (s(), p("div", re, [
219
+ n("button", {
220
+ onClick: e[3] || (e[3] = h((i) => k(), ["prevent", "stop"])),
206
221
  class: "btn btn--close btn-outline-contrast"
207
222
  }, [
208
- r(k, { symbol: "x" })
223
+ d(z, { symbol: "x" })
209
224
  ])
210
225
  ]))
211
- ], 2)) : h("", !0),
212
- r(X, {
213
- modelValue: g(f),
214
- "onUpdate:modelValue": e[4] || (e[4] = (n) => D(f) ? f.value = n : null),
226
+ ], 2)) : V("", !0),
227
+ d(Y, {
228
+ modelValue: f.value,
229
+ "onUpdate:modelValue": e[4] || (e[4] = (i) => f.value = i),
215
230
  id: a.id,
216
231
  name: a.name,
217
232
  accept: a.accept,
218
233
  "max-file-size": a.maxFileSize,
219
234
  class: "d-none"
220
235
  }, null, 8, ["modelValue", "id", "name", "accept", "max-file-size"]),
221
- a.src ? h("", !0) : (s(), m("label", {
236
+ a.src ? V("", !0) : (s(), p("label", {
222
237
  key: 1,
223
238
  for: a.id,
224
239
  class: "image-upload__label"
225
240
  }, [
226
- H(t.$slots, "button", {}, () => [
227
- o("span", {
241
+ j(t.$slots, "button", {}, () => [
242
+ n("span", {
228
243
  class: "btn btn-outline-contrast",
229
- innerHTML: a.label || t.$t("common.selectFile")
230
- }, null, 8, ie)
244
+ innerHTML: $(ae)(a.label || t.$t("common.selectFile"))
245
+ }, null, 8, se)
231
246
  ]),
232
- r(O, { name: "fade" }, {
233
- default: $(() => [
234
- g(C) ? (s(), m("span", oe, [...e[7] || (e[7] = [
235
- o("span", {
247
+ d(A, { name: "fade" }, {
248
+ default: B(() => [
249
+ $(L) ? (s(), p("span", de, [...e[7] || (e[7] = [
250
+ n("span", {
236
251
  class: "spinner-border",
237
252
  role: "status"
238
253
  }, [
239
- o("span", { class: "visually-hidden" }, "Loading...")
254
+ n("span", { class: "visually-hidden" }, "Loading...")
240
255
  ], -1)
241
- ])])) : h("", !0)
256
+ ])])) : V("", !0)
242
257
  ]),
243
258
  _: 1
244
259
  })
245
- ], 8, ne)),
246
- r(Y, {
247
- modelValue: u.value,
248
- "onUpdate:modelValue": e[6] || (e[6] = (n) => u.value = n),
260
+ ], 8, ue)),
261
+ d(Z, {
262
+ modelValue: r.value,
263
+ "onUpdate:modelValue": e[6] || (e[6] = (i) => r.value = i),
249
264
  footer: !1
250
265
  }, {
251
- default: $(() => [
252
- u.value && l.value ? (s(), j(J, {
266
+ default: B(() => [
267
+ r.value && l.value ? (s(), G(K, {
253
268
  key: 0,
254
269
  modelValue: l.value.src,
255
- "onUpdate:modelValue": e[5] || (e[5] = (n) => l.value.src = n),
270
+ "onUpdate:modelValue": e[5] || (e[5] = (i) => l.value.src = i),
256
271
  "aspect-ratio": a.aspectRatio
257
272
  }, {
258
- submit: $(() => [
259
- o("button", {
273
+ submit: B(() => [
274
+ n("button", {
260
275
  class: "btn btn-primary",
261
- onClick: w(I, ["prevent", "stop"])
262
- }, G(t.$t("common.save")), 1)
276
+ onClick: h(M, ["prevent", "stop"])
277
+ }, J(t.$t("common.save")), 1)
263
278
  ]),
264
279
  _: 1
265
- }, 8, ["modelValue", "aspect-ratio"])) : h("", !0)
280
+ }, 8, ["modelValue", "aspect-ratio"])) : V("", !0)
266
281
  ]),
267
282
  _: 1
268
283
  }, 8, ["modelValue"])
@@ -270,5 +285,5 @@ const te = { class: "image-upload__controls" }, ae = { class: "d-flex gap-1 alig
270
285
  }
271
286
  });
272
287
  export {
273
- ge as default
288
+ ke as default
274
289
  };