vuiii 1.0.0-beta.6 → 1.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/components/Breadcrumbs.vue.d.ts +79 -15
  2. package/dist/components/Button.vue.d.ts +94 -69
  3. package/dist/components/Checkbox.vue.d.ts +91 -25
  4. package/dist/components/CheckboxGroup.vue.d.ts +92 -57
  5. package/dist/components/Form.vue.d.ts +184 -82
  6. package/dist/components/FormFields.vue.d.ts +99 -50
  7. package/dist/components/FormGroup.vue.d.ts +85 -45
  8. package/dist/components/Icon.vue.d.ts +59 -14
  9. package/dist/components/Input.vue.d.ts +109 -55
  10. package/dist/components/Radio.vue.d.ts +91 -61
  11. package/dist/components/Select.vue.d.ts +147 -82
  12. package/dist/components/Table.vue.d.ts +69 -48
  13. package/dist/components/Textarea.vue.d.ts +77 -18
  14. package/dist/components/modal/ModalLayout.vue.d.ts +1 -1
  15. package/dist/components/modal/ModalStack.vue.d.ts +2 -2
  16. package/dist/hooks/useOnClickOutside.d.ts +2 -0
  17. package/dist/hooks/useOnKeyPress.d.ts +1 -0
  18. package/dist/hooks/useRouteQuery.d.ts +17 -0
  19. package/dist/hooks/useSubmitAction.d.ts +1 -7
  20. package/dist/icons/mail.vue.d.ts +2 -0
  21. package/dist/index.d.ts +7 -6
  22. package/dist/stories/Button.stories.d.ts +449 -0
  23. package/dist/stories/Icon.stories.d.ts +128 -0
  24. package/dist/stories/Input.stories.d.ts +422 -0
  25. package/dist/stories/icons.d.ts +1 -0
  26. package/dist/style.css +1 -1
  27. package/dist/types.d.ts +51 -4
  28. package/dist/utils/generateId.d.ts +1 -0
  29. package/dist/utils/iconsResolver.d.ts +5 -0
  30. package/dist/utils/normalizeOptions.d.ts +11 -8
  31. package/dist/validations/validator.d.ts +2 -0
  32. package/dist/vuiii.mjs +1488 -0
  33. package/dist/vuiii.umd.js +1 -1
  34. package/package.json +24 -9
  35. package/dist/vuiii.es.js +0 -1882
package/dist/vuiii.es.js DELETED
@@ -1,1882 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- import { openBlock, createElementBlock, createElementVNode, pushScopeId, popScopeId, defineComponent, shallowRef, watch, createBlock, resolveDynamicComponent, unref, resolveComponent, Fragment, renderList, createVNode, withCtx, createTextVNode, toDisplayString, mergeProps, renderSlot, normalizeClass, createCommentVNode, withDirectives, vShow, withModifiers, normalizeProps, guardReactiveProps, normalizeStyle, createSlots, Transition, TransitionGroup, reactive, createApp, h, getCurrentInstance, ref, onMounted } from "vue";
33
- import { useRouter } from "vue-router";
34
- var style = "";
35
- var _export_sfc = (sfc, props) => {
36
- const target = sfc.__vccOpts || sfc;
37
- for (const [key, val] of props) {
38
- target[key] = val;
39
- }
40
- return target;
41
- };
42
- const _sfc_main$w = {};
43
- const _hoisted_1$u = {
44
- xmlns: "http://www.w3.org/2000/svg",
45
- fill: "none",
46
- viewBox: "0 0 24 24",
47
- stroke: "currentColor",
48
- "stroke-width": "2"
49
- };
50
- const _hoisted_2$p = /* @__PURE__ */ createElementVNode("path", {
51
- "stroke-linecap": "round",
52
- "stroke-linejoin": "round",
53
- d: "M16 17l-4 4m0 0l-4-4m4 4V3"
54
- }, null, -1);
55
- const _hoisted_3$n = [
56
- _hoisted_2$p
57
- ];
58
- function _sfc_render$v(_ctx, _cache) {
59
- return openBlock(), createElementBlock("svg", _hoisted_1$u, _hoisted_3$n);
60
- }
61
- var arrowNarrowDown = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$v]]);
62
- var __glob_4_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
63
- __proto__: null,
64
- "default": arrowNarrowDown
65
- }, Symbol.toStringTag, { value: "Module" }));
66
- const _sfc_main$v = {};
67
- const _hoisted_1$t = {
68
- xmlns: "http://www.w3.org/2000/svg",
69
- fill: "none",
70
- viewBox: "0 0 24 24",
71
- stroke: "currentColor",
72
- "stroke-width": "2"
73
- };
74
- const _hoisted_2$o = /* @__PURE__ */ createElementVNode("path", {
75
- "stroke-linecap": "round",
76
- "stroke-linejoin": "round",
77
- d: "M7 16l-4-4m0 0l4-4m-4 4h18"
78
- }, null, -1);
79
- const _hoisted_3$m = [
80
- _hoisted_2$o
81
- ];
82
- function _sfc_render$u(_ctx, _cache) {
83
- return openBlock(), createElementBlock("svg", _hoisted_1$t, _hoisted_3$m);
84
- }
85
- var arrowNarrowLeft = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$u]]);
86
- var __glob_4_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
87
- __proto__: null,
88
- "default": arrowNarrowLeft
89
- }, Symbol.toStringTag, { value: "Module" }));
90
- const _sfc_main$u = {};
91
- const _hoisted_1$s = {
92
- xmlns: "http://www.w3.org/2000/svg",
93
- fill: "none",
94
- viewBox: "0 0 24 24",
95
- stroke: "currentColor",
96
- "stroke-width": "2"
97
- };
98
- const _hoisted_2$n = /* @__PURE__ */ createElementVNode("path", {
99
- "stroke-linecap": "round",
100
- "stroke-linejoin": "round",
101
- d: "M17 8l4 4m0 0l-4 4m4-4H3"
102
- }, null, -1);
103
- const _hoisted_3$l = [
104
- _hoisted_2$n
105
- ];
106
- function _sfc_render$t(_ctx, _cache) {
107
- return openBlock(), createElementBlock("svg", _hoisted_1$s, _hoisted_3$l);
108
- }
109
- var arrowNarrowRight = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$t]]);
110
- var __glob_4_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
111
- __proto__: null,
112
- "default": arrowNarrowRight
113
- }, Symbol.toStringTag, { value: "Module" }));
114
- const _sfc_main$t = {};
115
- const _hoisted_1$r = {
116
- xmlns: "http://www.w3.org/2000/svg",
117
- fill: "none",
118
- viewBox: "0 0 24 24",
119
- stroke: "currentColor",
120
- "stroke-width": "2"
121
- };
122
- const _hoisted_2$m = /* @__PURE__ */ createElementVNode("path", {
123
- "stroke-linecap": "round",
124
- "stroke-linejoin": "round",
125
- d: "M8 7l4-4m0 0l4 4m-4-4v18"
126
- }, null, -1);
127
- const _hoisted_3$k = [
128
- _hoisted_2$m
129
- ];
130
- function _sfc_render$s(_ctx, _cache) {
131
- return openBlock(), createElementBlock("svg", _hoisted_1$r, _hoisted_3$k);
132
- }
133
- var arrowNarrowUp = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$s]]);
134
- var __glob_4_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
135
- __proto__: null,
136
- "default": arrowNarrowUp
137
- }, Symbol.toStringTag, { value: "Module" }));
138
- const _sfc_main$s = {};
139
- const _hoisted_1$q = {
140
- xmlns: "http://www.w3.org/2000/svg",
141
- fill: "none",
142
- viewBox: "0 0 24 24",
143
- stroke: "currentColor",
144
- "stroke-width": "2"
145
- };
146
- const _hoisted_2$l = /* @__PURE__ */ createElementVNode("path", {
147
- "stroke-linecap": "round",
148
- "stroke-linejoin": "round",
149
- d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
150
- }, null, -1);
151
- const _hoisted_3$j = [
152
- _hoisted_2$l
153
- ];
154
- function _sfc_render$r(_ctx, _cache) {
155
- return openBlock(), createElementBlock("svg", _hoisted_1$q, _hoisted_3$j);
156
- }
157
- var checkCircle = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$r]]);
158
- var __glob_4_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
159
- __proto__: null,
160
- "default": checkCircle
161
- }, Symbol.toStringTag, { value: "Module" }));
162
- const _sfc_main$r = {};
163
- const _hoisted_1$p = {
164
- xmlns: "http://www.w3.org/2000/svg",
165
- fill: "none",
166
- viewBox: "0 0 24 24",
167
- stroke: "currentColor",
168
- "stroke-width": "2"
169
- };
170
- const _hoisted_2$k = /* @__PURE__ */ createElementVNode("path", {
171
- "stroke-linecap": "round",
172
- "stroke-linejoin": "round",
173
- d: "M5 13l4 4L19 7"
174
- }, null, -1);
175
- const _hoisted_3$i = [
176
- _hoisted_2$k
177
- ];
178
- function _sfc_render$q(_ctx, _cache) {
179
- return openBlock(), createElementBlock("svg", _hoisted_1$p, _hoisted_3$i);
180
- }
181
- var check = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$q]]);
182
- var __glob_4_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
183
- __proto__: null,
184
- "default": check
185
- }, Symbol.toStringTag, { value: "Module" }));
186
- const _sfc_main$q = {};
187
- const _hoisted_1$o = {
188
- xmlns: "http://www.w3.org/2000/svg",
189
- fill: "none",
190
- viewBox: "0 0 24 24",
191
- stroke: "currentColor",
192
- "stroke-width": "2"
193
- };
194
- const _hoisted_2$j = /* @__PURE__ */ createElementVNode("path", {
195
- "stroke-linecap": "round",
196
- "stroke-linejoin": "round",
197
- d: "M15 19l-7-7 7-7"
198
- }, null, -1);
199
- const _hoisted_3$h = [
200
- _hoisted_2$j
201
- ];
202
- function _sfc_render$p(_ctx, _cache) {
203
- return openBlock(), createElementBlock("svg", _hoisted_1$o, _hoisted_3$h);
204
- }
205
- var chevronLeft = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$p]]);
206
- var __glob_4_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
207
- __proto__: null,
208
- "default": chevronLeft
209
- }, Symbol.toStringTag, { value: "Module" }));
210
- const _sfc_main$p = {};
211
- const _hoisted_1$n = {
212
- xmlns: "http://www.w3.org/2000/svg",
213
- fill: "none",
214
- viewBox: "0 0 24 24",
215
- stroke: "currentColor",
216
- "stroke-width": "2"
217
- };
218
- const _hoisted_2$i = /* @__PURE__ */ createElementVNode("path", {
219
- "stroke-linecap": "round",
220
- "stroke-linejoin": "round",
221
- d: "M9 5l7 7-7 7"
222
- }, null, -1);
223
- const _hoisted_3$g = [
224
- _hoisted_2$i
225
- ];
226
- function _sfc_render$o(_ctx, _cache) {
227
- return openBlock(), createElementBlock("svg", _hoisted_1$n, _hoisted_3$g);
228
- }
229
- var chevronRight = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$o]]);
230
- var __glob_4_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
231
- __proto__: null,
232
- "default": chevronRight
233
- }, Symbol.toStringTag, { value: "Module" }));
234
- const _sfc_main$o = {};
235
- const _hoisted_1$m = {
236
- xmlns: "http://www.w3.org/2000/svg",
237
- fill: "none",
238
- viewBox: "0 0 24 24",
239
- stroke: "currentColor",
240
- "stroke-width": "2"
241
- };
242
- const _hoisted_2$h = /* @__PURE__ */ createElementVNode("path", {
243
- "stroke-linecap": "round",
244
- "stroke-linejoin": "round",
245
- d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
246
- }, null, -1);
247
- const _hoisted_3$f = [
248
- _hoisted_2$h
249
- ];
250
- function _sfc_render$n(_ctx, _cache) {
251
- return openBlock(), createElementBlock("svg", _hoisted_1$m, _hoisted_3$f);
252
- }
253
- var exclamationCircle = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$n]]);
254
- var __glob_4_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
255
- __proto__: null,
256
- "default": exclamationCircle
257
- }, Symbol.toStringTag, { value: "Module" }));
258
- const _sfc_main$n = {};
259
- const _hoisted_1$l = {
260
- xmlns: "http://www.w3.org/2000/svg",
261
- fill: "none",
262
- viewBox: "0 0 24 24",
263
- stroke: "currentColor",
264
- "stroke-width": "2"
265
- };
266
- const _hoisted_2$g = /* @__PURE__ */ createElementVNode("path", {
267
- "stroke-linecap": "round",
268
- "stroke-linejoin": "round",
269
- d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
270
- }, null, -1);
271
- const _hoisted_3$e = [
272
- _hoisted_2$g
273
- ];
274
- function _sfc_render$m(_ctx, _cache) {
275
- return openBlock(), createElementBlock("svg", _hoisted_1$l, _hoisted_3$e);
276
- }
277
- var exclamation = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$m]]);
278
- var __glob_4_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
279
- __proto__: null,
280
- "default": exclamation
281
- }, Symbol.toStringTag, { value: "Module" }));
282
- const _sfc_main$m = {};
283
- const _hoisted_1$k = {
284
- xmlns: "http://www.w3.org/2000/svg",
285
- fill: "none",
286
- viewBox: "0 0 24 24",
287
- "stroke-width": "1.5",
288
- stroke: "currentColor"
289
- };
290
- const _hoisted_2$f = /* @__PURE__ */ createElementVNode("path", {
291
- "stroke-linecap": "round",
292
- "stroke-linejoin": "round",
293
- d: "M19.5 12h-15"
294
- }, null, -1);
295
- const _hoisted_3$d = [
296
- _hoisted_2$f
297
- ];
298
- function _sfc_render$l(_ctx, _cache) {
299
- return openBlock(), createElementBlock("svg", _hoisted_1$k, _hoisted_3$d);
300
- }
301
- var minus = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$l]]);
302
- var __glob_4_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
303
- __proto__: null,
304
- "default": minus
305
- }, Symbol.toStringTag, { value: "Module" }));
306
- const _sfc_main$l = {};
307
- const _hoisted_1$j = {
308
- xmlns: "http://www.w3.org/2000/svg",
309
- fill: "none",
310
- viewBox: "0 0 24 24",
311
- stroke: "currentColor",
312
- "stroke-width": "2"
313
- };
314
- const _hoisted_2$e = /* @__PURE__ */ createElementVNode("path", {
315
- "stroke-linecap": "round",
316
- "stroke-linejoin": "round",
317
- d: "M12 4v16m8-8H4"
318
- }, null, -1);
319
- const _hoisted_3$c = [
320
- _hoisted_2$e
321
- ];
322
- function _sfc_render$k(_ctx, _cache) {
323
- return openBlock(), createElementBlock("svg", _hoisted_1$j, _hoisted_3$c);
324
- }
325
- var plus = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$k]]);
326
- var __glob_4_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
327
- __proto__: null,
328
- "default": plus
329
- }, Symbol.toStringTag, { value: "Module" }));
330
- const _sfc_main$k = {};
331
- const _hoisted_1$i = {
332
- fill: "none",
333
- stroke: "currentColor",
334
- viewBox: "0 0 24 24",
335
- xmlns: "http://www.w3.org/2000/svg"
336
- };
337
- const _hoisted_2$d = /* @__PURE__ */ createElementVNode("path", {
338
- d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",
339
- "stroke-linecap": "round",
340
- "stroke-linejoin": "round",
341
- "stroke-width": "2"
342
- }, null, -1);
343
- const _hoisted_3$b = [
344
- _hoisted_2$d
345
- ];
346
- function _sfc_render$j(_ctx, _cache) {
347
- return openBlock(), createElementBlock("svg", _hoisted_1$i, _hoisted_3$b);
348
- }
349
- var search = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$j]]);
350
- var __glob_4_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
351
- __proto__: null,
352
- "default": search
353
- }, Symbol.toStringTag, { value: "Module" }));
354
- var spinner_vue_vue_type_style_index_0_scoped_true_lang = "";
355
- const _sfc_main$j = {};
356
- const _withScopeId$1 = (n) => (pushScopeId("data-v-683816b2"), n = n(), popScopeId(), n);
357
- const _hoisted_1$h = {
358
- class: "IconSpinner",
359
- fill: "none",
360
- stroke: "currentColor",
361
- viewBox: "0 0 25 25",
362
- xmlns: "http://www.w3.org/2000/svg"
363
- };
364
- const _hoisted_2$c = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("path", {
365
- d: "M23.5 12.5c0 6.1-4.9 11-11 11s-11-4.9-11-11 4.9-11 11-11",
366
- "shape-rendering": "geometricPrecision",
367
- style: { "stroke-width": "2", "stroke-miterlimit": "10", "stroke": "currentColor", "fill": "none" },
368
- "vector-effect": "non-scaling-stroke"
369
- }, null, -1));
370
- const _hoisted_3$a = [
371
- _hoisted_2$c
372
- ];
373
- function _sfc_render$i(_ctx, _cache) {
374
- return openBlock(), createElementBlock("svg", _hoisted_1$h, _hoisted_3$a);
375
- }
376
- var spinner = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$i], ["__scopeId", "data-v-683816b2"]]);
377
- var __glob_4_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
378
- __proto__: null,
379
- "default": spinner
380
- }, Symbol.toStringTag, { value: "Module" }));
381
- const _sfc_main$i = {};
382
- const _hoisted_1$g = {
383
- xmlns: "http://www.w3.org/2000/svg",
384
- fill: "none",
385
- viewBox: "0 0 24 24",
386
- stroke: "currentColor",
387
- "stroke-width": "2"
388
- };
389
- const _hoisted_2$b = /* @__PURE__ */ createElementVNode("path", {
390
- "stroke-linecap": "round",
391
- "stroke-linejoin": "round",
392
- d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
393
- }, null, -1);
394
- const _hoisted_3$9 = [
395
- _hoisted_2$b
396
- ];
397
- function _sfc_render$h(_ctx, _cache) {
398
- return openBlock(), createElementBlock("svg", _hoisted_1$g, _hoisted_3$9);
399
- }
400
- var trash = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$h]]);
401
- var __glob_4_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
402
- __proto__: null,
403
- "default": trash
404
- }, Symbol.toStringTag, { value: "Module" }));
405
- const _sfc_main$h = {};
406
- const _hoisted_1$f = {
407
- "aria-hidden": "true",
408
- fill: "none",
409
- stroke: "currentColor",
410
- viewBox: "0 0 24 24",
411
- xmlns: "http://www.w3.org/2000/svg"
412
- };
413
- const _hoisted_2$a = /* @__PURE__ */ createElementVNode("path", {
414
- d: "M6 18L18 6M6 6l12 12",
415
- "stroke-linecap": "round",
416
- "stroke-linejoin": "round",
417
- "stroke-width": "2"
418
- }, null, -1);
419
- const _hoisted_3$8 = [
420
- _hoisted_2$a
421
- ];
422
- function _sfc_render$g(_ctx, _cache) {
423
- return openBlock(), createElementBlock("svg", _hoisted_1$f, _hoisted_3$8);
424
- }
425
- var x = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$g]]);
426
- var __glob_4_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
427
- __proto__: null,
428
- "default": x
429
- }, Symbol.toStringTag, { value: "Module" }));
430
- function resolveGlobImport(imports, filename) {
431
- var _a;
432
- return (_a = Object.entries(imports).map(([path, source]) => ({ path, source })).find((item) => item.path.endsWith(`/${filename}`))) == null ? void 0 : _a.source.default;
433
- }
434
- var Icon_vue_vue_type_style_index_0_scoped_true_lang = "";
435
- let customIconResolver;
436
- function registerCustomIconResolver(resolver) {
437
- customIconResolver = resolver;
438
- }
439
- function resolveIconComponent(name) {
440
- let component;
441
- if (customIconResolver) {
442
- component = customIconResolver(name);
443
- }
444
- if (!component) {
445
- component = resolveGlobImport(icons, `${name}.vue`);
446
- }
447
- return component;
448
- }
449
- const icons = { "../icons/arrow-narrow-down.vue": __glob_4_0, "../icons/arrow-narrow-left.vue": __glob_4_1, "../icons/arrow-narrow-right.vue": __glob_4_2, "../icons/arrow-narrow-up.vue": __glob_4_3, "../icons/check-circle.vue": __glob_4_4, "../icons/check.vue": __glob_4_5, "../icons/chevron-left.vue": __glob_4_6, "../icons/chevron-right.vue": __glob_4_7, "../icons/exclamation-circle.vue": __glob_4_8, "../icons/exclamation.vue": __glob_4_9, "../icons/minus.vue": __glob_4_10, "../icons/plus.vue": __glob_4_11, "../icons/search.vue": __glob_4_12, "../icons/spinner.vue": __glob_4_13, "../icons/trash.vue": __glob_4_14, "../icons/x.vue": __glob_4_15 };
450
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
451
- name: "Icon",
452
- props: {
453
- name: {
454
- type: String,
455
- required: true
456
- }
457
- },
458
- setup(__props) {
459
- const props = __props;
460
- const component = shallowRef(void 0);
461
- watch(() => props.name, () => component.value = resolveIconComponent(props.name), { immediate: true });
462
- return (_ctx, _cache) => {
463
- return openBlock(), createBlock(resolveDynamicComponent(unref(component)), { class: "Icon" });
464
- };
465
- }
466
- });
467
- var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-cc79c81e"]]);
468
- var Breadcrumbs_vue_vue_type_style_index_0_scoped_true_lang = "";
469
- const _sfc_main$f = defineComponent({
470
- components: {
471
- Icon
472
- },
473
- props: {
474
- breadcrumbs: {
475
- type: Object,
476
- default: () => ({})
477
- }
478
- }
479
- });
480
- const _hoisted_1$e = { class: "Breadcrumbs" };
481
- function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
482
- const _component_router_link = resolveComponent("router-link");
483
- const _component_Icon = resolveComponent("Icon");
484
- return openBlock(), createElementBlock("div", _hoisted_1$e, [
485
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.breadcrumbs, (location, label, index) => {
486
- return openBlock(), createElementBlock("div", {
487
- key: index,
488
- class: "Breadcrumbs__breadcrumb"
489
- }, [
490
- createVNode(_component_router_link, {
491
- to: location,
492
- class: "Breadcrumbs__link"
493
- }, {
494
- default: withCtx(() => [
495
- createTextVNode(toDisplayString(label), 1)
496
- ]),
497
- _: 2
498
- }, 1032, ["to"]),
499
- createVNode(_component_Icon, {
500
- name: "chevron-right",
501
- class: "Breadcrumbs__arrow"
502
- })
503
- ]);
504
- }), 128))
505
- ]);
506
- }
507
- var Breadcrumbs = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$f], ["__scopeId", "data-v-357000f6"]]);
508
- var button = "";
509
- const buttonSizes = ["normal", "small"];
510
- const buttonVariants = ["default", "primary", "secondary", "danger"];
511
- var Button_vue_vue_type_style_index_0_scoped_true_lang = "";
512
- const _sfc_main$e = defineComponent({
513
- components: {
514
- Icon
515
- },
516
- inheritAttrs: false,
517
- props: {
518
- size: {
519
- type: String,
520
- default: "normal",
521
- validator: (value) => buttonSizes.includes(value)
522
- },
523
- variant: {
524
- type: String,
525
- default: "default",
526
- validator: (value) => buttonVariants.includes(value)
527
- },
528
- prefixIcon: {
529
- type: String,
530
- default: ""
531
- },
532
- suffixIcon: {
533
- type: String,
534
- default: ""
535
- },
536
- label: {
537
- type: String,
538
- default: ""
539
- },
540
- active: Boolean,
541
- loading: Boolean,
542
- block: Boolean,
543
- disabled: Boolean
544
- },
545
- computed: {
546
- component() {
547
- if (this.$attrs.to) {
548
- return "router-link";
549
- }
550
- if (this.$attrs.href) {
551
- return "a";
552
- }
553
- return "button";
554
- },
555
- classModifiers() {
556
- const classModifiers = [this.size, this.variant];
557
- if (this.active) {
558
- classModifiers.push("active");
559
- }
560
- if (this.loading) {
561
- classModifiers.push("loading");
562
- }
563
- if (this.disabled) {
564
- classModifiers.push("disabled");
565
- }
566
- return classModifiers.map((modifier) => `vuiii-button--${modifier}`);
567
- }
568
- }
569
- });
570
- const _hoisted_1$d = { key: 1 };
571
- function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
572
- const _component_Icon = resolveComponent("Icon");
573
- return openBlock(), createBlock(resolveDynamicComponent(_ctx.component), mergeProps({
574
- class: ["Button vuiii-button", [_ctx.classModifiers, { "Button--block": _ctx.block }, { "vuiii-button--disabled": _ctx.$attrs.disabled }]]
575
- }, _ctx.$attrs, {
576
- type: _ctx.$attrs.type || (_ctx.component === "button" ? "button" : void 0)
577
- }), {
578
- default: withCtx(() => [
579
- renderSlot(_ctx.$slots, "prefix", {}, () => [
580
- _ctx.prefixIcon && !_ctx.loading ? (openBlock(), createBlock(_component_Icon, {
581
- key: 0,
582
- class: normalizeClass(["Button__icon Button__icon--prefix", [`Button__icon--${_ctx.size}`]]),
583
- name: _ctx.prefixIcon
584
- }, null, 8, ["class", "name"])) : createCommentVNode("", true)
585
- ], true),
586
- _ctx.loading ? (openBlock(), createBlock(_component_Icon, {
587
- key: 0,
588
- class: normalizeClass(["Button__icon Button__icon--prefix", [`Button__icon--${_ctx.size}`]]),
589
- name: "spinner"
590
- }, null, 8, ["class"])) : createCommentVNode("", true),
591
- _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_1$d, [
592
- renderSlot(_ctx.$slots, "default", {}, () => [
593
- createTextVNode(toDisplayString(_ctx.label), 1)
594
- ], true)
595
- ])) : createCommentVNode("", true),
596
- renderSlot(_ctx.$slots, "suffix", {}, () => [
597
- _ctx.suffixIcon ? (openBlock(), createBlock(_component_Icon, {
598
- key: 0,
599
- class: normalizeClass(["Button__icon Button__icon--suffix", [`Button__icon--${_ctx.size}`]]),
600
- name: _ctx.suffixIcon
601
- }, null, 8, ["class", "name"])) : createCommentVNode("", true)
602
- ], true)
603
- ]),
604
- _: 3
605
- }, 16, ["class", "type"]);
606
- }
607
- var Button = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e], ["__scopeId", "data-v-0e7d2036"]]);
608
- var input = "";
609
- const retrieveInputValue = (event) => {
610
- if (event.target.getAttribute("type") === "number") {
611
- return event.target.valueAsNumber;
612
- }
613
- if (event.target.getAttribute("type") === "checkbox") {
614
- return event.target.checked;
615
- }
616
- return event.target.value;
617
- };
618
- const transformInputAttrs = defineComponent({
619
- emits: ["update:modelValue"],
620
- computed: {
621
- normalizedAttrs() {
622
- const _a = this.$attrs, { class: _class } = _a, attrs = __objRest(_a, ["class"]);
623
- return __spreadProps(__spreadValues({}, attrs), {
624
- onInput: (e) => this.$emit("update:modelValue", retrieveInputValue(e))
625
- });
626
- }
627
- }
628
- });
629
- var Checkbox_vue_vue_type_style_index_0_scoped_true_lang = "";
630
- const _sfc_main$d = defineComponent({
631
- mixins: [transformInputAttrs],
632
- inheritAttrs: false,
633
- props: {
634
- modelValue: Boolean,
635
- required: Boolean,
636
- switch: Boolean,
637
- caption: {
638
- type: String,
639
- default: ""
640
- }
641
- }
642
- });
643
- const _withScopeId = (n) => (pushScopeId("data-v-18ef5cd1"), n = n(), popScopeId(), n);
644
- const _hoisted_1$c = ["checked", "required"];
645
- const _hoisted_2$9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "Checkbox__switchDot" }, null, -1));
646
- const _hoisted_3$7 = [
647
- _hoisted_2$9
648
- ];
649
- const _hoisted_4$3 = {
650
- key: 1,
651
- class: "Checkbox__label"
652
- };
653
- const _hoisted_5$1 = {
654
- key: 0,
655
- class: "Checkbox__required"
656
- };
657
- function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
658
- return openBlock(), createElementBlock("label", {
659
- class: normalizeClass(["Checkbox", [_ctx.$attrs.class, { "Checkbox--disabled": _ctx.$attrs.disabled }]])
660
- }, [
661
- withDirectives(createElementVNode("input", mergeProps(_ctx.normalizedAttrs, {
662
- checked: _ctx.modelValue,
663
- class: "Checkbox__input vuiii-input",
664
- required: _ctx.required,
665
- type: "checkbox"
666
- }), null, 16, _hoisted_1$c), [
667
- [vShow, !_ctx.$props.switch]
668
- ]),
669
- _ctx.$props.switch ? (openBlock(), createElementBlock("div", {
670
- key: 0,
671
- class: normalizeClass(["Checkbox__switch", { "Checkbox__switch--active": _ctx.modelValue }])
672
- }, _hoisted_3$7, 2)) : createCommentVNode("", true),
673
- _ctx.$slots.default || _ctx.caption ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
674
- _ctx.required ? (openBlock(), createElementBlock("span", _hoisted_5$1, "*")) : createCommentVNode("", true),
675
- renderSlot(_ctx.$slots, "default", {}, () => [
676
- createTextVNode(toDisplayString(_ctx.caption), 1)
677
- ], true)
678
- ])) : createCommentVNode("", true)
679
- ], 2);
680
- }
681
- var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-18ef5cd1"]]);
682
- function retrieveValue(item, extractor) {
683
- if (typeof extractor === "function") {
684
- return extractor(item);
685
- }
686
- if (extractor || extractor === 0) {
687
- return item[extractor];
688
- }
689
- return item;
690
- }
691
- function normalizeOptions(items, extractors = {}) {
692
- if (Array.isArray(items)) {
693
- return items.map((item) => ({
694
- value: retrieveValue(item, extractors.value),
695
- label: retrieveValue(item, extractors.label),
696
- description: extractors.description && retrieveValue(item, extractors.description),
697
- disabled: extractors.disabled && retrieveValue(item, extractors.disabled)
698
- }));
699
- }
700
- return Object.entries(items || {}).reduce((options, [value, label]) => {
701
- return options.concat({
702
- value,
703
- label
704
- });
705
- }, []);
706
- }
707
- var CheckboxGroup_vue_vue_type_style_index_0_scoped_true_lang = "";
708
- const _sfc_main$c = defineComponent({
709
- components: {
710
- Checkbox
711
- },
712
- props: {
713
- modelValue: {
714
- type: Array,
715
- default: () => []
716
- },
717
- options: {
718
- type: [Array, Object],
719
- required: true
720
- },
721
- optionLabelKey: {
722
- type: [Function, String, Number],
723
- default: void 0
724
- },
725
- optionValueKey: {
726
- type: [Function, String, Number],
727
- default: void 0
728
- },
729
- optionDisabledKey: {
730
- type: [Function, String, Number],
731
- default: void 0
732
- }
733
- },
734
- emits: ["update:modelValue"],
735
- computed: {
736
- normalizedOptions() {
737
- return normalizeOptions(this.options, {
738
- value: this.optionValueKey,
739
- label: this.optionLabelKey,
740
- disabled: this.optionDisabledKey
741
- });
742
- },
743
- checkedValues() {
744
- return this.modelValue.reduce((result, value) => __spreadProps(__spreadValues({}, result), {
745
- [value]: true
746
- }), {});
747
- }
748
- },
749
- methods: {
750
- toggleCheckedValue(value) {
751
- const checkedValues = __spreadProps(__spreadValues({}, this.checkedValues), {
752
- [value]: !this.checkedValues[value]
753
- });
754
- const modelValue = Object.entries(checkedValues).filter(([_, isChecked]) => isChecked).map(([value2]) => value2);
755
- this.$emit("update:modelValue", modelValue);
756
- }
757
- }
758
- });
759
- const _hoisted_1$b = { class: "CheckboxGroup" };
760
- function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
761
- const _component_Checkbox = resolveComponent("Checkbox");
762
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
763
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.normalizedOptions, (option) => {
764
- return openBlock(), createElementBlock("div", {
765
- key: option.value
766
- }, [
767
- createVNode(_component_Checkbox, {
768
- disabled: option.disabled,
769
- "model-value": _ctx.checkedValues[option.value],
770
- caption: option.label,
771
- "onUpdate:modelValue": ($event) => _ctx.toggleCheckedValue(option.value)
772
- }, null, 8, ["disabled", "model-value", "caption", "onUpdate:modelValue"])
773
- ]);
774
- }), 128))
775
- ]);
776
- }
777
- var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-1a9cd604"]]);
778
- var FormGroup_vue_vue_type_style_index_0_scoped_true_lang = "";
779
- const _sfc_main$b = defineComponent({
780
- props: {
781
- label: {
782
- type: String,
783
- default: ""
784
- },
785
- error: {
786
- type: [String, Array, Boolean],
787
- default: ""
788
- },
789
- description: {
790
- type: String,
791
- default: ""
792
- },
793
- hint: {
794
- type: String,
795
- default: ""
796
- },
797
- required: Boolean
798
- },
799
- computed: {
800
- errorMessage() {
801
- if (Array.isArray(this.error)) {
802
- return this.error.filter(Boolean).join(" ");
803
- }
804
- if (typeof this.error === "string") {
805
- return this.error;
806
- }
807
- return "";
808
- }
809
- }
810
- });
811
- const _hoisted_1$a = {
812
- key: 0,
813
- class: "FormGroup__header"
814
- };
815
- const _hoisted_2$8 = { class: "FormGroup__label" };
816
- const _hoisted_3$6 = {
817
- key: 0,
818
- class: "FormGroup__required"
819
- };
820
- const _hoisted_4$2 = {
821
- key: 1,
822
- class: "FormGroup__description"
823
- };
824
- const _hoisted_5 = {
825
- key: 2,
826
- class: "FormGroup__hint"
827
- };
828
- const _hoisted_6 = {
829
- key: 3,
830
- class: "FormGroup__error"
831
- };
832
- function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
833
- return openBlock(), createElementBlock("div", {
834
- class: normalizeClass(["FormGroup", { "FormGroup--invalid": _ctx.error }])
835
- }, [
836
- _ctx.label ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
837
- createElementVNode("label", _hoisted_2$8, toDisplayString(_ctx.label), 1),
838
- _ctx.required ? (openBlock(), createElementBlock("div", _hoisted_3$6, "*")) : createCommentVNode("", true)
839
- ])) : createCommentVNode("", true),
840
- _ctx.$slots.description || _ctx.description ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
841
- renderSlot(_ctx.$slots, "description", {}, () => [
842
- createTextVNode(toDisplayString(_ctx.description), 1)
843
- ], true)
844
- ])) : createCommentVNode("", true),
845
- renderSlot(_ctx.$slots, "default", {}, void 0, true),
846
- _ctx.$slots.hint || _ctx.hint ? (openBlock(), createElementBlock("div", _hoisted_5, [
847
- renderSlot(_ctx.$slots, "hint", {}, () => [
848
- createTextVNode(toDisplayString(_ctx.hint), 1)
849
- ], true)
850
- ])) : createCommentVNode("", true),
851
- _ctx.errorMessage ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(_ctx.errorMessage), 1)) : createCommentVNode("", true)
852
- ], 2);
853
- }
854
- var FormGroup = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-2a74e30e"]]);
855
- var FormFields_vue_vue_type_style_index_0_scoped_true_lang = "";
856
- const _sfc_main$a = defineComponent({
857
- components: {
858
- FormGroup
859
- },
860
- props: {
861
- fields: {
862
- type: Object,
863
- default: () => ({})
864
- },
865
- modelValue: {
866
- type: Object,
867
- default: () => ({})
868
- },
869
- errors: {
870
- type: Object,
871
- default: () => ({})
872
- }
873
- },
874
- emits: ["update:modelValue"],
875
- methods: {
876
- getFieldValue(name) {
877
- var _a;
878
- const getter = ((_a = this.fields[name].value) == null ? void 0 : _a.getter) || ((modelValue) => modelValue[name]);
879
- return getter(this.modelValue);
880
- },
881
- setFieldValue(name, value) {
882
- var _a;
883
- const setter = ((_a = this.fields[name].value) == null ? void 0 : _a.setter) || ((value2, modelValue2) => __spreadProps(__spreadValues({}, modelValue2), { [name]: value2 }));
884
- const modelValue = setter(value, this.modelValue);
885
- this.$emit("update:modelValue", modelValue);
886
- }
887
- }
888
- });
889
- const _hoisted_1$9 = { class: "FormFields" };
890
- function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
891
- const _component_FormGroup = resolveComponent("FormGroup");
892
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
893
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fields, (field, name) => {
894
- var _a;
895
- return openBlock(), createBlock(_component_FormGroup, {
896
- key: name,
897
- label: field.label,
898
- description: field.description,
899
- hint: field.hint,
900
- required: field.required,
901
- error: (_a = _ctx.errors) == null ? void 0 : _a[name]
902
- }, {
903
- default: withCtx(() => [
904
- (openBlock(), createBlock(resolveDynamicComponent(field.component), mergeProps({
905
- "model-value": _ctx.getFieldValue(String(name))
906
- }, field.props, {
907
- "onUpdate:modelValue": ($event) => _ctx.setFieldValue(String(name), $event)
908
- }), null, 16, ["model-value", "onUpdate:modelValue"]))
909
- ]),
910
- _: 2
911
- }, 1032, ["label", "description", "hint", "required", "error"]);
912
- }), 128))
913
- ]);
914
- }
915
- var FormFields = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a], ["__scopeId", "data-v-7f82ddf3"]]);
916
- var Form_vue_vue_type_style_index_0_scoped_true_lang = "";
917
- const _sfc_main$9 = defineComponent({
918
- components: { Button, FormFields, Icon },
919
- props: {
920
- structure: {
921
- type: Object,
922
- default: () => ({})
923
- },
924
- modelValue: {
925
- type: Object,
926
- default: () => void 0
927
- },
928
- errors: {
929
- type: Object,
930
- default: () => ({})
931
- },
932
- submit: {
933
- type: Function,
934
- default: void 0
935
- },
936
- submitLabel: {
937
- type: String,
938
- default: "Submit"
939
- },
940
- cancel: {
941
- type: [Function, Object],
942
- default: void 0
943
- },
944
- cancelLabel: {
945
- type: String,
946
- default: "Cancel"
947
- },
948
- submitting: Boolean
949
- },
950
- emits: ["update:modelValue", "change", "submit", "cancel"],
951
- methods: {
952
- handleSubmit() {
953
- var _a;
954
- (_a = this.submit) == null ? void 0 : _a.call(this, this.modelValue);
955
- },
956
- handleCancel() {
957
- var _a;
958
- typeof this.cancel === "function" ? (_a = this.cancel) == null ? void 0 : _a.call(this) : this.cancel && this.$router.push(this.cancel);
959
- }
960
- }
961
- });
962
- const _hoisted_1$8 = { class: "Form" };
963
- const _hoisted_2$7 = ["disabled"];
964
- const _hoisted_3$5 = {
965
- key: 0,
966
- class: "Form__title"
967
- };
968
- const _hoisted_4$1 = {
969
- key: 0,
970
- class: "Form__buttons"
971
- };
972
- function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
973
- const _component_FormFields = resolveComponent("FormFields");
974
- const _component_Button = resolveComponent("Button");
975
- const _component_Icon = resolveComponent("Icon");
976
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
977
- _ctx.modelValue ? (openBlock(), createElementBlock("form", {
978
- key: 0,
979
- disabled: _ctx.submitting,
980
- onSubmit: _cache[3] || (_cache[3] = withModifiers(($event) => {
981
- var _a;
982
- return (_a = _ctx.handleSubmit) == null ? void 0 : _a.call(_ctx);
983
- }, ["prevent"]))
984
- }, [
985
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.structure, (block, index) => {
986
- return openBlock(), createElementBlock("div", { key: index }, [
987
- block.title ? (openBlock(), createElementBlock("div", _hoisted_3$5, toDisplayString(block.title), 1)) : createCommentVNode("", true),
988
- createVNode(_component_FormFields, {
989
- fields: block.fields,
990
- "model-value": _ctx.modelValue,
991
- errors: _ctx.errors,
992
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event)),
993
- onChange: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("change", $event))
994
- }, null, 8, ["fields", "model-value", "errors"])
995
- ]);
996
- }), 128)),
997
- renderSlot(_ctx.$slots, "buttons", normalizeProps(guardReactiveProps({ cancel: _ctx.cancel, submit: _ctx.submit })), () => [
998
- _ctx.submit || _ctx.cancel ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
999
- _ctx.submit ? (openBlock(), createBlock(_component_Button, {
1000
- key: 0,
1001
- variant: "primary",
1002
- type: "submit",
1003
- label: _ctx.submitLabel,
1004
- disabled: _ctx.submitting,
1005
- "prefix-icon": _ctx.submitting ? "spinner" : void 0
1006
- }, null, 8, ["label", "disabled", "prefix-icon"])) : createCommentVNode("", true),
1007
- _ctx.cancel ? (openBlock(), createBlock(_component_Button, {
1008
- key: 1,
1009
- label: _ctx.cancelLabel,
1010
- disabled: _ctx.submitting,
1011
- onClick: _cache[2] || (_cache[2] = ($event) => _ctx.handleCancel())
1012
- }, null, 8, ["label", "disabled"])) : createCommentVNode("", true)
1013
- ])) : createCommentVNode("", true)
1014
- ], true)
1015
- ], 40, _hoisted_2$7)) : (openBlock(), createBlock(_component_Icon, {
1016
- key: 1,
1017
- name: "spinner"
1018
- }))
1019
- ]);
1020
- }
1021
- var Form = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-4a2acd7e"]]);
1022
- var Input_vue_vue_type_style_index_0_scoped_true_lang = "";
1023
- const sizes$1 = ["normal", "small"];
1024
- const _sfc_main$8 = defineComponent({
1025
- components: {
1026
- Icon
1027
- },
1028
- mixins: [transformInputAttrs],
1029
- inheritAttrs: false,
1030
- props: {
1031
- modelValue: {
1032
- type: [Number, String],
1033
- default: ""
1034
- },
1035
- prefixIcon: {
1036
- type: String,
1037
- default: ""
1038
- },
1039
- suffixIcon: {
1040
- type: String,
1041
- default: ""
1042
- },
1043
- size: {
1044
- type: String,
1045
- default: "normal",
1046
- validator: (value) => sizes$1.includes(value)
1047
- },
1048
- invalid: Boolean
1049
- },
1050
- computed: {
1051
- hasPrefix() {
1052
- return Boolean(this.$slots.prefix || this.prefixIcon);
1053
- },
1054
- hasSuffix() {
1055
- return Boolean(this.$slots.suffix || this.suffixIcon);
1056
- }
1057
- }
1058
- });
1059
- const _hoisted_1$7 = { class: "Input__icon Input__icon--left" };
1060
- const _hoisted_2$6 = ["aria-label", "value"];
1061
- const _hoisted_3$4 = { class: "Input__icon Input__icon--right" };
1062
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
1063
- const _component_Icon = resolveComponent("Icon");
1064
- return openBlock(), createElementBlock("div", {
1065
- class: normalizeClass(["Input vuiii-input", [
1066
- _ctx.$attrs.class,
1067
- {
1068
- "vuiii-input--invalid": _ctx.invalid,
1069
- "vuiii-input--disabled": _ctx.$attrs.disabled,
1070
- "vuiii-input--small": _ctx.size === "small"
1071
- }
1072
- ]]),
1073
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$refs.input.focus())
1074
- }, [
1075
- _ctx.hasPrefix ? renderSlot(_ctx.$slots, "prefix", { key: 0 }, () => [
1076
- createElementVNode("div", _hoisted_1$7, [
1077
- createVNode(_component_Icon, { name: _ctx.prefixIcon }, null, 8, ["name"])
1078
- ])
1079
- ], true) : createCommentVNode("", true),
1080
- createElementVNode("input", mergeProps({
1081
- ref: "input",
1082
- "aria-label": _ctx.$attrs.placeholder || "input"
1083
- }, _ctx.normalizedAttrs, {
1084
- class: "Input__nestedInput vuiii-input__nested",
1085
- value: _ctx.modelValue
1086
- }), null, 16, _hoisted_2$6),
1087
- _ctx.hasSuffix ? renderSlot(_ctx.$slots, "suffix", { key: 1 }, () => [
1088
- createElementVNode("div", _hoisted_3$4, [
1089
- createVNode(_component_Icon, { name: _ctx.suffixIcon }, null, 8, ["name"])
1090
- ])
1091
- ], true) : createCommentVNode("", true)
1092
- ], 2);
1093
- }
1094
- var Input = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__scopeId", "data-v-6a6438b5"]]);
1095
- var ModalLayout_vue_vue_type_style_index_0_scoped_true_lang = "";
1096
- const _sfc_main$7 = defineComponent({
1097
- components: {
1098
- Icon
1099
- },
1100
- props: {
1101
- title: {
1102
- type: String,
1103
- default: ""
1104
- },
1105
- width: {
1106
- type: [Number, String],
1107
- default: 600
1108
- },
1109
- hideCloser: Boolean,
1110
- scroll: Boolean,
1111
- plain: Boolean
1112
- },
1113
- computed: {
1114
- hasHeader() {
1115
- return Boolean(this.$slots.header || this.title);
1116
- },
1117
- hasFooter() {
1118
- return Boolean(this.$slots.footer);
1119
- },
1120
- computedStyle() {
1121
- const maxWidth = this.width + (Number(this.width) ? "px" : "");
1122
- if (maxWidth && maxWidth !== "auto") {
1123
- return {
1124
- width: "100%",
1125
- maxWidth
1126
- };
1127
- }
1128
- return {};
1129
- }
1130
- },
1131
- methods: {
1132
- close() {
1133
- window.dispatchEvent(new KeyboardEvent("keydown", { "key": "Escape" }));
1134
- }
1135
- }
1136
- });
1137
- const _hoisted_1$6 = {
1138
- key: 1,
1139
- class: "ModalLayout__header"
1140
- };
1141
- const _hoisted_2$5 = { class: "ModalLayout__title" };
1142
- const _hoisted_3$3 = { class: "ModalLayout__body" };
1143
- const _hoisted_4 = {
1144
- key: 2,
1145
- class: "ModalLayout__footer"
1146
- };
1147
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
1148
- const _component_Icon = resolveComponent("Icon");
1149
- return openBlock(), createElementBlock("div", {
1150
- class: normalizeClass(["ModalLayout", { hasHeader: _ctx.hasHeader, hasFooter: _ctx.hasFooter, isScrollable: _ctx.scroll, isPlain: _ctx.plain }]),
1151
- style: normalizeStyle(_ctx.computedStyle)
1152
- }, [
1153
- !_ctx.hideCloser ? (openBlock(), createElementBlock("div", {
1154
- key: 0,
1155
- class: "ModalLayout__close",
1156
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.close())
1157
- }, [
1158
- createVNode(_component_Icon, {
1159
- name: "x",
1160
- class: "ModalLayout__closeIcon"
1161
- })
1162
- ])) : createCommentVNode("", true),
1163
- _ctx.hasHeader ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
1164
- renderSlot(_ctx.$slots, "header", {}, () => [
1165
- createElementVNode("div", _hoisted_2$5, toDisplayString(_ctx.title), 1)
1166
- ], true)
1167
- ])) : createCommentVNode("", true),
1168
- createElementVNode("div", _hoisted_3$3, [
1169
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
1170
- ]),
1171
- _ctx.hasFooter ? (openBlock(), createElementBlock("div", _hoisted_4, [
1172
- renderSlot(_ctx.$slots, "footer", {}, void 0, true)
1173
- ])) : createCommentVNode("", true)
1174
- ], 6);
1175
- }
1176
- var ModalLayout = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__scopeId", "data-v-386279ac"]]);
1177
- var Radio_vue_vue_type_style_index_0_scoped_true_lang = "";
1178
- let iterator = 1;
1179
- const _sfc_main$6 = defineComponent({
1180
- mixins: [transformInputAttrs],
1181
- inheritAttrs: false,
1182
- props: {
1183
- modelValue: {
1184
- type: [String, Number],
1185
- default: void 0
1186
- },
1187
- options: {
1188
- type: [Array, Object],
1189
- required: true
1190
- },
1191
- optionLabelKey: {
1192
- type: [Function, String, Number],
1193
- default: void 0
1194
- },
1195
- optionValueKey: {
1196
- type: [Function, String, Number],
1197
- default: void 0
1198
- },
1199
- optionDisabledKey: {
1200
- type: [Function, String, Number],
1201
- default: void 0
1202
- },
1203
- required: Boolean
1204
- },
1205
- emits: ["update:modelValue"],
1206
- data() {
1207
- return {
1208
- inputName: "vuiii-radio-input-" + iterator++
1209
- };
1210
- },
1211
- computed: {
1212
- normalizedOptions() {
1213
- return normalizeOptions(this.options, {
1214
- value: this.optionValueKey,
1215
- label: this.optionLabelKey,
1216
- disabled: this.optionDisabledKey
1217
- });
1218
- }
1219
- }
1220
- });
1221
- const _hoisted_1$5 = { class: "Radio" };
1222
- const _hoisted_2$4 = ["value", "checked", "required", "name", "disabled"];
1223
- const _hoisted_3$2 = { class: "Radio__label" };
1224
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
1225
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
1226
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.normalizedOptions, (option) => {
1227
- return openBlock(), createElementBlock("label", {
1228
- key: option.value,
1229
- class: normalizeClass(["Radio__option", { "Radio--disabled": option.disabled }])
1230
- }, [
1231
- createElementVNode("input", mergeProps(_ctx.normalizedAttrs, {
1232
- value: option.value,
1233
- checked: _ctx.modelValue === option.value,
1234
- class: "Radio__input vuiii-input",
1235
- required: _ctx.required,
1236
- type: "Radio",
1237
- name: _ctx.inputName,
1238
- disabled: option.disabled
1239
- }), null, 16, _hoisted_2$4),
1240
- createElementVNode("div", _hoisted_3$2, [
1241
- renderSlot(_ctx.$slots, "default", {}, () => [
1242
- createTextVNode(toDisplayString(option.label), 1)
1243
- ], true)
1244
- ])
1245
- ], 2);
1246
- }), 128))
1247
- ]);
1248
- }
1249
- var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__scopeId", "data-v-0251715f"]]);
1250
- const sizes = ["normal", "small"];
1251
- const _sfc_main$5 = defineComponent({
1252
- mixins: [transformInputAttrs],
1253
- props: {
1254
- modelValue: {
1255
- type: [String, Number, Object],
1256
- default: ""
1257
- },
1258
- options: {
1259
- type: [Array, Object],
1260
- default: () => []
1261
- },
1262
- optionLabelKey: {
1263
- type: [Function, String, Number],
1264
- default: void 0
1265
- },
1266
- optionValueKey: {
1267
- type: [Function, String, Number],
1268
- default: void 0
1269
- },
1270
- optionDisabledKey: {
1271
- type: [Function, String, Number],
1272
- default: void 0
1273
- },
1274
- placeholder: {
1275
- type: String,
1276
- default: ""
1277
- },
1278
- size: {
1279
- type: String,
1280
- default: "normal",
1281
- validator: (value) => sizes.includes(value)
1282
- },
1283
- allowEmpty: Boolean
1284
- },
1285
- computed: {
1286
- normalizedOptions() {
1287
- return normalizeOptions(this.options, {
1288
- value: this.optionValueKey,
1289
- label: this.optionLabelKey,
1290
- disabled: this.optionDisabledKey
1291
- });
1292
- }
1293
- }
1294
- });
1295
- const _hoisted_1$4 = ["value"];
1296
- const _hoisted_2$3 = ["disabled"];
1297
- const _hoisted_3$1 = ["disabled", "value"];
1298
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
1299
- return openBlock(), createElementBlock("select", mergeProps({ class: "Select vuiii-input" }, _ctx.normalizedAttrs, {
1300
- class: [_ctx.$attrs.class, { "vuiii-input--small": _ctx.size === "small" }],
1301
- value: _ctx.modelValue
1302
- }), [
1303
- _ctx.placeholder ? (openBlock(), createElementBlock("option", {
1304
- key: 0,
1305
- disabled: !_ctx.allowEmpty,
1306
- selected: "",
1307
- value: ""
1308
- }, toDisplayString(_ctx.placeholder), 9, _hoisted_2$3)) : createCommentVNode("", true),
1309
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.normalizedOptions, (option) => {
1310
- return openBlock(), createElementBlock("option", {
1311
- key: option.value,
1312
- disabled: option.disabled,
1313
- value: option.value
1314
- }, toDisplayString(option.label), 9, _hoisted_3$1);
1315
- }), 128))
1316
- ], 16, _hoisted_1$4);
1317
- }
1318
- var Select = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
1319
- var table = "";
1320
- var typography = "";
1321
- const _sfc_main$4 = defineComponent({
1322
- props: {
1323
- items: {
1324
- type: Array,
1325
- default: () => []
1326
- },
1327
- columns: {
1328
- type: Object,
1329
- default: null
1330
- },
1331
- rowClass: {
1332
- type: [String, Function],
1333
- default: null
1334
- }
1335
- },
1336
- computed: {
1337
- normalizedColumns() {
1338
- return Object.entries(this.columns).reduce((result, [key, options]) => __spreadProps(__spreadValues({}, result), {
1339
- [key]: typeof options === "string" ? { label: options } : options
1340
- }), {});
1341
- }
1342
- },
1343
- methods: {
1344
- formatValue(item, key) {
1345
- const column = this.normalizedColumns[key];
1346
- const value = typeof column.value === "function" ? column.value(item) : item[key];
1347
- if (column.format) {
1348
- return column.format(value);
1349
- }
1350
- return value;
1351
- },
1352
- resolveRowClass(item) {
1353
- return typeof this.rowClass === "function" ? this.rowClass(item) : this.rowClass;
1354
- }
1355
- }
1356
- });
1357
- const _hoisted_1$3 = { class: "vuiii-table vuiii-table--hover" };
1358
- const _hoisted_2$2 = ["width"];
1359
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
1360
- const _component_router_link = resolveComponent("router-link");
1361
- return openBlock(), createElementBlock("table", _hoisted_1$3, [
1362
- createElementVNode("thead", null, [
1363
- createElementVNode("tr", null, [
1364
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.normalizedColumns, (column, key) => {
1365
- return openBlock(), createElementBlock("th", {
1366
- key,
1367
- style: normalizeStyle({ textAlign: column.align || "left" }),
1368
- width: column.width
1369
- }, toDisplayString(column.label), 13, _hoisted_2$2);
1370
- }), 128))
1371
- ])
1372
- ]),
1373
- createElementVNode("tbody", null, [
1374
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item, index) => {
1375
- return openBlock(), createElementBlock("tr", {
1376
- key: index,
1377
- class: normalizeClass(_ctx.resolveRowClass(item))
1378
- }, [
1379
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.normalizedColumns, (column, key) => {
1380
- return openBlock(), createElementBlock("td", {
1381
- key,
1382
- style: normalizeStyle({ textAlign: column.align || "left" })
1383
- }, [
1384
- renderSlot(_ctx.$slots, key, normalizeProps(guardReactiveProps({ item })), () => [
1385
- column.href ? (openBlock(), createBlock(_component_router_link, {
1386
- key: 0,
1387
- class: "vuiii-link",
1388
- to: column.href(item)
1389
- }, {
1390
- default: withCtx(() => [
1391
- createTextVNode(toDisplayString(_ctx.formatValue(item, key)), 1)
1392
- ]),
1393
- _: 2
1394
- }, 1032, ["to"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1395
- createTextVNode(toDisplayString(_ctx.formatValue(item, key)), 1)
1396
- ], 64))
1397
- ])
1398
- ], 4);
1399
- }), 128))
1400
- ], 2);
1401
- }), 128))
1402
- ])
1403
- ]);
1404
- }
1405
- var Table = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
1406
- const _sfc_main$3 = defineComponent({
1407
- mixins: [transformInputAttrs],
1408
- props: {
1409
- modelValue: {
1410
- type: String,
1411
- default: ""
1412
- }
1413
- }
1414
- });
1415
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
1416
- return openBlock(), createElementBlock("textarea", mergeProps({ class: "Textarea vuiii-input" }, _ctx.normalizedAttrs), null, 16);
1417
- }
1418
- var Textarea = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
1419
- var ModalLayoutDialog_vue_vue_type_style_index_0_scoped_true_lang = "";
1420
- const _sfc_main$2 = defineComponent({
1421
- components: {
1422
- ModalLayout,
1423
- Button
1424
- },
1425
- props: {
1426
- title: {
1427
- type: String,
1428
- default: ""
1429
- },
1430
- message: {
1431
- type: String,
1432
- default: ""
1433
- },
1434
- buttons: {
1435
- type: Array,
1436
- default: () => []
1437
- }
1438
- },
1439
- emits: ["close"]
1440
- });
1441
- const _hoisted_1$2 = { class: "ModalLayoutDialog__buttons" };
1442
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1443
- var _a;
1444
- const _component_Button = resolveComponent("Button");
1445
- const _component_ModalLayout = resolveComponent("ModalLayout");
1446
- return openBlock(), createBlock(_component_ModalLayout, {
1447
- class: "ModalLayoutDialog",
1448
- width: "480",
1449
- title: _ctx.title
1450
- }, createSlots({
1451
- default: withCtx(() => [
1452
- createElementVNode("div", {
1453
- class: normalizeClass(["ModalLayoutDialog__message", { "ModalLayoutDialog__message--offset": !_ctx.title }])
1454
- }, toDisplayString(_ctx.message), 3)
1455
- ]),
1456
- _: 2
1457
- }, [
1458
- ((_a = _ctx.buttons) == null ? void 0 : _a.length) ? {
1459
- name: "footer",
1460
- fn: withCtx(() => [
1461
- createElementVNode("div", _hoisted_1$2, [
1462
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.buttons, (button2, $index) => {
1463
- return openBlock(), createElementBlock("span", {
1464
- key: $index,
1465
- class: "ModalLayoutDialog__buttonWrapper"
1466
- }, [
1467
- createVNode(_component_Button, {
1468
- type: "button",
1469
- variant: button2.variant,
1470
- "prefix-icon": button2.icon,
1471
- autofocus: "",
1472
- onClick: ($event) => _ctx.$emit("close", button2.value)
1473
- }, {
1474
- default: withCtx(() => [
1475
- createTextVNode(toDisplayString(button2.label), 1)
1476
- ]),
1477
- _: 2
1478
- }, 1032, ["variant", "prefix-icon", "onClick"])
1479
- ]);
1480
- }), 128))
1481
- ])
1482
- ])
1483
- } : void 0
1484
- ]), 1032, ["title"]);
1485
- }
1486
- var ModalLayoutDialog = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-612c6cb9"]]);
1487
- var ModalStack_vue_vue_type_style_index_0_scoped_true_lang = "";
1488
- const _sfc_main$1 = defineComponent({
1489
- props: {
1490
- modals: {
1491
- type: Array,
1492
- default: () => []
1493
- }
1494
- },
1495
- emits: ["closeModal"],
1496
- data() {
1497
- return {
1498
- modalInstances: {},
1499
- registerReference(modalId) {
1500
- return (instance) => this.modalInstances[modalId] = instance;
1501
- }
1502
- };
1503
- },
1504
- computed: {
1505
- activeModal() {
1506
- return this.modals.length ? this.modals[this.modals.length - 1] : null;
1507
- }
1508
- },
1509
- mounted() {
1510
- window.addEventListener("keydown", this.closeActiveModalByEscapeKey);
1511
- },
1512
- beforeUnmount() {
1513
- window.removeEventListener("keydown", this.closeActiveModalByEscapeKey);
1514
- },
1515
- methods: {
1516
- closeModal(modal2, result) {
1517
- var _a;
1518
- const close = () => {
1519
- this.$emit("closeModal", { modal: modal2, result });
1520
- };
1521
- const modalRootInstance = this.modalInstances[modal2.id].$el;
1522
- if ((_a = modalRootInstance.$attrs) == null ? void 0 : _a.onBeforeClose) {
1523
- modalRootInstance.$attrs.onBeforeClose(close);
1524
- } else {
1525
- close();
1526
- }
1527
- },
1528
- closeActiveModal() {
1529
- if (this.activeModal) {
1530
- this.closeModal(this.activeModal);
1531
- }
1532
- },
1533
- closeActiveModalByEscapeKey(e) {
1534
- if (this.activeModal && e.key === "Escape" && !e.defaultPrevented) {
1535
- e.preventDefault();
1536
- this.closeActiveModal();
1537
- }
1538
- },
1539
- closeModalByBackdropClick(e, modal2) {
1540
- if (e.target === e.currentTarget) {
1541
- this.closeModal(modal2);
1542
- }
1543
- }
1544
- }
1545
- });
1546
- const _hoisted_1$1 = { class: "ModalStack" };
1547
- const _hoisted_2$1 = {
1548
- key: 0,
1549
- class: "ModalStack__backdrop"
1550
- };
1551
- const _hoisted_3 = ["onClick"];
1552
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1553
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
1554
- createVNode(Transition, { name: "ModalStack__backdrop" }, {
1555
- default: withCtx(() => [
1556
- _ctx.modals.length ? (openBlock(), createElementBlock("div", _hoisted_2$1)) : createCommentVNode("", true)
1557
- ]),
1558
- _: 1
1559
- }),
1560
- createVNode(TransitionGroup, { name: "ModalStack__modal" }, {
1561
- default: withCtx(() => [
1562
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modals, (modal2) => {
1563
- var _a;
1564
- return openBlock(), createElementBlock("div", {
1565
- key: modal2.id,
1566
- class: "ModalStack__modalWrapper",
1567
- onClick: ($event) => _ctx.closeModalByBackdropClick($event, modal2)
1568
- }, [
1569
- (openBlock(), createBlock(resolveDynamicComponent(modal2.component), mergeProps(modal2.props, {
1570
- ref_for: true,
1571
- ref: _ctx.registerReference(modal2.id),
1572
- class: ["ModalStack__modal", { isActive: ((_a = _ctx.activeModal) == null ? void 0 : _a.id) === modal2.id }],
1573
- onClose: ($event) => _ctx.closeModal(modal2, $event)
1574
- }), null, 16, ["class", "onClose"]))
1575
- ], 8, _hoisted_3);
1576
- }), 128))
1577
- ]),
1578
- _: 1
1579
- })
1580
- ]);
1581
- }
1582
- var ModalStack = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-2f4ee2c2"]]);
1583
- const defaultConfig = {
1584
- cancelLabel: "Cancel",
1585
- confirmLabel: "OK"
1586
- };
1587
- const modal = (app, config = {}) => {
1588
- let iterator2 = 1;
1589
- config = __spreadValues(__spreadValues({}, defaultConfig), config);
1590
- const state = reactive({
1591
- modals: []
1592
- });
1593
- const closeModal = (modal2, result) => {
1594
- var _a;
1595
- state.modals = state.modals.filter(({ id }) => id !== modal2.id);
1596
- modal2.resolve(result);
1597
- (_a = modal2.focusElement) == null ? void 0 : _a.focus();
1598
- };
1599
- const modalApp = createApp({
1600
- parent: app,
1601
- data() {
1602
- return state;
1603
- },
1604
- render() {
1605
- return h(ModalStack, {
1606
- modals: state.modals,
1607
- onCloseModal: ({ modal: modal2, result }) => closeModal(modal2, result)
1608
- });
1609
- }
1610
- });
1611
- const placeholder = document.createElement("div");
1612
- document.body.appendChild(placeholder);
1613
- modalApp.mount(placeholder);
1614
- const openModal = (component, props) => {
1615
- var _a;
1616
- const focusElement = document.activeElement;
1617
- (_a = focusElement.blur) == null ? void 0 : _a.call(focusElement);
1618
- return new Promise((resolve) => {
1619
- state.modals.push({
1620
- id: iterator2++,
1621
- component,
1622
- props,
1623
- resolve,
1624
- focusElement
1625
- });
1626
- });
1627
- };
1628
- const openDialog = (options) => {
1629
- return openModal(ModalLayoutDialog, options);
1630
- };
1631
- const openAlert = (options) => {
1632
- if (typeof options === "string") {
1633
- options = {
1634
- message: options
1635
- };
1636
- }
1637
- const { title, message, confirmVariant, confirmLabel = config.confirmLabel, confirmIcon } = options;
1638
- return openDialog({
1639
- title,
1640
- message,
1641
- buttons: [
1642
- {
1643
- variant: confirmVariant || "primary",
1644
- label: confirmLabel || "",
1645
- icon: confirmIcon
1646
- }
1647
- ]
1648
- });
1649
- };
1650
- const openConfirm = (options) => {
1651
- if (typeof options === "string") {
1652
- options = {
1653
- message: options
1654
- };
1655
- }
1656
- const {
1657
- title,
1658
- message,
1659
- cancelLabel = config.cancelLabel,
1660
- cancelVariant,
1661
- cancelIcon,
1662
- confirmLabel = config.confirmLabel,
1663
- confirmVariant,
1664
- confirmIcon
1665
- } = options;
1666
- return openDialog({
1667
- title,
1668
- message,
1669
- buttons: [
1670
- {
1671
- variant: cancelVariant,
1672
- label: cancelLabel || "",
1673
- icon: cancelIcon,
1674
- value: false
1675
- },
1676
- {
1677
- variant: confirmVariant || "primary",
1678
- label: confirmLabel || "",
1679
- icon: confirmIcon,
1680
- value: true
1681
- }
1682
- ]
1683
- });
1684
- };
1685
- app.config.globalProperties.$modal = {
1686
- open: openModal,
1687
- dialog: openDialog,
1688
- alert: openAlert,
1689
- confirm: openConfirm
1690
- };
1691
- };
1692
- function useModal() {
1693
- var _a;
1694
- return (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$modal;
1695
- }
1696
- var SnackbarStack_vue_vue_type_style_index_0_scoped_true_lang = "";
1697
- const _sfc_main = defineComponent({
1698
- components: {
1699
- Icon
1700
- },
1701
- props: {
1702
- messages: {
1703
- type: Array,
1704
- default: () => []
1705
- }
1706
- },
1707
- emits: ["remove-message"],
1708
- computed: {
1709
- messagesInReverse() {
1710
- return [...this.messages].reverse();
1711
- }
1712
- }
1713
- });
1714
- const _hoisted_1 = { class: "Snackbar" };
1715
- const _hoisted_2 = ["onClick"];
1716
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1717
- const _component_Icon = resolveComponent("Icon");
1718
- return openBlock(), createElementBlock("div", _hoisted_1, [
1719
- createVNode(TransitionGroup, { name: "Snackbar__transition" }, {
1720
- default: withCtx(() => [
1721
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.messagesInReverse, (message, index) => {
1722
- return openBlock(), createElementBlock("div", {
1723
- key: message.id,
1724
- class: "Snackbar__message"
1725
- }, [
1726
- createElementVNode("div", {
1727
- class: "Snackbar__messageWrapper",
1728
- style: normalizeStyle({ transform: `translateY(-${100 * index}%)` })
1729
- }, [
1730
- createElementVNode("div", {
1731
- class: normalizeClass(["Snackbar__messageBlock", `Snackbar__messageBlock--${message.type}`])
1732
- }, [
1733
- createElementVNode("div", null, toDisplayString(message.text), 1),
1734
- createElementVNode("div", {
1735
- class: "Snackbar__messageClose",
1736
- onClick: ($event) => _ctx.$emit("remove-message", message.id)
1737
- }, [
1738
- createVNode(_component_Icon, {
1739
- class: "Snackbar__messageCloseIcon",
1740
- name: "x"
1741
- })
1742
- ], 8, _hoisted_2)
1743
- ], 2)
1744
- ], 4)
1745
- ]);
1746
- }), 128))
1747
- ]),
1748
- _: 1
1749
- })
1750
- ]);
1751
- }
1752
- var SnackbarStack = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-272e7ab3"]]);
1753
- const DEFAULT_MESSAGE_DURATION = 1e4;
1754
- const MAX_MESSAGES = 5;
1755
- const snackbar = (app) => {
1756
- let iterator2 = 1;
1757
- const state = reactive({
1758
- messages: []
1759
- });
1760
- const removeMessage = (messageId) => {
1761
- state.messages = state.messages.filter(({ id }) => id !== messageId);
1762
- };
1763
- const snackbarApp = createApp({
1764
- parent: app,
1765
- data() {
1766
- return state;
1767
- },
1768
- render() {
1769
- return h(SnackbarStack, { messages: this.messages, onRemoveMessage: removeMessage });
1770
- }
1771
- });
1772
- const placeholder = document.createElement("div");
1773
- document.body.appendChild(placeholder);
1774
- snackbarApp.mount(placeholder);
1775
- const showMessage = (text, type = "success", duration = DEFAULT_MESSAGE_DURATION) => {
1776
- const id = iterator2++;
1777
- state.messages.push({ text, type, id });
1778
- if (state.messages.length > MAX_MESSAGES) {
1779
- state.messages.shift();
1780
- }
1781
- if (duration > 0) {
1782
- setTimeout(() => removeMessage(id), duration);
1783
- }
1784
- };
1785
- app.config.globalProperties.$snackbar = {
1786
- success: (text) => showMessage(text, "success"),
1787
- error: (text) => showMessage(text, "error", 0)
1788
- };
1789
- };
1790
- function useSnackbar() {
1791
- var _a;
1792
- return (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$snackbar;
1793
- }
1794
- function useSubmitAction(action, options = {}) {
1795
- const snackbar2 = useSnackbar();
1796
- const modal2 = useModal();
1797
- const router = useRouter();
1798
- const isSubmitting = ref(false);
1799
- const result = ref();
1800
- const errors = ref(Object.freeze({}));
1801
- const submit = async (data) => {
1802
- var _a, _b;
1803
- if (options.confirm && modal2) {
1804
- const confirmed = await modal2.confirm(typeof options.confirm === "function" ? options.confirm(data) : options.confirm);
1805
- if (!confirmed) {
1806
- return;
1807
- }
1808
- }
1809
- if (options.validator) {
1810
- const validationResult = await options.validator(data);
1811
- (_a = options.onValidationResults) == null ? void 0 : _a.call(options, validationResult);
1812
- if (!validationResult) {
1813
- return;
1814
- }
1815
- if (typeof validationResult === "object") {
1816
- errors.value = (validationResult == null ? void 0 : validationResult.errors) || {};
1817
- if (!(validationResult == null ? void 0 : validationResult.isValid)) {
1818
- return;
1819
- }
1820
- }
1821
- }
1822
- isSubmitting.value = true;
1823
- try {
1824
- result.value = await action(data);
1825
- } catch (error) {
1826
- if (options.errorMessage && snackbar2) {
1827
- snackbar2.error(typeof options.errorMessage === "function" ? options.errorMessage(error, data) : options.errorMessage || error.message);
1828
- }
1829
- isSubmitting.value = false;
1830
- if (options.onError) {
1831
- const hasErrorBeenResolved = options.onError({ error, data, router, snackbar: snackbar2 });
1832
- if (hasErrorBeenResolved) {
1833
- return;
1834
- }
1835
- }
1836
- throw error;
1837
- }
1838
- isSubmitting.value = false;
1839
- if (options.successMessage && snackbar2) {
1840
- snackbar2.success(typeof options.successMessage === "function" ? options.successMessage(result.value, data) : options.successMessage);
1841
- }
1842
- (_b = options.onSuccess) == null ? void 0 : _b.call(options, { result: result.value, data, router, snackbar: snackbar2 });
1843
- if (options.redirectOnSuccess) {
1844
- router.push(typeof options.redirectOnSuccess === "function" ? options.redirectOnSuccess(result.value, data) : options.redirectOnSuccess);
1845
- }
1846
- return result.value;
1847
- };
1848
- if (options.immediate) {
1849
- onMounted(submit);
1850
- }
1851
- return {
1852
- submit,
1853
- errors,
1854
- result,
1855
- isSubmitting
1856
- };
1857
- }
1858
- const useLoadData = (source, options = {}) => {
1859
- const {
1860
- isSubmitting: isLoading,
1861
- submit: load,
1862
- result: data
1863
- } = useSubmitAction(source, {
1864
- onSuccess: ({ router, data: data2, result }) => {
1865
- var _a;
1866
- return (_a = options.onSuccess) == null ? void 0 : _a.call(options, { data: result, params: data2, router });
1867
- },
1868
- onError: ({ router, error, data: data2 }) => {
1869
- var _a;
1870
- return (_a = options.onError) == null ? void 0 : _a.call(options, { error, params: data2, router });
1871
- },
1872
- successMessage: options.successMessage,
1873
- errorMessage: options.errorMessage,
1874
- immediate: options.immediate
1875
- });
1876
- return {
1877
- load,
1878
- isLoading,
1879
- data
1880
- };
1881
- };
1882
- export { Breadcrumbs, Button, Checkbox, CheckboxGroup, Form, FormFields, FormGroup, Icon, Input, ModalLayout, Radio, Select, Table, Textarea, modal, registerCustomIconResolver, snackbar, useLoadData, useModal, useSnackbar, useSubmitAction };