@vvedantb/ui 0.81.0 → 0.83.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
@@ -1290,6 +1290,7 @@ Rail-variant pieces (all work without the rail variant too, except the first):
1290
1290
  - **`dockPopIn`, `dockNudge`, `dockPopOut`, `slideWith`, `slideNextResize`** (`DockEdge`, `DOCK_MOTION_EVENT`, `DockMotionEvent`, `dockMotionOff`): the same motion for any panel that docks into a tile. All of it stops with `MotionProvider reducedMotion` and `PageMotionProvider disabled`: a show is instant and a hide runs at once.
1291
1291
  - **`ButtonTrack`** (`buttonTrackClass`): a trough for a group of flat buttons, for page header actions (`direction="row"`, default) or tools under a side rail (`direction="column"`). It renders nothing visible when empty.
1292
1292
  - **`DockArrow`** and **`useDockArrow`**: the arrow `SidePanelTabs.Frame` draws, for any dock card. `<DockArrow ref={arrowRef} edge="left" hairline />` renders the 16 px rotated square (`bg-surface` fill; set another with a `bg-*` class). `hairline` adds a 0.5 px line on the two outer sides, matching `Card`'s inset ring, so it shows no seam on a `Card`. `useDockArrow({ frameRef, cardRef, arrowRef, tile, edge, watch })` puts it on the card's `edge` (`"left"` or `"right"`, the edge that touches the rail), level with the tile `tile(frame)` returns, and slides it in step with the tab pill. It runs `dockPopIn` when the card opens (the arrow fades in once the card lands) and `dockSwitch` when the tile changes. Close with `dockPopOut(card, tile, edge, hide, arrow)`. Motion stops under page motion off and reduced motion.
1293
+ - **Pin or unpin the sidebar panel (hover-open).** A collapsed `Sidebar.Root` or `AppSidebar` is now "unpinned": on desktop, hovering or focusing a rail item opens the panel as an overlay that grows out of that item (`dockPopIn`), and it shrinks back into it (`dockPopOut`) when the pointer leaves the rail and panel. It stays open while a menu opened from the sidebar is open. Rail links (`asChild`) and tabs (`tabValue`) open it by default; set `peek` on a `Sidebar.RailItem` to opt a button in (`peek` or `peek="value"`) or a link out (`peek={false}`). Pass `onCollapsedChange` to `Sidebar.Root` or `AppSidebar` and `SidebarPanel` shows `Sidebar.PinButton` in its header ("Unpin sidebar" or "Pin sidebar", desktop only); you can drop the `RailCollapseTile`. To show the hovered item's panel without navigating, make `const peek = useSidebarPeek()`, pass `peek={peek}` to the root, and read `peek.previewPath` (a hovered link's path) or `peek.previewValue` (its `tabValue` or `peek` string). `peek={false}` turns hover-open off.
1293
1294
  - **`SidePanelTabs`**: tabs on a rail beside a content card, for a side panel. `SidePanelTabs.Frame({ collapsed, rail })` holds a `SidePanelTabs.Rail` with a `SidePanelTabs.List({ value, onValueChange })` of `SidePanelTabs.Tab({ value, label, icon, activeIcon, layout, count, indicator, onReselect })`. From `md` up the rail is on the right edge and an arrow on the card points at the active tab; below `md` the tabs are a strip on top. `collapsed` hides the card and leaves the rail (`SIDE_PANEL_RAIL_WIDTH_PX`, 44; `SIDE_PANEL_RAIL_LABELLED_WIDTH_PX`, 76). Close it with `popOutSidePanel(root, collapse)`. It does not depend on the `AppShell` variant. The rail is on the right only. The card is `bg-surface md:rounded-surface`. The tab trough is `bg-default`, and in dark (and `.dark.neutral`) it takes the card tone (`dark:bg-surface`) so the `bg-segment` pill stands out; `Sidebar.RailGroup` and `ButtonTrack` troughs do the same.
1294
1295
 
1295
1296
  ```tsx
@@ -12,11 +12,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  * `.ResizeHandle` instead.
13
13
  */
14
14
  export function AppSidebar(t0) {
15
- const $ = _c(29);
15
+ const $ = _c(31);
16
16
  const {
17
17
  rail,
18
18
  panel,
19
19
  collapsed: t1,
20
+ onCollapsedChange,
21
+ peek,
20
22
  panelHidden: t2,
21
23
  isDesktop,
22
24
  mobileOpen,
@@ -110,12 +112,14 @@ export function AppSidebar(t0) {
110
112
  t10 = $[18];
111
113
  }
112
114
  let t11;
113
- if ($[19] !== collapsed || $[20] !== id || $[21] !== isDesktop || $[22] !== mobileOpen || $[23] !== onMobileOpenChange || $[24] !== panelHidden || $[25] !== t10 || $[26] !== t6 || $[27] !== t7) {
115
+ if ($[19] !== collapsed || $[20] !== id || $[21] !== isDesktop || $[22] !== mobileOpen || $[23] !== onCollapsedChange || $[24] !== onMobileOpenChange || $[25] !== panelHidden || $[26] !== peek || $[27] !== t10 || $[28] !== t6 || $[29] !== t7) {
114
116
  t11 = /*#__PURE__*/_jsxs(Parts.Root, {
115
117
  isDesktop: isDesktop,
116
118
  mobileOpen: mobileOpen,
117
119
  onMobileOpenChange: onMobileOpenChange,
118
120
  collapsed: collapsed,
121
+ onCollapsedChange: onCollapsedChange,
122
+ peek: peek,
119
123
  panelHidden: panelHidden,
120
124
  id: id,
121
125
  children: [t6, t7, t10]
@@ -124,14 +128,16 @@ export function AppSidebar(t0) {
124
128
  $[20] = id;
125
129
  $[21] = isDesktop;
126
130
  $[22] = mobileOpen;
127
- $[23] = onMobileOpenChange;
128
- $[24] = panelHidden;
129
- $[25] = t10;
130
- $[26] = t6;
131
- $[27] = t7;
132
- $[28] = t11;
131
+ $[23] = onCollapsedChange;
132
+ $[24] = onMobileOpenChange;
133
+ $[25] = panelHidden;
134
+ $[26] = peek;
135
+ $[27] = t10;
136
+ $[28] = t6;
137
+ $[29] = t7;
138
+ $[30] = t11;
133
139
  } else {
134
- t11 = $[28];
140
+ t11 = $[30];
135
141
  }
136
142
  return t11;
137
143
  }
@@ -1,11 +1,12 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { createContext, useContext, useEffect, useId } from "react";
3
3
  import { AnimatePresence, domMax, LazyMotion, m } from "motion/react";
4
- import { IconMenu2 } from "@tabler/icons-react";
4
+ import { IconMenu2, IconPin, IconPinFilled } from "@tabler/icons-react";
5
5
  import { Button } from "../../src/ui/button.js";
6
6
  import { motionEase, motionTiming } from "../../src/motion/presets.js";
7
7
  import { cn } from "../../src/utils/cn.js";
8
8
  import { mobileMenuButtonClass } from "./app-shell-classes.js";
9
+ import { useSidebarPeek } from "./SidebarPeek.js";
9
10
  import { SidebarResizeHandle, useSidebarResizeContext } from "./SidebarResize.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  const SidebarContext = /*#__PURE__*/createContext(null);
@@ -22,12 +23,14 @@ function useSidebar(part) {
22
23
  return sidebar;
23
24
  }
24
25
  function Root(t0) {
25
- const $ = _c(16);
26
+ const $ = _c(19);
26
27
  const {
27
28
  isDesktop,
28
29
  mobileOpen,
29
30
  onMobileOpenChange,
30
31
  collapsed: t1,
32
+ onCollapsedChange,
33
+ peek: peekProp,
31
34
  panelHidden: t2,
32
35
  id,
33
36
  children
@@ -35,6 +38,9 @@ function Root(t0) {
35
38
  const collapsed = t1 === undefined ? false : t1;
36
39
  const panelHidden = t2 === undefined ? false : t2;
37
40
  const autoId = useId();
41
+ const ownPeek = useSidebarPeek();
42
+ const peek = peekProp === false ? null : peekProp ?? ownPeek;
43
+ const peeking = collapsed && isDesktop && (peek?.peeking ?? false);
38
44
  let t3;
39
45
  if ($[0] !== isDesktop || $[1] !== mobileOpen || $[2] !== onMobileOpenChange) {
40
46
  t3 = () => {
@@ -58,40 +64,48 @@ function Root(t0) {
58
64
  t4 = $[5];
59
65
  }
60
66
  useEffect(t3, t4);
61
- const t5 = id ?? autoId;
62
- let t6;
63
- if ($[6] !== collapsed || $[7] !== isDesktop || $[8] !== mobileOpen || $[9] !== onMobileOpenChange || $[10] !== panelHidden || $[11] !== t5) {
64
- t6 = {
67
+ const t5 = collapsed && !peeking;
68
+ const t6 = onCollapsedChange ?? null;
69
+ const t7 = id ?? autoId;
70
+ let t8;
71
+ if ($[6] !== collapsed || $[7] !== isDesktop || $[8] !== mobileOpen || $[9] !== onMobileOpenChange || $[10] !== panelHidden || $[11] !== peek || $[12] !== t5 || $[13] !== t6 || $[14] !== t7) {
72
+ t8 = {
65
73
  isDesktop,
66
74
  mobileOpen,
67
75
  onMobileOpenChange,
68
- collapsed,
76
+ collapsed: t5,
77
+ unpinned: collapsed,
78
+ peek,
79
+ onCollapsedChange: t6,
69
80
  panelHidden,
70
- drawerId: t5
81
+ drawerId: t7
71
82
  };
72
83
  $[6] = collapsed;
73
84
  $[7] = isDesktop;
74
85
  $[8] = mobileOpen;
75
86
  $[9] = onMobileOpenChange;
76
87
  $[10] = panelHidden;
77
- $[11] = t5;
78
- $[12] = t6;
88
+ $[11] = peek;
89
+ $[12] = t5;
90
+ $[13] = t6;
91
+ $[14] = t7;
92
+ $[15] = t8;
79
93
  } else {
80
- t6 = $[12];
94
+ t8 = $[15];
81
95
  }
82
- let t7;
83
- if ($[13] !== children || $[14] !== t6) {
84
- t7 = /*#__PURE__*/_jsx(SidebarContext.Provider, {
85
- value: t6,
96
+ let t9;
97
+ if ($[16] !== children || $[17] !== t8) {
98
+ t9 = /*#__PURE__*/_jsx(SidebarContext.Provider, {
99
+ value: t8,
86
100
  children: children
87
101
  });
88
- $[13] = children;
89
- $[14] = t6;
90
- $[15] = t7;
102
+ $[16] = children;
103
+ $[17] = t8;
104
+ $[18] = t9;
91
105
  } else {
92
- t7 = $[15];
106
+ t9 = $[18];
93
107
  }
94
- return t7;
108
+ return t9;
95
109
  }
96
110
  function closeOnEscape(sidebar, event) {
97
111
  if (event.key === "Escape" && !sidebar.isDesktop && sidebar.mobileOpen) {
@@ -450,17 +464,25 @@ function Backdrop(t0) {
450
464
  return t3;
451
465
  }
452
466
  function Aside(t0) {
453
- const $ = _c(34);
467
+ const $ = _c(57);
454
468
  let children;
455
469
  let className;
456
470
  let id;
471
+ let onBlur;
472
+ let onFocus;
457
473
  let onKeyDown;
474
+ let onPointerLeave;
475
+ let onPointerOver;
458
476
  let props;
459
477
  if ($[0] !== t0) {
460
478
  ({
461
479
  id,
462
480
  className,
463
481
  onKeyDown,
482
+ onPointerOver,
483
+ onPointerLeave,
484
+ onFocus,
485
+ onBlur,
464
486
  children,
465
487
  ...props
466
488
  } = t0);
@@ -468,14 +490,22 @@ function Aside(t0) {
468
490
  $[1] = children;
469
491
  $[2] = className;
470
492
  $[3] = id;
471
- $[4] = onKeyDown;
472
- $[5] = props;
493
+ $[4] = onBlur;
494
+ $[5] = onFocus;
495
+ $[6] = onKeyDown;
496
+ $[7] = onPointerLeave;
497
+ $[8] = onPointerOver;
498
+ $[9] = props;
473
499
  } else {
474
500
  children = $[1];
475
501
  className = $[2];
476
502
  id = $[3];
477
- onKeyDown = $[4];
478
- props = $[5];
503
+ onBlur = $[4];
504
+ onFocus = $[5];
505
+ onKeyDown = $[6];
506
+ onPointerLeave = $[7];
507
+ onPointerOver = $[8];
508
+ props = $[9];
479
509
  }
480
510
  const sidebar = useSidebar("Aside");
481
511
  const resize = useSidebarResizeContext();
@@ -483,10 +513,13 @@ function Aside(t0) {
483
513
  isDesktop,
484
514
  mobileOpen,
485
515
  collapsed,
486
- panelHidden
516
+ panelHidden,
517
+ peek
487
518
  } = sidebar;
519
+ const hover = isDesktop && sidebar.unpinned && !panelHidden ? peek : null;
520
+ const peeking = hover !== null && !collapsed;
488
521
  let t1;
489
- if ($[6] !== isDesktop || $[7] !== mobileOpen || $[8] !== sidebar) {
522
+ if ($[10] !== isDesktop || $[11] !== mobileOpen || $[12] !== sidebar) {
490
523
  t1 = (_event, info) => {
491
524
  if (isDesktop || !mobileOpen) {
492
525
  return;
@@ -495,125 +528,188 @@ function Aside(t0) {
495
528
  sidebar.onMobileOpenChange(false);
496
529
  }
497
530
  };
498
- $[6] = isDesktop;
499
- $[7] = mobileOpen;
500
- $[8] = sidebar;
501
- $[9] = t1;
531
+ $[10] = isDesktop;
532
+ $[11] = mobileOpen;
533
+ $[12] = sidebar;
534
+ $[13] = t1;
502
535
  } else {
503
- t1 = $[9];
536
+ t1 = $[13];
504
537
  }
505
538
  const handleDrawerDragEnd = t1;
506
539
  const t2 = id ?? sidebar.drawerId;
507
540
  const t3 = isDesktop ? "desktop" : "drawer";
508
541
  const t4 = !isDesktop && !mobileOpen;
509
- let t5;
510
- if ($[10] !== onKeyDown || $[11] !== sidebar) {
511
- t5 = event => {
512
- onKeyDown?.(event);
513
- closeOnEscape(sidebar, event);
542
+ const t5 = peeking ? "" : undefined;
543
+ let t6;
544
+ if ($[14] !== hover?.handlers || $[15] !== onPointerOver) {
545
+ t6 = event => {
546
+ onPointerOver?.(event);
547
+ hover?.handlers.onPointerOver(event);
514
548
  };
515
- $[10] = onKeyDown;
516
- $[11] = sidebar;
517
- $[12] = t5;
549
+ $[14] = hover?.handlers;
550
+ $[15] = onPointerOver;
551
+ $[16] = t6;
552
+ } else {
553
+ t6 = $[16];
554
+ }
555
+ let t7;
556
+ if ($[17] !== hover?.handlers || $[18] !== onPointerLeave) {
557
+ t7 = event_0 => {
558
+ onPointerLeave?.(event_0);
559
+ hover?.handlers.onPointerLeave(event_0);
560
+ };
561
+ $[17] = hover?.handlers;
562
+ $[18] = onPointerLeave;
563
+ $[19] = t7;
518
564
  } else {
519
- t5 = $[12];
565
+ t7 = $[19];
566
+ }
567
+ let t8;
568
+ if ($[20] !== hover?.handlers || $[21] !== onFocus) {
569
+ t8 = event_1 => {
570
+ onFocus?.(event_1);
571
+ hover?.handlers.onFocus(event_1);
572
+ };
573
+ $[20] = hover?.handlers;
574
+ $[21] = onFocus;
575
+ $[22] = t8;
576
+ } else {
577
+ t8 = $[22];
520
578
  }
521
- const t6 = panelHidden ? "w-[var(--app-shell-rail-width)]" : "w-[min(var(--app-shell-sidebar-width),calc(100vw-1.5rem))]";
522
- const t7 = collapsed || panelHidden ? "md:w-[var(--app-shell-rail-width)]" : "md:w-[var(--app-shell-sidebar-width)]";
523
- const t8 = !resize?.isResizing && "md:transition-[width] md:[transition-duration:280ms] md:[transition-timing-function:cubic-bezier(0.22,1,0.36,1)]";
524
579
  let t9;
525
- if ($[13] !== className || $[14] !== t6 || $[15] !== t7 || $[16] !== t8) {
526
- t9 = cn("fixed inset-y-0 left-0 z-50 flex bg-background pb-[env(safe-area-inset-bottom,0px)] pt-[env(safe-area-inset-top,0px)] md:py-0", t6, t7, t8, className);
527
- $[13] = className;
528
- $[14] = t6;
529
- $[15] = t7;
530
- $[16] = t8;
531
- $[17] = t9;
532
- } else {
533
- t9 = $[17];
534
- }
535
- const t10 = isDesktop || mobileOpen ? 0 : "-100%";
536
- let t11;
537
- if ($[18] !== t10) {
538
- t11 = {
539
- x: t10
580
+ if ($[23] !== hover?.handlers || $[24] !== onBlur) {
581
+ t9 = event_2 => {
582
+ onBlur?.(event_2);
583
+ hover?.handlers.onBlur(event_2);
584
+ };
585
+ $[23] = hover?.handlers;
586
+ $[24] = onBlur;
587
+ $[25] = t9;
588
+ } else {
589
+ t9 = $[25];
590
+ }
591
+ let t10;
592
+ if ($[26] !== onKeyDown || $[27] !== sidebar) {
593
+ t10 = event_3 => {
594
+ onKeyDown?.(event_3);
595
+ closeOnEscape(sidebar, event_3);
596
+ };
597
+ $[26] = onKeyDown;
598
+ $[27] = sidebar;
599
+ $[28] = t10;
600
+ } else {
601
+ t10 = $[28];
602
+ }
603
+ const t11 = panelHidden ? "w-[var(--app-shell-rail-width)]" : "w-[min(var(--app-shell-sidebar-width),calc(100vw-1.5rem))]";
604
+ const t12 = collapsed || panelHidden ? "md:w-[var(--app-shell-rail-width)]" : "md:w-[var(--app-shell-sidebar-width)]";
605
+ const t13 = hover !== null && "md:transition-none";
606
+ const t14 = peeking && (sidebar.onCollapsedChange ? "md:bg-transparent md:[&_[data-sidebar-card]]:smooth-shadow-ring-xl" : "md:shadow-[8px_0_24px_-12px_rgb(0_0_0/0.18)]");
607
+ const t15 = !resize?.isResizing && hover === null && "md:transition-[width] md:[transition-duration:280ms] md:[transition-timing-function:cubic-bezier(0.22,1,0.36,1)]";
608
+ let t16;
609
+ if ($[29] !== className || $[30] !== t11 || $[31] !== t12 || $[32] !== t13 || $[33] !== t14 || $[34] !== t15) {
610
+ t16 = cn("fixed inset-y-0 left-0 z-50 flex bg-background pb-[env(safe-area-inset-bottom,0px)] pt-[env(safe-area-inset-top,0px)] md:py-0", t11, t12, t13, t14, t15, className);
611
+ $[29] = className;
612
+ $[30] = t11;
613
+ $[31] = t12;
614
+ $[32] = t13;
615
+ $[33] = t14;
616
+ $[34] = t15;
617
+ $[35] = t16;
618
+ } else {
619
+ t16 = $[35];
620
+ }
621
+ const t17 = isDesktop || mobileOpen ? 0 : "-100%";
622
+ let t18;
623
+ if ($[36] !== t17) {
624
+ t18 = {
625
+ x: t17
540
626
  };
541
- $[18] = t10;
542
- $[19] = t11;
627
+ $[36] = t17;
628
+ $[37] = t18;
543
629
  } else {
544
- t11 = $[19];
630
+ t18 = $[37];
545
631
  }
546
- let t12;
547
- if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
548
- t12 = {
632
+ let t19;
633
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
634
+ t19 = {
549
635
  duration: motionTiming.sidebar,
550
636
  ease: motionEase
551
637
  };
552
- $[20] = t12;
638
+ $[38] = t19;
553
639
  } else {
554
- t12 = $[20];
640
+ t19 = $[38];
555
641
  }
556
- const t13 = !isDesktop && mobileOpen ? "x" : false;
557
- let t14;
558
- let t15;
559
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
560
- t14 = {
642
+ const t20 = !isDesktop && mobileOpen ? "x" : false;
643
+ let t21;
644
+ let t22;
645
+ if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
646
+ t21 = {
561
647
  left: 0,
562
648
  right: 0
563
649
  };
564
- t15 = {
650
+ t22 = {
565
651
  left: 0.45,
566
652
  right: 0.08
567
653
  };
568
- $[21] = t14;
569
- $[22] = t15;
654
+ $[39] = t21;
655
+ $[40] = t22;
570
656
  } else {
571
- t14 = $[21];
572
- t15 = $[22];
657
+ t21 = $[39];
658
+ t22 = $[40];
573
659
  }
574
- let t16;
575
- if ($[23] !== children || $[24] !== handleDrawerDragEnd || $[25] !== props || $[26] !== t11 || $[27] !== t13 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5 || $[32] !== t9) {
576
- t16 = /*#__PURE__*/_jsx(LazyMotion, {
660
+ let t23;
661
+ if ($[41] !== children || $[42] !== handleDrawerDragEnd || $[43] !== props || $[44] !== t10 || $[45] !== t16 || $[46] !== t18 || $[47] !== t2 || $[48] !== t20 || $[49] !== t3 || $[50] !== t4 || $[51] !== t5 || $[52] !== t6 || $[53] !== t7 || $[54] !== t8 || $[55] !== t9) {
662
+ t23 = /*#__PURE__*/_jsx(LazyMotion, {
577
663
  features: domMax,
578
664
  children: /*#__PURE__*/_jsx(m.aside, {
579
665
  id: t2,
580
666
  "data-sidebar-layout": t3,
581
667
  ...props,
582
668
  inert: t4,
583
- onKeyDown: t5,
584
- className: t9,
669
+ "data-sidebar-peek": t5,
670
+ onPointerOver: t6,
671
+ onPointerLeave: t7,
672
+ onFocus: t8,
673
+ onBlur: t9,
674
+ onKeyDown: t10,
675
+ className: t16,
585
676
  initial: false,
586
- animate: t11,
587
- transition: t12,
588
- drag: t13,
677
+ animate: t18,
678
+ transition: t19,
679
+ drag: t20,
589
680
  dragDirectionLock: true,
590
- dragConstraints: t14,
591
- dragElastic: t15,
681
+ dragConstraints: t21,
682
+ dragElastic: t22,
592
683
  onDragEnd: handleDrawerDragEnd,
593
684
  children: children
594
685
  })
595
686
  });
596
- $[23] = children;
597
- $[24] = handleDrawerDragEnd;
598
- $[25] = props;
599
- $[26] = t11;
600
- $[27] = t13;
601
- $[28] = t2;
602
- $[29] = t3;
603
- $[30] = t4;
604
- $[31] = t5;
605
- $[32] = t9;
606
- $[33] = t16;
607
- } else {
608
- t16 = $[33];
609
- }
610
- return t16;
687
+ $[41] = children;
688
+ $[42] = handleDrawerDragEnd;
689
+ $[43] = props;
690
+ $[44] = t10;
691
+ $[45] = t16;
692
+ $[46] = t18;
693
+ $[47] = t2;
694
+ $[48] = t20;
695
+ $[49] = t3;
696
+ $[50] = t4;
697
+ $[51] = t5;
698
+ $[52] = t6;
699
+ $[53] = t7;
700
+ $[54] = t8;
701
+ $[55] = t9;
702
+ $[56] = t23;
703
+ } else {
704
+ t23 = $[56];
705
+ }
706
+ return t23;
611
707
  }
612
708
  function ResizeHandle(props) {
613
709
  const $ = _c(3);
614
710
  const sidebar = useOptionalSidebar();
615
711
  const resize = useSidebarResizeContext();
616
- const show = resize !== null && (sidebar === null || sidebar.isDesktop && !sidebar.collapsed && !sidebar.panelHidden);
712
+ const show = resize !== null && (sidebar === null || sidebar.isDesktop && !sidebar.unpinned && !sidebar.panelHidden);
617
713
  let t0;
618
714
  if ($[0] !== props || $[1] !== show) {
619
715
  t0 = show ? /*#__PURE__*/_jsx(SidebarResizeHandle, {
@@ -627,7 +723,102 @@ function ResizeHandle(props) {
627
723
  }
628
724
  return t0;
629
725
  }
726
+ /**
727
+ * Pins or unpins the panel. Pinned keeps it docked beside the rail; unpinned
728
+ * shows the rail alone and opens the panel on hover. Renders nothing when
729
+ * `Sidebar.Root` has no `onCollapsedChange`, and is hidden below `md`.
730
+ */
731
+ function PinButton(t0) {
732
+ const $ = _c(18);
733
+ let className;
734
+ let props;
735
+ if ($[0] !== t0) {
736
+ ({
737
+ className,
738
+ ...props
739
+ } = t0);
740
+ $[0] = t0;
741
+ $[1] = className;
742
+ $[2] = props;
743
+ } else {
744
+ className = $[1];
745
+ props = $[2];
746
+ }
747
+ const sidebar = useOptionalSidebar();
748
+ if (!sidebar?.onCollapsedChange) {
749
+ return null;
750
+ }
751
+ const {
752
+ onCollapsedChange,
753
+ peek
754
+ } = sidebar;
755
+ const pinned = !sidebar.unpinned;
756
+ const label = pinned ? "Unpin sidebar" : "Pin sidebar";
757
+ const Icon = pinned ? IconPinFilled : IconPin;
758
+ let t1;
759
+ if ($[3] !== onCollapsedChange || $[4] !== peek || $[5] !== pinned) {
760
+ t1 = () => {
761
+ if (pinned) {
762
+ peek?.hold();
763
+ } else {
764
+ peek?.reset();
765
+ }
766
+ onCollapsedChange(pinned);
767
+ };
768
+ $[3] = onCollapsedChange;
769
+ $[4] = peek;
770
+ $[5] = pinned;
771
+ $[6] = t1;
772
+ } else {
773
+ t1 = $[6];
774
+ }
775
+ let t2;
776
+ if ($[7] !== className) {
777
+ t2 = cn("size-8 shrink-0 text-muted-foreground max-md:hidden", className);
778
+ $[7] = className;
779
+ $[8] = t2;
780
+ } else {
781
+ t2 = $[8];
782
+ }
783
+ let t3;
784
+ if ($[9] !== Icon) {
785
+ t3 = /*#__PURE__*/_jsx(Icon, {
786
+ size: 16
787
+ });
788
+ $[9] = Icon;
789
+ $[10] = t3;
790
+ } else {
791
+ t3 = $[10];
792
+ }
793
+ let t4;
794
+ if ($[11] !== label || $[12] !== pinned || $[13] !== props || $[14] !== t1 || $[15] !== t2 || $[16] !== t3) {
795
+ t4 = /*#__PURE__*/_jsx(Button, {
796
+ type: "button",
797
+ variant: "ghost",
798
+ size: "icon-sm",
799
+ shape: "rounded",
800
+ ...props,
801
+ onClick: t1,
802
+ "aria-pressed": pinned,
803
+ "aria-label": label,
804
+ title: label,
805
+ className: t2,
806
+ children: t3
807
+ });
808
+ $[11] = label;
809
+ $[12] = pinned;
810
+ $[13] = props;
811
+ $[14] = t1;
812
+ $[15] = t2;
813
+ $[16] = t3;
814
+ $[17] = t4;
815
+ } else {
816
+ t4 = $[17];
817
+ }
818
+ return t4;
819
+ }
630
820
  export const SidebarChromeParts = {
821
+ PinButton,
631
822
  Root,
632
823
  MobileHeader,
633
824
  MobileMenuButton,