grevlingui 0.1.44 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +204 -72
  3. package/dist/Buttons/MenuButton.d.ts +12 -0
  4. package/dist/Buttons/ResetButton.d.ts +6 -0
  5. package/dist/Buttons/SettingsButton.d.ts +13 -0
  6. package/dist/CheckBox.d.ts +10 -0
  7. package/dist/Loader/Loader.d.ts +6 -0
  8. package/dist/Menu/Menu.d.ts +19 -0
  9. package/dist/NumberSelect/NumberSelect.d.ts +16 -0
  10. package/dist/PaneView/PaneView.d.ts +7 -0
  11. package/dist/Radio/RadioButton.d.ts +8 -0
  12. package/dist/Radio/RadioGroup.d.ts +12 -0
  13. package/dist/Radio/index.d.ts +4 -0
  14. package/dist/index.css +1 -0
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.js +583 -0
  17. package/package.json +47 -15
  18. package/Buttons/Buttons.css +0 -64
  19. package/Buttons/MenuButton.js +0 -78
  20. package/Buttons/ResetButton.js +0 -56
  21. package/Buttons/SettingsButton.js +0 -97
  22. package/CheckBox.js +0 -143
  23. package/Dots/Dots.css +0 -27
  24. package/Dots/Dots.js +0 -34
  25. package/Loader/Loader.css +0 -26
  26. package/Loader/Loader.js +0 -67
  27. package/Menu/Menu.css +0 -91
  28. package/Menu/Menu.js +0 -103
  29. package/NumberSelect/NumberSelect.css +0 -107
  30. package/NumberSelect/NumberSelect.js +0 -268
  31. package/NumberSliderSelect/NumberSliderSelect.css +0 -110
  32. package/NumberSliderSelect/NumberSliderSelect.js +0 -199
  33. package/PaneView/PaneView.css +0 -31
  34. package/PaneView/PaneView.js +0 -36
  35. package/Radio/RadioButton.js +0 -53
  36. package/Radio/RadioGroup.js +0 -32
  37. package/Radio/index.js +0 -19
  38. package/SunMoon.js +0 -57
  39. package/ToggleSwitch.js +0 -55
  40. package/index.js +0 -117
  41. package/utils/UseEffectOnce.js +0 -12
  42. package/utils/UseEffectPartialDeps.js +0 -12
package/dist/index.js ADDED
@@ -0,0 +1,583 @@
1
+ import { Fragment as e, useEffect as t, useRef as n, useState as r } from "react";
2
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
3
+ import './index.css';//#region src/Library/Buttons/MenuButton.tsx
4
+ var s = ({ open: e, setOpen: t, transitionTime: n = 300, stageDelay: s = 100, color: c, backgroundColor: l, styles: u, className: d = "" }) => {
5
+ let [f, p] = r(!1), m = ([t, r], i) => /* @__PURE__ */ a("path", {
6
+ style: {
7
+ transitionProperty: "d",
8
+ transitionDuration: `${n}ms`,
9
+ transitionDelay: e && i || !(e || i) ? "" : `${s}ms`
10
+ },
11
+ d: e ? r : t,
12
+ fill: c,
13
+ className: "mainShape"
14
+ }), h = /* @__PURE__ */ o("svg", {
15
+ className: "xburgerButton",
16
+ viewBox: "0 0 132.29166 132.29167",
17
+ height: "30",
18
+ width: "30",
19
+ children: [
20
+ m(f ? ["m 3.3906325,100.69908 125.3180175,0.008 -0.001,18.59162 -125.3180167,-0.008 z", "M 28.846694,14.020461 117.45992,106.30873 104.83715,119.455 16.223931,27.166726 Z"] : ["m 4.0263095,14.267981 125.3180305,-0.01822 0.003,18.591625 -125.3180367,0.01823 z", "M 16.175122,106.15278 104.78835,13.864516 117.41112,27.010786 28.79789,119.29905 Z"], !1),
21
+ m(["M 3.4245129,57.752314 H 128.74254 V 76.343939 H 3.4245129 Z", "M 67.752314,57.752314 H 67.752314 V 76.343939 H 67.752314 Z"], !0),
22
+ m(f ? ["m 4.0263095,14.267981 125.3180305,-0.01822 0.003,18.591625 -125.3180367,0.01823 z", "M 16.175122,106.15278 104.78835,13.864516 117.41112,27.010786 28.79789,119.29905 Z"] : ["m 3.3906325,100.69908 125.3180175,0.008 -0.001,18.59162 -125.3180167,-0.008 z", "M 28.846694,14.020461 117.45992,106.30873 104.83715,119.455 16.223931,27.166726 Z"], !1)
23
+ ]
24
+ });
25
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
26
+ className: "thingy",
27
+ children: f
28
+ }), /* @__PURE__ */ a("button", {
29
+ className: `xburgerMenuButton styleOverride ${d}`,
30
+ onClick: () => {
31
+ e && p((e) => !e), t(!e);
32
+ },
33
+ style: {
34
+ ...u,
35
+ backgroundColor: l
36
+ },
37
+ children: h
38
+ })] });
39
+ }, c = ({ open: e, setOpen: t, transitionTime: n = 300, stageDelay: i = 100, color: s = "white", backgroundColor: c, styles: l, className: u = "", rounding: d = 7 }) => {
40
+ let [f] = r(Math.random()), p = e ? [0, 0] : [20, 35], m = (t, r) => /* @__PURE__ */ a("rect", {
41
+ style: {
42
+ transitionProperty: "x, width",
43
+ transitionDuration: `${n}ms, ${n}ms`,
44
+ transitionDelay: e ? "" : `${i}ms, ${i}ms`
45
+ },
46
+ x: r && e ? 40 : 0,
47
+ y: "41",
48
+ height: "18",
49
+ fill: s,
50
+ width: r && e ? 20 : 100,
51
+ transform: `rotate(${t} 50 50)`,
52
+ rx: d
53
+ }), h = (t, r) => /* @__PURE__ */ a("circle", {
54
+ style: {
55
+ transitionProperty: "r",
56
+ transitionDuration: `${n}ms`,
57
+ transitionDelay: e ? `${i}ms` : ""
58
+ },
59
+ fill: r ?? "black",
60
+ cx: "50",
61
+ cy: "50",
62
+ r: t
63
+ });
64
+ return /* @__PURE__ */ a("button", {
65
+ className: `settingsButton styleOverride ${u}`,
66
+ onClick: () => {
67
+ t(!e);
68
+ },
69
+ style: {
70
+ ...l,
71
+ backgroundColor: c
72
+ },
73
+ children: /* @__PURE__ */ o("svg", {
74
+ viewBox: "0 0 100 100",
75
+ xmlns: "http://www.w3.org/2000/svg",
76
+ children: [/* @__PURE__ */ o("mask", {
77
+ id: `gearMask${f}`,
78
+ children: [/* @__PURE__ */ a("rect", {
79
+ x: "0",
80
+ y: "0",
81
+ height: "100",
82
+ width: "100",
83
+ fill: "white"
84
+ }), h(p[0])]
85
+ }), /* @__PURE__ */ o("g", {
86
+ mask: `url(#gearMask${f})`,
87
+ id: "settingsButtonShapes",
88
+ children: [
89
+ m(0, !0),
90
+ m(45),
91
+ m(90, !0),
92
+ m(135),
93
+ h(p[1], s)
94
+ ]
95
+ })]
96
+ })
97
+ });
98
+ }, l = ({ children: t, onCloseClickOverride: n, shouldCloseOnClick: i, transitionTime: l = 300, zIndex: u = 2, color: d = "white", bgColor: f = "#333", menuBgColor: p, backdropColor: m = "#22222266", settings: h, renderButton: g, className: _ = "", fullSlider: v, fader: y, left: b }) => {
99
+ let [x, S] = r(!1), C;
100
+ C = g ? g(x, S, l, d, f) : /* @__PURE__ */ a(h ? c : s, {
101
+ className: `button ${b ? "left" : ""}`,
102
+ open: !!(x || n),
103
+ setOpen: (e) => {
104
+ n ? n() : S(e);
105
+ },
106
+ transitionTime: l,
107
+ stageDelay: l * .3,
108
+ color: d,
109
+ backgroundColor: f,
110
+ styles: {
111
+ zIndex: u + 2,
112
+ backgroundColor: f
113
+ }
114
+ });
115
+ let w, T = {
116
+ zIndex: u + 1,
117
+ color: d,
118
+ backgroundColor: p ?? f
119
+ }, E = (e) => {
120
+ i?.(e) && S(!1);
121
+ };
122
+ return w = y ? /* @__PURE__ */ a("div", {
123
+ className: `xburgerMenu fader ${x ? " show" : ""} ${_}`,
124
+ onClick: E,
125
+ style: {
126
+ ...T,
127
+ transition: `opacity ${l}ms ease-out`
128
+ },
129
+ children: t
130
+ }) : /* @__PURE__ */ a("div", {
131
+ className: `xburgerMenu slider ${v ? "" : "partial"} ${x ? " show" : ""} ${b ? "left" : ""} ${_}`,
132
+ onClick: E,
133
+ style: {
134
+ ...T,
135
+ transition: `left ${l}ms ease-out, right ${l}ms ease-out`
136
+ },
137
+ children: t
138
+ }), /* @__PURE__ */ o(e, { children: [
139
+ !v && !y && /* @__PURE__ */ a("div", {
140
+ className: `xburgerTouchOutsideSensor ${x ? " show" : ""}`,
141
+ onClick: () => S(!1),
142
+ style: {
143
+ transition: `opacity ${l}ms ease-out`,
144
+ zIndex: u,
145
+ backgroundColor: m
146
+ }
147
+ }),
148
+ C,
149
+ w
150
+ ] });
151
+ }, u = ({ onClick: e, color: t = "white", backgroundColor: n }) => {
152
+ let [i, s] = r(!1);
153
+ return /* @__PURE__ */ a("button", {
154
+ className: `resetButton ${i ? "spin" : ""}`,
155
+ onClick: () => {
156
+ e?.(), !i && (s(!0), setTimeout(() => {
157
+ s(!1);
158
+ }, 400));
159
+ },
160
+ style: { backgroundColor: n },
161
+ children: /* @__PURE__ */ o("svg", {
162
+ viewBox: "0 0 90 90",
163
+ xmlns: "http://www.w3.org/2000/svg",
164
+ fill: t,
165
+ style: i ? { animation: "spinCC 400ms linear" } : {},
166
+ children: [/* @__PURE__ */ a("path", { d: "M52.7646 16.0222C58.4958 17.5579 63.643 20.7586 67.5552 25.2196C71.4674 29.6806 73.9689 35.2015 74.7433 41.0842C75.5178 46.9669 74.5305 52.9471 71.9062 58.2686C69.2819 63.5902 65.1385 68.014 60 70.9807C54.8615 73.9475 48.9586 75.3238 43.0379 74.9357C37.1172 74.5477 31.4445 72.4126 26.7372 68.8006C22.0298 65.1885 18.4993 60.2617 16.5921 54.6432C14.6849 49.0246 14.4865 42.9667 16.0222 37.2354L26.5314 40.0513C25.5527 43.7041 25.6791 47.565 26.8946 51.1459C28.1102 54.7268 30.3603 57.8669 33.3604 60.169C36.3606 62.471 39.976 63.8318 43.7495 64.0791C47.523 64.3264 51.2851 63.4492 54.56 61.5584C57.835 59.6677 60.4757 56.8482 62.1483 53.4566C63.8208 50.065 64.4501 46.2535 63.9565 42.5043C63.4629 38.7551 61.8686 35.2364 59.3752 32.3932C56.8819 29.5501 53.6014 27.5101 49.9486 26.5314L52.7646 16.0222Z" }), /* @__PURE__ */ a("path", { d: "M60.8172 6.52009L38.3382 17.6037L49.0722 39.3736L57.9016 35.0202L51.3837 21.8011L65.0334 15.0709L60.8172 6.52009Z" })]
167
+ })
168
+ });
169
+ }, d = ({ checked: e, setChecked: t, label: n, color: r = "white", v2: s, time: c = 200 }) => {
170
+ let l = (e, t) => ({
171
+ transition: `height ${c}ms, width ${c}ms ${e ? "ease-out" : "ease-in"}`,
172
+ transitionDelay: `${t * c / 5}ms`,
173
+ fill: r
174
+ });
175
+ return /* @__PURE__ */ a("div", {
176
+ className: `checkBoxWrapper ${e ? " checked" : ""}`,
177
+ style: { display: "inline-block" },
178
+ children: /* @__PURE__ */ o("div", {
179
+ className: `checkBox ${e ? " checked" : ""}`,
180
+ style: {
181
+ display: "flex",
182
+ alignItems: "center",
183
+ justifyContent: "flex-start",
184
+ cursor: "default"
185
+ },
186
+ onClick: () => t(!e),
187
+ children: [/* @__PURE__ */ a("svg", {
188
+ viewBox: "0 0 132.29166 132.29167",
189
+ height: "35",
190
+ width: "35",
191
+ children: s ? /* @__PURE__ */ a("path", {
192
+ style: { transition: "d 250ms" },
193
+ d: e ? "m 11.120115,58.317116 7.120334,6.317823 6.026283,5.413084 26.863979,23.785172 0.08968,-0.0065 73.610599,-75.912909 0.19168,-0.208115 0.23209,-0.218791 0.25933,-0.293027 1.0137,-1.034147 -0.0487,17.386797 -74.521188,89.035537 -0.04318,-0.001 -40.699193,-50.569883 z" : "m 10.924959,17.515864 7.384214,-8.0947911 2.070114,7.0942151 0.0095,90.248492 89.714263,0.33483 0.54025,-90.469474 -90.263871,-0.113848 -2.070115,-7.0942151 96.390046,-0.033179 8.52678,11.0587641 -0.17363,92.233642 -9.78754,10.89971 -92.027722,-0.27385 -10.358292,-9.04231 z",
194
+ fill: r,
195
+ className: "mainShape"
196
+ }) : /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("mask", {
197
+ id: "checkMask",
198
+ children: [/* @__PURE__ */ a("rect", {
199
+ x: "-20",
200
+ y: "-20",
201
+ width: "200",
202
+ height: "200",
203
+ fill: "black"
204
+ }), /* @__PURE__ */ a("path", {
205
+ d: "M21.7652 124.127C18.2495 124.127 15.2398 122.875 12.7361 120.371C10.2325 117.868 8.98068 114.858 8.98068 111.342V21.8505C8.98068 18.3347 10.2325 15.3251 12.7361 12.8214C15.2398 10.3178 18.2495 9.06596 21.7652 9.06596H111.257C114.773 9.06596 117.782 10.3178 120.286 12.8214C122.79 15.3251 124.041 18.3347 124.041 21.8505V111.342C124.041 114.858 122.79 117.868 120.286 120.371C117.782 122.875 114.773 124.127 111.257 124.127H21.7652Z",
206
+ fill: "white"
207
+ })]
208
+ }), /* @__PURE__ */ o("g", {
209
+ mask: "url(#checkMask)",
210
+ className: "transformers",
211
+ children: [e ? /* @__PURE__ */ o(i, { children: [
212
+ /* @__PURE__ */ a("rect", {
213
+ style: l(!0, 0),
214
+ x: "72.3839",
215
+ y: "-31.2401",
216
+ width: "76.3103",
217
+ height: "88.4339",
218
+ transform: "rotate(50 72.3839 -31.2401)"
219
+ }),
220
+ /* @__PURE__ */ a("rect", {
221
+ style: l(!0, 1),
222
+ x: "71.5962",
223
+ y: "148.092",
224
+ width: "48.1662",
225
+ height: "103.342",
226
+ transform: "rotate(-130 71.5962 148.092)"
227
+ }),
228
+ /* @__PURE__ */ a("rect", {
229
+ style: l(!0, 2),
230
+ x: "35.078",
231
+ y: "136.193",
232
+ width: "65.7519",
233
+ height: "35.4406",
234
+ transform: "rotate(-130 35.078 136.193)"
235
+ }),
236
+ /* @__PURE__ */ a("rect", {
237
+ style: l(!0, 4),
238
+ x: "48.968",
239
+ y: "-28.5624",
240
+ width: "63.3354",
241
+ height: "93.5079",
242
+ transform: "rotate(50 48.968 -28.5624)"
243
+ }),
244
+ /* @__PURE__ */ a("rect", {
245
+ style: l(!0, 5),
246
+ x: "98.5041",
247
+ y: "2.19794",
248
+ width: "56.3159",
249
+ height: "27.3439",
250
+ transform: "rotate(50 98.5041 2.19794)"
251
+ })
252
+ ] }) : /* @__PURE__ */ o(i, { children: [
253
+ /* @__PURE__ */ a("rect", {
254
+ style: l(!1, 2.6),
255
+ x: "72.3839",
256
+ y: "-31.2401",
257
+ width: "7.42665",
258
+ height: "88.4339",
259
+ transform: "rotate(50 72.3839 -31.2401)"
260
+ }),
261
+ /* @__PURE__ */ a("rect", {
262
+ style: l(!1, 2.3),
263
+ x: "71.5962",
264
+ y: "148.092",
265
+ width: "1.70323",
266
+ height: "103.342",
267
+ transform: "rotate(-130 71.5962 148.092)"
268
+ }),
269
+ /* @__PURE__ */ a("rect", {
270
+ style: l(!1, 1.5),
271
+ x: "35.078",
272
+ y: "136.193",
273
+ width: "65.7519",
274
+ height: "2.75196",
275
+ transform: "rotate(-130 35.078 136.193)"
276
+ }),
277
+ /* @__PURE__ */ a("rect", {
278
+ style: l(!1, .2),
279
+ x: "48.968",
280
+ y: "-28.5624",
281
+ width: "18.3253",
282
+ height: "93.5079",
283
+ transform: "rotate(50 48.968 -28.5624)"
284
+ }),
285
+ /* @__PURE__ */ a("rect", {
286
+ style: l(!1, 0),
287
+ x: "98.5041",
288
+ y: "2.19794",
289
+ width: "56.3159",
290
+ height: "1.80076",
291
+ transform: "rotate(50 98.5041 2.19794)"
292
+ })
293
+ ] }), /* @__PURE__ */ a("path", {
294
+ d: "M21.7652 147.556C14.7876 147.556 -13.189 118.32 -13.189 111.342V21.8505C-13.189 14.8729 14.7876 -12.096 21.7652 -12.096H111.257C118.234 -12.096 141.928 14.8729 141.928 21.8505V111.342C141.928 118.32 118.234 147.556 111.257 147.556H21.7652ZM111.257 111.317V21.8505H21.7652V111.317C56.197 111.317 76.8251 111.317 111.257 111.317Z",
295
+ fill: r
296
+ })]
297
+ })] })
298
+ }), /* @__PURE__ */ a("span", {
299
+ style: {
300
+ marginLeft: "10px",
301
+ color: r
302
+ },
303
+ children: n
304
+ })]
305
+ })
306
+ });
307
+ }, f = ({ active: e, text: t, className: n, color: r }) => {
308
+ let i = (e, t, n, r) => /* @__PURE__ */ a("circle", {
309
+ style: { transition: "r 300ms" },
310
+ cx: "67",
311
+ cy: "67",
312
+ r: e,
313
+ fill: r,
314
+ className: t,
315
+ mask: n
316
+ });
317
+ return /* @__PURE__ */ o("div", {
318
+ style: {
319
+ display: "flex",
320
+ alignItems: "center",
321
+ justifyContent: "flex-start",
322
+ cursor: "default"
323
+ },
324
+ className: `radioButton ${e ? " active" : ""}`,
325
+ children: [/* @__PURE__ */ o("svg", {
326
+ className: `${n || ""}`,
327
+ viewBox: "0 0 132.29 132.29",
328
+ height: "35",
329
+ width: "35",
330
+ children: [
331
+ /* @__PURE__ */ o("mask", {
332
+ id: "mask",
333
+ children: [/* @__PURE__ */ a("rect", {
334
+ x: "0",
335
+ y: "0",
336
+ width: "200",
337
+ height: "200",
338
+ fill: "white"
339
+ }), i(55, "black", void 0, "#000")]
340
+ }),
341
+ i(65, "mainShape", "url(#mask)", r),
342
+ i(e ? 40 : 0, "mainShape", void 0, r)
343
+ ]
344
+ }), /* @__PURE__ */ a("span", {
345
+ style: {
346
+ marginLeft: "10px",
347
+ color: r
348
+ },
349
+ children: t
350
+ })]
351
+ });
352
+ }, p = ({ options: e, selected: t, onSelect: n, color: r }) => /* @__PURE__ */ a("div", {
353
+ className: "radioGroup",
354
+ children: e.map((e, i) => /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("div", {
355
+ onClick: () => n(e.key),
356
+ style: { display: "inline-block" },
357
+ children: /* @__PURE__ */ a(f, {
358
+ active: e.key === t,
359
+ text: e.label,
360
+ color: r
361
+ })
362
+ }) }, i))
363
+ }), m = ({ value: e, setValue: n, min: i = 1, max: s = 10, size: c = 5, color: l = "white", numberBgColor: u = "#663399", selectorColor: d = "#1E90FF", timeout: f = 1e3, onOpenInput: p, closed: m, invert: h = !1, noFlick: g = !1 }) => {
364
+ let [_, v] = r(!1), [y, b] = r(!0), [x, S] = r(), [C, w] = r(), [T, E] = r(0), [D, O] = r(0), k = () => {
365
+ clearTimeout(x), v(!1), S(void 0), j();
366
+ };
367
+ t(() => {
368
+ m && k();
369
+ }, [m]);
370
+ let A = () => {
371
+ f && (clearTimeout(x), S(setTimeout(k, f)));
372
+ }, j = () => {
373
+ clearTimeout(C), w(setTimeout(() => {
374
+ b(!0), w(void 0);
375
+ }, 200));
376
+ }, M = `${c}rem`, N = `${c * .8}rem`, P = `-${c * .9}rem`, F = `${c * .1}rem`, I = `-${c / 3}rem`, L = {
377
+ height: N,
378
+ width: N,
379
+ backgroundColor: d,
380
+ right: F,
381
+ bottom: F
382
+ }, R = {
383
+ ...L,
384
+ top: _ ? P : 0
385
+ }, z = {
386
+ ...L,
387
+ bottom: _ ? P : 0
388
+ }, B = {
389
+ background: `radial-gradient(${u}FF, ${u}00, ${u}00)`,
390
+ left: I,
391
+ right: I,
392
+ top: P,
393
+ bottom: P
394
+ }, V = (e) => /* @__PURE__ */ a("svg", {
395
+ xmlns: "http://www.w3.org/2000/svg",
396
+ viewBox: "0 -960 960 960",
397
+ fill: l,
398
+ children: e ? /* @__PURE__ */ a("path", { d: "m283-345-43-43 240-240 240 239-43 43-197-197-197 198Z" }) : /* @__PURE__ */ a("path", { d: "M480-345 240-585l43-43 197 198 197-197 43 43-240 239Z" })
399
+ }), H = (t, r) => () => {
400
+ let a = h ? -1 * t : t;
401
+ r || A();
402
+ let o = a + e;
403
+ o > s || o < i || n(o);
404
+ }, U = () => /* @__PURE__ */ o("div", {
405
+ className: `numberSelect_input ${_ ? "" : "numberSelect_input-hidden"}`,
406
+ children: [
407
+ /* @__PURE__ */ a("div", {
408
+ className: "numberSelect_increment numberSelect_add",
409
+ style: R,
410
+ onClick: H(1),
411
+ children: V(!0)
412
+ }),
413
+ /* @__PURE__ */ a("div", {
414
+ className: "numberSelect_blur",
415
+ style: B
416
+ }),
417
+ /* @__PURE__ */ a("div", {
418
+ className: "numberSelect_increment numberSelect_subtract",
419
+ style: z,
420
+ onClick: H(-1),
421
+ children: V()
422
+ })
423
+ ]
424
+ }), W = (e) => e.touches[0].clientY, G = (e) => {
425
+ g || E(W(e));
426
+ }, K = (t) => {
427
+ if (g) return;
428
+ let n = T - W(t);
429
+ (i === e && !h || s === e && h) && n < 0 || (s === e && !h || i === e && h) && n > 0 || i === e && n < 0 || O(T - W(t));
430
+ }, q = () => {
431
+ g || _ || (Math.abs(D) > 30 && H(D > 0 ? 1 : -1, !0)(), O(0));
432
+ }, J = Math.min(Math.max(D, -30), 30) / 30, Y = 0, X = 0;
433
+ if (J !== 0) {
434
+ let e = Math.abs(J), t = `-${c / 5 * e}rem`;
435
+ J > 0 ? Y = t : X = t;
436
+ }
437
+ let Z = {
438
+ top: Y,
439
+ bottom: X
440
+ }, Q = Math.max(0, Math.abs(J) - .5) * 1.5;
441
+ return /* @__PURE__ */ o("div", {
442
+ onTouchStart: G,
443
+ onTouchMove: K,
444
+ onTouchEnd: q,
445
+ className: `numberSelect ${_ ? "numberSelect_editing" : ""} ${y ? "numberSelect_doneClosing" : ""}`,
446
+ children: [
447
+ /* @__PURE__ */ a("div", {
448
+ className: "plusMinus plus",
449
+ style: {
450
+ top: `-${c / 5}rem`,
451
+ opacity: J > 0 ? Q : 0,
452
+ height: `${c / 3}rem`
453
+ },
454
+ children: /* @__PURE__ */ a("svg", {
455
+ height: `${c / 4}rem`,
456
+ viewBox: "0 0 271 153",
457
+ xmlns: "http://www.w3.org/2000/svg",
458
+ children: /* @__PURE__ */ a("path", {
459
+ d: "M136.68 19.1619L17.4993 133.606H47.2944L136.68 64.9149L226.065 133.606H255.86L136.68 19.1619Z",
460
+ fill: l
461
+ })
462
+ })
463
+ }),
464
+ /* @__PURE__ */ a("div", {
465
+ className: "plusMinus minus",
466
+ style: {
467
+ bottom: `-${c / 5}rem`,
468
+ opacity: J < 0 ? Q : 0,
469
+ height: `${c / 3}rem`
470
+ },
471
+ children: /* @__PURE__ */ a("svg", {
472
+ height: `${c / 4}rem`,
473
+ viewBox: "0 0 271 153",
474
+ xmlns: "http://www.w3.org/2000/svg",
475
+ children: /* @__PURE__ */ a("path", {
476
+ d: "M136.68 133.606L17.4993 19.1621H47.2944L136.68 87.8532L226.065 19.1621H255.86L136.68 133.606Z",
477
+ fill: l
478
+ })
479
+ })
480
+ }),
481
+ /* @__PURE__ */ a("div", {
482
+ className: "swipeBlobContainer",
483
+ children: /* @__PURE__ */ a("div", {
484
+ className: "swipeBlob",
485
+ style: {
486
+ left: `${c * .02}rem`,
487
+ right: `${c * .02}rem`,
488
+ backgroundColor: u,
489
+ ...Z
490
+ }
491
+ })
492
+ }),
493
+ /* @__PURE__ */ a("div", {
494
+ className: "numberSelect_value",
495
+ onClick: () => {
496
+ g && (_ ? k() : (A(), p?.(), b(!1), v(!0)));
497
+ },
498
+ style: {
499
+ height: M,
500
+ width: M,
501
+ color: l,
502
+ backgroundColor: u,
503
+ fontSize: `${c / 2}rem`
504
+ },
505
+ children: e
506
+ }),
507
+ U()
508
+ ]
509
+ });
510
+ }, h = ({ children: e, styleOverride: r, startOnPane: i = 0 }) => {
511
+ let o = n(null);
512
+ t(() => {
513
+ let e = setTimeout(() => o.current?.scrollIntoView(), 1);
514
+ return () => clearTimeout(e);
515
+ }, []);
516
+ let s = (e, t) => /* @__PURE__ */ a("div", {
517
+ ref: (e) => {
518
+ i === t && (o.current = e);
519
+ },
520
+ className: "grevlingPaneViewPane",
521
+ children: e
522
+ }, `pane${t}`);
523
+ return /* @__PURE__ */ a("div", {
524
+ className: "grevlingPaneView",
525
+ style: r,
526
+ children: /* @__PURE__ */ a("div", {
527
+ className: "grevlingPaneViewScrollyContent",
528
+ children: Array.isArray(e) ? e.map(s) : s(e, 0)
529
+ })
530
+ });
531
+ }, g = ({ color: e = "black", size: t = "10rem", speed: n = 5e3 }) => {
532
+ let r = (e) => ({
533
+ WebkitAnimation: `spin${e ? "CC" : ""} ${n}ms linear infinite`,
534
+ MozAnimation: `spin${e ? "CC" : ""} ${n}ms linear infinite`,
535
+ animation: `spin${e ? "CC" : ""} ${n}ms linear infinite`
536
+ });
537
+ return /* @__PURE__ */ o("svg", {
538
+ className: "grevloadinger",
539
+ xmlns: "http://www.w3.org/2000/svg",
540
+ viewBox: "-8.5 12.5 117 117",
541
+ height: t,
542
+ width: t,
543
+ style: r(),
544
+ children: [
545
+ /* @__PURE__ */ o("mask", {
546
+ id: "spinnyMask1",
547
+ children: [/* @__PURE__ */ a("rect", {
548
+ x: "-10",
549
+ y: "0",
550
+ width: "200",
551
+ height: "200",
552
+ fill: "white"
553
+ }), /* @__PURE__ */ a("polygon", {
554
+ points: "50 13.397, 100 100, 0 100",
555
+ fill: "black"
556
+ })]
557
+ }),
558
+ /* @__PURE__ */ a("circle", {
559
+ cx: "50",
560
+ cy: "71.1",
561
+ r: "58",
562
+ mask: "url(#spinnyMask1)",
563
+ fill: e
564
+ }),
565
+ /* @__PURE__ */ a("g", {
566
+ transform: "rotate(45 50 71)",
567
+ children: /* @__PURE__ */ a("rect", {
568
+ height: "40.8",
569
+ width: "40.8",
570
+ x: "29.6",
571
+ y: "50.6",
572
+ fill: e,
573
+ style: {
574
+ transformOrigin: "50px 71px",
575
+ ...r(!0)
576
+ }
577
+ })
578
+ })
579
+ ]
580
+ });
581
+ };
582
+ //#endregion
583
+ export { d as CheckBox, g as Loader, l as Menu, s as MenuButton, m as NumberSelect, h as PaneView, f as RadioButton, p as RadioGroup, u as ResetButton, c as SettingsButton };
package/package.json CHANGED
@@ -1,15 +1,10 @@
1
1
  {
2
2
  "name": "grevlingui",
3
- "version": "0.1.44",
4
- "description": "GUI elements",
5
- "module": "index.js",
6
- "dependencies": {
7
- "core-js": "^3.30.1"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/sGrevling/gui"
12
- },
3
+ "version": "0.2.0",
4
+ "description": "GUI elements for basic mobile web app stuff",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Sigve Grevling",
13
8
  "keywords": [
14
9
  "react",
15
10
  "gui",
@@ -17,11 +12,48 @@
17
12
  "menu",
18
13
  "buttons",
19
14
  "checkbox",
20
- "toggle",
15
+ "radio",
16
+ "loader",
21
17
  "drawer",
22
- "mobile"
18
+ "mobile",
19
+ "typescript"
23
20
  ],
24
- "author": "Sigve Grevling",
25
- "license": "MIT"
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "sideEffects": [
25
+ "**/*.css"
26
+ ],
27
+ "main": "./dist/index.js",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
36
+ "scripts": {
37
+ "dev": "vite",
38
+ "build": "tsc -b && vite build && tsc -p tsconfig.lib.json && node scripts/strip-css-imports.mjs dist",
39
+ "lint": "oxlint",
40
+ "preview": "vite preview",
41
+ "prepublishOnly": "npm run build",
42
+ "bap": "npm run build && npm publish --ignore-scripts"
43
+ },
44
+ "peerDependencies": {
45
+ "react": "^18.0.0 || ^19.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^24.13.3",
49
+ "@types/react": "^19.2.18",
50
+ "@types/react-dom": "^19.2.7",
51
+ "@vitejs/plugin-react": "^6.1.1",
52
+ "oxlint": "^1.81.0",
53
+ "react": "^19.2.8",
54
+ "react-dom": "^19.2.8",
55
+ "typescript": "~6.0.2",
56
+ "vite": "^8.3.0",
57
+ "vite-plugin-lib-inject-css": "^2.2.2"
58
+ }
26
59
  }
27
-