@gradient-ui/core 0.2.0 → 0.4.0

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 (52) hide show
  1. package/README.md +2 -0
  2. package/dist/{GLoading.vue_vue_type_style_index_0_lang-DDqJEYGf.js → GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js} +195 -206
  3. package/dist/GLoading.vue_vue_type_style_index_0_lang-cokm-HBh.cjs +1 -0
  4. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BmbKqNgm.js +6421 -0
  5. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-By_7hZOW.cjs +4 -0
  6. package/dist/components.cjs +1 -1
  7. package/dist/components.mjs +39 -38
  8. package/dist/directives.cjs +1 -1
  9. package/dist/directives.mjs +1 -1
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.mjs +92 -88
  12. package/dist/{mask-BgaDaVWU.js → mask-Bu8cjwwH.js} +22 -21
  13. package/dist/mask-D1vJj5Hl.cjs +1 -0
  14. package/dist/propsFactory-DyyboUaC.cjs +1 -0
  15. package/dist/propsFactory-UhcvubZJ.js +13 -0
  16. package/dist/services.cjs +1 -1
  17. package/dist/services.mjs +1 -1
  18. package/dist/style.css +1 -1
  19. package/dist/tagName-CYG1CUfd.js +103 -0
  20. package/dist/tagName-CbsvFHGg.cjs +1 -0
  21. package/dist/types/components/index.d.ts +2 -0
  22. package/dist/types/components/ui/GButton/GButton.vue.d.ts +62 -2
  23. package/dist/types/components/ui/GButton/types.d.ts +76 -40
  24. package/dist/types/components/ui/GNavbar/GNavbarItem.vue.d.ts +3 -3
  25. package/dist/types/components/ui/GNavbar/GNavbarMenu.vue.d.ts +3 -3
  26. package/dist/types/components/ui/GTable/GTable.vue.d.ts +143 -0
  27. package/dist/types/components/ui/GTable/GTableBody.vue.d.ts +69 -0
  28. package/dist/types/components/ui/GTable/GTableCell.vue.d.ts +35 -0
  29. package/dist/types/components/ui/GTable/GTableExpandedRow.vue.d.ts +25 -0
  30. package/dist/types/components/ui/GTable/GTableHead.vue.d.ts +30 -0
  31. package/dist/types/components/ui/GTable/GTableRow.vue.d.ts +40 -0
  32. package/dist/types/components/ui/GTable/context.d.ts +25 -0
  33. package/dist/types/components/ui/GTable/index.d.ts +3 -0
  34. package/dist/types/components/ui/GTable/types.d.ts +318 -0
  35. package/dist/types/components/ui/GTable/useTable.d.ts +22 -0
  36. package/dist/types/components/ui/GTable/useTableExpansion.d.ts +17 -0
  37. package/dist/types/components/ui/GTable/useTableSpans.d.ts +12 -0
  38. package/dist/types/use/index.d.ts +1 -0
  39. package/dist/types/use/tagName.d.ts +47 -0
  40. package/dist/use.cjs +1 -1
  41. package/dist/use.mjs +15 -12
  42. package/dist/useSnackbar-2iJU4bdd.js +769 -0
  43. package/dist/useSnackbar-3QuH25xm.cjs +1 -0
  44. package/package.json +2 -2
  45. package/dist/GLoading.vue_vue_type_style_index_0_lang-CqbeZChH.cjs +0 -1
  46. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-Bufs8uqY.js +0 -5633
  47. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-CH9jX5W1.cjs +0 -4
  48. package/dist/icon-0-mbYGMr.cjs +0 -1
  49. package/dist/icon-BrFRYYf3.js +0 -66
  50. package/dist/mask-pzGv8apS.cjs +0 -1
  51. package/dist/useSnackbar-CFrWSpt4.cjs +0 -1
  52. package/dist/useSnackbar-lGrTDbl-.js +0 -763
@@ -0,0 +1,769 @@
1
+ import { defineComponent as I, computed as p, unref as l, openBlock as v, createBlock as G, resolveDynamicComponent as K, mergeProps as x, createCommentVNode as y, toRef as T, useCssVars as ee, toRefs as be, createElementBlock as b, normalizeStyle as H, normalizeClass as S, createElementVNode as k, renderSlot as $, toValue as R, useSlots as te, useAttrs as Se, resolveDirective as X, withDirectives as Y, withCtx as j, createVNode as W, Fragment as ke, createTextVNode as M, toDisplayString as J, shallowRef as ne, ref as V, onUnmounted as ae, createApp as oe, watch as he, onBeforeUnmount as Ce, reactive as $e, h as L } from "vue";
2
+ import { c as D, d as Be, e as se, u as re, f as we, g as B, h as Pe, i as Ge, j as Ie, k as Ne, l as ze, n as Ae, o as Oe, p as ie, q as Re, s as ce, _ as Ve, a as xe } from "./GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js";
3
+ import { p as h } from "./propsFactory-UhcvubZJ.js";
4
+ import "@mdi/js";
5
+ import { a as le, m as Te, d as We } from "./tagName-CYG1CUfd.js";
6
+ const De = () => ({
7
+ icon: {
8
+ type: String,
9
+ required: !0
10
+ },
11
+ size: {
12
+ type: [Number, String],
13
+ default: void 0
14
+ },
15
+ tag: {
16
+ type: String,
17
+ default: "span"
18
+ }
19
+ }), qe = /* @__PURE__ */ I({
20
+ __name: "GIcon",
21
+ props: De(),
22
+ setup(e) {
23
+ const t = e, s = le(() => t.icon), n = p(
24
+ () => t.size == null ? "var(--g-token-icon-size-m)" : Number.isFinite(Number(t.size)) ? `${t.size}px` : String(t.size)
25
+ );
26
+ return (c, r) => l(s).icon ? (v(), G(K(l(s).component), x({
27
+ key: 0,
28
+ icon: l(s).icon,
29
+ tag: t.tag,
30
+ class: "g-icon",
31
+ style: { fontSize: n.value }
32
+ }, c.$attrs), null, 16, ["icon", "tag", "style"])) : y("", !0);
33
+ }
34
+ }), Z = /* @__PURE__ */ D(qe, [["__scopeId", "data-v-f1c09700"]]), Ee = h({
35
+ placement: {
36
+ type: String,
37
+ default: "bottom"
38
+ }
39
+ });
40
+ function Fe(e, t) {
41
+ return p(() => `${t}_${e.placement}`);
42
+ }
43
+ const Le = h({
44
+ active: Boolean,
45
+ ...se(),
46
+ glow: [Boolean, Number, String],
47
+ animateGlow: Boolean,
48
+ shadow: Boolean,
49
+ ...Be()
50
+ });
51
+ function Ue(e, t = "g-gradient") {
52
+ const s = re(e, t), n = we(e, t);
53
+ return {
54
+ glowClasses: p(() => ({
55
+ [s.value]: !0,
56
+ [n.value]: !0,
57
+ [`${t}_active`]: e.active,
58
+ [`${t}_glow`]: e.glow,
59
+ [`${t}_animate-glow`]: e.animateGlow,
60
+ [`${t}_shadow`]: e.shadow
61
+ }))
62
+ };
63
+ }
64
+ const He = h({
65
+ borderRadius: {
66
+ type: [Number, String],
67
+ default: 4
68
+ },
69
+ inheritWidth: Boolean
70
+ });
71
+ function je(e) {
72
+ return {
73
+ surfaceBorderRadius: B(T(e, "borderRadius"))
74
+ };
75
+ }
76
+ const Me = h({
77
+ ...se(),
78
+ ...Ge(),
79
+ ...Pe(),
80
+ ...Ee({
81
+ placement: "center"
82
+ }),
83
+ borderRadius: {
84
+ type: [Number, String],
85
+ default: 4
86
+ },
87
+ borderWidth: {
88
+ type: [Number, String],
89
+ default: 1
90
+ },
91
+ color: String,
92
+ state: String
93
+ }), ue = h({
94
+ ...Me(),
95
+ ...Le(),
96
+ ...He()
97
+ });
98
+ function Je(e) {
99
+ const t = B(T(e, "borderWidth")), s = B(T(e, "borderRadius")), n = p(() => t.value ? `calc(${s.value} + ${t.value})` : s.value), c = re(e, "g-gradient"), r = Fe(e, "g-gradient"), i = Ie(e, "g-gradient"), a = Ne(
100
+ () => e.color ?? e.state
101
+ ), o = p(() => ({
102
+ [c.value]: !0,
103
+ [r.value]: !0,
104
+ [i.value]: !0,
105
+ "g-gradient_inherit-width": e.inheritWidth,
106
+ [`g-gradient_${e.placement}`]: e.placement,
107
+ [`g-gradient_${e.state}`]: e.state,
108
+ [`g-gradient_border_${e.borderWidth}`]: !0
109
+ })), u = p(() => ({
110
+ "--g-border-radius": s.value,
111
+ "--g-border-width": t.value,
112
+ "--g-gradient-current": a.value
113
+ }));
114
+ return {
115
+ borderWidthPx: t,
116
+ borderRadiusPx: s,
117
+ containerBorderRadius: n,
118
+ resolvedGradient: a,
119
+ gradientClasses: o,
120
+ gradientStyles: u
121
+ };
122
+ }
123
+ const Ke = { class: "g-gradient__slot" }, Qe = /* @__PURE__ */ I({
124
+ __name: "GGradient",
125
+ props: ue(),
126
+ setup(e) {
127
+ ee((u) => ({
128
+ v3beb5b00: l(c),
129
+ ea600628: l(o),
130
+ v61d97152: l(n)
131
+ }));
132
+ const t = e, { borderWidth: s } = be(t), n = B(s), { containerBorderRadius: c, gradientClasses: r, gradientStyles: i } = Je(t), { glowClasses: a } = Ue(t), { surfaceBorderRadius: o } = je(t);
133
+ return (u, d) => (v(), b("div", {
134
+ class: S(["g-gradient", [l(r), l(a)]]),
135
+ style: H(l(i))
136
+ }, [
137
+ k("div", Ke, [
138
+ $(u.$slots, "default", {}, void 0, !0)
139
+ ])
140
+ ], 6));
141
+ }
142
+ }), Xe = /* @__PURE__ */ D(Qe, [["__scopeId", "data-v-f23c788d"]]), Ye = /* @__PURE__ */ I({
143
+ __name: "GIcon",
144
+ props: {
145
+ icon: {},
146
+ size: { default: 20 },
147
+ tag: { default: "span" }
148
+ },
149
+ setup(e) {
150
+ const t = e, s = B(T(t, "size")), n = le(() => t.icon);
151
+ return (c, r) => (v(), G(K(l(n).component), x({
152
+ icon: l(n).icon,
153
+ tag: t.tag,
154
+ class: "g-icon",
155
+ style: { fontSize: l(s) }
156
+ }, c.$attrs), null, 16, ["icon", "tag", "style"]));
157
+ }
158
+ }), U = /* @__PURE__ */ D(Ye, [["__scopeId", "data-v-1e1fd36a"]]), Ze = h({
159
+ ...Ae(),
160
+ ...ze(),
161
+ active: Boolean,
162
+ activeColor: String,
163
+ activeState: String,
164
+ activeVariant: String
165
+ });
166
+ function et(e, t, s = {}) {
167
+ const { disabledClass: n, roundedClass: c, stateClass: r } = Oe(
168
+ e,
169
+ t
170
+ ), {
171
+ surfaceOverlayClasses: i,
172
+ surfaceUnderlayClasses: a,
173
+ surfaceContentClasses: o
174
+ } = ie(t), u = Re(e, t), d = p(
175
+ () => !!(R(s.active) ?? e.active)
176
+ ), g = p(() => !!R(s.selected)), { resolvedColor: _, resolvedState: C, colorStyles: N } = ce({
177
+ color: () => R(e.color),
178
+ state: () => e.state,
179
+ active: () => d.value || g.value,
180
+ activeColor: () => R(e.activeColor),
181
+ activeState: () => e.activeState
182
+ }), f = p(
183
+ () => (g.value || d.value) && e.activeVariant ? e.activeVariant : e.variant
184
+ );
185
+ return {
186
+ actionSurfaceClasses: p(() => {
187
+ const w = !!R(s.focused);
188
+ return [
189
+ `${t}_${f.value}`,
190
+ n.value,
191
+ c.value,
192
+ r.value,
193
+ u.value,
194
+ w ? `${t}_focused` : "",
195
+ g.value ? `${t}_selected` : "",
196
+ d.value ? `${t}_active` : ""
197
+ ].filter(Boolean);
198
+ }),
199
+ resolvedColor: _,
200
+ resolvedState: C,
201
+ resolvedVariant: f,
202
+ surfaceStyles: N,
203
+ surfaceOverlayClasses: i,
204
+ surfaceUnderlayClasses: a,
205
+ surfaceContentClasses: o
206
+ };
207
+ }
208
+ const tt = h({
209
+ prepend: String,
210
+ append: String,
211
+ label: String
212
+ }), nt = h({
213
+ ...Ze(),
214
+ ...tt(),
215
+ ...ue(),
216
+ ...Te(),
217
+ isIconButton: Boolean,
218
+ iconButton: String,
219
+ ripple: {
220
+ type: [Boolean, String, Object],
221
+ default: !0
222
+ }
223
+ }), at = {
224
+ key: 0,
225
+ class: "g-button__prepend"
226
+ }, ot = { class: "g-button__label" }, st = {
227
+ key: 1,
228
+ class: "g-button__append"
229
+ }, rt = /* @__PURE__ */ I({
230
+ inheritAttrs: !1,
231
+ __name: "GButton",
232
+ props: nt({
233
+ borderWidth: 0,
234
+ borderRadius: 4,
235
+ placement: "center"
236
+ }),
237
+ setup(e) {
238
+ ee((f) => ({
239
+ v7dbfdfb3: l(c)
240
+ }));
241
+ const t = te(), s = Se(), n = e, c = B(n.borderRadius), r = p(() => n.disabled || n.ripple === !1 ? !1 : typeof n.ripple == "object" ? {
242
+ ...n.ripple,
243
+ disabled: n.ripple.disabled || n.disabled
244
+ } : n.ripple), { tagName: i, tagAttrs: a } = We(n, "button"), {
245
+ actionSurfaceClasses: o,
246
+ resolvedColor: u,
247
+ resolvedState: d,
248
+ surfaceStyles: g,
249
+ surfaceOverlayClasses: _,
250
+ surfaceUnderlayClasses: C,
251
+ surfaceContentClasses: N
252
+ } = et(n, "g-button");
253
+ return (f, q) => {
254
+ const w = X("ripple"), E = X("gradient-icon");
255
+ return Y((v(), G(Xe, x({ class: "g-gradient" }, {
256
+ ...n,
257
+ color: l(u),
258
+ state: l(d)
259
+ }), {
260
+ default: j(() => [
261
+ Y((v(), G(K(l(i)), x({
262
+ class: ["g-button", [
263
+ l(o),
264
+ {
265
+ "g-button_icon": f.iconButton || f.isIconButton
266
+ }
267
+ ]],
268
+ style: l(g)
269
+ }, { ...l(a), ...l(s) }), {
270
+ default: j(() => [
271
+ k("span", {
272
+ class: S(l(C))
273
+ }, null, 2),
274
+ k("span", {
275
+ class: S(l(_))
276
+ }, null, 2),
277
+ k("span", {
278
+ class: S(["g-button__content", l(N)])
279
+ }, [
280
+ (t.prepend || f.prepend) && !f.iconButton ? (v(), b("span", at, [
281
+ $(f.$slots, "prepend", {}, () => [
282
+ W(U, { icon: f.prepend }, null, 8, ["icon"])
283
+ ])
284
+ ])) : y("", !0),
285
+ k("span", ot, [
286
+ $(f.$slots, "default", {}, () => [
287
+ f.iconButton ? f.iconButton ? (v(), G(U, {
288
+ key: 1,
289
+ icon: f.iconButton
290
+ }, null, 8, ["icon"])) : y("", !0) : (v(), b(ke, { key: 0 }, [
291
+ M(J(f.label), 1)
292
+ ], 64))
293
+ ])
294
+ ]),
295
+ (t.append || f.append) && !f.iconButton ? (v(), b("span", st, [
296
+ $(f.$slots, "append", {}, () => [
297
+ W(U, { icon: f.append }, null, 8, ["icon"])
298
+ ])
299
+ ])) : y("", !0)
300
+ ], 2)
301
+ ]),
302
+ _: 3
303
+ }, 16, ["class", "style"])), [
304
+ [w, r.value]
305
+ ])
306
+ ]),
307
+ _: 3
308
+ }, 16)), [
309
+ [E]
310
+ ]);
311
+ };
312
+ }
313
+ });
314
+ function Gt() {
315
+ const e = ne(null), t = V(!1), s = (a) => {
316
+ c();
317
+ const o = n(a.target), u = o.style.position;
318
+ r(o) || (o.style.position = "relative");
319
+ const d = document.createElement("div");
320
+ d.className = "g-loading__container", o.appendChild(d);
321
+ const g = {}, _ = oe(Ve, {
322
+ text: a.text,
323
+ noText: a.noText,
324
+ color: a.color,
325
+ dark: a.dark,
326
+ opacity: a.opacity,
327
+ blur: a.blur,
328
+ progressView: a.progressView,
329
+ onClose: () => {
330
+ i(g);
331
+ }
332
+ }), C = _.mount(d);
333
+ Object.assign(g, {
334
+ app: _,
335
+ container: d,
336
+ target: o,
337
+ originalPosition: u,
338
+ componentInstance: C
339
+ }), e.value = g, C.show(), t.value = !0;
340
+ }, n = (a) => {
341
+ if (!a) return document.body;
342
+ if (typeof a == "string") {
343
+ const o = document.querySelector(a);
344
+ if (!o) throw new Error(`Target element ${a} not found`);
345
+ return o;
346
+ }
347
+ return a;
348
+ }, c = async () => {
349
+ if (!e.value) return;
350
+ const { componentInstance: a } = e.value;
351
+ a && a.hide();
352
+ }, r = (a) => {
353
+ const o = window.getComputedStyle(a).position;
354
+ return ["relative", "absolute", "fixed", "sticky"].includes(o);
355
+ }, i = (a = e.value) => {
356
+ if (!a) return;
357
+ const o = e.value === a, { app: u, container: d, target: g, originalPosition: _ } = a;
358
+ u.unmount(), d.parentElement === g && g.removeChild(d), o && (g.style.position = _, e.value = null, t.value = !1);
359
+ };
360
+ return ae(() => {
361
+ c();
362
+ }), {
363
+ show: s,
364
+ hide: c,
365
+ visible: t
366
+ };
367
+ }
368
+ const it = h({
369
+ modelValue: {
370
+ type: Boolean,
371
+ default: void 0
372
+ },
373
+ defaultOpen: {
374
+ type: Boolean,
375
+ default: !1
376
+ },
377
+ title: String,
378
+ text: String,
379
+ icon: String,
380
+ color: {
381
+ type: String,
382
+ default: "primary"
383
+ },
384
+ state: String,
385
+ variant: {
386
+ type: String,
387
+ default: "tonal"
388
+ },
389
+ location: {
390
+ type: String,
391
+ default: "bottom-center"
392
+ },
393
+ position: {
394
+ type: String,
395
+ default: "fixed"
396
+ },
397
+ transition: {
398
+ type: [Boolean, String, Object],
399
+ default: void 0
400
+ },
401
+ timeout: {
402
+ type: Number,
403
+ default: 5e3
404
+ },
405
+ persistent: {
406
+ type: Boolean,
407
+ default: !1
408
+ },
409
+ closeable: {
410
+ type: Boolean,
411
+ default: !0
412
+ },
413
+ action: Object,
414
+ actionText: String,
415
+ closeOnAction: {
416
+ type: Boolean,
417
+ default: !0
418
+ },
419
+ multiline: {
420
+ type: Boolean,
421
+ default: !1
422
+ },
423
+ offset: {
424
+ type: [Number, String],
425
+ default: 24
426
+ },
427
+ maxWidth: {
428
+ type: [Number, String],
429
+ default: 520
430
+ },
431
+ pauseOnHover: {
432
+ type: Boolean,
433
+ default: !0
434
+ }
435
+ }), ct = {
436
+ key: 0,
437
+ class: "g-snackbar__prepend"
438
+ }, lt = { class: "g-snackbar__main" }, ut = {
439
+ key: 0,
440
+ class: "g-snackbar__title"
441
+ }, dt = {
442
+ key: 1,
443
+ class: "g-snackbar__text"
444
+ }, ft = {
445
+ key: 1,
446
+ class: "g-snackbar__actions"
447
+ }, pt = /* @__PURE__ */ I({
448
+ __name: "GSnackbar",
449
+ props: it(),
450
+ emits: ["update:modelValue", "action", "close", "after-close"],
451
+ setup(e, { expose: t, emit: s }) {
452
+ const n = e, c = s, r = te(), i = V(), a = V(n.defaultOpen), o = V("manual"), u = p(() => n.modelValue !== void 0), d = p(
453
+ () => u.value ? n.modelValue === !0 : a.value
454
+ ), g = B(n.offset), _ = B(n.maxWidth), { colorStyles: C } = ce(n), {
455
+ surfaceOverlayClasses: N,
456
+ surfaceUnderlayClasses: f,
457
+ surfaceContentClasses: q
458
+ } = ie("g-snackbar"), w = p(
459
+ () => {
460
+ var m;
461
+ return ((m = n.action) == null ? void 0 : m.label) ?? n.actionText;
462
+ }
463
+ ), E = p(() => ({
464
+ ...C.value,
465
+ "--g-snackbar-max-width": _.value
466
+ })), de = p(() => ({
467
+ "--g-snackbar-offset": g.value
468
+ })), fe = p(() => [
469
+ `g-snackbar_${n.variant}`,
470
+ {
471
+ "g-snackbar_multiline": n.multiline
472
+ }
473
+ ]), pe = p(() => [
474
+ `g-snackbar-layer_position-${n.position}`,
475
+ `g-snackbar-layer_location-${n.location}`
476
+ ]), me = p(
477
+ () => n.transition ?? {
478
+ name: n.location.startsWith("top") ? "slide-y" : "slide-y-reverse",
479
+ appear: !0,
480
+ duration: 240,
481
+ leaveDuration: 180,
482
+ distance: "16px"
483
+ }
484
+ );
485
+ function Q(m) {
486
+ u.value || (a.value = m), c("update:modelValue", m);
487
+ }
488
+ function z() {
489
+ i.value !== void 0 && (window.clearTimeout(i.value), i.value = void 0);
490
+ }
491
+ function F() {
492
+ z(), !(!d.value || n.persistent || n.timeout <= 0) && (i.value = window.setTimeout(() => {
493
+ A("timeout");
494
+ }, n.timeout));
495
+ }
496
+ function A(m = "manual") {
497
+ o.value = m, z(), Q(!1), c("close", m);
498
+ }
499
+ function ve() {
500
+ var m, O;
501
+ c("action", (m = n.action) == null ? void 0 : m.value), (((O = n.action) == null ? void 0 : O.closeOnClick) ?? n.closeOnAction) && A("action");
502
+ }
503
+ function ge() {
504
+ n.pauseOnHover && z();
505
+ }
506
+ function _e() {
507
+ n.pauseOnHover && F();
508
+ }
509
+ he(d, (m) => {
510
+ if (!m) {
511
+ z();
512
+ return;
513
+ }
514
+ F();
515
+ }), F(), Ce(() => {
516
+ z();
517
+ });
518
+ function ye() {
519
+ c("after-close", o.value);
520
+ }
521
+ return t({
522
+ open: () => Q(!0),
523
+ close: A
524
+ }), (m, O) => (v(), b("div", {
525
+ class: S(["g-snackbar-layer", pe.value]),
526
+ style: H(de.value)
527
+ }, [
528
+ W(l(xe), {
529
+ transition: me.value,
530
+ onAfterLeave: ye
531
+ }, {
532
+ default: j(() => [
533
+ d.value ? (v(), b("section", {
534
+ key: 0,
535
+ class: S(["g-snackbar", fe.value]),
536
+ style: H(E.value),
537
+ role: "status",
538
+ "aria-live": "polite",
539
+ onMouseenter: ge,
540
+ onMouseleave: _e
541
+ }, [
542
+ k("span", {
543
+ class: S(l(f))
544
+ }, null, 2),
545
+ k("span", {
546
+ class: S(l(N))
547
+ }, null, 2),
548
+ k("div", {
549
+ class: S(["g-snackbar__content", l(q)])
550
+ }, [
551
+ r.prepend || n.icon ? (v(), b("div", ct, [
552
+ $(m.$slots, "prepend", {}, () => [
553
+ n.icon ? (v(), G(Z, {
554
+ key: 0,
555
+ icon: n.icon,
556
+ size: "22"
557
+ }, null, 8, ["icon"])) : y("", !0)
558
+ ], !0)
559
+ ])) : y("", !0),
560
+ k("div", lt, [
561
+ r.title || n.title ? (v(), b("div", ut, [
562
+ $(m.$slots, "title", {}, () => [
563
+ M(J(n.title), 1)
564
+ ], !0)
565
+ ])) : y("", !0),
566
+ r.default || n.text ? (v(), b("div", dt, [
567
+ $(m.$slots, "default", {}, () => [
568
+ M(J(n.text), 1)
569
+ ], !0)
570
+ ])) : y("", !0)
571
+ ]),
572
+ r.action || w.value || n.closeable ? (v(), b("div", ft, [
573
+ $(m.$slots, "action", {
574
+ close: () => A("action")
575
+ }, () => [
576
+ w.value ? (v(), G(rt, {
577
+ key: 0,
578
+ variant: "text",
579
+ size: "s",
580
+ label: w.value,
581
+ onClick: ve
582
+ }, null, 8, ["label"])) : y("", !0)
583
+ ], !0),
584
+ n.closeable ? (v(), b("button", {
585
+ key: 0,
586
+ type: "button",
587
+ class: "g-snackbar__close",
588
+ "aria-label": "Close snackbar",
589
+ onClick: O[0] || (O[0] = (ht) => A("dismiss"))
590
+ }, [
591
+ W(Z, {
592
+ icon: "close",
593
+ size: "18"
594
+ })
595
+ ])) : y("", !0)
596
+ ])) : y("", !0)
597
+ ], 2)
598
+ ], 38)) : y("", !0)
599
+ ]),
600
+ _: 3
601
+ }, 8, ["transition"])
602
+ ], 6));
603
+ }
604
+ }), mt = /* @__PURE__ */ D(pt, [["__scopeId", "data-v-6d1d4bf9"]]), vt = "bottom-center", gt = "slide-y", P = /* @__PURE__ */ new Map();
605
+ let _t = 0;
606
+ function yt(e) {
607
+ return typeof e == "string" ? {
608
+ label: e
609
+ } : e;
610
+ }
611
+ function bt(e, t) {
612
+ return e === "fade" ? "fade" : e === "scale" ? "scale" : e === "slide-x" ? t.endsWith("right") ? "slide-x-reverse" : "slide-x" : t.startsWith("top") ? "slide-y" : "slide-y-reverse";
613
+ }
614
+ function St() {
615
+ return I({
616
+ name: "GSnackbarHost",
617
+ props: {
618
+ items: {
619
+ type: Array,
620
+ required: !0
621
+ },
622
+ location: {
623
+ type: String,
624
+ required: !0
625
+ },
626
+ transition: {
627
+ type: String,
628
+ required: !0
629
+ },
630
+ close: {
631
+ type: Function,
632
+ required: !0
633
+ },
634
+ remove: {
635
+ type: Function,
636
+ required: !0
637
+ }
638
+ },
639
+ setup(e) {
640
+ return () => L(
641
+ "div",
642
+ {
643
+ class: [
644
+ "g-snackbar-stack",
645
+ `g-snackbar-stack_location-${e.location}`
646
+ ]
647
+ },
648
+ [
649
+ L(
650
+ "div",
651
+ {
652
+ class: "g-snackbar-stack__items"
653
+ },
654
+ e.items.map(
655
+ (t) => L(mt, {
656
+ key: t.id,
657
+ ...t,
658
+ modelValue: t.open,
659
+ position: "static",
660
+ transition: {
661
+ name: bt(
662
+ t.transition ?? e.transition,
663
+ t.location
664
+ ),
665
+ appear: !0,
666
+ duration: 240,
667
+ leaveDuration: 180,
668
+ distance: "18px",
669
+ scale: 0.96
670
+ },
671
+ "onUpdate:modelValue": (s) => {
672
+ t.open = s;
673
+ },
674
+ onClose: (s) => e.close(t.id, s),
675
+ onAfterClose: () => e.remove(t.id)
676
+ })
677
+ )
678
+ )
679
+ ]
680
+ );
681
+ }
682
+ });
683
+ }
684
+ function kt(e, t, s, n) {
685
+ const c = P.get(e);
686
+ if (c) return c;
687
+ const r = document.createElement("div");
688
+ r.className = "g-snackbar-stack__container", document.body.appendChild(r);
689
+ const i = $e([]), a = oe(St(), {
690
+ items: i,
691
+ location: e,
692
+ transition: t,
693
+ close: s,
694
+ remove: n
695
+ });
696
+ a.mount(r);
697
+ const o = {
698
+ app: a,
699
+ container: r,
700
+ items: i
701
+ };
702
+ return P.set(e, o), o;
703
+ }
704
+ function It() {
705
+ const e = ne([]);
706
+ function t(r) {
707
+ for (const [i, a] of P.entries()) {
708
+ const o = a.items.findIndex((u) => u.id === r);
709
+ if (o !== -1) {
710
+ a.items.splice(o, 1), e.value = e.value.filter(
711
+ (u) => u.id !== r
712
+ ), a.items.length || window.setTimeout(() => {
713
+ a.items.length || (a.app.unmount(), a.container.remove(), P.delete(i));
714
+ }, 220);
715
+ return;
716
+ }
717
+ }
718
+ }
719
+ function s(r, i = "manual") {
720
+ for (const a of P.values()) {
721
+ const o = a.items.find((u) => u.id === r);
722
+ if (o) {
723
+ o.open = !1;
724
+ return;
725
+ }
726
+ }
727
+ }
728
+ function n(r) {
729
+ const i = typeof r == "string" ? { text: r } : r, a = i.location ?? vt, o = i.transition ?? gt, u = ++_t, d = {
730
+ ...i,
731
+ id: u,
732
+ open: !0,
733
+ location: a,
734
+ transition: o,
735
+ action: yt(i.action)
736
+ };
737
+ return kt(a, o, s, t).items.push(d), e.value = [...e.value, d], {
738
+ id: u,
739
+ close: (_ = "manual") => {
740
+ s(u, _);
741
+ }
742
+ };
743
+ }
744
+ function c() {
745
+ for (const [r, i] of P.entries())
746
+ i.app.unmount(), i.container.remove(), P.delete(r);
747
+ e.value = [];
748
+ }
749
+ return ae(() => {
750
+ c();
751
+ }), {
752
+ show: n,
753
+ closeAll: c,
754
+ items: e
755
+ };
756
+ }
757
+ export {
758
+ Xe as G,
759
+ rt as _,
760
+ Z as a,
761
+ mt as b,
762
+ It as c,
763
+ Ze as d,
764
+ et as e,
765
+ U as f,
766
+ tt as g,
767
+ ue as m,
768
+ Gt as u
769
+ };