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