@schwarzdavid/ui-kit 0.0.1-alpha.1 → 0.0.1-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js ADDED
@@ -0,0 +1,869 @@
1
+ import { getCurrentInstance as ge, inject as ye, readonly as Z, markRaw as oe, defineComponent as k, createElementBlock as U, openBlock as m, Fragment as M, renderList as J, unref as l, createBlock as p, resolveDynamicComponent as F, mergeProps as $, ref as E, computed as y, onMounted as Ce, createSlots as Te, withCtx as d, toDisplayString as G, createVNode as s, TransitionGroup as we, normalizeClass as le, isRef as xe, createTextVNode as te, createElementVNode as N, createCommentVNode as S, normalizeProps as re, toValue as ne, useTemplateRef as De } from "vue";
2
+ import { VAlert as Ve, VIcon as Ie, VOverlay as Ae, VProgressCircular as Re, VDialog as K, VCard as z, VCardTitle as ue, VBtn as A, VCardText as se, VCardActions as q, VToolbar as ce, VToolbarTitle as ie, VSpacer as B, VDivider as de, VDefaultsProvider as he } from "vuetify/components";
3
+ import { useI18n as me } from "vue-i18n";
4
+ import { useDisplay as fe } from "vuetify";
5
+ import { merge as Q } from "lodash";
6
+ import Ee from "@vuelidate/core";
7
+ const g = [];
8
+ for (let e = 0; e < 256; ++e)
9
+ g.push((e + 256).toString(16).slice(1));
10
+ function be(e, a = 0) {
11
+ return (g[e[a + 0]] + g[e[a + 1]] + g[e[a + 2]] + g[e[a + 3]] + "-" + g[e[a + 4]] + g[e[a + 5]] + "-" + g[e[a + 6]] + g[e[a + 7]] + "-" + g[e[a + 8]] + g[e[a + 9]] + "-" + g[e[a + 10]] + g[e[a + 11]] + g[e[a + 12]] + g[e[a + 13]] + g[e[a + 14]] + g[e[a + 15]]).toLowerCase();
12
+ }
13
+ let Y;
14
+ const ke = new Uint8Array(16);
15
+ function Oe() {
16
+ if (!Y) {
17
+ if (typeof crypto > "u" || !crypto.getRandomValues)
18
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
19
+ Y = crypto.getRandomValues.bind(crypto);
20
+ }
21
+ return Y(ke);
22
+ }
23
+ const Ue = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ae = { randomUUID: Ue };
24
+ function ve(e, a, t) {
25
+ var o;
26
+ if (ae.randomUUID && !e)
27
+ return ae.randomUUID();
28
+ e = e || {};
29
+ const r = e.random ?? ((o = e.rng) == null ? void 0 : o.call(e)) ?? Oe();
30
+ if (r.length < 16)
31
+ throw new Error("Random bytes length must be >= 16");
32
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, be(r);
33
+ }
34
+ var X = /* @__PURE__ */ ((e) => (e.NOT_INSTALLED = "Need to install with `app.use` function", e.UNEXPECTED_ERROR = "Unexpected error", e))(X || {});
35
+ function j() {
36
+ const e = ge();
37
+ if (!(e != null && e.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__))
38
+ throw new Error(X.NOT_INSTALLED);
39
+ const a = e.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__, t = ye(a);
40
+ if (!t)
41
+ throw new Error(X.UNEXPECTED_ERROR);
42
+ return t;
43
+ }
44
+ function pe() {
45
+ const { dialogQueue: e } = j();
46
+ function a() {
47
+ let o;
48
+ for (; ; )
49
+ if (o = ve(), !e.value.some((u) => u.id === o))
50
+ return o;
51
+ }
52
+ function t(o) {
53
+ const u = a(), i = oe({ ...o, id: u, resolve: (f) => {
54
+ r(u), o.resolve(f);
55
+ }, reject: (f) => {
56
+ r(u), o.reject(f);
57
+ } });
58
+ return e.value.push(i), i;
59
+ }
60
+ function r(o) {
61
+ const u = typeof o == "string" ? o : o.id, c = e.value.findIndex((n) => n.id === u);
62
+ c >= 0 && e.value.splice(c, 1);
63
+ }
64
+ return {
65
+ queue: Z(e),
66
+ addToQueue: t,
67
+ removeFromQueue: r
68
+ };
69
+ }
70
+ const Le = /* @__PURE__ */ k({
71
+ __name: "DialogOutlet",
72
+ setup(e) {
73
+ const { queue: a } = pe();
74
+ return (t, r) => (m(!0), U(M, null, J(l(a), (o) => (m(), p(F(o.component), $({
75
+ key: o.id,
76
+ ref_for: !0
77
+ }, o.props, {
78
+ onResolve: o.resolve,
79
+ onReject: o.reject
80
+ }), null, 16, ["onResolve", "onReject"]))), 128));
81
+ }
82
+ });
83
+ function ee() {
84
+ const { toastQueue: e } = j();
85
+ function a() {
86
+ let o;
87
+ for (; ; )
88
+ if (o = ve(), !e.value.some((u) => u.id === o))
89
+ return o;
90
+ }
91
+ function t(o) {
92
+ const u = a(), n = oe({ ...o, id: u, resolve: () => {
93
+ r(u), o.resolve();
94
+ } });
95
+ return e.value.unshift(n), n;
96
+ }
97
+ function r(o) {
98
+ const u = typeof o == "string" ? o : o.id, c = e.value.findIndex((n) => n.id === u);
99
+ c >= 0 && e.value.splice(c, 1);
100
+ }
101
+ return {
102
+ queue: Z(e),
103
+ addToQueue: t,
104
+ removeFromQueue: r
105
+ };
106
+ }
107
+ var x = /* @__PURE__ */ ((e) => (e.SUCCESS = "success", e.INFO = "info", e.WARNING = "warning", e.ERROR = "error", e))(x || {});
108
+ const Se = { key: 0 }, je = { key: 1 }, Me = /* @__PURE__ */ k({
109
+ __name: "ToastEntry",
110
+ props: {
111
+ entry: {}
112
+ },
113
+ setup(e) {
114
+ const a = {
115
+ [x.ERROR]: "mdi-alert-circle-outline",
116
+ [x.SUCCESS]: "mdi-check-circle-outline",
117
+ [x.INFO]: "mdi-information-outline",
118
+ [x.WARNING]: "mdi-alert-circle-outline"
119
+ }, t = {
120
+ [x.ERROR]: "error",
121
+ [x.SUCCESS]: "success",
122
+ [x.INFO]: "primary",
123
+ [x.WARNING]: "warning"
124
+ }, r = e, o = ee(), u = E(-1), c = y(() => a[r.entry.type]), n = y(() => t[r.entry.type]), { t: i } = me({ useScope: "global" });
125
+ function f() {
126
+ window.clearTimeout(u.value), o.removeFromQueue(r.entry.id);
127
+ }
128
+ return Ce(() => {
129
+ u.value = window.setTimeout(() => {
130
+ f();
131
+ }, r.entry.timeout);
132
+ }), (_, D) => (m(), p(l(Ve), {
133
+ theme: "dark",
134
+ class: "toast-entry",
135
+ closable: "",
136
+ "onClick:close": f,
137
+ density: "compact"
138
+ }, Te({
139
+ default: d(() => [
140
+ _.entry.translateMessage ? (m(), U("span", Se, G(l(i)(_.entry.message)), 1)) : (m(), U("span", je, G(_.entry.message), 1))
141
+ ]),
142
+ _: 2
143
+ }, [
144
+ c.value ? {
145
+ name: "prepend",
146
+ fn: d(() => [
147
+ s(l(Ie), {
148
+ icon: c.value,
149
+ color: n.value
150
+ }, null, 8, ["icon", "color"])
151
+ ]),
152
+ key: "0"
153
+ } : void 0
154
+ ]), 1024));
155
+ }
156
+ }), W = (e, a) => {
157
+ const t = e.__vccOpts || e;
158
+ for (const [r, o] of a)
159
+ t[r] = o;
160
+ return t;
161
+ }, Pe = /* @__PURE__ */ W(Me, [["__scopeId", "data-v-7b5e0267"]]), Ne = /* @__PURE__ */ k({
162
+ __name: "ToastOutlet",
163
+ setup(e) {
164
+ const { queue: a } = ee(), { mobile: t } = fe(), r = y(() => t.value ? "" : "toast-outlet--desktop");
165
+ function o(u) {
166
+ const { width: c } = u.getBoundingClientRect();
167
+ u instanceof HTMLElement && (u.style.width = `${c.toFixed()}px`);
168
+ }
169
+ return (u, c) => (m(), p(we, {
170
+ name: "fade",
171
+ tag: "div",
172
+ class: le(["toast-outlet", r.value]),
173
+ onBeforeLeave: o
174
+ }, {
175
+ default: d(() => [
176
+ (m(!0), U(M, null, J(l(a), (n) => (m(), p(Pe, {
177
+ key: n.id,
178
+ entry: n
179
+ }, null, 8, ["entry"]))), 128))
180
+ ]),
181
+ _: 1
182
+ }, 8, ["class"]));
183
+ }
184
+ }), Qe = /* @__PURE__ */ W(Ne, [["__scopeId", "data-v-ba5c8268"]]), Fe = E(!1);
185
+ function _e() {
186
+ return Fe;
187
+ }
188
+ const $e = /* @__PURE__ */ k({
189
+ __name: "LoadingOverlay",
190
+ setup(e) {
191
+ const a = _e();
192
+ return (t, r) => (m(), p(l(Ae), {
193
+ modelValue: l(a),
194
+ "onUpdate:modelValue": r[0] || (r[0] = (o) => xe(a) ? a.value = o : null),
195
+ persistent: "",
196
+ class: "d-flex align-center justify-center"
197
+ }, {
198
+ default: d(() => [
199
+ s(l(Re), {
200
+ indeterminate: "",
201
+ color: "primary",
202
+ size: "100"
203
+ })
204
+ ]),
205
+ _: 1
206
+ }, 8, ["modelValue"]));
207
+ }
208
+ }), dt = /* @__PURE__ */ k({
209
+ __name: "UiKitOutlet",
210
+ setup(e) {
211
+ return (a, t) => (m(), U(M, null, [
212
+ s(Le),
213
+ s(Qe),
214
+ s($e)
215
+ ], 64));
216
+ }
217
+ }), C = /* @__PURE__ */ k({
218
+ __name: "MaybeTranslation",
219
+ props: {
220
+ content: {},
221
+ translate: { type: Boolean, default: !0 }
222
+ },
223
+ setup(e) {
224
+ const { t: a } = me({ useScope: "global" });
225
+ return (t, r) => t.translate ? (m(), U(M, { key: 0 }, [
226
+ te(G(l(a)(t.content)), 1)
227
+ ], 64)) : (m(), U(M, { key: 1 }, [
228
+ te(G(t.content), 1)
229
+ ], 64));
230
+ }
231
+ }), We = { class: "d-flex justify-space-between pr-2 py-2" }, Ge = 650, Be = /* @__PURE__ */ k({
232
+ __name: "InfoDialog",
233
+ props: {
234
+ data: {}
235
+ },
236
+ emits: ["resolve", "reject"],
237
+ setup(e, { emit: a }) {
238
+ const t = e, r = a, { options: { i18n: { messages: { close: o } } } } = j(), u = {
239
+ text: o,
240
+ translateText: !0,
241
+ value: null
242
+ };
243
+ let c = null;
244
+ const n = E(!0), i = y(() => Object.hasOwn(t.data, "content") ? {
245
+ content: t.data.content,
246
+ translateContent: t.data.translateContent
247
+ } : null), f = y(() => Object.hasOwn(t.data, "component") ? {
248
+ component: t.data.component,
249
+ props: t.data.props
250
+ } : null), _ = y(() => t.data.defaultCta === !1 ? null : Q({}, u, t.data.defaultCta));
251
+ function D(v) {
252
+ R(v) ? v.action() : b(v.value);
253
+ }
254
+ function R(v) {
255
+ return Object.hasOwn(v, "action");
256
+ }
257
+ function b(v = null) {
258
+ c = v, n.value = !1;
259
+ }
260
+ function h() {
261
+ r("resolve", c);
262
+ }
263
+ return (v, T) => (m(), p(l(K), {
264
+ modelValue: n.value,
265
+ "onUpdate:modelValue": T[1] || (T[1] = (V) => n.value = V),
266
+ "max-width": v.data.width ?? Ge,
267
+ onAfterLeave: h
268
+ }, {
269
+ default: d(() => [
270
+ s(l(z), { class: "info-dialog-card" }, {
271
+ default: d(() => [
272
+ N("div", We, [
273
+ s(l(ue), null, {
274
+ default: d(() => [
275
+ s(C, {
276
+ translate: v.data.translateTitle,
277
+ content: v.data.title
278
+ }, null, 8, ["translate", "content"])
279
+ ]),
280
+ _: 1
281
+ }),
282
+ s(l(A), {
283
+ icon: "$close",
284
+ variant: "text",
285
+ onClick: T[0] || (T[0] = (V) => b(null))
286
+ })
287
+ ]),
288
+ i.value ? (m(), p(l(se), { key: 0 }, {
289
+ default: d(() => [
290
+ N("p", null, [
291
+ s(C, {
292
+ translate: i.value.translateContent,
293
+ content: i.value.content
294
+ }, null, 8, ["translate", "content"])
295
+ ])
296
+ ]),
297
+ _: 1
298
+ })) : S("", !0),
299
+ f.value ? (m(), p(F(f.value.component), re($({ key: 1 }, f.value.props)), null, 16)) : S("", !0),
300
+ s(l(q), { class: "justify-end" }, {
301
+ default: d(() => [
302
+ (m(!0), U(M, null, J(v.data.additionalCta ?? [], (V, I) => (m(), p(l(A), {
303
+ key: I,
304
+ color: "primary",
305
+ variant: "text",
306
+ onClick: () => D(V)
307
+ }, {
308
+ default: d(() => [
309
+ s(C, {
310
+ translate: V.translateText,
311
+ content: V.text
312
+ }, null, 8, ["translate", "content"])
313
+ ]),
314
+ _: 2
315
+ }, 1032, ["onClick"]))), 128)),
316
+ _.value ? (m(), p(l(A), {
317
+ key: 0,
318
+ color: "primary",
319
+ variant: "elevated",
320
+ onClick: b
321
+ }, {
322
+ default: d(() => [
323
+ s(C, {
324
+ translate: _.value.translateText,
325
+ content: _.value.text
326
+ }, null, 8, ["translate", "content"])
327
+ ]),
328
+ _: 1
329
+ })) : S("", !0)
330
+ ]),
331
+ _: 1
332
+ })
333
+ ]),
334
+ _: 1
335
+ })
336
+ ]),
337
+ _: 1
338
+ }, 8, ["modelValue", "max-width"]));
339
+ }
340
+ }), He = /* @__PURE__ */ W(Be, [["__scopeId", "data-v-0f8116ef"]]);
341
+ var L = /* @__PURE__ */ ((e) => (e.SMALL = "sm", e.LARGE = "lg", e))(L || {});
342
+ function H(e, a) {
343
+ const r = {
344
+ text: j().options.i18n.messages[a],
345
+ translateText: !0
346
+ };
347
+ return Q(r, e);
348
+ }
349
+ const Ke = /* @__PURE__ */ k({
350
+ __name: "PromptDialog",
351
+ props: {
352
+ data: {}
353
+ },
354
+ emits: ["resolve", "reject"],
355
+ setup(e, { emit: a }) {
356
+ const t = e, r = a, o = {
357
+ [L.SMALL]: 650,
358
+ [L.LARGE]: 1200
359
+ }, u = H(t.data.saveCta, "save"), c = H(t.data.abortCta, "cancel"), n = E(!0), i = E(ne(t.data.initialValue) ?? null), f = E(null), { mobile: _ } = fe(), D = y(() => t.data.required && !i.value), R = y(() => o[t.data.size ?? L.SMALL]), b = y(() => t.data.size === L.LARGE ? _.value : !1), h = y(() => t.data.size === L.LARGE ? "secondary" : "primary");
360
+ function v() {
361
+ return t.data.props ?? {};
362
+ }
363
+ function T() {
364
+ i.value = ne(t.data.initialValue) ?? null, n.value = !1;
365
+ }
366
+ function V() {
367
+ n.value = !1;
368
+ }
369
+ function I() {
370
+ if (t.data.required && !i.value) {
371
+ r("reject");
372
+ return;
373
+ }
374
+ r("resolve", i.value);
375
+ }
376
+ return (w, O) => (m(), p(l(K), {
377
+ modelValue: n.value,
378
+ "onUpdate:modelValue": O[1] || (O[1] = (P) => n.value = P),
379
+ "max-width": R.value,
380
+ fullscreen: b.value,
381
+ scrollable: w.data.size === l(L).LARGE,
382
+ onAfterLeave: I
383
+ }, {
384
+ default: d(() => [
385
+ s(l(z), { class: "prompt-dialog-card" }, {
386
+ default: d(() => [
387
+ s(l(ce), { color: "primary" }, {
388
+ default: d(() => [
389
+ s(l(ie), null, {
390
+ default: d(() => [
391
+ s(C, {
392
+ translate: w.data.translateTitle,
393
+ content: w.data.title
394
+ }, null, 8, ["translate", "content"])
395
+ ]),
396
+ _: 1
397
+ }),
398
+ s(l(B)),
399
+ N("div", {
400
+ ref_key: "toolbar",
401
+ ref: f,
402
+ class: "prompt-dialog-toolbar-slot"
403
+ }, null, 512),
404
+ s(l(A), {
405
+ icon: "mdi-close",
406
+ onClick: T
407
+ })
408
+ ]),
409
+ _: 1
410
+ }),
411
+ f.value ? (m(), p(F(w.data.component), $({ key: 0 }, v(), {
412
+ modelValue: i.value,
413
+ "onUpdate:modelValue": O[0] || (O[0] = (P) => i.value = P),
414
+ toolbar: f.value
415
+ }), null, 16, ["modelValue", "toolbar"])) : S("", !0),
416
+ s(l(de)),
417
+ s(l(q), null, {
418
+ default: d(() => [
419
+ s(l(B)),
420
+ s(l(A), {
421
+ color: h.value,
422
+ onClick: T
423
+ }, {
424
+ default: d(() => [
425
+ s(C, {
426
+ translate: l(c).translateText,
427
+ content: l(c).text
428
+ }, null, 8, ["translate", "content"])
429
+ ]),
430
+ _: 1
431
+ }, 8, ["color"]),
432
+ s(l(A), {
433
+ variant: "elevated",
434
+ color: h.value,
435
+ disabled: D.value,
436
+ onClick: V
437
+ }, {
438
+ default: d(() => [
439
+ s(C, {
440
+ translate: l(u).translateText,
441
+ content: l(u).text
442
+ }, null, 8, ["translate", "content"])
443
+ ]),
444
+ _: 1
445
+ }, 8, ["color", "disabled"])
446
+ ]),
447
+ _: 1
448
+ })
449
+ ]),
450
+ _: 1
451
+ })
452
+ ]),
453
+ _: 1
454
+ }, 8, ["modelValue", "max-width", "fullscreen", "scrollable"]));
455
+ }
456
+ }), ze = /* @__PURE__ */ W(Ke, [["__scopeId", "data-v-6cec23a5"]]), qe = { class: "d-flex justify-space-between pr-2 py-2" }, Ye = 550, Xe = /* @__PURE__ */ k({
457
+ __name: "ConfirmDialog",
458
+ props: {
459
+ data: {}
460
+ },
461
+ emits: ["resolve", "reject"],
462
+ setup(e, { emit: a }) {
463
+ const t = e, r = a, { options: { i18n: { messages: { yes: o, no: u } } } } = j(), c = {
464
+ text: o,
465
+ translateText: !0
466
+ }, n = {
467
+ text: u,
468
+ translateText: !0
469
+ };
470
+ let i = !1;
471
+ const f = E(!0), _ = y(() => Object.hasOwn(t.data, "content") ? {
472
+ content: t.data.content,
473
+ translateContent: t.data.translateContent
474
+ } : null), D = y(() => Object.hasOwn(t.data, "component") ? {
475
+ component: t.data.component,
476
+ props: t.data.props
477
+ } : null), R = y(() => Q({}, c, t.data.confirmCta)), b = y(() => Q({}, n, t.data.rejectCta)), h = y(() => t.data.highlightCta ?? "confirm"), v = y(() => t.data.level ?? "primary");
478
+ function T() {
479
+ f.value = !1;
480
+ }
481
+ function V() {
482
+ i = !0, f.value = !1;
483
+ }
484
+ function I() {
485
+ if (t.data.throwOnReject && !i) {
486
+ r("reject");
487
+ return;
488
+ }
489
+ r("resolve", i);
490
+ }
491
+ return (w, O) => (m(), p(l(K), {
492
+ modelValue: f.value,
493
+ "onUpdate:modelValue": O[0] || (O[0] = (P) => f.value = P),
494
+ persistent: !!w.data.permanent,
495
+ "max-width": w.data.maxWidth ?? Ye,
496
+ onAfterLeave: I
497
+ }, {
498
+ default: d(() => [
499
+ s(l(z), { class: "confirm-dialog-card" }, {
500
+ default: d(() => [
501
+ N("div", qe, [
502
+ s(l(ue), null, {
503
+ default: d(() => [
504
+ s(C, {
505
+ translate: w.data.translateTitle,
506
+ content: w.data.title
507
+ }, null, 8, ["translate", "content"])
508
+ ]),
509
+ _: 1
510
+ }),
511
+ w.data.permanent ? S("", !0) : (m(), p(l(A), {
512
+ key: 0,
513
+ icon: "$close",
514
+ variant: "text",
515
+ onClick: T
516
+ }))
517
+ ]),
518
+ _.value ? (m(), p(l(se), { key: 0 }, {
519
+ default: d(() => [
520
+ s(C, {
521
+ translate: _.value.translateContent,
522
+ content: _.value.content
523
+ }, null, 8, ["translate", "content"])
524
+ ]),
525
+ _: 1
526
+ })) : S("", !0),
527
+ D.value ? (m(), p(F(D.value.component), re($({ key: 1 }, D.value.props)), null, 16)) : S("", !0),
528
+ s(l(q), { class: "justify-end" }, {
529
+ default: d(() => [
530
+ N("div", {
531
+ class: le(["d-flex align-center", h.value === "confirm" ? "" : "flex-row-reverse"])
532
+ }, [
533
+ s(l(A), {
534
+ variant: h.value === "reject" ? "elevated" : "text",
535
+ color: v.value,
536
+ onClick: T
537
+ }, {
538
+ default: d(() => [
539
+ s(C, {
540
+ translate: b.value.translateText,
541
+ content: b.value.text
542
+ }, null, 8, ["translate", "content"])
543
+ ]),
544
+ _: 1
545
+ }, 8, ["variant", "color"]),
546
+ s(l(A), {
547
+ variant: h.value === "confirm" ? "elevated" : "text",
548
+ color: v.value,
549
+ onClick: V
550
+ }, {
551
+ default: d(() => [
552
+ s(C, {
553
+ translate: R.value.translateText,
554
+ content: R.value.text
555
+ }, null, 8, ["translate", "content"])
556
+ ]),
557
+ _: 1
558
+ }, 8, ["variant", "color"])
559
+ ], 2)
560
+ ]),
561
+ _: 1
562
+ })
563
+ ]),
564
+ _: 1
565
+ })
566
+ ]),
567
+ _: 1
568
+ }, 8, ["modelValue", "persistent", "max-width"]));
569
+ }
570
+ }), Ze = /* @__PURE__ */ W(Xe, [["__scopeId", "data-v-3e8b3358"]]);
571
+ function Je(e) {
572
+ return e ? new Promise((a) => {
573
+ setTimeout(() => {
574
+ a();
575
+ }, e);
576
+ }) : Promise.resolve();
577
+ }
578
+ function et(e, a = {}) {
579
+ const { options: { loading: { delay: t, overlay: r } } } = j(), o = E(!1), u = _e();
580
+ async function c(...n) {
581
+ o.value = !0, r && (u.value = !0);
582
+ try {
583
+ const [i] = await Promise.all([
584
+ e(...n),
585
+ Je(t)
586
+ ]);
587
+ return i;
588
+ } catch (i) {
589
+ throw i;
590
+ } finally {
591
+ o.value = !1, r && (u.value = !1);
592
+ }
593
+ }
594
+ return { loading: Z(o), action: c };
595
+ }
596
+ const tt = /* @__PURE__ */ k({
597
+ __name: "FormDialog",
598
+ props: {
599
+ data: {}
600
+ },
601
+ emits: ["resolve", "reject"],
602
+ setup(e, { emit: a }) {
603
+ const t = e, r = a, o = H(t.data.saveCta, "save"), u = H(t.data.abortCta, "cancel"), c = De("formComponent"), n = E(!0), i = Ee(), { loading: f, action: _ } = et(v), D = y(() => ({
604
+ global: {
605
+ disabled: f.value
606
+ }
607
+ }));
608
+ let R = null;
609
+ function b() {
610
+ return t.data.props ?? {};
611
+ }
612
+ async function h() {
613
+ await i.value.$validate() && await _();
614
+ }
615
+ async function v() {
616
+ if (!c.value)
617
+ throw new Error("Form component not mounted");
618
+ const I = await c.value.finish();
619
+ typeof t.data.action == "function" ? R = await t.data.action(I) : R = I;
620
+ }
621
+ function T() {
622
+ n.value = !1;
623
+ }
624
+ function V() {
625
+ if (t.data.rejectOnEmpty && R === null) {
626
+ r("reject");
627
+ return;
628
+ }
629
+ r("resolve", R);
630
+ }
631
+ return (I, w) => (m(), p(l(K), {
632
+ modelValue: n.value,
633
+ "onUpdate:modelValue": w[0] || (w[0] = (O) => n.value = O),
634
+ onAfterLeave: V,
635
+ "max-width": "1200",
636
+ scrollable: ""
637
+ }, {
638
+ default: d(() => [
639
+ s(l(z), null, {
640
+ default: d(() => [
641
+ s(l(ce), { color: "primary" }, {
642
+ default: d(() => [
643
+ s(l(ie), null, {
644
+ default: d(() => [
645
+ s(C, {
646
+ content: I.data.title,
647
+ translate: !!I.data.translateTitle
648
+ }, null, 8, ["content", "translate"])
649
+ ]),
650
+ _: 1
651
+ }),
652
+ s(l(B)),
653
+ s(l(A), {
654
+ icon: "mdi-close",
655
+ onClick: T
656
+ })
657
+ ]),
658
+ _: 1
659
+ }),
660
+ s(l(he), { defaults: D.value }, {
661
+ default: d(() => [
662
+ (m(), p(F(I.data.component), $({
663
+ ref_key: "formComponent",
664
+ ref: c,
665
+ onSave: h
666
+ }, b()), null, 16))
667
+ ]),
668
+ _: 1
669
+ }, 8, ["defaults"]),
670
+ s(l(de)),
671
+ s(l(q), null, {
672
+ default: d(() => [
673
+ s(l(B)),
674
+ s(l(A), {
675
+ onClick: T,
676
+ color: "primary"
677
+ }, {
678
+ default: d(() => [
679
+ s(C, {
680
+ content: l(u).text,
681
+ translate: l(u).translateText
682
+ }, null, 8, ["content", "translate"])
683
+ ]),
684
+ _: 1
685
+ }),
686
+ s(l(A), {
687
+ onClick: h,
688
+ variant: "elevated",
689
+ color: "primary"
690
+ }, {
691
+ default: d(() => [
692
+ s(C, {
693
+ translate: l(o).translateText,
694
+ content: l(o).text
695
+ }, null, 8, ["translate", "content"])
696
+ ]),
697
+ _: 1
698
+ })
699
+ ]),
700
+ _: 1
701
+ })
702
+ ]),
703
+ _: 1
704
+ })
705
+ ]),
706
+ _: 1
707
+ }, 8, ["modelValue"]));
708
+ }
709
+ });
710
+ function mt() {
711
+ const e = pe();
712
+ function a(u, c) {
713
+ let n;
714
+ return typeof u == "string" ? n = {
715
+ title: u,
716
+ content: c ?? ""
717
+ } : n = u, new Promise((i) => {
718
+ const f = {
719
+ component: He,
720
+ props: { data: n },
721
+ resolve: i,
722
+ reject: () => {
723
+ i(null);
724
+ }
725
+ };
726
+ e.addToQueue(f);
727
+ });
728
+ }
729
+ function t(u) {
730
+ return new Promise((c, n) => {
731
+ const i = {
732
+ component: ze,
733
+ props: { data: u },
734
+ resolve: c,
735
+ reject: n
736
+ };
737
+ e.addToQueue(i);
738
+ });
739
+ }
740
+ function r(u, c, n) {
741
+ let i = u;
742
+ return typeof u == "string" && typeof c == "string" && (i = {
743
+ title: u,
744
+ content: c,
745
+ level: n
746
+ }), new Promise((f, _) => {
747
+ const D = {
748
+ component: Ze,
749
+ props: { data: i },
750
+ resolve: f,
751
+ reject: _
752
+ };
753
+ e.addToQueue(D);
754
+ });
755
+ }
756
+ function o(u) {
757
+ return new Promise((c, n) => {
758
+ const i = {
759
+ component: tt,
760
+ props: { data: u },
761
+ resolve: c,
762
+ reject: n
763
+ };
764
+ e.addToQueue(i);
765
+ });
766
+ }
767
+ return {
768
+ info: a,
769
+ prompt: t,
770
+ confirm: r,
771
+ form: o
772
+ };
773
+ }
774
+ var nt = /* @__PURE__ */ ((e) => (e.DEFAULT = "primary", e.WARNING = "warning", e.DANGER = "error", e))(nt || {});
775
+ function ft() {
776
+ const e = ee(), { options: { toast: { timeout: a } } } = j();
777
+ function t(c, n) {
778
+ return new Promise((i) => {
779
+ e.addToQueue({
780
+ message: c,
781
+ resolve: i,
782
+ timeout: (n == null ? void 0 : n.timeout) ?? a,
783
+ translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
784
+ type: x.INFO
785
+ });
786
+ });
787
+ }
788
+ function r(c, n) {
789
+ return new Promise((i) => {
790
+ e.addToQueue({
791
+ message: c,
792
+ resolve: i,
793
+ timeout: (n == null ? void 0 : n.timeout) ?? a,
794
+ translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
795
+ type: x.WARNING
796
+ });
797
+ });
798
+ }
799
+ function o(c, n) {
800
+ return new Promise((i) => {
801
+ e.addToQueue({
802
+ message: c,
803
+ resolve: i,
804
+ timeout: (n == null ? void 0 : n.timeout) ?? a,
805
+ translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
806
+ type: x.ERROR
807
+ });
808
+ });
809
+ }
810
+ function u(c, n) {
811
+ return new Promise((i) => {
812
+ e.addToQueue({
813
+ message: c,
814
+ resolve: i,
815
+ timeout: (n == null ? void 0 : n.timeout) ?? a,
816
+ translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
817
+ type: x.SUCCESS
818
+ });
819
+ });
820
+ }
821
+ return {
822
+ info: t,
823
+ warn: r,
824
+ error: o,
825
+ success: u
826
+ };
827
+ }
828
+ const at = () => ({
829
+ loading: {
830
+ delay: 2e3,
831
+ overlay: !1
832
+ },
833
+ toast: {
834
+ timeout: 4e3
835
+ },
836
+ i18n: {
837
+ messages: {
838
+ yes: "common.yes",
839
+ no: "common.no",
840
+ cancel: "action.cancel",
841
+ close: "action.close",
842
+ save: "action.save"
843
+ }
844
+ }
845
+ });
846
+ function ot(e) {
847
+ const a = E([]), t = E([]);
848
+ return {
849
+ dialogQueue: a,
850
+ toastQueue: t,
851
+ options: e
852
+ };
853
+ }
854
+ function vt(e) {
855
+ return (a) => {
856
+ const t = at(), r = Q(t, e), o = ot(r);
857
+ a.__SCHWARZDAVID_UIKIT_SYMBOL__ = Symbol("@schwarzdavid/ui-kit"), a.provide(a.__SCHWARZDAVID_UIKIT_SYMBOL__, o);
858
+ };
859
+ }
860
+ export {
861
+ nt as ConfirmDialogLevel,
862
+ L as PromptDialogSize,
863
+ dt as UiKitOutlet,
864
+ vt as createUIKit,
865
+ mt as useDialog,
866
+ et as useLoading,
867
+ _e as useLoadingOverlay,
868
+ ft as useToast
869
+ };