@versini/ui-panel 2.1.0 → 2.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.
- package/dist/components/Panel/Panel.js +223 -218
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -5
- package/package.json +2 -2
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as l, jsxs as L, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import F, { useRef as N, useLayoutEffect as Y, useEffect as B, useState as K, useMemo as Q, useCallback as ue, useId as Z } from "react";
|
|
4
4
|
import n from "clsx";
|
|
5
5
|
import { useFloating as me, useClick as ge, useDismiss as he, useRole as fe, useInteractions as be, useMergeRefs as ve, FloatingPortal as ye, FloatingOverlay as pe, FloatingFocusManager as ke } from "@floating-ui/react";
|
|
6
|
-
const
|
|
6
|
+
const H = "av-messagebox", R = "av-panel", q = "av-button", V = "icon", ee = "button", z = "link", we = ({
|
|
7
7
|
type: e,
|
|
8
8
|
size: t,
|
|
9
9
|
labelRight: r,
|
|
10
10
|
labelLeft: a,
|
|
11
|
-
align:
|
|
12
|
-
animated:
|
|
11
|
+
align: i,
|
|
12
|
+
animated: o
|
|
13
13
|
}) => {
|
|
14
|
-
const c = "max-h-8 py-0 px-2",
|
|
14
|
+
const c = "max-h-8 py-0 px-2", d = "max-h-9 h-8 px-3", s = "max-h-12 py-2 px-4";
|
|
15
15
|
switch (e) {
|
|
16
16
|
case ee:
|
|
17
17
|
case z:
|
|
18
18
|
return n({
|
|
19
19
|
[c]: t === "small",
|
|
20
|
-
[
|
|
20
|
+
[d]: t === "medium",
|
|
21
21
|
[s]: t === "large"
|
|
22
22
|
});
|
|
23
|
-
case
|
|
23
|
+
case V:
|
|
24
24
|
return n("flex items-center", {
|
|
25
|
-
"justify-center":
|
|
26
|
-
"justify-start":
|
|
27
|
-
"justify-end":
|
|
28
|
-
"h-6 w-6 p-0": t === "small" && !
|
|
29
|
-
"h-6 px-2": t === "small" && !
|
|
30
|
-
"h-8 w-8 p-1": t === "medium" && !
|
|
31
|
-
"h-8 px-3": t === "medium" && !
|
|
32
|
-
"h-12 w-12 p-2": t === "large" && !
|
|
33
|
-
"h-12 px-4": t === "large" && !
|
|
34
|
-
"h-6 py-0": t === "small" &&
|
|
35
|
-
"h-6": t === "small" &&
|
|
36
|
-
"h-8 py-1": t === "medium" &&
|
|
37
|
-
"h-8": t === "medium" &&
|
|
38
|
-
"h-12 py-2": t === "large" &&
|
|
39
|
-
"h-12": t === "large" &&
|
|
25
|
+
"justify-center": i === "center",
|
|
26
|
+
"justify-start": i === "left",
|
|
27
|
+
"justify-end": i === "right",
|
|
28
|
+
"h-6 w-6 p-0": t === "small" && !o && !(r || a),
|
|
29
|
+
"h-6 px-2": t === "small" && !o && (r || a),
|
|
30
|
+
"h-8 w-8 p-1": t === "medium" && !o && !(r || a),
|
|
31
|
+
"h-8 px-3": t === "medium" && !o && (r || a),
|
|
32
|
+
"h-12 w-12 p-2": t === "large" && !o && !(r || a),
|
|
33
|
+
"h-12 px-4": t === "large" && !o && (r || a),
|
|
34
|
+
"h-6 py-0": t === "small" && o && !(r || a),
|
|
35
|
+
"h-6": t === "small" && o && (r || a),
|
|
36
|
+
"h-8 py-1": t === "medium" && o && !(r || a),
|
|
37
|
+
"h-8": t === "medium" && o && (r || a),
|
|
38
|
+
"h-12 py-2": t === "large" && o && !(r || a),
|
|
39
|
+
"h-12": t === "large" && o && (r || a)
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, xe = ({
|
|
43
43
|
type: e,
|
|
44
44
|
size: t,
|
|
45
45
|
labelRight: r,
|
|
46
46
|
labelLeft: a
|
|
47
47
|
}) => {
|
|
48
|
-
const
|
|
48
|
+
const i = "text-sm font-medium", o = "text-base font-medium", c = "text-lg font-medium";
|
|
49
49
|
switch (e) {
|
|
50
50
|
case ee:
|
|
51
51
|
case z:
|
|
52
52
|
return n({
|
|
53
53
|
"text-center": e === z,
|
|
54
|
-
[
|
|
55
|
-
[
|
|
54
|
+
[i]: t === "small",
|
|
55
|
+
[o]: t === "medium",
|
|
56
56
|
[c]: t === "large"
|
|
57
57
|
});
|
|
58
|
-
case
|
|
58
|
+
case V:
|
|
59
59
|
return n({
|
|
60
|
-
[
|
|
61
|
-
[
|
|
60
|
+
[i]: t === "small" && (r || a),
|
|
61
|
+
[o]: t === "medium" && (r || a),
|
|
62
62
|
[c]: t === "large" && (r || a)
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -252,73 +252,73 @@ const Y = "av-messagebox", H = "av-panel", W = "av-button", F = "icon", ee = "bu
|
|
|
252
252
|
className: t,
|
|
253
253
|
raw: r,
|
|
254
254
|
mode: a,
|
|
255
|
-
focusMode:
|
|
256
|
-
disabled:
|
|
255
|
+
focusMode: i,
|
|
256
|
+
disabled: o,
|
|
257
257
|
fullWidth: c,
|
|
258
|
-
size:
|
|
258
|
+
size: d,
|
|
259
259
|
noBorder: s,
|
|
260
260
|
labelRight: g,
|
|
261
|
-
labelLeft:
|
|
262
|
-
noBackground:
|
|
263
|
-
variant:
|
|
264
|
-
truncate:
|
|
265
|
-
align:
|
|
266
|
-
radius:
|
|
267
|
-
animated:
|
|
268
|
-
}) => (
|
|
269
|
-
|
|
261
|
+
labelLeft: v,
|
|
262
|
+
noBackground: u,
|
|
263
|
+
variant: m,
|
|
264
|
+
truncate: f,
|
|
265
|
+
align: b,
|
|
266
|
+
radius: x,
|
|
267
|
+
animated: I
|
|
268
|
+
}) => (m || (m = "primary"), r ? n(q, t) : n(
|
|
269
|
+
q,
|
|
270
270
|
Ie({
|
|
271
271
|
mode: a,
|
|
272
|
-
variant:
|
|
273
|
-
noBackground:
|
|
274
|
-
truncate:
|
|
272
|
+
variant: m,
|
|
273
|
+
noBackground: u,
|
|
274
|
+
truncate: f
|
|
275
275
|
}),
|
|
276
|
-
_e({ mode: a, noBackground:
|
|
277
|
-
Ne({ radius:
|
|
278
|
-
|
|
276
|
+
_e({ mode: a, noBackground: u, variant: m }),
|
|
277
|
+
Ne({ radius: x }),
|
|
278
|
+
we({
|
|
279
279
|
type: e,
|
|
280
|
-
size:
|
|
280
|
+
size: d,
|
|
281
281
|
labelRight: g,
|
|
282
|
-
labelLeft:
|
|
283
|
-
align:
|
|
284
|
-
animated:
|
|
282
|
+
labelLeft: v,
|
|
283
|
+
align: b,
|
|
284
|
+
animated: I
|
|
285
285
|
}),
|
|
286
|
-
|
|
287
|
-
Be({ mode: a, variant:
|
|
288
|
-
Se({ focusMode:
|
|
289
|
-
Ee({ mode: a, variant:
|
|
290
|
-
Ce({ mode: a, variant:
|
|
286
|
+
xe({ type: e, size: d, labelRight: g, labelLeft: v }),
|
|
287
|
+
Be({ mode: a, variant: m, noBorder: s }),
|
|
288
|
+
Se({ focusMode: i }),
|
|
289
|
+
Ee({ mode: a, variant: m, disabled: o }),
|
|
290
|
+
Ce({ mode: a, variant: m, disabled: o }),
|
|
291
291
|
{
|
|
292
292
|
"w-full": c,
|
|
293
|
-
"disabled:cursor-not-allowed disabled:opacity-50":
|
|
293
|
+
"disabled:cursor-not-allowed disabled:opacity-50": o
|
|
294
294
|
},
|
|
295
295
|
n({
|
|
296
|
-
"transition-[width] duration-300 ease-in":
|
|
296
|
+
"transition-[width] duration-300 ease-in": I
|
|
297
297
|
}),
|
|
298
298
|
t
|
|
299
299
|
)), Le = (e, t, r) => {
|
|
300
300
|
!t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof e?.currentTarget?.focus == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
|
|
301
|
-
}, re =
|
|
302
|
-
const { onClick: r, noInternalClick: a = !1, ...
|
|
301
|
+
}, re = F.forwardRef((e, t) => {
|
|
302
|
+
const { onClick: r, noInternalClick: a = !1, ...i } = e;
|
|
303
303
|
return /* @__PURE__ */ l(
|
|
304
304
|
"button",
|
|
305
305
|
{
|
|
306
306
|
ref: t,
|
|
307
|
-
onClick: (
|
|
308
|
-
Le(
|
|
307
|
+
onClick: (o) => {
|
|
308
|
+
Le(o, a, r);
|
|
309
309
|
},
|
|
310
|
-
...
|
|
310
|
+
...i
|
|
311
311
|
}
|
|
312
312
|
);
|
|
313
313
|
});
|
|
314
314
|
re.displayName = "BaseButton";
|
|
315
|
-
function
|
|
316
|
-
const e =
|
|
315
|
+
function Oe() {
|
|
316
|
+
const e = N(!1);
|
|
317
317
|
return B(() => (e.current = !0, () => {
|
|
318
318
|
e.current = !1;
|
|
319
319
|
}), []), ue(() => e.current, []);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Ae(e) {
|
|
322
322
|
return Q(() => e.every((t) => t == null) ? () => {
|
|
323
323
|
} : (t) => {
|
|
324
324
|
e.forEach((r) => {
|
|
@@ -326,7 +326,7 @@ function Oe(e) {
|
|
|
326
326
|
});
|
|
327
327
|
}, [...e]);
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const Pe = {
|
|
330
330
|
x: 0,
|
|
331
331
|
y: 0,
|
|
332
332
|
width: 0,
|
|
@@ -336,93 +336,93 @@ const De = {
|
|
|
336
336
|
bottom: 0,
|
|
337
337
|
right: 0
|
|
338
338
|
};
|
|
339
|
-
function
|
|
340
|
-
const t =
|
|
341
|
-
const s =
|
|
339
|
+
function D(e) {
|
|
340
|
+
const t = Oe(), r = N(0), a = N(null), [i, o] = K(Pe), c = Q(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((d) => {
|
|
341
|
+
const s = d[0];
|
|
342
342
|
s && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
|
343
|
-
a.current && t() &&
|
|
343
|
+
a.current && t() && o(s.contentRect);
|
|
344
344
|
}));
|
|
345
345
|
}), [t]);
|
|
346
346
|
return B(() => (a.current && c?.observe(a.current, e), () => {
|
|
347
347
|
c?.disconnect(), r.current && cancelAnimationFrame(r.current);
|
|
348
|
-
}), [c, e]), [a,
|
|
348
|
+
}), [c, e]), [a, i];
|
|
349
349
|
}
|
|
350
|
-
const
|
|
350
|
+
const M = {
|
|
351
351
|
small: 24,
|
|
352
352
|
// w-6
|
|
353
353
|
medium: 32,
|
|
354
354
|
// w-8
|
|
355
355
|
large: 48
|
|
356
356
|
// w-12
|
|
357
|
-
},
|
|
357
|
+
}, $e = {
|
|
358
358
|
small: 16,
|
|
359
359
|
// px-2 x 2
|
|
360
360
|
medium: 24,
|
|
361
361
|
// px-3 x 2
|
|
362
362
|
large: 32
|
|
363
363
|
// px-4 x 2
|
|
364
|
-
},
|
|
364
|
+
}, De = 2, ze = 300, U = F.forwardRef(
|
|
365
365
|
({
|
|
366
366
|
children: e,
|
|
367
367
|
disabled: t = !1,
|
|
368
368
|
mode: r = "system",
|
|
369
369
|
focusMode: a = "system",
|
|
370
|
-
fullWidth:
|
|
371
|
-
className:
|
|
370
|
+
fullWidth: i = !1,
|
|
371
|
+
className: o,
|
|
372
372
|
type: c = "button",
|
|
373
|
-
raw:
|
|
373
|
+
raw: d = !1,
|
|
374
374
|
noBorder: s = !1,
|
|
375
375
|
"aria-label": g,
|
|
376
|
-
label:
|
|
377
|
-
size:
|
|
378
|
-
labelRight:
|
|
379
|
-
labelLeft:
|
|
380
|
-
noBackground:
|
|
381
|
-
align:
|
|
382
|
-
radius:
|
|
376
|
+
label: v,
|
|
377
|
+
size: u = "medium",
|
|
378
|
+
labelRight: m,
|
|
379
|
+
labelLeft: f,
|
|
380
|
+
noBackground: b = !1,
|
|
381
|
+
align: x = "center",
|
|
382
|
+
radius: I = "large",
|
|
383
383
|
variant: ae = "primary",
|
|
384
384
|
iconClassName: ie,
|
|
385
|
-
animated:
|
|
385
|
+
animated: k = !1,
|
|
386
386
|
...oe
|
|
387
387
|
}, ne) => {
|
|
388
388
|
const le = Te({
|
|
389
|
-
type:
|
|
389
|
+
type: V,
|
|
390
390
|
mode: r,
|
|
391
391
|
focusMode: a,
|
|
392
|
-
fullWidth:
|
|
392
|
+
fullWidth: i,
|
|
393
393
|
disabled: t,
|
|
394
|
-
raw:
|
|
395
|
-
className:
|
|
394
|
+
raw: d,
|
|
395
|
+
className: o,
|
|
396
396
|
noBorder: s,
|
|
397
|
-
size:
|
|
398
|
-
labelRight:
|
|
399
|
-
labelLeft:
|
|
400
|
-
noBackground:
|
|
401
|
-
align:
|
|
402
|
-
radius:
|
|
397
|
+
size: u,
|
|
398
|
+
labelRight: m,
|
|
399
|
+
labelLeft: f,
|
|
400
|
+
noBackground: b,
|
|
401
|
+
align: x,
|
|
402
|
+
radius: I,
|
|
403
403
|
variant: ae,
|
|
404
|
-
animated:
|
|
405
|
-
}), ce = Re({ mode: r, raw:
|
|
406
|
-
return
|
|
407
|
-
S && S.current &&
|
|
408
|
-
}, [
|
|
409
|
-
if (
|
|
410
|
-
let
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
},
|
|
404
|
+
animated: k
|
|
405
|
+
}), ce = Re({ mode: r, raw: d, iconClassName: ie }), j = Me({ animated: k }), se = "flex items-center justify-center relative w-full h-full overflow-hidden", [y, A] = D(), [p, P] = D(), [S, G] = D(), $ = N(0), w = N(null), E = N(null), de = Ae([ne, w]);
|
|
406
|
+
return Y(() => {
|
|
407
|
+
S && S.current && k && ($.current = G.width + $e[u] + (s ? 0 : De), w.current && !w.current.style.width && (w.current.style.width = `${M[u]}px`));
|
|
408
|
+
}, [G, S, u, s, k]), Y(() => {
|
|
409
|
+
if (w && w.current && k) {
|
|
410
|
+
let C = M[u];
|
|
411
|
+
m && y && A.width > 0 ? C = A.width + $.current : f && p && P.width > 0 && (C = P.width + $.current), E.current && clearTimeout(E.current), C !== parseInt(w.current.style.width || "0", 10) && (y.current && (y.current.style.opacity = "0"), p.current && (p.current.style.opacity = "0"), w.current.style.width = `${C}px`, C > M[u] && (E.current = setTimeout(() => {
|
|
412
|
+
y.current && m && (y.current.style.opacity = "1"), p.current && f && (p.current.style.opacity = "1"), E.current = null;
|
|
413
|
+
}, ze * 0.8))), C === M[u] && (y.current && (y.current.style.opacity = "0"), p.current && (p.current.style.opacity = "0"));
|
|
414
414
|
}
|
|
415
415
|
}, [
|
|
416
416
|
A,
|
|
417
|
-
d,
|
|
418
|
-
v,
|
|
419
|
-
O,
|
|
420
|
-
h,
|
|
421
|
-
y,
|
|
422
417
|
m,
|
|
423
|
-
|
|
418
|
+
y,
|
|
419
|
+
P,
|
|
420
|
+
f,
|
|
421
|
+
p,
|
|
422
|
+
u,
|
|
423
|
+
k
|
|
424
424
|
]), B(() => () => {
|
|
425
|
-
|
|
425
|
+
E.current && clearTimeout(E.current);
|
|
426
426
|
}, []), /* @__PURE__ */ l(
|
|
427
427
|
re,
|
|
428
428
|
{
|
|
@@ -430,50 +430,50 @@ const R = {
|
|
|
430
430
|
className: le,
|
|
431
431
|
disabled: t,
|
|
432
432
|
type: c,
|
|
433
|
-
"aria-label": g ||
|
|
433
|
+
"aria-label": g || v,
|
|
434
434
|
...oe,
|
|
435
|
-
children: /* @__PURE__ */
|
|
435
|
+
children: /* @__PURE__ */ L("div", { className: se, children: [
|
|
436
436
|
/* @__PURE__ */ l(
|
|
437
|
-
|
|
437
|
+
X,
|
|
438
438
|
{
|
|
439
|
-
label:
|
|
440
|
-
labelRef:
|
|
441
|
-
labelClass:
|
|
439
|
+
label: f,
|
|
440
|
+
labelRef: p,
|
|
441
|
+
labelClass: j,
|
|
442
442
|
labelInnerClass: "pr-2",
|
|
443
|
-
initiallyHidden:
|
|
443
|
+
initiallyHidden: k
|
|
444
444
|
}
|
|
445
445
|
),
|
|
446
446
|
/* @__PURE__ */ l("span", { ref: S, className: ce, children: e }),
|
|
447
447
|
/* @__PURE__ */ l(
|
|
448
|
-
|
|
448
|
+
X,
|
|
449
449
|
{
|
|
450
|
-
label:
|
|
451
|
-
labelRef:
|
|
452
|
-
labelClass:
|
|
450
|
+
label: m,
|
|
451
|
+
labelRef: y,
|
|
452
|
+
labelClass: j,
|
|
453
453
|
labelInnerClass: "pl-2",
|
|
454
|
-
initiallyHidden:
|
|
454
|
+
initiallyHidden: k
|
|
455
455
|
}
|
|
456
456
|
)
|
|
457
457
|
] })
|
|
458
458
|
}
|
|
459
459
|
);
|
|
460
460
|
}
|
|
461
|
-
),
|
|
461
|
+
), X = ({
|
|
462
462
|
labelRef: e,
|
|
463
463
|
labelClass: t,
|
|
464
464
|
label: r,
|
|
465
465
|
labelInnerClass: a,
|
|
466
|
-
initiallyHidden:
|
|
466
|
+
initiallyHidden: i = !1
|
|
467
467
|
}) => /* @__PURE__ */ l(
|
|
468
468
|
"span",
|
|
469
469
|
{
|
|
470
470
|
ref: e,
|
|
471
471
|
className: t,
|
|
472
|
-
style:
|
|
472
|
+
style: i ? { opacity: 0 } : void 0,
|
|
473
473
|
children: r && /* @__PURE__ */ l("span", { className: a, children: r })
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
|
-
|
|
476
|
+
U.displayName = "ButtonIcon";
|
|
477
477
|
/*!
|
|
478
478
|
@versini/ui-button v6.0.9
|
|
479
479
|
© 2025 gizmette.com
|
|
@@ -481,20 +481,20 @@ V.displayName = "ButtonIcon";
|
|
|
481
481
|
try {
|
|
482
482
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
483
483
|
version: "6.0.9",
|
|
484
|
-
buildTime: "08/04/2025
|
|
484
|
+
buildTime: "08/04/2025 12:23 PM EDT",
|
|
485
485
|
homepage: "https://github.com/aversini/ui-components",
|
|
486
486
|
license: "MIT"
|
|
487
487
|
});
|
|
488
488
|
} catch {
|
|
489
489
|
}
|
|
490
|
-
const Fe =
|
|
490
|
+
const Fe = F.forwardRef(
|
|
491
491
|
({
|
|
492
492
|
children: e,
|
|
493
493
|
mode: t = "system",
|
|
494
494
|
className: r,
|
|
495
495
|
active: a = !1,
|
|
496
|
-
...
|
|
497
|
-
},
|
|
496
|
+
...i
|
|
497
|
+
}, o) => {
|
|
498
498
|
const c = a ? n(
|
|
499
499
|
"relative",
|
|
500
500
|
"focus-within:static",
|
|
@@ -513,13 +513,13 @@ const Fe = $.forwardRef(
|
|
|
513
513
|
}
|
|
514
514
|
) : "";
|
|
515
515
|
return /* @__PURE__ */ l("div", { className: c, children: /* @__PURE__ */ l(
|
|
516
|
-
|
|
516
|
+
U,
|
|
517
517
|
{
|
|
518
518
|
className: n("justify-center", r),
|
|
519
|
-
ref:
|
|
519
|
+
ref: o,
|
|
520
520
|
mode: t,
|
|
521
521
|
radius: "small",
|
|
522
|
-
...
|
|
522
|
+
...i,
|
|
523
523
|
children: e
|
|
524
524
|
}
|
|
525
525
|
) });
|
|
@@ -531,26 +531,26 @@ const Ve = ({
|
|
|
531
531
|
fill: t,
|
|
532
532
|
viewBox: r,
|
|
533
533
|
className: a,
|
|
534
|
-
defaultViewBox:
|
|
535
|
-
size:
|
|
534
|
+
defaultViewBox: i,
|
|
535
|
+
size: o,
|
|
536
536
|
title: c,
|
|
537
|
-
semantic:
|
|
537
|
+
semantic: d = !1,
|
|
538
538
|
...s
|
|
539
539
|
}) => {
|
|
540
|
-
const g = n(
|
|
541
|
-
return /* @__PURE__ */ l(J, { children: /* @__PURE__ */
|
|
540
|
+
const g = n(o, a);
|
|
541
|
+
return /* @__PURE__ */ l(J, { children: /* @__PURE__ */ L(
|
|
542
542
|
"svg",
|
|
543
543
|
{
|
|
544
544
|
xmlns: "http://www.w3.org/2000/svg",
|
|
545
545
|
className: g,
|
|
546
|
-
viewBox: r ||
|
|
546
|
+
viewBox: r || i,
|
|
547
547
|
fill: t || "currentColor",
|
|
548
548
|
role: "img",
|
|
549
|
-
"aria-hidden": !
|
|
549
|
+
"aria-hidden": !d,
|
|
550
550
|
focusable: !1,
|
|
551
551
|
...s,
|
|
552
552
|
children: [
|
|
553
|
-
c &&
|
|
553
|
+
c && d && /* @__PURE__ */ l("title", { children: c }),
|
|
554
554
|
e
|
|
555
555
|
]
|
|
556
556
|
}
|
|
@@ -574,7 +574,7 @@ const Ue = ({
|
|
|
574
574
|
viewBox: t,
|
|
575
575
|
title: r,
|
|
576
576
|
monotone: a,
|
|
577
|
-
...
|
|
577
|
+
...i
|
|
578
578
|
}) => /* @__PURE__ */ l(
|
|
579
579
|
Ve,
|
|
580
580
|
{
|
|
@@ -583,7 +583,7 @@ const Ue = ({
|
|
|
583
583
|
viewBox: t,
|
|
584
584
|
className: e,
|
|
585
585
|
title: r || "Close",
|
|
586
|
-
...
|
|
586
|
+
...i,
|
|
587
587
|
children: /* @__PURE__ */ l(
|
|
588
588
|
"path",
|
|
589
589
|
{
|
|
@@ -606,37 +606,37 @@ try {
|
|
|
606
606
|
});
|
|
607
607
|
} catch {
|
|
608
608
|
}
|
|
609
|
-
const te =
|
|
609
|
+
const te = h.createContext(null);
|
|
610
610
|
function je({
|
|
611
611
|
initialOpen: e = !1,
|
|
612
612
|
open: t,
|
|
613
613
|
onOpenChange: r
|
|
614
614
|
} = {}) {
|
|
615
|
-
const [a,
|
|
615
|
+
const [a, i] = h.useState(e), [o, c] = h.useState(), [d, s] = h.useState(), g = t ?? a, v = r ?? i, u = me({
|
|
616
616
|
open: g,
|
|
617
|
-
onOpenChange:
|
|
618
|
-
}),
|
|
617
|
+
onOpenChange: v
|
|
618
|
+
}), m = u.context, f = ge(m, {
|
|
619
619
|
enabled: t == null
|
|
620
|
-
}),
|
|
620
|
+
}), b = he(m, {
|
|
621
621
|
outsidePress: !1,
|
|
622
622
|
outsidePressEvent: "mousedown"
|
|
623
|
-
}),
|
|
624
|
-
return
|
|
623
|
+
}), x = fe(m), I = be([f, b, x]);
|
|
624
|
+
return h.useMemo(
|
|
625
625
|
() => ({
|
|
626
626
|
open: g,
|
|
627
|
-
setOpen:
|
|
628
|
-
...
|
|
629
|
-
...
|
|
630
|
-
labelId:
|
|
631
|
-
descriptionId:
|
|
627
|
+
setOpen: v,
|
|
628
|
+
...I,
|
|
629
|
+
...u,
|
|
630
|
+
labelId: o,
|
|
631
|
+
descriptionId: d,
|
|
632
632
|
setLabelId: c,
|
|
633
633
|
setDescriptionId: s
|
|
634
634
|
}),
|
|
635
|
-
[g,
|
|
635
|
+
[g, v, I, u, o, d]
|
|
636
636
|
);
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
const e =
|
|
638
|
+
const O = () => {
|
|
639
|
+
const e = h.useContext(te);
|
|
640
640
|
if (e == null)
|
|
641
641
|
throw new Error("Modal components must be wrapped in <Modal />");
|
|
642
642
|
return e;
|
|
@@ -648,36 +648,36 @@ function Ge({
|
|
|
648
648
|
const r = je(t);
|
|
649
649
|
return /* @__PURE__ */ l(te.Provider, { value: r, children: e });
|
|
650
650
|
}
|
|
651
|
-
const Ye =
|
|
652
|
-
const { context: r, ...a } =
|
|
651
|
+
const Ye = h.forwardRef(function(e, t) {
|
|
652
|
+
const { context: r, ...a } = O(), i = ve([a.refs.setFloating, t]);
|
|
653
653
|
if (!r.open)
|
|
654
654
|
return null;
|
|
655
|
-
const { overlayBackground:
|
|
656
|
-
[`${
|
|
657
|
-
"bg-black sm:bg-black/[.8]": !
|
|
655
|
+
const { overlayBackground: o, ...c } = e, d = n("grid place-items-center", {
|
|
656
|
+
[`${o}`]: o,
|
|
657
|
+
"bg-black sm:bg-black/[.8]": !o
|
|
658
658
|
});
|
|
659
|
-
return /* @__PURE__ */ l(ye, { children: /* @__PURE__ */ l(pe, { className:
|
|
659
|
+
return /* @__PURE__ */ l(ye, { children: /* @__PURE__ */ l(pe, { className: d, lockScroll: !0, children: /* @__PURE__ */ l(ke, { context: r, children: /* @__PURE__ */ l(
|
|
660
660
|
"div",
|
|
661
661
|
{
|
|
662
|
-
ref:
|
|
662
|
+
ref: i,
|
|
663
663
|
"aria-labelledby": a.labelId,
|
|
664
664
|
"aria-describedby": a.descriptionId,
|
|
665
665
|
...a.getFloatingProps(c),
|
|
666
666
|
children: c.children
|
|
667
667
|
}
|
|
668
668
|
) }) }) });
|
|
669
|
-
}), He =
|
|
670
|
-
const { setLabelId: a } =
|
|
671
|
-
return
|
|
672
|
-
}),
|
|
673
|
-
const { setDescriptionId: a } =
|
|
674
|
-
return
|
|
675
|
-
}),
|
|
676
|
-
const { setOpen: r } =
|
|
677
|
-
return /* @__PURE__ */ l("div", { className:
|
|
669
|
+
}), He = h.forwardRef(function({ children: e, ...t }, r) {
|
|
670
|
+
const { setLabelId: a } = O(), i = Z();
|
|
671
|
+
return h.useLayoutEffect(() => (a(i), () => a(void 0)), [i, a]), /* @__PURE__ */ l("h1", { ...t, ref: r, id: i, children: e });
|
|
672
|
+
}), qe = h.forwardRef(function({ children: e, ...t }, r) {
|
|
673
|
+
const { setDescriptionId: a } = O(), i = Z();
|
|
674
|
+
return h.useLayoutEffect(() => (a(i), () => a(void 0)), [i, a]), /* @__PURE__ */ l("div", { ...t, ref: r, id: i, children: e });
|
|
675
|
+
}), Xe = h.forwardRef(function(e, t) {
|
|
676
|
+
const { setOpen: r } = O(), { trigger: a, className: i, ...o } = e, c = h.useCallback(() => r(!1), [r]);
|
|
677
|
+
return /* @__PURE__ */ l("div", { className: i, children: h.cloneElement(a, {
|
|
678
678
|
ref: t,
|
|
679
679
|
onClick: c,
|
|
680
|
-
...
|
|
680
|
+
...o
|
|
681
681
|
}) });
|
|
682
682
|
});
|
|
683
683
|
/*!
|
|
@@ -687,67 +687,72 @@ const Ye = f.forwardRef(function(e, t) {
|
|
|
687
687
|
try {
|
|
688
688
|
window.__VERSINI_UI_MODAL__ || (window.__VERSINI_UI_MODAL__ = {
|
|
689
689
|
version: "2.0.5",
|
|
690
|
-
buildTime: "08/04/2025
|
|
690
|
+
buildTime: "08/04/2025 12:23 PM EDT",
|
|
691
691
|
homepage: "https://github.com/aversini/ui-components",
|
|
692
692
|
license: "MIT"
|
|
693
693
|
});
|
|
694
694
|
} catch {
|
|
695
695
|
}
|
|
696
|
-
const
|
|
696
|
+
const _ = "panel", T = "messagebox", We = ({
|
|
697
697
|
className: e,
|
|
698
698
|
kind: t,
|
|
699
699
|
borderMode: r,
|
|
700
|
-
animation: a
|
|
700
|
+
animation: a,
|
|
701
|
+
maxWidth: i = "medium"
|
|
701
702
|
}) => ({
|
|
702
703
|
main: n("prose prose-lighter flex flex-col bg-surface-medium", {
|
|
703
704
|
"duration-200 ease-out": a,
|
|
704
|
-
[`${
|
|
705
|
-
[`${
|
|
706
|
-
[`${
|
|
707
|
-
[`${
|
|
705
|
+
[`${R} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === _,
|
|
706
|
+
[`${R} w-full sm:w-[95%] md:max-w-2xl`]: t === _ && !e && i === "small",
|
|
707
|
+
[`${R} w-full sm:w-[95%] md:max-w-3xl`]: t === _ && !e && i === "medium",
|
|
708
|
+
[`${R} w-full sm:w-[95%] md:max-w-4xl`]: t === _ && !e && i === "large",
|
|
709
|
+
[`${H} rounded-lg border-2`]: t === T,
|
|
710
|
+
[`${H} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === T && !e,
|
|
708
711
|
[`${e}`]: !!e,
|
|
709
|
-
"sm:border-border-dark": r === "dark" && t ===
|
|
710
|
-
"sm:border-border-accent": r === "light" && t ===
|
|
711
|
-
"border-border-dark": r === "dark" && t ===
|
|
712
|
-
"border-border-accent": r === "light" && t ===
|
|
712
|
+
"sm:border-border-dark": r === "dark" && t === _,
|
|
713
|
+
"sm:border-border-accent": r === "light" && t === _,
|
|
714
|
+
"border-border-dark": r === "dark" && t === T,
|
|
715
|
+
"border-border-accent": r === "light" && t === T
|
|
713
716
|
}),
|
|
714
717
|
content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
|
|
715
718
|
footer: "flex grow flex-col sm:p-4 p-2",
|
|
716
719
|
header: "sm:p-4 mb-0 p-2",
|
|
717
720
|
close: "sm:p-4 p-2"
|
|
718
|
-
}), Je = "slide",
|
|
721
|
+
}), Je = "slide", W = "fade", rr = ({
|
|
719
722
|
open: e,
|
|
720
723
|
onOpenChange: t,
|
|
721
724
|
title: r,
|
|
722
725
|
children: a,
|
|
723
|
-
footer:
|
|
724
|
-
borderMode:
|
|
725
|
-
kind: c =
|
|
726
|
-
className:
|
|
726
|
+
footer: i,
|
|
727
|
+
borderMode: o = "light",
|
|
728
|
+
kind: c = _,
|
|
729
|
+
className: d,
|
|
727
730
|
animation: s = !1,
|
|
728
|
-
animationType: g = Je
|
|
731
|
+
animationType: g = Je,
|
|
732
|
+
maxWidth: v = "medium"
|
|
729
733
|
}) => {
|
|
730
|
-
const
|
|
731
|
-
s ? g ===
|
|
734
|
+
const u = N(""), [m, f] = K(
|
|
735
|
+
s ? g === W ? { opacity: 0 } : {
|
|
732
736
|
transform: "translateY(-100vh)"
|
|
733
737
|
} : {}
|
|
734
|
-
),
|
|
735
|
-
className:
|
|
738
|
+
), b = We({
|
|
739
|
+
className: d,
|
|
736
740
|
kind: c,
|
|
737
|
-
borderMode:
|
|
738
|
-
animation: s
|
|
741
|
+
borderMode: o,
|
|
742
|
+
animation: s,
|
|
743
|
+
maxWidth: v
|
|
739
744
|
});
|
|
740
|
-
return B(() => (e && (
|
|
741
|
-
e && (document.title =
|
|
745
|
+
return B(() => (e && (u.current = document.title, document.title = `${r} | ${u.current}`), () => {
|
|
746
|
+
e && (document.title = u.current);
|
|
742
747
|
}), [r, e]), B(() => {
|
|
743
748
|
if (s && e) {
|
|
744
|
-
|
|
745
|
-
s ? g ===
|
|
749
|
+
f(
|
|
750
|
+
s ? g === W ? { opacity: 0 } : {
|
|
746
751
|
transform: "translateY(-666vh)"
|
|
747
752
|
} : {}
|
|
748
753
|
);
|
|
749
754
|
const x = setTimeout(() => {
|
|
750
|
-
|
|
755
|
+
f(
|
|
751
756
|
s ? g === "fade" ? { opacity: 1 } : {
|
|
752
757
|
transform: "translateY(0)"
|
|
753
758
|
} : {}
|
|
@@ -755,14 +760,14 @@ const C = "panel", M = "messagebox", Xe = ({
|
|
|
755
760
|
}, 100);
|
|
756
761
|
return () => clearTimeout(x);
|
|
757
762
|
}
|
|
758
|
-
}, [e, s, g]), /* @__PURE__ */ l(J, { children: e && /* @__PURE__ */ l(Ge, { open: e, onOpenChange: t, children: /* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
763
|
+
}, [e, s, g]), /* @__PURE__ */ l(J, { children: e && /* @__PURE__ */ l(Ge, { open: e, onOpenChange: t, children: /* @__PURE__ */ L(Ye, { className: b.main, style: m, children: [
|
|
764
|
+
/* @__PURE__ */ L("div", { className: "flex flex-row-reverse items-center justify-between", children: [
|
|
760
765
|
/* @__PURE__ */ l(
|
|
761
|
-
|
|
766
|
+
Xe,
|
|
762
767
|
{
|
|
763
|
-
className:
|
|
768
|
+
className: b.close,
|
|
764
769
|
trigger: /* @__PURE__ */ l(
|
|
765
|
-
|
|
770
|
+
U,
|
|
766
771
|
{
|
|
767
772
|
mode: "dark",
|
|
768
773
|
focusMode: "light",
|
|
@@ -773,14 +778,14 @@ const C = "panel", M = "messagebox", Xe = ({
|
|
|
773
778
|
)
|
|
774
779
|
}
|
|
775
780
|
),
|
|
776
|
-
/* @__PURE__ */ l(He, { className:
|
|
781
|
+
/* @__PURE__ */ l(He, { className: b.header, children: r })
|
|
777
782
|
] }),
|
|
778
|
-
/* @__PURE__ */ l(
|
|
779
|
-
|
|
783
|
+
/* @__PURE__ */ l(qe, { className: b.content, children: a }),
|
|
784
|
+
i && /* @__PURE__ */ l("div", { className: b.footer, children: i })
|
|
780
785
|
] }) }) });
|
|
781
786
|
};
|
|
782
787
|
export {
|
|
783
|
-
|
|
784
|
-
|
|
788
|
+
H as MESSAGEBOX_CLASSNAME,
|
|
789
|
+
R as PANEL_CLASSNAME,
|
|
785
790
|
rr as Panel
|
|
786
791
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -48,8 +48,16 @@ type PanelProps = {
|
|
|
48
48
|
* @default "slide"
|
|
49
49
|
*/
|
|
50
50
|
animationType?: "slide" | "fade";
|
|
51
|
+
/**
|
|
52
|
+
* The maximum width of the Panel when kind is "panel".
|
|
53
|
+
* NOTE: This only applies to panels, not messageboxes.
|
|
54
|
+
* NOTE: The max-width only takes effect at the medium breakpoint and above (768px+).
|
|
55
|
+
* At smaller viewports, the panel will take the full screen width.
|
|
56
|
+
* @default "medium"
|
|
57
|
+
*/
|
|
58
|
+
maxWidth?: "small" | "medium" | "large";
|
|
51
59
|
};
|
|
52
60
|
|
|
53
|
-
declare const Panel: ({ open, onOpenChange, title, children, footer, borderMode, kind, className, animation, animationType, }: PanelProps) => react_jsx_runtime.JSX.Element;
|
|
61
|
+
declare const Panel: ({ open, onOpenChange, title, children, footer, borderMode, kind, className, animation, animationType, maxWidth, }: PanelProps) => react_jsx_runtime.JSX.Element;
|
|
54
62
|
|
|
55
63
|
export { MESSAGEBOX_CLASSNAME, PANEL_CLASSNAME, Panel };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { MESSAGEBOX_CLASSNAME as o, PANEL_CLASSNAME as E, Panel as
|
|
1
|
+
import { MESSAGEBOX_CLASSNAME as o, PANEL_CLASSNAME as E, Panel as n } from "./components/Panel/Panel.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/ui-panel v2.
|
|
3
|
+
@versini/ui-panel v2.2.0
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
|
|
8
|
-
version: "2.
|
|
9
|
-
buildTime: "08/04/2025
|
|
8
|
+
version: "2.2.0",
|
|
9
|
+
buildTime: "08/04/2025 12:23 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
|
@@ -15,5 +15,5 @@ try {
|
|
|
15
15
|
export {
|
|
16
16
|
o as MESSAGEBOX_CLASSNAME,
|
|
17
17
|
E as PANEL_CLASSNAME,
|
|
18
|
-
|
|
18
|
+
n as Panel
|
|
19
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-panel",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"sideEffects": [
|
|
54
54
|
"**/*.css"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "14d53d66c2f014604b12f5e3ef0bb8708c996c21"
|
|
57
57
|
}
|