@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,817 +0,0 @@
1
- import { r as z, b as $, _ as fe, m as pe, a as G, c as Q } from "./GLoading.vue_vue_type_style_index_0_lang-CPzo3WD3.js";
2
- import { createApp as ee, ref as v, computed as p, onMounted as me, onBeforeUnmount as S, watch as te, defineComponent as ne, toRef as ge, openBlock as L, createElementBlock as ye, Fragment as ve, createElementVNode as _, normalizeClass as _e, renderSlot as C, unref as y, createBlock as A, Teleport as be, createVNode as ke, withCtx as D, withDirectives as K, normalizeStyle as W, vShow as j, mergeProps as P, createSlots as he, toDisplayString as xe, h as we } from "vue";
3
- import { p as oe } from "./propsFactory-UhcvubZJ.js";
4
- import { offset as Te, flip as Ee, shift as Le, size as Ce, useFloating as De, autoUpdate as Be } from "@floating-ui/vue";
5
- import { d as Me, a as Fe } from "./index-Cs3XQ3JB.js";
6
- const U = "var(--g-gradient-current, var(--g-gradient-main))", Ie = "135deg";
7
- function Ve() {
8
- return /* @__PURE__ */ new WeakMap();
9
- }
10
- function re(e) {
11
- const t = Ve();
12
- function n(r) {
13
- const i = t.get(r);
14
- if (i) {
15
- for (const [l, s] of i.targets)
16
- Se(l, s);
17
- t.delete(r);
18
- }
19
- }
20
- function o(r, i) {
21
- const l = Pe(i, e);
22
- if (n(r), l.disabled) return;
23
- const s = Ne(r, l.selector), a = {
24
- targets: /* @__PURE__ */ new Map()
25
- };
26
- for (const u of s)
27
- a.targets.set(u, Oe(u)), Re(u, l.gradient);
28
- t.set(r, a);
29
- }
30
- return {
31
- mounted(r, i) {
32
- o(r, i.value);
33
- },
34
- updated(r, i) {
35
- o(r, i.value);
36
- },
37
- unmounted(r) {
38
- n(r);
39
- }
40
- };
41
- }
42
- function Pe(e, t) {
43
- if (typeof e == "string")
44
- return {
45
- gradient: z(e),
46
- disabled: !1,
47
- selector: t
48
- };
49
- if (!e)
50
- return {
51
- gradient: U,
52
- disabled: !1,
53
- selector: t
54
- };
55
- const n = $e(e);
56
- return {
57
- gradient: e.gradient ?? (n.length ? Ae(n, e.direction) : void 0) ?? z(e.state ?? e.color) ?? U,
58
- disabled: e.disabled ?? !1,
59
- selector: e.selector ?? t
60
- };
61
- }
62
- function $e(e) {
63
- var t;
64
- return (t = e.colors) != null && t.length ? e.colors : [e.from, e.to].filter(
65
- (n) => !!n
66
- );
67
- }
68
- function Ae(e, t = Ie) {
69
- const n = e.length === 1 ? [e[0], e[0]] : e;
70
- return `linear-gradient(${t}, ${n.map((o) => $(o)).join(", ")})`;
71
- }
72
- function Ne(e, t) {
73
- if (!t)
74
- return [e];
75
- const n = [];
76
- return e.matches(t) && n.push(e), n.push(...Array.from(e.querySelectorAll(t))), n;
77
- }
78
- function Oe(e) {
79
- return {
80
- backgroundClip: e.style.backgroundClip,
81
- backgroundImage: e.style.backgroundImage,
82
- color: e.style.color,
83
- webkitBackgroundClip: e.style.getPropertyValue(
84
- "-webkit-background-clip"
85
- ),
86
- webkitTextFillColor: e.style.getPropertyValue(
87
- "-webkit-text-fill-color"
88
- )
89
- };
90
- }
91
- function Se(e, t) {
92
- e.style.backgroundClip = t.backgroundClip, e.style.backgroundImage = t.backgroundImage, e.style.color = t.color, e.style.setProperty(
93
- "-webkit-background-clip",
94
- t.webkitBackgroundClip
95
- ), e.style.setProperty(
96
- "-webkit-text-fill-color",
97
- t.webkitTextFillColor
98
- );
99
- }
100
- function Re(e, t) {
101
- e.style.backgroundImage = t, e.style.backgroundClip = "text", e.style.color = "transparent", e.style.setProperty("-webkit-background-clip", "text"), e.style.setProperty("-webkit-text-fill-color", "transparent");
102
- }
103
- const Tt = re(), Et = re(".mdi");
104
- function ze(e) {
105
- const t = e == null ? void 0 : e.isVisible;
106
- return typeof t == "object" && t !== null && "value" in t ? !!t.value : !!t;
107
- }
108
- const Ge = {
109
- active: !1,
110
- text: "Loading...",
111
- noText: !1,
112
- color: "primary",
113
- dark: !1,
114
- opacity: void 0,
115
- blur: void 0,
116
- progressView: "glow"
117
- };
118
- function Ke(e, t = {}) {
119
- const n = typeof e == "object" && e !== null ? e : {}, o = typeof e == "boolean" ? e : n.active ?? n.value ?? !1;
120
- return {
121
- ...Ge,
122
- ...n,
123
- active: o,
124
- dark: n.dark ?? !!t.dark,
125
- noText: n.noText ?? !!t.noText
126
- };
127
- }
128
- function ie(e) {
129
- return JSON.stringify({
130
- text: e.text,
131
- noText: e.noText,
132
- color: e.color,
133
- dark: e.dark,
134
- opacity: e.opacity,
135
- blur: e.blur,
136
- progressView: e.progressView
137
- });
138
- }
139
- function We(e) {
140
- return ["relative", "absolute", "fixed", "sticky"].includes(
141
- getComputedStyle(e).position
142
- );
143
- }
144
- function je(e) {
145
- We(e) || (e.style.position = "relative");
146
- }
147
- function B(e) {
148
- var n, o;
149
- const t = e.__gLoading__;
150
- t && ((n = t.app) == null || n.unmount(), (o = t.container) == null || o.remove(), t.app = void 0, t.container = void 0, t.component = void 0, t.optionsKey = void 0, e.style.position = t.originalPosition);
151
- }
152
- function Ue(e) {
153
- const t = e.__gLoading__;
154
- if (t) {
155
- if (!t.component) {
156
- B(e);
157
- return;
158
- }
159
- t.component.hide();
160
- }
161
- }
162
- function He(e, t) {
163
- const n = e.__gLoading__;
164
- if (!n) return;
165
- je(e);
166
- const o = document.createElement("div");
167
- o.className = "g-loading__container";
168
- const r = ee(fe, {
169
- text: t.text,
170
- noText: t.noText,
171
- color: t.color,
172
- dark: t.dark,
173
- opacity: t.opacity,
174
- blur: t.blur,
175
- progressView: t.progressView,
176
- onClose: () => {
177
- ze(n.component) || B(e);
178
- }
179
- });
180
- n.app = r, n.container = o, n.optionsKey = ie(t), e.appendChild(o), n.component = r.mount(o), n.component.show();
181
- }
182
- function H(e, t, n) {
183
- var l;
184
- const o = e.__gLoading__;
185
- if (!o) return;
186
- const r = Ke(t, n), i = ie(r);
187
- if (!r.active) {
188
- Ue(e);
189
- return;
190
- }
191
- if (o.app && o.optionsKey === i) {
192
- (l = o.component) == null || l.show();
193
- return;
194
- }
195
- B(e), He(e, r);
196
- }
197
- const Lt = {
198
- mounted(e, t) {
199
- e.__gLoading__ = {
200
- originalPosition: e.style.position
201
- }, H(e, t.value, t.modifiers);
202
- },
203
- updated(e, t) {
204
- t.value === t.oldValue && (typeof t.value != "object" || t.value === null) || H(e, t.value, t.modifiers);
205
- },
206
- unmounted(e) {
207
- B(e), delete e.__gLoading__;
208
- }
209
- }, h = {
210
- center: !1,
211
- color: "currentcolor",
212
- disabled: !1,
213
- duration: 520,
214
- easing: "var(--g-token-easing-standard)",
215
- opacity: 0.16
216
- };
217
- function se(e) {
218
- if (typeof e == "boolean")
219
- return {
220
- ...h,
221
- disabled: !e
222
- };
223
- if (typeof e == "string")
224
- return {
225
- ...h,
226
- color: $(e)
227
- };
228
- const t = e != null && e.color ? $(e.color) : h.color;
229
- return {
230
- ...h,
231
- ...e,
232
- color: t
233
- };
234
- }
235
- function qe(e) {
236
- getComputedStyle(e).position === "static" && (e.style.position = "relative");
237
- }
238
- function Je(e) {
239
- return typeof e == "number" ? `${e}ms` : e;
240
- }
241
- function Xe(e) {
242
- if (typeof e == "number") return e;
243
- const t = e.trim();
244
- if (t.endsWith("ms"))
245
- return Number.parseFloat(t);
246
- if (t.endsWith("s"))
247
- return Number.parseFloat(t) * 1e3;
248
- const n = Number.parseFloat(t);
249
- return Number.isNaN(n) ? Number(h.duration) : n;
250
- }
251
- function Ye(e, t, n) {
252
- const o = e.getBoundingClientRect(), r = Math.hypot(o.width, o.height) * 2, i = t.x - o.left - r / 2, l = t.y - o.top - r / 2, s = document.createElement("span"), a = document.createElement("span");
253
- return s.className = "g-ripple__container", s.style.setProperty("--g-ripple-color", n.color), s.style.setProperty(
254
- "--g-ripple-duration",
255
- Je(n.duration)
256
- ), s.style.setProperty("--g-ripple-easing", n.easing), s.style.setProperty(
257
- "--g-ripple-opacity",
258
- String(n.opacity)
259
- ), a.className = "g-ripple__animation", a.style.width = `${r}px`, a.style.height = `${r}px`, a.style.left = `${i}px`, a.style.top = `${l}px`, s.appendChild(a), e.appendChild(s), s;
260
- }
261
- function Ze(e, t) {
262
- var n;
263
- t.remove(), (n = e.__gRipple__) == null || n.ripples.delete(t);
264
- }
265
- function ae(e) {
266
- const t = e.__gRipple__;
267
- if (t) {
268
- for (const n of t.ripples)
269
- n.remove();
270
- t.ripples.clear();
271
- }
272
- }
273
- function q(e) {
274
- const t = e.getBoundingClientRect();
275
- return {
276
- x: t.left + t.width / 2,
277
- y: t.top + t.height / 2
278
- };
279
- }
280
- function Qe(e) {
281
- return e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" || e.classList.contains("g-button_disabled");
282
- }
283
- function J(e, t, n) {
284
- var r;
285
- if (n.disabled || Qe(e)) return;
286
- qe(e);
287
- const o = Ye(e, t, n);
288
- (r = e.__gRipple__) == null || r.ripples.add(o), window.setTimeout(
289
- () => Ze(e, o),
290
- Xe(n.duration)
291
- );
292
- }
293
- function et(e, t) {
294
- if (e.__gRipple__) {
295
- le(e, t);
296
- return;
297
- }
298
- const n = se(t), o = {
299
- originalPosition: e.style.position,
300
- options: n,
301
- onKeyDown: (r) => {
302
- r.key !== "Enter" && r.key !== " " || J(e, q(e), o.options);
303
- },
304
- onPointerDown: (r) => {
305
- r.button !== 0 || e.hasAttribute("disabled") || J(
306
- e,
307
- o.options.center ? q(e) : { x: r.clientX, y: r.clientY },
308
- o.options
309
- );
310
- },
311
- ripples: /* @__PURE__ */ new Set()
312
- };
313
- e.addEventListener("pointerdown", o.onPointerDown), e.addEventListener("keydown", o.onKeyDown), e.__gRipple__ = o;
314
- }
315
- function le(e, t) {
316
- const n = e.__gRipple__;
317
- n && (n.options = se(t), n.options.disabled && ae(e));
318
- }
319
- function tt(e) {
320
- const t = e.__gRipple__;
321
- t && (e.removeEventListener("pointerdown", t.onPointerDown), e.removeEventListener("keydown", t.onKeyDown), ae(e), e.style.position = t.originalPosition, delete e.__gRipple__);
322
- }
323
- const Ct = {
324
- mounted(e, t) {
325
- et(e, t.value);
326
- },
327
- updated(e, t) {
328
- le(e, t.value);
329
- },
330
- unmounted(e) {
331
- tt(e);
332
- }
333
- }, ue = oe({
334
- ...pe(),
335
- modelValue: {
336
- type: Boolean,
337
- default: void 0
338
- },
339
- defaultOpen: {
340
- type: Boolean,
341
- default: !1
342
- },
343
- placement: {
344
- type: String,
345
- default: "bottom"
346
- },
347
- strategy: {
348
- type: String,
349
- default: "absolute"
350
- },
351
- offset: {
352
- type: Number,
353
- default: 8
354
- },
355
- shift: {
356
- type: Boolean,
357
- default: !0
358
- },
359
- flip: {
360
- type: Boolean,
361
- default: !0
362
- },
363
- sameWidth: {
364
- type: Boolean,
365
- default: !1
366
- },
367
- referenceFullWidth: {
368
- type: Boolean,
369
- default: !1
370
- },
371
- appendTo: {
372
- type: String,
373
- default: ""
374
- },
375
- zIndexBase: {
376
- type: Number,
377
- default: 1e3
378
- },
379
- disabled: Boolean,
380
- content: String,
381
- reference: Object
382
- }), nt = (e) => {
383
- const t = v(null), n = v(null), o = p(() => {
384
- const u = [];
385
- return e.offset && u.push(Te(e.offset)), e.flip && u.push(Ee()), e.shift && u.push(
386
- Le({
387
- padding: 4,
388
- crossAxis: !0
389
- })
390
- ), e.sameWidth && u.push(
391
- Ce({
392
- apply({ rects: c, elements: d }) {
393
- Object.assign(d.floating.style, {
394
- width: `${c.reference.width}px`
395
- });
396
- }
397
- })
398
- ), u;
399
- }), { x: r, y: i, strategy: l, placement: s, update: a } = De(
400
- t,
401
- n,
402
- {
403
- ...e,
404
- middleware: o,
405
- whileElementsMounted: Be
406
- }
407
- );
408
- return {
409
- reference: t,
410
- floating: n,
411
- x: r,
412
- y: i,
413
- strategy: l,
414
- placement: s,
415
- update: a
416
- };
417
- };
418
- function ot(e) {
419
- const t = p(() => !!e), n = p(() => e || "body");
420
- return {
421
- hasAppendTarget: t,
422
- appendTarget: n
423
- };
424
- }
425
- function rt(e, t) {
426
- const n = p(() => e.modelValue !== void 0), o = v(e.defaultOpen ?? !1);
427
- return {
428
- open: p({
429
- get() {
430
- return n.value ? e.modelValue ?? !1 : o.value;
431
- },
432
- set(i) {
433
- n.value || (o.value = i), t("update:modelValue", i);
434
- }
435
- }),
436
- isControlled: n
437
- };
438
- }
439
- function it(e) {
440
- return e instanceof HTMLElement;
441
- }
442
- function st(e) {
443
- return !!e && typeof e == "object" && "$el" in e;
444
- }
445
- function X(e) {
446
- return e ? it(e) ? e : st(e) ? e.$el : null : null;
447
- }
448
- function at({
449
- open: e,
450
- reference: t,
451
- floating: n,
452
- escapeKey: o = !0,
453
- outsideClick: r = !0
454
- }) {
455
- if (!e || !t || !n)
456
- throw new Error(
457
- "useDismiss: open, reference, and floating are required"
458
- );
459
- const i = (s) => {
460
- if (!r) return;
461
- const a = X(t.value), u = X(n.value), c = s.target;
462
- a && u && !a.contains(c) && !u.contains(c) && (e.value = !1);
463
- }, l = (s) => {
464
- o && s.key === "Escape" && (e.value = !1);
465
- };
466
- me(() => {
467
- document.addEventListener("click", i), document.addEventListener("keydown", l);
468
- }), S(() => {
469
- document.removeEventListener("click", i), document.removeEventListener("keydown", l);
470
- });
471
- }
472
- let lt = 0;
473
- const g = [], ce = v(null);
474
- function Y(e) {
475
- const t = g.find((r) => r.id === e);
476
- if (!t) return;
477
- const o = g.filter((r) => r.kind === t.kind).findIndex((r) => r.id === e);
478
- return t.base + o + 1;
479
- }
480
- function N() {
481
- const e = [...g].reverse().find((t) => t.kind === "overlay" && t.open.value);
482
- ce.value = (e == null ? void 0 : e.id) ?? null;
483
- }
484
- function Z(e) {
485
- const t = g.findIndex((o) => o.id === e);
486
- if (t === -1) return;
487
- const [n] = g.splice(t, 1);
488
- g.push(n), N();
489
- }
490
- function ut(e) {
491
- const { open: t, base: n = 1e3, kind: o = "floating" } = e, r = ++lt, i = v();
492
- function l() {
493
- g.findIndex((m) => m.id === r) === -1 ? g.push({ id: r, kind: o, base: n, open: t }) : Z(r), i.value = Y(r), N();
494
- }
495
- function s() {
496
- const d = g.findIndex((m) => m.id === r);
497
- d !== -1 && g.splice(d, 1), i.value = void 0, N();
498
- }
499
- function a() {
500
- t.value && (Z(r), i.value = Y(r));
501
- }
502
- const u = p(() => {
503
- var m;
504
- return ((m = g.filter((b) => b.kind === o).at(-1)) == null ? void 0 : m.id) === r;
505
- }), c = p(
506
- () => o === "overlay" && ce.value === r
507
- );
508
- return te(
509
- t,
510
- (d) => {
511
- d ? l() : s();
512
- },
513
- { immediate: !0 }
514
- ), S(() => {
515
- s();
516
- }), {
517
- id: r,
518
- zIndex: i,
519
- isTop: u,
520
- isTopOverlay: c,
521
- bringToFront: a
522
- };
523
- }
524
- const ct = /* @__PURE__ */ ne({
525
- __name: "BaseFloating",
526
- props: ue(),
527
- emits: ["update:modelValue"],
528
- setup(e, { emit: t }) {
529
- const n = e, o = ge(n, "reference"), r = t, { open: i } = rt(n, r), { hasAppendTarget: l, appendTarget: s } = ot(n.appendTo), a = v(!1), u = p(() => i.value || a.value), { reference: c, floating: d, x: m, y: b, strategy: M, update: F } = nt(n);
530
- at({ open: i, reference: c, floating: d });
531
- const { zIndex: x } = ut({
532
- open: u,
533
- base: n.zIndexBase,
534
- kind: "floating"
535
- }), k = p(() => ({
536
- position: M.value,
537
- top: b.value != null ? `${b.value}px` : "",
538
- left: m.value != null ? `${m.value}px` : "",
539
- minWidth: n.sameWidth && c.value instanceof HTMLElement ? `${c.value.offsetWidth}px` : void 0,
540
- zIndex: x.value
541
- }));
542
- function I(f) {
543
- f && ("$el" in f || f instanceof HTMLElement) ? c.value = f : (c.value = n.reference, F());
544
- }
545
- function w() {
546
- a.value = !0;
547
- }
548
- function T() {
549
- a.value = !1;
550
- }
551
- function E() {
552
- a.value = !1;
553
- }
554
- return te(
555
- o,
556
- (f) => {
557
- f && (c.value = f);
558
- },
559
- { deep: !0, immediate: !0 }
560
- ), (f, V) => (L(), ye(ve, null, [
561
- _("div", {
562
- class: _e(["base-floating__reference", {
563
- "base-floating__reference_full": n.referenceFullWidth
564
- }])
565
- }, [
566
- C(f.$slots, "reference", { ref: I }, void 0, !0)
567
- ], 2),
568
- y(l) ? (L(), A(be, {
569
- key: 0,
570
- to: y(s)
571
- }, [
572
- ke(y(G), {
573
- transition: n.transition,
574
- name: "scale",
575
- onBeforeLeave: w,
576
- onAfterLeave: T,
577
- onLeaveCancelled: E
578
- }, {
579
- default: D(() => [
580
- K(_("div", {
581
- ref_key: "floating",
582
- ref: d,
583
- style: W(k.value)
584
- }, [
585
- C(f.$slots, "default", {}, void 0, !0)
586
- ], 4), [
587
- [j, y(i)]
588
- ])
589
- ]),
590
- _: 3
591
- }, 8, ["transition"])
592
- ], 8, ["to"])) : (L(), A(y(G), {
593
- key: 1,
594
- transition: n.transition,
595
- name: "scale",
596
- onBeforeLeave: w,
597
- onAfterLeave: T,
598
- onLeaveCancelled: E
599
- }, {
600
- default: D(() => [
601
- K(_("div", {
602
- ref_key: "floating",
603
- ref: d,
604
- style: W(k.value)
605
- }, [
606
- C(f.$slots, "default", {}, void 0, !0)
607
- ], 4), [
608
- [j, y(i)]
609
- ])
610
- ]),
611
- _: 3
612
- }, 8, ["transition"]))
613
- ], 64));
614
- }
615
- }), dt = /* @__PURE__ */ Q(ct, [["__scopeId", "data-v-d9f4cacd"]]), ft = oe({
616
- ...ue(),
617
- openDelay: {
618
- type: Number,
619
- default: 0
620
- },
621
- closeDelay: {
622
- type: Number,
623
- default: 0
624
- }
625
- });
626
- function pt(e, t) {
627
- const { click: n, hover: o, focus: r, contextmenu: i, disabled: l = !1 } = t;
628
- let s = null, a = null;
629
- function u() {
630
- s && clearTimeout(s), a && clearTimeout(a), s = null, a = null;
631
- }
632
- function c(f, V = 0) {
633
- if (u(), V === 0) {
634
- e.value = f;
635
- return;
636
- }
637
- const R = window.setTimeout(() => {
638
- e.value = f;
639
- }, V);
640
- f ? s = R : a = R;
641
- }
642
- const d = typeof o == "object" ? o : {}, m = d.openDelay ?? 0, b = d.closeDelay ?? 0;
643
- function M() {
644
- l || !n || (e.value = !e.value);
645
- }
646
- function F(f) {
647
- l || !i || (f.preventDefault(), e.value = !0);
648
- }
649
- function x() {
650
- l || !o || c(!0, m);
651
- }
652
- function k() {
653
- o && c(!1, b);
654
- }
655
- function I() {
656
- l || !r || (e.value = !0);
657
- }
658
- function w() {
659
- r && (e.value = !1);
660
- }
661
- S(u);
662
- const T = p(() => ({
663
- ...n ? { onClick: M } : {},
664
- ...i ? { onContextmenu: F } : {},
665
- ...o ? { onMouseenter: x, onMouseleave: k } : {},
666
- ...r ? { onFocus: I, onBlur: w } : {}
667
- })), E = p(() => ({
668
- ...o ? { onMouseenter: x, onMouseleave: k } : {}
669
- }));
670
- return {
671
- triggerAttrs: T,
672
- floatingAttrs: E
673
- };
674
- }
675
- const mt = { class: "g-tooltip__content" }, gt = /* @__PURE__ */ ne({
676
- __name: "GTooltip",
677
- props: ft(),
678
- setup(e, { expose: t }) {
679
- const n = e, o = v(!1), r = p(
680
- () => n.transition ?? { name: "scale-only", scale: 0.96 }
681
- ), { triggerAttrs: i, floatingAttrs: l } = pt(o, {
682
- hover: {
683
- openDelay: n.openDelay,
684
- closeDelay: n.closeDelay
685
- },
686
- focus: !0
687
- });
688
- function s() {
689
- o.value = !1;
690
- }
691
- function a() {
692
- o.value = !0;
693
- }
694
- return t({ hide: s, show: a, open: o }), (u, c) => (L(), A(y(dt), P(n, {
695
- "model-value": o.value,
696
- "onUpdate:modelValue": c[0] || (c[0] = (d) => o.value = d),
697
- transition: r.value
698
- }), he({
699
- default: D(() => [
700
- _("div", P({ class: "g-tooltip" }, y(l), { role: "tooltip" }), [
701
- c[1] || (c[1] = _("div", { class: "g-tooltip__underlay" }, null, -1)),
702
- _("span", mt, xe(n.content), 1)
703
- ], 16)
704
- ]),
705
- _: 2
706
- }, [
707
- u.$slots.default ? {
708
- name: "reference",
709
- fn: D(({ ref: d }) => [
710
- _("div", P({
711
- ref: d,
712
- class: "g-tooltip__trigger",
713
- tabindex: "0"
714
- }, y(i)), [
715
- C(u.$slots, "default", {}, void 0, !0)
716
- ], 16)
717
- ]),
718
- key: "0"
719
- } : void 0
720
- ]), 1040, ["model-value", "transition"]));
721
- }
722
- }), yt = /* @__PURE__ */ Q(gt, [["__scopeId", "data-v-578012d6"]]), Dt = {
723
- mounted(e, t) {
724
- if (!t.value) return;
725
- const n = typeof t.value == "string" ? { content: t.value } : t.value, o = v(!1), r = document.createElement("div");
726
- document.body.appendChild(r);
727
- const i = v(null), l = ee({
728
- setup() {
729
- return () => we(
730
- yt,
731
- {
732
- ...n,
733
- reference: e,
734
- ref: (u) => {
735
- u && (i.value = u);
736
- }
737
- },
738
- {
739
- reference: ({
740
- ref: u
741
- }) => (u(e), e)
742
- }
743
- );
744
- }
745
- });
746
- l.mount(r);
747
- const s = () => {
748
- i.value && i.value.show();
749
- }, a = () => {
750
- i.value && i.value.hide();
751
- };
752
- e.addEventListener("mouseenter", s), e.addEventListener("mouseleave", a), e.addEventListener("focus", s), e.addEventListener("blur", a), e.__tooltip__ = {
753
- app: l,
754
- container: r,
755
- open: o,
756
- cleanup() {
757
- e.removeEventListener("mouseenter", s), e.removeEventListener("mouseleave", a), e.removeEventListener("focus", s), e.removeEventListener("blur", a), l.unmount(), r.remove();
758
- }
759
- };
760
- },
761
- unmounted(e) {
762
- var t;
763
- (t = e.__tooltip__) == null || t.cleanup();
764
- }
765
- };
766
- function vt(e) {
767
- return typeof e == "string" || Array.isArray(e) || e === void 0 ? {
768
- mask: e
769
- } : e;
770
- }
771
- function de(e) {
772
- return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? e : e.querySelector("input, textarea");
773
- }
774
- function O(e, t) {
775
- const n = de(e);
776
- if (!n) return;
777
- const o = vt(t.value), r = {
778
- ...Me,
779
- ...o.tokens ?? {}
780
- }, i = Fe(n.value, o.mask, r);
781
- n.value !== i && (n.value = i);
782
- }
783
- function _t(e, t) {
784
- const n = de(e);
785
- if (!n) return;
786
- const o = () => {
787
- e._gMaskFormatting || (e._gMaskFormatting = !0, O(e, t), n.dispatchEvent(new Event("input", { bubbles: !0 })), e._gMaskFormatting = !1);
788
- };
789
- n.addEventListener("input", o), e._gMaskCleanup = () => {
790
- n.removeEventListener("input", o);
791
- }, O(e, t);
792
- }
793
- const Bt = {
794
- mounted: _t,
795
- updated(e, t) {
796
- O(e, t);
797
- },
798
- beforeUnmount(e) {
799
- var t;
800
- (t = e._gMaskCleanup) == null || t.call(e), delete e._gMaskCleanup, delete e._gMaskFormatting;
801
- }
802
- };
803
- export {
804
- dt as B,
805
- yt as G,
806
- Bt as a,
807
- Dt as b,
808
- ot as c,
809
- ut as d,
810
- pt as e,
811
- Et as g,
812
- Lt as l,
813
- ue as m,
814
- Ct as r,
815
- rt as u,
816
- Tt as v
817
- };