@kvell-group/ui 1.9.0 → 1.9.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.
@@ -1,560 +1,14 @@
1
- import { jsx as i, Fragment as Q, jsxs as F } from "react/jsx-runtime";
2
- import { u as it, j as ct, g as mt, r as q } from "../../MantineThemeProvider-kHsOfZUW.js";
3
- import { useState as j, useRef as L, useEffect as X, forwardRef as I } from "react";
4
- import { B as g, d as M, f as W, u as N, a as k, c as E, e as _, h as z, b as D, p as pt } from "../../polymorphic-factory-Bvt8Is5k.js";
5
- import lt from "react-dom";
6
- import { U as dt } from "../../UnstyledButton-D2QHft3M.js";
7
- import '../../assets/Button.css';function ut(t, o) {
8
- try {
9
- return t.addEventListener("change", o), () => t.removeEventListener("change", o);
10
- } catch {
11
- return t.addListener(o), () => t.removeListener(o);
12
- }
13
- }
14
- function ft(t, o) {
15
- return typeof window < "u" && "matchMedia" in window ? window.matchMedia(t).matches : !1;
16
- }
17
- function yt(t, o, { getInitialValueInEffect: r } = {
18
- getInitialValueInEffect: !0
19
- }) {
20
- const [s, e] = j(
21
- r ? o : ft(t)
22
- ), n = L(null);
23
- return X(() => {
24
- if ("matchMedia" in window)
25
- return n.current = window.matchMedia(t), e(n.current.matches), ut(n.current, (a) => e(a.matches));
26
- }, [t]), s;
27
- }
28
- function gt(t, o) {
29
- const r = L(!1);
30
- X(
31
- () => () => {
32
- r.current = !1;
33
- },
34
- []
35
- ), X(() => {
36
- if (r.current)
37
- return t();
38
- r.current = !0;
39
- }, o);
40
- }
41
- function bt(t, o) {
42
- return yt("(prefers-reduced-motion: reduce)", t, o);
43
- }
44
- const Y = (t) => ({
45
- in: { opacity: 1, transform: "scale(1)" },
46
- out: { opacity: 0, transform: `scale(.9) translateY(${t === "bottom" ? 10 : -10}px)` },
47
- transitionProperty: "transform, opacity"
48
- }), C = {
49
- fade: {
50
- in: { opacity: 1 },
51
- out: { opacity: 0 },
52
- transitionProperty: "opacity"
53
- },
54
- "fade-up": {
55
- in: { opacity: 1, transform: "translateY(0)" },
56
- out: { opacity: 0, transform: "translateY(30px)" },
57
- transitionProperty: "opacity, transform"
58
- },
59
- "fade-down": {
60
- in: { opacity: 1, transform: "translateY(0)" },
61
- out: { opacity: 0, transform: "translateY(-30px)" },
62
- transitionProperty: "opacity, transform"
63
- },
64
- "fade-left": {
65
- in: { opacity: 1, transform: "translateX(0)" },
66
- out: { opacity: 0, transform: "translateX(30px)" },
67
- transitionProperty: "opacity, transform"
68
- },
69
- "fade-right": {
70
- in: { opacity: 1, transform: "translateX(0)" },
71
- out: { opacity: 0, transform: "translateX(-30px)" },
72
- transitionProperty: "opacity, transform"
73
- },
74
- scale: {
75
- in: { opacity: 1, transform: "scale(1)" },
76
- out: { opacity: 0, transform: "scale(0)" },
77
- common: { transformOrigin: "top" },
78
- transitionProperty: "transform, opacity"
79
- },
80
- "scale-y": {
81
- in: { opacity: 1, transform: "scaleY(1)" },
82
- out: { opacity: 0, transform: "scaleY(0)" },
83
- common: { transformOrigin: "top" },
84
- transitionProperty: "transform, opacity"
85
- },
86
- "scale-x": {
87
- in: { opacity: 1, transform: "scaleX(1)" },
88
- out: { opacity: 0, transform: "scaleX(0)" },
89
- common: { transformOrigin: "left" },
90
- transitionProperty: "transform, opacity"
91
- },
92
- "skew-up": {
93
- in: { opacity: 1, transform: "translateY(0) skew(0deg, 0deg)" },
94
- out: { opacity: 0, transform: "translateY(-20px) skew(-10deg, -5deg)" },
95
- common: { transformOrigin: "top" },
96
- transitionProperty: "transform, opacity"
97
- },
98
- "skew-down": {
99
- in: { opacity: 1, transform: "translateY(0) skew(0deg, 0deg)" },
100
- out: { opacity: 0, transform: "translateY(20px) skew(-10deg, -5deg)" },
101
- common: { transformOrigin: "bottom" },
102
- transitionProperty: "transform, opacity"
103
- },
104
- "rotate-left": {
105
- in: { opacity: 1, transform: "translateY(0) rotate(0deg)" },
106
- out: { opacity: 0, transform: "translateY(20px) rotate(-5deg)" },
107
- common: { transformOrigin: "bottom" },
108
- transitionProperty: "transform, opacity"
109
- },
110
- "rotate-right": {
111
- in: { opacity: 1, transform: "translateY(0) rotate(0deg)" },
112
- out: { opacity: 0, transform: "translateY(20px) rotate(5deg)" },
113
- common: { transformOrigin: "top" },
114
- transitionProperty: "transform, opacity"
115
- },
116
- "slide-down": {
117
- in: { opacity: 1, transform: "translateY(0)" },
118
- out: { opacity: 0, transform: "translateY(-100%)" },
119
- common: { transformOrigin: "top" },
120
- transitionProperty: "transform, opacity"
121
- },
122
- "slide-up": {
123
- in: { opacity: 1, transform: "translateY(0)" },
124
- out: { opacity: 0, transform: "translateY(100%)" },
125
- common: { transformOrigin: "bottom" },
126
- transitionProperty: "transform, opacity"
127
- },
128
- "slide-left": {
129
- in: { opacity: 1, transform: "translateX(0)" },
130
- out: { opacity: 0, transform: "translateX(100%)" },
131
- common: { transformOrigin: "left" },
132
- transitionProperty: "transform, opacity"
133
- },
134
- "slide-right": {
135
- in: { opacity: 1, transform: "translateX(0)" },
136
- out: { opacity: 0, transform: "translateX(-100%)" },
137
- common: { transformOrigin: "right" },
138
- transitionProperty: "transform, opacity"
139
- },
140
- pop: {
141
- ...Y("bottom"),
142
- common: { transformOrigin: "center center" }
143
- },
144
- "pop-bottom-left": {
145
- ...Y("bottom"),
146
- common: { transformOrigin: "bottom left" }
147
- },
148
- "pop-bottom-right": {
149
- ...Y("bottom"),
150
- common: { transformOrigin: "bottom right" }
151
- },
152
- "pop-top-left": {
153
- ...Y("top"),
154
- common: { transformOrigin: "top left" }
155
- },
156
- "pop-top-right": {
157
- ...Y("top"),
158
- common: { transformOrigin: "top right" }
159
- }
160
- }, J = {
161
- entering: "in",
162
- entered: "in",
163
- exiting: "out",
164
- exited: "out",
165
- "pre-exiting": "out",
166
- "pre-entering": "out"
167
- };
168
- function ht({
169
- transition: t,
170
- state: o,
171
- duration: r,
172
- timingFunction: s
173
- }) {
174
- const e = {
175
- WebkitBackfaceVisibility: "hidden",
176
- willChange: "transform, opacity",
177
- transitionDuration: `${r}ms`,
178
- transitionTimingFunction: s
179
- };
180
- return typeof t == "string" ? t in C ? {
181
- transitionProperty: C[t].transitionProperty,
182
- ...e,
183
- ...C[t].common,
184
- ...C[t][J[o]]
185
- } : {} : {
186
- transitionProperty: t.transitionProperty,
187
- ...e,
188
- ...t.common,
189
- ...t[J[o]]
190
- };
191
- }
192
- function vt({
193
- duration: t,
194
- exitDuration: o,
195
- timingFunction: r,
196
- mounted: s,
197
- onEnter: e,
198
- onExit: n,
199
- onEntered: a,
200
- onExited: c,
201
- enterDelay: m,
202
- exitDelay: l
203
- }) {
204
- const u = it(), h = bt(), f = u.respectReducedMotion ? h : !1, [v, p] = j(f ? 0 : t), [S, w] = j(s ? "entered" : "exited"), B = L(-1), $ = L(-1), x = L(-1), O = (d) => {
205
- const P = d ? e : n, y = d ? a : c;
206
- window.clearTimeout(B.current);
207
- const T = f ? 0 : d ? t : o;
208
- p(T), T === 0 ? (typeof P == "function" && P(), typeof y == "function" && y(), w(d ? "entered" : "exited")) : x.current = requestAnimationFrame(() => {
209
- lt.flushSync(() => {
210
- w(d ? "pre-entering" : "pre-exiting");
211
- }), x.current = requestAnimationFrame(() => {
212
- typeof P == "function" && P(), w(d ? "entering" : "exiting"), B.current = window.setTimeout(() => {
213
- typeof y == "function" && y(), w(d ? "entered" : "exited");
214
- }, T);
215
- });
216
- });
217
- }, H = (d) => {
218
- if (window.clearTimeout($.current), typeof (d ? m : l) != "number") {
219
- O(d);
220
- return;
221
- }
222
- $.current = window.setTimeout(
223
- () => {
224
- O(d);
225
- },
226
- d ? m : l
227
- );
228
- };
229
- return gt(() => {
230
- H(s);
231
- }, [s]), X(
232
- () => () => {
233
- window.clearTimeout(B.current), cancelAnimationFrame(x.current);
234
- },
235
- []
236
- ), {
237
- transitionDuration: v,
238
- transitionStatus: S,
239
- transitionTimingFunction: r || "ease"
240
- };
241
- }
242
- function tt({
243
- keepMounted: t,
244
- transition: o = "fade",
245
- duration: r = 250,
246
- exitDuration: s = r,
247
- mounted: e,
248
- children: n,
249
- timingFunction: a = "ease",
250
- onExit: c,
251
- onEntered: m,
252
- onEnter: l,
253
- onExited: u,
254
- enterDelay: h,
255
- exitDelay: f
256
- }) {
257
- const v = ct(), { transitionDuration: p, transitionStatus: S, transitionTimingFunction: w } = vt({
258
- mounted: e,
259
- exitDuration: s,
260
- duration: r,
261
- timingFunction: a,
262
- onExit: c,
263
- onEntered: m,
264
- onEnter: l,
265
- onExited: u,
266
- enterDelay: h,
267
- exitDelay: f
268
- });
269
- return p === 0 || v === "test" ? e ? /* @__PURE__ */ i(Q, { children: n({}) }) : t ? n({ display: "none" }) : null : S === "exited" ? t ? n({ display: "none" }) : null : /* @__PURE__ */ i(Q, { children: n(
270
- ht({
271
- transition: o,
272
- duration: p,
273
- state: S,
274
- timingFunction: w
275
- })
276
- ) });
277
- }
278
- tt.displayName = "@mantine/core/Transition";
279
- var b = { root: "m_5ae2e3c", barsLoader: "m_7a2bd4cd", bar: "m_870bb79", "bars-loader-animation": "m_5d2b3b9d", dotsLoader: "m_4e3f22d7", dot: "m_870c4af", "loader-dots-animation": "m_aac34a1", ovalLoader: "m_b34414df", "oval-loader-animation": "m_f8e89c4b" };
280
- const ot = I(({ className: t, ...o }, r) => /* @__PURE__ */ F(g, { component: "span", className: M(b.barsLoader, t), ...o, ref: r, children: [
281
- /* @__PURE__ */ i("span", { className: b.bar }),
282
- /* @__PURE__ */ i("span", { className: b.bar }),
283
- /* @__PURE__ */ i("span", { className: b.bar })
284
- ] }));
285
- ot.displayName = "@mantine/core/Bars";
286
- const rt = I(({ className: t, ...o }, r) => /* @__PURE__ */ F(g, { component: "span", className: M(b.dotsLoader, t), ...o, ref: r, children: [
287
- /* @__PURE__ */ i("span", { className: b.dot }),
288
- /* @__PURE__ */ i("span", { className: b.dot }),
289
- /* @__PURE__ */ i("span", { className: b.dot })
290
- ] }));
291
- rt.displayName = "@mantine/core/Dots";
292
- const nt = I(({ className: t, ...o }, r) => /* @__PURE__ */ i(g, { component: "span", className: M(b.ovalLoader, t), ...o, ref: r }));
293
- nt.displayName = "@mantine/core/Oval";
294
- const et = {
295
- bars: ot,
296
- oval: nt,
297
- dots: rt
298
- }, wt = {
299
- loaders: et,
300
- type: "oval"
301
- }, St = E((t, { size: o, color: r }) => ({
302
- root: {
303
- "--loader-size": _(o, "loader-size"),
304
- "--loader-color": r ? mt(r, t) : void 0
305
- }
306
- })), V = W((t, o) => {
307
- const r = N("Loader", wt, t), {
308
- size: s,
309
- color: e,
310
- type: n,
311
- vars: a,
312
- className: c,
313
- style: m,
314
- classNames: l,
315
- styles: u,
316
- unstyled: h,
317
- loaders: f,
318
- variant: v,
319
- children: p,
320
- ...S
321
- } = r, w = k({
322
- name: "Loader",
323
- props: r,
324
- classes: b,
325
- className: c,
326
- style: m,
327
- classNames: l,
328
- styles: u,
329
- unstyled: h,
330
- vars: a,
331
- varsResolver: St
332
- });
333
- return p ? /* @__PURE__ */ i(g, { ...w("root"), ref: o, ...S, children: p }) : /* @__PURE__ */ i(
334
- g,
335
- {
336
- ...w("root"),
337
- ref: o,
338
- component: f[n],
339
- variant: v,
340
- size: s,
341
- ...S
342
- }
343
- );
344
- });
345
- V.defaultLoaders = et;
346
- V.classes = b;
347
- V.displayName = "@mantine/core/Loader";
348
- var R = { root: "m_77c9d27d", inner: "m_80f1301b", label: "m_811560b9", section: "m_a74036a", loader: "m_a25b86ee", group: "m_80d6d844", groupSection: "m_70be2a01" };
349
- const K = {
350
- orientation: "horizontal"
351
- }, Pt = E((t, { borderWidth: o }) => ({
352
- group: { "--button-border-width": q(o) }
353
- })), A = W((t, o) => {
354
- const r = N("ButtonGroup", K, t), {
355
- className: s,
356
- style: e,
357
- classNames: n,
358
- styles: a,
359
- unstyled: c,
360
- orientation: m,
361
- vars: l,
362
- borderWidth: u,
363
- variant: h,
364
- mod: f,
365
- ...v
366
- } = N("ButtonGroup", K, t), p = k({
367
- name: "ButtonGroup",
368
- props: r,
369
- classes: R,
370
- className: s,
371
- style: e,
372
- classNames: n,
373
- styles: a,
374
- unstyled: c,
375
- vars: l,
376
- varsResolver: Pt,
377
- rootSelector: "group"
378
- });
379
- return /* @__PURE__ */ i(
380
- g,
381
- {
382
- ...p("group"),
383
- ref: o,
384
- variant: h,
385
- mod: [{ "data-orientation": m }, f],
386
- role: "group",
387
- ...v
388
- }
389
- );
390
- });
391
- A.classes = R;
392
- A.displayName = "@mantine/core/ButtonGroup";
393
- const Z = {}, xt = E(
394
- (t, { radius: o, color: r, gradient: s, variant: e, autoContrast: n, size: a }) => {
395
- const c = t.variantColorResolver({
396
- color: r || t.primaryColor,
397
- theme: t,
398
- gradient: s,
399
- variant: e || "filled",
400
- autoContrast: n
401
- });
402
- return {
403
- groupSection: {
404
- "--section-height": _(a, "section-height"),
405
- "--section-padding-x": _(a, "section-padding-x"),
406
- "--section-fz": a != null && a.includes("compact") ? D(a.replace("compact-", "")) : D(a),
407
- "--section-radius": o === void 0 ? void 0 : z(o),
408
- "--section-bg": r || e ? c.background : void 0,
409
- "--section-color": c.color,
410
- "--section-bd": r || e ? c.border : void 0
411
- }
412
- };
413
- }
414
- ), U = W((t, o) => {
415
- const r = N("ButtonGroupSection", Z, t), {
416
- className: s,
417
- style: e,
418
- classNames: n,
419
- styles: a,
420
- unstyled: c,
421
- vars: m,
422
- variant: l,
423
- gradient: u,
424
- radius: h,
425
- autoContrast: f,
426
- ...v
427
- } = N("ButtonGroupSection", Z, t), p = k({
428
- name: "ButtonGroupSection",
429
- props: r,
430
- classes: R,
431
- className: s,
432
- style: e,
433
- classNames: n,
434
- styles: a,
435
- unstyled: c,
436
- vars: m,
437
- varsResolver: xt,
438
- rootSelector: "groupSection"
439
- });
440
- return /* @__PURE__ */ i(g, { ...p("groupSection"), ref: o, variant: l, ...v });
441
- });
442
- U.classes = R;
443
- U.displayName = "@mantine/core/ButtonGroupSection";
444
- const Nt = {
445
- in: { opacity: 1, transform: `translate(-50%, calc(-50% + ${q(1)}))` },
446
- out: { opacity: 0, transform: "translate(-50%, -200%)" },
447
- common: { transformOrigin: "center" },
448
- transitionProperty: "transform, opacity"
449
- }, Rt = {}, Bt = E(
450
- (t, { radius: o, color: r, gradient: s, variant: e, size: n, justify: a, autoContrast: c }) => {
451
- const m = t.variantColorResolver({
452
- color: r || t.primaryColor,
453
- theme: t,
454
- gradient: s,
455
- variant: e || "filled",
456
- autoContrast: c
457
- });
458
- return {
459
- root: {
460
- "--button-justify": a,
461
- "--button-height": _(n, "button-height"),
462
- "--button-padding-x": _(n, "button-padding-x"),
463
- "--button-fz": n != null && n.includes("compact") ? D(n.replace("compact-", "")) : D(n),
464
- "--button-radius": o === void 0 ? void 0 : z(o),
465
- "--button-bg": r || e ? m.background : void 0,
466
- "--button-hover": r || e ? m.hover : void 0,
467
- "--button-color": m.color,
468
- "--button-bd": r || e ? m.border : void 0,
469
- "--button-hover-color": r || e ? m.hoverColor : void 0
470
- }
471
- };
472
- }
473
- ), G = pt((t, o) => {
474
- const r = N("Button", Rt, t), {
475
- style: s,
476
- vars: e,
477
- className: n,
478
- color: a,
479
- disabled: c,
480
- children: m,
481
- leftSection: l,
482
- rightSection: u,
483
- fullWidth: h,
484
- variant: f,
485
- radius: v,
486
- loading: p,
487
- loaderProps: S,
488
- gradient: w,
489
- classNames: B,
490
- styles: $,
491
- unstyled: x,
492
- "data-disabled": O,
493
- autoContrast: H,
494
- mod: d,
495
- ...P
496
- } = r, y = k({
497
- name: "Button",
498
- props: r,
499
- classes: R,
500
- className: n,
501
- style: s,
502
- classNames: B,
503
- styles: $,
504
- unstyled: x,
505
- vars: e,
506
- varsResolver: Bt
507
- }), T = !!l, at = !!u;
508
- return /* @__PURE__ */ F(
509
- dt,
510
- {
511
- ref: o,
512
- ...y("root", { active: !c && !p && !O }),
513
- unstyled: x,
514
- variant: f,
515
- disabled: c || p,
516
- mod: [
517
- {
518
- disabled: c || O,
519
- loading: p,
520
- block: h,
521
- "with-left-section": T,
522
- "with-right-section": at
523
- },
524
- d
525
- ],
526
- ...P,
527
- children: [
528
- /* @__PURE__ */ i(tt, { mounted: !!p, transition: Nt, duration: 150, children: (st) => /* @__PURE__ */ i(g, { component: "span", ...y("loader", { style: st }), "aria-hidden": !0, children: /* @__PURE__ */ i(
529
- V,
530
- {
531
- color: "var(--button-color)",
532
- size: "calc(var(--button-height) / 1.8)",
533
- ...S
534
- }
535
- ) }) }),
536
- /* @__PURE__ */ F("span", { ...y("inner"), children: [
537
- l && /* @__PURE__ */ i(g, { component: "span", ...y("section"), mod: { position: "left" }, children: l }),
538
- /* @__PURE__ */ i(g, { component: "span", mod: { loading: p }, ...y("label"), children: m }),
539
- u && /* @__PURE__ */ i(g, { component: "span", ...y("section"), mod: { position: "right" }, children: u })
540
- ] })
541
- ]
542
- }
543
- );
544
- });
545
- G.classes = R;
546
- G.displayName = "@mantine/core/Button";
547
- G.Group = A;
548
- G.GroupSection = U;
549
- const Ot = "_root_arz1h_1", Tt = {
550
- root: Ot
551
- }, Ft = (t) => /* @__PURE__ */ i(
552
- G,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Button as s } from "@mantine/core";
3
+ import '../../assets/Button.css';const r = "_root_arz1h_1", n = {
4
+ root: r
5
+ }, c = (o) => /* @__PURE__ */ t(
6
+ s,
553
7
  {
554
- ...t,
555
- classNames: Tt
8
+ ...o,
9
+ classNames: n
556
10
  }
557
11
  );
558
12
  export {
559
- Ft as Button
13
+ c as Button
560
14
  };