@sitharaj08/gamify 1.0.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.
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.js +677 -0
- package/dist/index.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +80 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import me, { useEffect as U, useRef as W, createContext as B, useState as V, useContext as J, useCallback as de } from "react";
|
|
2
|
+
var E = { exports: {} }, _ = {};
|
|
3
|
+
var Y;
|
|
4
|
+
function ue() {
|
|
5
|
+
if (Y) return _;
|
|
6
|
+
Y = 1;
|
|
7
|
+
var a = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function s(n, i, c) {
|
|
9
|
+
var l = null;
|
|
10
|
+
if (c !== void 0 && (l = "" + c), i.key !== void 0 && (l = "" + i.key), "key" in i) {
|
|
11
|
+
c = {};
|
|
12
|
+
for (var h in i)
|
|
13
|
+
h !== "key" && (c[h] = i[h]);
|
|
14
|
+
} else c = i;
|
|
15
|
+
return i = c.ref, {
|
|
16
|
+
$$typeof: a,
|
|
17
|
+
type: n,
|
|
18
|
+
key: l,
|
|
19
|
+
ref: i !== void 0 ? i : null,
|
|
20
|
+
props: c
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return _.Fragment = t, _.jsx = s, _.jsxs = s, _;
|
|
24
|
+
}
|
|
25
|
+
var p = {};
|
|
26
|
+
var D;
|
|
27
|
+
function fe() {
|
|
28
|
+
return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
|
+
function a(e) {
|
|
30
|
+
if (e == null) return null;
|
|
31
|
+
if (typeof e == "function")
|
|
32
|
+
return e.$$typeof === oe ? null : e.displayName || e.name || null;
|
|
33
|
+
if (typeof e == "string") return e;
|
|
34
|
+
switch (e) {
|
|
35
|
+
case N:
|
|
36
|
+
return "Fragment";
|
|
37
|
+
case K:
|
|
38
|
+
return "Profiler";
|
|
39
|
+
case Z:
|
|
40
|
+
return "StrictMode";
|
|
41
|
+
case te:
|
|
42
|
+
return "Suspense";
|
|
43
|
+
case se:
|
|
44
|
+
return "SuspenseList";
|
|
45
|
+
case ie:
|
|
46
|
+
return "Activity";
|
|
47
|
+
}
|
|
48
|
+
if (typeof e == "object")
|
|
49
|
+
switch (typeof e.tag == "number" && console.error(
|
|
50
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
|
+
), e.$$typeof) {
|
|
52
|
+
case Q:
|
|
53
|
+
return "Portal";
|
|
54
|
+
case re:
|
|
55
|
+
return e.displayName || "Context";
|
|
56
|
+
case ee:
|
|
57
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
58
|
+
case ae:
|
|
59
|
+
var o = e.render;
|
|
60
|
+
return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
61
|
+
case ne:
|
|
62
|
+
return o = e.displayName || null, o !== null ? o : a(e.type) || "Memo";
|
|
63
|
+
case k:
|
|
64
|
+
o = e._payload, e = e._init;
|
|
65
|
+
try {
|
|
66
|
+
return a(e(o));
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function t(e) {
|
|
73
|
+
return "" + e;
|
|
74
|
+
}
|
|
75
|
+
function s(e) {
|
|
76
|
+
try {
|
|
77
|
+
t(e);
|
|
78
|
+
var o = !1;
|
|
79
|
+
} catch {
|
|
80
|
+
o = !0;
|
|
81
|
+
}
|
|
82
|
+
if (o) {
|
|
83
|
+
o = console;
|
|
84
|
+
var m = o.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
85
|
+
return m.call(
|
|
86
|
+
o,
|
|
87
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
|
+
d
|
|
89
|
+
), t(e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function n(e) {
|
|
93
|
+
if (e === N) return "<>";
|
|
94
|
+
if (typeof e == "object" && e !== null && e.$$typeof === k)
|
|
95
|
+
return "<...>";
|
|
96
|
+
try {
|
|
97
|
+
var o = a(e);
|
|
98
|
+
return o ? "<" + o + ">" : "<...>";
|
|
99
|
+
} catch {
|
|
100
|
+
return "<...>";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function i() {
|
|
104
|
+
var e = R.A;
|
|
105
|
+
return e === null ? null : e.getOwner();
|
|
106
|
+
}
|
|
107
|
+
function c() {
|
|
108
|
+
return Error("react-stack-top-frame");
|
|
109
|
+
}
|
|
110
|
+
function l(e) {
|
|
111
|
+
if ($.call(e, "key")) {
|
|
112
|
+
var o = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
113
|
+
if (o && o.isReactWarning) return !1;
|
|
114
|
+
}
|
|
115
|
+
return e.key !== void 0;
|
|
116
|
+
}
|
|
117
|
+
function h(e, o) {
|
|
118
|
+
function m() {
|
|
119
|
+
G || (G = !0, console.error(
|
|
120
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
121
|
+
o
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
m.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
125
|
+
get: m,
|
|
126
|
+
configurable: !0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function g() {
|
|
130
|
+
var e = a(this.type);
|
|
131
|
+
return I[e] || (I[e] = !0, console.error(
|
|
132
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
133
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
134
|
+
}
|
|
135
|
+
function v(e, o, m, d, T, S) {
|
|
136
|
+
var u = m.ref;
|
|
137
|
+
return e = {
|
|
138
|
+
$$typeof: O,
|
|
139
|
+
type: e,
|
|
140
|
+
key: o,
|
|
141
|
+
props: m,
|
|
142
|
+
_owner: d
|
|
143
|
+
}, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
|
|
144
|
+
enumerable: !1,
|
|
145
|
+
get: g
|
|
146
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
147
|
+
configurable: !1,
|
|
148
|
+
enumerable: !1,
|
|
149
|
+
writable: !0,
|
|
150
|
+
value: 0
|
|
151
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
152
|
+
configurable: !1,
|
|
153
|
+
enumerable: !1,
|
|
154
|
+
writable: !0,
|
|
155
|
+
value: null
|
|
156
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
157
|
+
configurable: !1,
|
|
158
|
+
enumerable: !1,
|
|
159
|
+
writable: !0,
|
|
160
|
+
value: T
|
|
161
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
162
|
+
configurable: !1,
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
writable: !0,
|
|
165
|
+
value: S
|
|
166
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
167
|
+
}
|
|
168
|
+
function y(e, o, m, d, T, S) {
|
|
169
|
+
var u = o.children;
|
|
170
|
+
if (u !== void 0)
|
|
171
|
+
if (d)
|
|
172
|
+
if (ce(u)) {
|
|
173
|
+
for (d = 0; d < u.length; d++)
|
|
174
|
+
j(u[d]);
|
|
175
|
+
Object.freeze && Object.freeze(u);
|
|
176
|
+
} else
|
|
177
|
+
console.error(
|
|
178
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
179
|
+
);
|
|
180
|
+
else j(u);
|
|
181
|
+
if ($.call(o, "key")) {
|
|
182
|
+
u = a(e);
|
|
183
|
+
var x = Object.keys(o).filter(function(le) {
|
|
184
|
+
return le !== "key";
|
|
185
|
+
});
|
|
186
|
+
d = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", z[u + d] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
187
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
188
|
+
let props = %s;
|
|
189
|
+
<%s {...props} />
|
|
190
|
+
React keys must be passed directly to JSX without using spread:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s key={someKey} {...props} />`,
|
|
193
|
+
d,
|
|
194
|
+
u,
|
|
195
|
+
x,
|
|
196
|
+
u
|
|
197
|
+
), z[u + d] = !0);
|
|
198
|
+
}
|
|
199
|
+
if (u = null, m !== void 0 && (s(m), u = "" + m), l(o) && (s(o.key), u = "" + o.key), "key" in o) {
|
|
200
|
+
m = {};
|
|
201
|
+
for (var A in o)
|
|
202
|
+
A !== "key" && (m[A] = o[A]);
|
|
203
|
+
} else m = o;
|
|
204
|
+
return u && h(
|
|
205
|
+
m,
|
|
206
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
207
|
+
), v(
|
|
208
|
+
e,
|
|
209
|
+
u,
|
|
210
|
+
m,
|
|
211
|
+
i(),
|
|
212
|
+
T,
|
|
213
|
+
S
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function j(e) {
|
|
217
|
+
C(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? C(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
218
|
+
}
|
|
219
|
+
function C(e) {
|
|
220
|
+
return typeof e == "object" && e !== null && e.$$typeof === O;
|
|
221
|
+
}
|
|
222
|
+
var b = me, O = /* @__PURE__ */ Symbol.for("react.transitional.element"), Q = /* @__PURE__ */ Symbol.for("react.portal"), N = /* @__PURE__ */ Symbol.for("react.fragment"), Z = /* @__PURE__ */ Symbol.for("react.strict_mode"), K = /* @__PURE__ */ Symbol.for("react.profiler"), ee = /* @__PURE__ */ Symbol.for("react.consumer"), re = /* @__PURE__ */ Symbol.for("react.context"), ae = /* @__PURE__ */ Symbol.for("react.forward_ref"), te = /* @__PURE__ */ Symbol.for("react.suspense"), se = /* @__PURE__ */ Symbol.for("react.suspense_list"), ne = /* @__PURE__ */ Symbol.for("react.memo"), k = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), oe = /* @__PURE__ */ Symbol.for("react.client.reference"), R = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, ce = Array.isArray, w = console.createTask ? console.createTask : function() {
|
|
223
|
+
return null;
|
|
224
|
+
};
|
|
225
|
+
b = {
|
|
226
|
+
react_stack_bottom_frame: function(e) {
|
|
227
|
+
return e();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var G, I = {}, L = b.react_stack_bottom_frame.bind(
|
|
231
|
+
b,
|
|
232
|
+
c
|
|
233
|
+
)(), M = w(n(c)), z = {};
|
|
234
|
+
p.Fragment = N, p.jsx = function(e, o, m) {
|
|
235
|
+
var d = 1e4 > R.recentlyCreatedOwnerStacks++;
|
|
236
|
+
return y(
|
|
237
|
+
e,
|
|
238
|
+
o,
|
|
239
|
+
m,
|
|
240
|
+
!1,
|
|
241
|
+
d ? Error("react-stack-top-frame") : L,
|
|
242
|
+
d ? w(n(e)) : M
|
|
243
|
+
);
|
|
244
|
+
}, p.jsxs = function(e, o, m) {
|
|
245
|
+
var d = 1e4 > R.recentlyCreatedOwnerStacks++;
|
|
246
|
+
return y(
|
|
247
|
+
e,
|
|
248
|
+
o,
|
|
249
|
+
m,
|
|
250
|
+
!0,
|
|
251
|
+
d ? Error("react-stack-top-frame") : L,
|
|
252
|
+
d ? w(n(e)) : M
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
})()), p;
|
|
256
|
+
}
|
|
257
|
+
var F;
|
|
258
|
+
function he() {
|
|
259
|
+
return F || (F = 1, process.env.NODE_ENV === "production" ? E.exports = ue() : E.exports = fe()), E.exports;
|
|
260
|
+
}
|
|
261
|
+
var r = he();
|
|
262
|
+
function q(a) {
|
|
263
|
+
var t, s, n = "";
|
|
264
|
+
if (typeof a == "string" || typeof a == "number") n += a;
|
|
265
|
+
else if (typeof a == "object") if (Array.isArray(a)) {
|
|
266
|
+
var i = a.length;
|
|
267
|
+
for (t = 0; t < i; t++) a[t] && (s = q(a[t])) && (n && (n += " "), n += s);
|
|
268
|
+
} else for (s in a) a[s] && (n && (n += " "), n += s);
|
|
269
|
+
return n;
|
|
270
|
+
}
|
|
271
|
+
function f() {
|
|
272
|
+
for (var a, t, s = 0, n = "", i = arguments.length; s < i; s++) (a = arguments[s]) && (t = q(a)) && (n && (n += " "), n += t);
|
|
273
|
+
return n;
|
|
274
|
+
}
|
|
275
|
+
const ge = ({
|
|
276
|
+
src: a,
|
|
277
|
+
alt: t,
|
|
278
|
+
size: s = "md",
|
|
279
|
+
rank: n = "common",
|
|
280
|
+
status: i,
|
|
281
|
+
className: c,
|
|
282
|
+
...l
|
|
283
|
+
}) => /* @__PURE__ */ r.jsxs(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
className: f(
|
|
287
|
+
"gamify-avatar",
|
|
288
|
+
`gamify-avatar--${s}`,
|
|
289
|
+
`gamify-avatar--${n}`,
|
|
290
|
+
c
|
|
291
|
+
),
|
|
292
|
+
...l,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ r.jsx("img", { src: a, alt: t, className: "gamify-avatar__img" }),
|
|
295
|
+
i && /* @__PURE__ */ r.jsx(
|
|
296
|
+
"span",
|
|
297
|
+
{
|
|
298
|
+
className: f(
|
|
299
|
+
"gamify-avatar__status",
|
|
300
|
+
`gamify-avatar__status--${i}`
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
), P = ({
|
|
307
|
+
variant: a = "common",
|
|
308
|
+
className: t,
|
|
309
|
+
children: s,
|
|
310
|
+
...n
|
|
311
|
+
}) => /* @__PURE__ */ r.jsx(
|
|
312
|
+
"span",
|
|
313
|
+
{
|
|
314
|
+
className: f("gamify-badge", `gamify-badge--${a}`, t),
|
|
315
|
+
...n,
|
|
316
|
+
children: s
|
|
317
|
+
}
|
|
318
|
+
), ye = ({
|
|
319
|
+
variant: a = "primary",
|
|
320
|
+
size: t = "md",
|
|
321
|
+
className: s,
|
|
322
|
+
children: n,
|
|
323
|
+
...i
|
|
324
|
+
}) => /* @__PURE__ */ r.jsx(
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
className: f(
|
|
328
|
+
"gamify-btn",
|
|
329
|
+
`gamify-btn--${a}`,
|
|
330
|
+
`gamify-btn--${t}`,
|
|
331
|
+
s
|
|
332
|
+
),
|
|
333
|
+
...i,
|
|
334
|
+
children: n
|
|
335
|
+
}
|
|
336
|
+
), je = ({
|
|
337
|
+
variant: a = "default",
|
|
338
|
+
className: t,
|
|
339
|
+
children: s,
|
|
340
|
+
...n
|
|
341
|
+
}) => /* @__PURE__ */ r.jsx(
|
|
342
|
+
"div",
|
|
343
|
+
{
|
|
344
|
+
className: f("gamify-card", `gamify-card--${a}`, t),
|
|
345
|
+
...n,
|
|
346
|
+
children: s
|
|
347
|
+
}
|
|
348
|
+
), be = ({
|
|
349
|
+
label: a,
|
|
350
|
+
error: t,
|
|
351
|
+
className: s,
|
|
352
|
+
...n
|
|
353
|
+
}) => /* @__PURE__ */ r.jsxs("div", { className: "gamify-input-wrapper", children: [
|
|
354
|
+
a && /* @__PURE__ */ r.jsx("label", { className: "gamify-label", children: a }),
|
|
355
|
+
/* @__PURE__ */ r.jsx(
|
|
356
|
+
"input",
|
|
357
|
+
{
|
|
358
|
+
className: f(
|
|
359
|
+
"gamify-input",
|
|
360
|
+
{ "gamify-input--error": t },
|
|
361
|
+
s
|
|
362
|
+
),
|
|
363
|
+
...n
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
t && /* @__PURE__ */ r.jsx("span", { className: "gamify-error-message", children: t })
|
|
367
|
+
] }), Te = ({
|
|
368
|
+
data: a,
|
|
369
|
+
className: t,
|
|
370
|
+
...s
|
|
371
|
+
}) => /* @__PURE__ */ r.jsxs("table", { className: f("gamify-leaderboard", t), ...s, children: [
|
|
372
|
+
/* @__PURE__ */ r.jsx("thead", { children: /* @__PURE__ */ r.jsxs("tr", { children: [
|
|
373
|
+
/* @__PURE__ */ r.jsx("th", { children: "Rank" }),
|
|
374
|
+
/* @__PURE__ */ r.jsx("th", { children: "Player" }),
|
|
375
|
+
/* @__PURE__ */ r.jsx("th", { style: { textAlign: "right" }, children: "Score" })
|
|
376
|
+
] }) }),
|
|
377
|
+
/* @__PURE__ */ r.jsx("tbody", { children: a.map((n, i) => /* @__PURE__ */ r.jsxs("tr", { className: `gamify-leaderboard-row--${i + 1}`, children: [
|
|
378
|
+
/* @__PURE__ */ r.jsxs("td", { className: "gamify-leaderboard__rank", children: [
|
|
379
|
+
"#",
|
|
380
|
+
i + 1
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsxs("div", { className: "gamify-leaderboard__player", children: [
|
|
383
|
+
/* @__PURE__ */ r.jsx(ge, { src: n.avatar, alt: n.name, size: "sm" }),
|
|
384
|
+
n.name
|
|
385
|
+
] }) }),
|
|
386
|
+
/* @__PURE__ */ r.jsx("td", { className: "gamify-leaderboard__score", children: n.score.toLocaleString() })
|
|
387
|
+
] }, n.id)) })
|
|
388
|
+
] }), Ee = ({
|
|
389
|
+
isOpen: a,
|
|
390
|
+
onClose: t,
|
|
391
|
+
title: s,
|
|
392
|
+
children: n,
|
|
393
|
+
variant: i = "default",
|
|
394
|
+
footer: c
|
|
395
|
+
}) => (U(() => {
|
|
396
|
+
const l = (h) => {
|
|
397
|
+
h.key === "Escape" && t();
|
|
398
|
+
};
|
|
399
|
+
return a && window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
|
|
400
|
+
}, [a, t]), a ? /* @__PURE__ */ r.jsx("div", { className: "gamify-modal-overlay", onClick: t, children: /* @__PURE__ */ r.jsxs(
|
|
401
|
+
"div",
|
|
402
|
+
{
|
|
403
|
+
className: f("gamify-modal", `gamify-modal--${i}`),
|
|
404
|
+
onClick: (l) => l.stopPropagation(),
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ r.jsxs("div", { className: "gamify-modal__header", children: [
|
|
407
|
+
/* @__PURE__ */ r.jsx("h3", { className: "gamify-modal__title", children: s }),
|
|
408
|
+
/* @__PURE__ */ r.jsx("button", { className: "gamify-modal__close", onClick: t, children: "×" })
|
|
409
|
+
] }),
|
|
410
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-modal__content", children: n }),
|
|
411
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-modal__footer", children: c || /* @__PURE__ */ r.jsx(ye, { size: "sm", variant: "ghost", onClick: t, children: "Close" }) })
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
) }) : null), Ne = ({
|
|
415
|
+
label: a,
|
|
416
|
+
value: t,
|
|
417
|
+
showValue: s = !0,
|
|
418
|
+
className: n,
|
|
419
|
+
...i
|
|
420
|
+
}) => /* @__PURE__ */ r.jsxs("div", { className: f("gamify-slider-container", n), children: [
|
|
421
|
+
(a || s) && /* @__PURE__ */ r.jsxs("div", { className: "gamify-slider-label", children: [
|
|
422
|
+
a && /* @__PURE__ */ r.jsx("span", { children: a }),
|
|
423
|
+
s && /* @__PURE__ */ r.jsx("span", { className: "gamify-slider-value", children: t })
|
|
424
|
+
] }),
|
|
425
|
+
/* @__PURE__ */ r.jsx(
|
|
426
|
+
"input",
|
|
427
|
+
{
|
|
428
|
+
type: "range",
|
|
429
|
+
className: "gamify-slider",
|
|
430
|
+
value: t,
|
|
431
|
+
...i
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
] }), ke = ({
|
|
435
|
+
size: a = "md",
|
|
436
|
+
className: t
|
|
437
|
+
}) => /* @__PURE__ */ r.jsxs("div", { className: f("gamify-spinner", `gamify-spinner--${a}`, t), children: [
|
|
438
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-spinner__ring" }),
|
|
439
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-spinner__ring" }),
|
|
440
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-spinner__ring" }),
|
|
441
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-spinner__ring" })
|
|
442
|
+
] }), Re = ({
|
|
443
|
+
label: a,
|
|
444
|
+
className: t,
|
|
445
|
+
checked: s,
|
|
446
|
+
...n
|
|
447
|
+
}) => /* @__PURE__ */ r.jsxs("label", { className: f("gamify-switch-label", t), children: [
|
|
448
|
+
/* @__PURE__ */ r.jsxs("div", { className: "gamify-switch", children: [
|
|
449
|
+
/* @__PURE__ */ r.jsx("input", { type: "checkbox", checked: s, ...n }),
|
|
450
|
+
/* @__PURE__ */ r.jsx("span", { className: "gamify-switch__slider" })
|
|
451
|
+
] }),
|
|
452
|
+
a && /* @__PURE__ */ r.jsx("span", { children: a })
|
|
453
|
+
] }), we = ({
|
|
454
|
+
tabs: a,
|
|
455
|
+
activeTabId: t,
|
|
456
|
+
onTabChange: s,
|
|
457
|
+
className: n
|
|
458
|
+
}) => {
|
|
459
|
+
const i = W(null), c = (l, h) => {
|
|
460
|
+
if (s(l), i.current) {
|
|
461
|
+
const g = i.current, y = g.querySelectorAll(".gamify-tab")[h];
|
|
462
|
+
if (y) {
|
|
463
|
+
const j = y.offsetLeft - 16;
|
|
464
|
+
g.scrollTo({
|
|
465
|
+
left: j,
|
|
466
|
+
behavior: "smooth"
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
return /* @__PURE__ */ r.jsx("div", { className: f("gamify-tabs", n), ref: i, children: a.map((l, h) => /* @__PURE__ */ r.jsx(
|
|
472
|
+
"button",
|
|
473
|
+
{
|
|
474
|
+
className: f(
|
|
475
|
+
"gamify-tab",
|
|
476
|
+
t === l.id && "gamify-tab--active"
|
|
477
|
+
),
|
|
478
|
+
onClick: () => c(l.id, h),
|
|
479
|
+
children: l.label
|
|
480
|
+
},
|
|
481
|
+
l.id
|
|
482
|
+
)) });
|
|
483
|
+
}, X = B(void 0), Se = ({ children: a }) => {
|
|
484
|
+
const [t, s] = V(() => {
|
|
485
|
+
const c = localStorage.getItem("gamify-theme");
|
|
486
|
+
return c === "light" || c === "dark" ? c : "dark";
|
|
487
|
+
});
|
|
488
|
+
U(() => {
|
|
489
|
+
document.documentElement.setAttribute("data-theme", t), localStorage.setItem("gamify-theme", t);
|
|
490
|
+
}, [t]);
|
|
491
|
+
const n = () => {
|
|
492
|
+
s((c) => c === "light" ? "dark" : "light");
|
|
493
|
+
}, i = (c) => {
|
|
494
|
+
s(c);
|
|
495
|
+
};
|
|
496
|
+
return /* @__PURE__ */ r.jsx(X.Provider, { value: { theme: t, toggleTheme: n, setTheme: i }, children: a });
|
|
497
|
+
}, ve = () => {
|
|
498
|
+
const a = J(X);
|
|
499
|
+
if (!a) throw new Error("useThemeContext must be used within GamifyThemeProvider");
|
|
500
|
+
return a;
|
|
501
|
+
}, xe = () => {
|
|
502
|
+
const { theme: a, toggleTheme: t, setTheme: s } = ve();
|
|
503
|
+
return { theme: a, toggleTheme: t, setTheme: s };
|
|
504
|
+
}, Ae = ({ className: a }) => {
|
|
505
|
+
const { theme: t, toggleTheme: s } = xe();
|
|
506
|
+
return /* @__PURE__ */ r.jsx(
|
|
507
|
+
"button",
|
|
508
|
+
{
|
|
509
|
+
className: f("gamify-theme-toggle", a),
|
|
510
|
+
onClick: s,
|
|
511
|
+
"aria-label": "Toggle Theme",
|
|
512
|
+
title: `Switch to ${t === "dark" ? "light" : "dark"} mode`,
|
|
513
|
+
children: t === "dark" ? /* @__PURE__ */ r.jsx("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { d: "M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z" }) }) : /* @__PURE__ */ r.jsx("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ r.jsx("path", { d: "M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z" }) })
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}, H = B(void 0), Pe = ({ children: a }) => {
|
|
517
|
+
const [t, s] = V([]), n = W(0), i = de((c, l, h = 3e3) => {
|
|
518
|
+
const g = `toast-${n.current++}`;
|
|
519
|
+
s((v) => [...v, { id: g, title: c, message: l, duration: h }]), setTimeout(() => {
|
|
520
|
+
s((v) => v.filter((y) => y.id !== g));
|
|
521
|
+
}, h);
|
|
522
|
+
}, []);
|
|
523
|
+
return /* @__PURE__ */ r.jsxs(H.Provider, { value: { addToast: i }, children: [
|
|
524
|
+
a,
|
|
525
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-toast-container", children: t.map((c) => /* @__PURE__ */ r.jsxs("div", { className: "gamify-toast", style: { "--duration": `${c.duration}ms` }, children: [
|
|
526
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-toast__icon", children: "🏆" }),
|
|
527
|
+
/* @__PURE__ */ r.jsxs("div", { className: "gamify-toast__content", children: [
|
|
528
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-toast__title", children: c.title }),
|
|
529
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-toast__message", children: c.message })
|
|
530
|
+
] })
|
|
531
|
+
] }, c.id)) })
|
|
532
|
+
] });
|
|
533
|
+
}, _e = () => {
|
|
534
|
+
const a = J(H);
|
|
535
|
+
if (!a)
|
|
536
|
+
throw new Error("useToast must be used within a GamifyToastProvider");
|
|
537
|
+
return a;
|
|
538
|
+
}, Ce = ({
|
|
539
|
+
content: a,
|
|
540
|
+
children: t,
|
|
541
|
+
rarity: s = "common"
|
|
542
|
+
}) => /* @__PURE__ */ r.jsxs("div", { className: "gamify-tooltip-wrapper", children: [
|
|
543
|
+
t,
|
|
544
|
+
/* @__PURE__ */ r.jsx("div", { className: f("gamify-tooltip", `gamify-tooltip--${s}`), children: a })
|
|
545
|
+
] }), Oe = ({
|
|
546
|
+
value: a,
|
|
547
|
+
max: t,
|
|
548
|
+
variant: s = "hp",
|
|
549
|
+
showLabel: n = !0,
|
|
550
|
+
className: i,
|
|
551
|
+
...c
|
|
552
|
+
}) => {
|
|
553
|
+
const l = Math.min(100, Math.max(0, a / t * 100));
|
|
554
|
+
return /* @__PURE__ */ r.jsxs(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
className: f("gamify-health-bar", `gamify-health-bar--${s}`, i),
|
|
558
|
+
...c,
|
|
559
|
+
children: [
|
|
560
|
+
/* @__PURE__ */ r.jsx(
|
|
561
|
+
"div",
|
|
562
|
+
{
|
|
563
|
+
className: "gamify-health-bar__fill",
|
|
564
|
+
style: { width: `${l}%` }
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
n && /* @__PURE__ */ r.jsxs("span", { className: "gamify-health-bar__text", children: [
|
|
568
|
+
a,
|
|
569
|
+
" / ",
|
|
570
|
+
t
|
|
571
|
+
] })
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
}, $e = ({
|
|
576
|
+
itemSrc: a,
|
|
577
|
+
count: t,
|
|
578
|
+
rarity: s,
|
|
579
|
+
isActive: n,
|
|
580
|
+
size: i = "md",
|
|
581
|
+
className: c,
|
|
582
|
+
...l
|
|
583
|
+
}) => /* @__PURE__ */ r.jsxs(
|
|
584
|
+
"div",
|
|
585
|
+
{
|
|
586
|
+
className: f(
|
|
587
|
+
"gamify-inventory-slot",
|
|
588
|
+
`gamify-inventory-slot--${i}`,
|
|
589
|
+
s && `gamify-inventory-slot--${s}`,
|
|
590
|
+
n && "gamify-inventory-slot--active",
|
|
591
|
+
c
|
|
592
|
+
),
|
|
593
|
+
...l,
|
|
594
|
+
children: [
|
|
595
|
+
a && /* @__PURE__ */ r.jsx("img", { src: a, alt: "Item", className: "gamify-inventory-slot__img" }),
|
|
596
|
+
t && t > 1 && /* @__PURE__ */ r.jsx("span", { className: "gamify-inventory-slot__count", children: t })
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
), Ge = ({
|
|
600
|
+
quests: a,
|
|
601
|
+
onQuestClick: t,
|
|
602
|
+
className: s,
|
|
603
|
+
...n
|
|
604
|
+
}) => /* @__PURE__ */ r.jsx("div", { className: f("gamify-quest-log", s), ...n, children: a.map((i) => /* @__PURE__ */ r.jsxs(
|
|
605
|
+
"div",
|
|
606
|
+
{
|
|
607
|
+
className: f(
|
|
608
|
+
"gamify-quest-item",
|
|
609
|
+
`gamify-quest-item--${i.status}`
|
|
610
|
+
),
|
|
611
|
+
onClick: () => t?.(i),
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ r.jsxs("div", { className: "gamify-quest-item__title", children: [
|
|
614
|
+
i.title,
|
|
615
|
+
i.status === "completed" && /* @__PURE__ */ r.jsx(P, { variant: "uncommon", children: "DONE" }),
|
|
616
|
+
i.status === "active" && /* @__PURE__ */ r.jsx(P, { variant: "legendary", children: "ACTIVE" }),
|
|
617
|
+
i.status === "failed" && /* @__PURE__ */ r.jsx(P, { variant: "mythic", children: "FAILED" })
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ r.jsx("div", { className: "gamify-quest-item__desc", children: i.description })
|
|
620
|
+
]
|
|
621
|
+
},
|
|
622
|
+
i.id
|
|
623
|
+
)) }), Ie = () => {
|
|
624
|
+
const { addToast: a } = _e(), t = async () => {
|
|
625
|
+
const s = {
|
|
626
|
+
title: "Gamify - Cyberpunk React UI Library",
|
|
627
|
+
text: "Check out Gamify! 🎮 The ultimate cyberpunk React component library for gaming apps. ⚡️",
|
|
628
|
+
url: window.location.href
|
|
629
|
+
};
|
|
630
|
+
if (navigator.share)
|
|
631
|
+
try {
|
|
632
|
+
await navigator.share(s);
|
|
633
|
+
} catch {
|
|
634
|
+
}
|
|
635
|
+
else
|
|
636
|
+
try {
|
|
637
|
+
await navigator.clipboard.writeText(`${s.text}
|
|
638
|
+
${s.url}`), a("Link Copied!", "Share this with your friends! 🚀", 3e3);
|
|
639
|
+
} catch {
|
|
640
|
+
a("Error", "Could not access clipboard.", 2e3);
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
return /* @__PURE__ */ r.jsx(
|
|
644
|
+
"button",
|
|
645
|
+
{
|
|
646
|
+
className: "gamify-share-fab",
|
|
647
|
+
onClick: t,
|
|
648
|
+
"aria-label": "Share Loot UI",
|
|
649
|
+
title: "Share this page",
|
|
650
|
+
children: /* @__PURE__ */ r.jsx("svg", { className: "gamify-share-fab__icon", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ r.jsx("path", { d: "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z" }) })
|
|
651
|
+
}
|
|
652
|
+
);
|
|
653
|
+
};
|
|
654
|
+
export {
|
|
655
|
+
ge as GamifyAvatar,
|
|
656
|
+
P as GamifyBadge,
|
|
657
|
+
ye as GamifyButton,
|
|
658
|
+
je as GamifyCard,
|
|
659
|
+
be as GamifyInput,
|
|
660
|
+
Te as GamifyLeaderboard,
|
|
661
|
+
Ee as GamifyModal,
|
|
662
|
+
Ie as GamifyShareFab,
|
|
663
|
+
Ne as GamifySlider,
|
|
664
|
+
ke as GamifySpinner,
|
|
665
|
+
Re as GamifySwitch,
|
|
666
|
+
we as GamifyTabs,
|
|
667
|
+
Se as GamifyThemeProvider,
|
|
668
|
+
Ae as GamifyThemeToggle,
|
|
669
|
+
Pe as GamifyToastProvider,
|
|
670
|
+
Ce as GamifyTooltip,
|
|
671
|
+
Oe as HealthBar,
|
|
672
|
+
$e as InventorySlot,
|
|
673
|
+
Ge as QuestLog,
|
|
674
|
+
ve as useThemeContext,
|
|
675
|
+
_e as useToast
|
|
676
|
+
};
|
|
677
|
+
//# sourceMappingURL=index.js.map
|