@schwarzdavid/ui-kit 0.0.1-alpha.12 → 0.0.1-alpha.13

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