@gradient-ui/core 0.4.0 → 0.4.1

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 (172) hide show
  1. package/README.md +58 -2
  2. package/dist/GLoading.vue_vue_type_style_index_0_lang-Bv3dWEq8.cjs +1 -0
  3. package/dist/GLoading.vue_vue_type_style_index_0_lang-CBB_GocW.js +466 -0
  4. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BS6bb1XY.cjs +1 -0
  5. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-UTBNFP5X.js +7015 -0
  6. package/dist/{default-585QCoXx.js → camelToKebabCase-6qY6WHvl.js} +987 -1194
  7. package/dist/camelToKebabCase-BQDotaQm.cjs +316 -0
  8. package/dist/components.cjs +1 -1
  9. package/dist/components.mjs +56 -53
  10. package/dist/default-BhuY-A3o.cjs +4 -0
  11. package/dist/default-OTmCd0Aq.js +131 -0
  12. package/dist/directives.cjs +1 -1
  13. package/dist/directives.mjs +6 -5
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.mjs +183 -113
  16. package/dist/mask-BbofdFd4.cjs +1 -0
  17. package/dist/mask-CZX-I_iy.js +936 -0
  18. package/dist/material-Ca7ZZAiO.cjs +194 -0
  19. package/dist/material-okvXHenb.js +1162 -0
  20. package/dist/materialSurface-BBrP9ltj.js +591 -0
  21. package/dist/materialSurface-CK8LN_dU.cjs +1 -0
  22. package/dist/services.cjs +1 -1
  23. package/dist/services.mjs +1 -1
  24. package/dist/style.css +1 -1
  25. package/dist/surface-8z3gR7vF.cjs +1 -0
  26. package/dist/surface-BKu4KfkY.js +288 -0
  27. package/dist/theme.cjs +1 -1
  28. package/dist/theme.mjs +55 -9
  29. package/dist/types/components/index.d.ts +3 -1
  30. package/dist/types/components/ui/BaseOverlay/BaseOverlay.vue.d.ts +1 -1
  31. package/dist/types/components/ui/GAlert/GAlert.vue.d.ts +675 -9
  32. package/dist/types/components/ui/GAlert/types.d.ts +352 -4
  33. package/dist/types/components/ui/GAside/GAside.vue.d.ts +7 -5
  34. package/dist/types/components/ui/GAside/types.d.ts +17 -6
  35. package/dist/types/components/ui/GBadge/GBadge.vue.d.ts +679 -13
  36. package/dist/types/components/ui/GBadge/types.d.ts +350 -3
  37. package/dist/types/components/ui/GButton/GButton.vue.d.ts +295 -25
  38. package/dist/types/components/ui/GButton/types.d.ts +194 -49
  39. package/dist/types/components/ui/GCheckControl/GCheckControl.vue.d.ts +24 -24
  40. package/dist/types/components/ui/GCheckControl/GCheckGroup.vue.d.ts +24 -24
  41. package/dist/types/components/ui/GCheckbox/GCheckbox.vue.d.ts +24 -24
  42. package/dist/types/components/ui/GChip/GChip.vue.d.ts +295 -25
  43. package/dist/types/components/ui/GChip/types.d.ts +188 -43
  44. package/dist/types/components/ui/GDrawer/GDrawer.vue.d.ts +1 -1
  45. package/dist/types/components/ui/GExpansion/GExpansion.vue.d.ts +47 -13
  46. package/dist/types/components/ui/GExpansion/types.d.ts +284 -22
  47. package/dist/types/components/ui/GFAB/GFAB.vue.d.ts +220 -7
  48. package/dist/types/components/ui/GFAB/types.d.ts +122 -3
  49. package/dist/types/components/ui/GFieldBase/GFieldBase.vue.d.ts +15 -15
  50. package/dist/types/components/ui/GFieldBase/props.d.ts +10 -10
  51. package/dist/types/components/ui/GForm/GForm.vue.d.ts +156 -0
  52. package/dist/types/components/ui/GForm/index.d.ts +2 -0
  53. package/dist/types/components/ui/GForm/types.d.ts +107 -0
  54. package/dist/types/components/ui/GGradient/GGradient.vue.d.ts +165 -66
  55. package/dist/types/components/ui/GGradient/GGradientBorderLayer.vue.d.ts +11 -0
  56. package/dist/types/components/ui/GGradient/index.d.ts +1 -0
  57. package/dist/types/components/ui/GGradient/types.d.ts +10 -1
  58. package/dist/types/components/ui/GGradientMaterial/GGradientMaterial.vue.d.ts +257 -0
  59. package/dist/types/components/ui/GGradientMaterial/index.d.ts +2 -0
  60. package/dist/types/components/ui/GGradientMaterial/types.d.ts +140 -0
  61. package/dist/types/components/ui/GInput/GInput.vue.d.ts +15 -15
  62. package/dist/types/components/ui/GLoading/GLoading.vue.d.ts +5 -5
  63. package/dist/types/components/ui/GLoading/types.d.ts +3 -2
  64. package/dist/types/components/ui/GMenu/GSubmenu.vue.d.ts +14 -14
  65. package/dist/types/components/ui/GMenuItem/GMenuItem.vue.d.ts +11 -11
  66. package/dist/types/components/ui/GMenuItem/types.d.ts +4 -4
  67. package/dist/types/components/ui/GModal/GModal.vue.d.ts +1 -1
  68. package/dist/types/components/ui/GNavList/GNavList.vue.d.ts +7 -5
  69. package/dist/types/components/ui/GNavList/types.d.ts +17 -6
  70. package/dist/types/components/ui/GNavbar/GNavbar.vue.d.ts +4 -4
  71. package/dist/types/components/ui/GNavbar/types.d.ts +6 -6
  72. package/dist/types/components/ui/GProgress/GProgress.vue.d.ts +41 -20
  73. package/dist/types/components/ui/GProgress/types.d.ts +23 -10
  74. package/dist/types/components/ui/GQuickActions/GQuickActions.vue.d.ts +1 -1
  75. package/dist/types/components/ui/GSelectItem.vue.d.ts +5 -3
  76. package/dist/types/components/ui/GSnackbar/GSnackbar.vue.d.ts +681 -15
  77. package/dist/types/components/ui/GSnackbar/types.d.ts +350 -3
  78. package/dist/types/components/ui/GSquircle/GSquircle.vue.d.ts +2 -2
  79. package/dist/types/components/ui/GSquircle/types.d.ts +8 -2
  80. package/dist/types/components/ui/GSwitch/GSwitch.vue.d.ts +24 -24
  81. package/dist/types/components/ui/GTable/GTable.vue.d.ts +51 -3
  82. package/dist/types/components/ui/GTable/types.d.ts +351 -3
  83. package/dist/types/components/ui/GTabs/GTabs.vue.d.ts +4 -4
  84. package/dist/types/components/ui/GTabs/types.d.ts +6 -6
  85. package/dist/types/components/ui/GTextarea/GTextarea.vue.d.ts +15 -15
  86. package/dist/types/components/ui/GToggleButton/GToggleButton.vue.d.ts +490 -16
  87. package/dist/types/components/ui/GToggleButton/types.d.ts +284 -32
  88. package/dist/types/directives/index.d.ts +2 -0
  89. package/dist/types/directives/ripple.d.ts +1 -1
  90. package/dist/types/directives/specular.d.ts +34 -0
  91. package/dist/types/theme/color.d.ts +11 -0
  92. package/dist/types/theme/colorSeeds.d.ts +21 -20
  93. package/dist/types/theme/colorSystem.d.ts +12 -0
  94. package/dist/types/theme/cssTokens.d.ts +7 -0
  95. package/dist/types/theme/default.d.ts +26 -80
  96. package/dist/types/theme/gradient/animation/css.d.ts +12 -0
  97. package/dist/types/theme/gradient/animation/index.d.ts +1 -0
  98. package/dist/types/theme/gradient/colorMath.d.ts +3 -0
  99. package/dist/types/theme/gradient/constants.d.ts +3 -0
  100. package/dist/types/theme/gradient/core.d.ts +1 -0
  101. package/dist/types/theme/gradient/effects/index.d.ts +1 -0
  102. package/dist/types/theme/gradient/effects/morph.d.ts +5 -0
  103. package/dist/types/theme/gradient/effects/shadow.d.ts +3 -0
  104. package/dist/types/theme/gradient/formatters/canvas.d.ts +2 -0
  105. package/dist/types/theme/gradient/formatters/css.d.ts +3 -0
  106. package/dist/types/theme/gradient/formatters/index.d.ts +1 -0
  107. package/dist/types/theme/gradient/formatters/svg.d.ts +5 -0
  108. package/dist/types/theme/gradient/index.d.ts +1 -0
  109. package/dist/types/theme/gradient/material.d.ts +1 -0
  110. package/dist/types/theme/gradient/model.d.ts +5 -0
  111. package/dist/types/theme/gradient/presets.d.ts +158 -0
  112. package/dist/types/theme/gradient/recipes.d.ts +14 -0
  113. package/dist/types/theme/gradient/tokens.d.ts +72 -0
  114. package/dist/types/theme/gradient/types.d.ts +117 -0
  115. package/dist/types/theme/gradient/utils.d.ts +10 -0
  116. package/dist/types/theme/gradient.d.ts +1 -0
  117. package/dist/types/theme/index.d.ts +12 -1
  118. package/dist/types/theme/palette.d.ts +13 -0
  119. package/dist/types/theme/scheme.d.ts +2 -0
  120. package/dist/types/theme/types.d.ts +11 -0
  121. package/dist/types/use/actionSurface.d.ts +1742 -20
  122. package/dist/types/use/check/booleanControl.d.ts +9 -9
  123. package/dist/types/use/check/optionGroup.d.ts +9 -7
  124. package/dist/types/use/check/types.d.ts +26 -26
  125. package/dist/types/use/color.d.ts +2 -2
  126. package/dist/types/use/colorResolver.d.ts +15 -5
  127. package/dist/types/use/form/context.d.ts +8 -0
  128. package/dist/types/use/form/control.d.ts +4 -0
  129. package/dist/types/use/form/props.d.ts +4 -4
  130. package/dist/types/use/form/textFieldControl.d.ts +1 -1
  131. package/dist/types/use/glass.d.ts +24 -0
  132. package/dist/types/use/gradient.d.ts +1759 -43
  133. package/dist/types/use/gradientGlow.d.ts +4 -4
  134. package/dist/types/use/gradientMaterial.d.ts +21 -0
  135. package/dist/types/use/gradientRuntime.d.ts +11 -0
  136. package/dist/types/use/gradientRuntimeRegistry.d.ts +8 -0
  137. package/dist/types/use/gradientSurface.d.ts +31 -4
  138. package/dist/types/use/index.d.ts +8 -0
  139. package/dist/types/use/input/props.d.ts +11 -11
  140. package/dist/types/use/material.d.ts +112 -0
  141. package/dist/types/use/materialSurface.d.ts +376 -0
  142. package/dist/types/use/surface.d.ts +67 -19
  143. package/dist/types/use/surfaceColor.d.ts +1 -1
  144. package/dist/types/use/textarea/props.d.ts +11 -11
  145. package/dist/types/use/variant.d.ts +1 -1
  146. package/dist/use.cjs +1 -1
  147. package/dist/use.mjs +42 -22
  148. package/dist/useSnackbar-BHQshEZ8.cjs +1 -0
  149. package/dist/useSnackbar-DeNHZH8v.js +908 -0
  150. package/package.json +11 -4
  151. package/dist/GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js +0 -680
  152. package/dist/GLoading.vue_vue_type_style_index_0_lang-cokm-HBh.cjs +0 -1
  153. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-BmbKqNgm.js +0 -6421
  154. package/dist/GSwitch.vue_vue_type_script_setup_true_lang-By_7hZOW.cjs +0 -4
  155. package/dist/camelToKebabCase-BAESShJ1.cjs +0 -1
  156. package/dist/camelToKebabCase-KgkZ7-1F.js +0 -28
  157. package/dist/default-BcPApP1Q.cjs +0 -318
  158. package/dist/mask-Bu8cjwwH.js +0 -817
  159. package/dist/mask-D1vJj5Hl.cjs +0 -1
  160. package/dist/propsFactory-DyyboUaC.cjs +0 -1
  161. package/dist/propsFactory-UhcvubZJ.js +0 -13
  162. package/dist/tagName-CYG1CUfd.js +0 -103
  163. package/dist/tagName-CbsvFHGg.cjs +0 -1
  164. package/dist/types/theme/changeTone.d.ts +0 -1
  165. package/dist/types/theme/colorPallete.d.ts +0 -2
  166. package/dist/types/theme/generateColors.d.ts +0 -1
  167. package/dist/types/theme/generateGradient.d.ts +0 -9
  168. package/dist/types/theme/getComplementaryColor.d.ts +0 -1
  169. package/dist/types/utils/color.d.ts +0 -3
  170. package/dist/types/utils/colors/normaliseColor.d.ts +0 -5
  171. package/dist/useSnackbar-2iJU4bdd.js +0 -769
  172. package/dist/useSnackbar-3QuH25xm.cjs +0 -1
@@ -1,769 +0,0 @@
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
- };