@vvedantb/ui 0.82.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/dist/shell/src/SidebarChrome.js +1 -1
- package/dist/shell/src/SidebarPanel.js +178 -23
- package/dist/shell/src/SidebarPeek.js +10 -8
- package/dist/shell/src/SidebarRail.js +1 -0
- package/package.json +1 -1
- package/shell/src/SidebarChrome.tsx +4 -1
- package/shell/src/SidebarPanel.tsx +71 -5
- package/shell/src/SidebarPeek.ts +8 -6
- package/shell/src/SidebarRail.tsx +1 -0
|
@@ -603,7 +603,7 @@ function Aside(t0) {
|
|
|
603
603
|
const t11 = panelHidden ? "w-[var(--app-shell-rail-width)]" : "w-[min(var(--app-shell-sidebar-width),calc(100vw-1.5rem))]";
|
|
604
604
|
const t12 = collapsed || panelHidden ? "md:w-[var(--app-shell-rail-width)]" : "md:w-[var(--app-shell-sidebar-width)]";
|
|
605
605
|
const t13 = hover !== null && "md:transition-none";
|
|
606
|
-
const t14 = peeking && "md:shadow-[8px_0_24px_-12px_rgb(0_0_0/0.18)]";
|
|
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
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
608
|
let t16;
|
|
609
609
|
if ($[29] !== className || $[30] !== t11 || $[31] !== t12 || $[32] !== t13 || $[33] !== t14 || $[34] !== t15) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
2
3
|
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
3
4
|
import { IconX } from "@tabler/icons-react";
|
|
4
5
|
import { Button } from "../../src/ui/button.js";
|
|
6
|
+
import { Card } from "../../src/ui/card.js";
|
|
5
7
|
import { cn } from "../../src/utils/cn.js";
|
|
6
8
|
import { panelCloseButtonClass, sidebarHeaderRowClass, sidebarNavIconClass, sidebarNavItemActionsClass, sidebarNavItemClass, sidebarNavItemIndentStyle, sidebarNavItemLabelClass, sidebarNavItemLeadingClass, sidebarNavItemTrailingClass } from "./app-shell-classes.js";
|
|
9
|
+
import { DockArrow, useDockArrow } from "./DockArrow.js";
|
|
7
10
|
import { SidebarChromeParts, useOptionalSidebar } from "./SidebarChrome.js";
|
|
8
11
|
import { useAppShellPanelDock } from "./shell-variant.js";
|
|
9
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -79,9 +82,110 @@ export function SidebarPanel(t0) {
|
|
|
79
82
|
}
|
|
80
83
|
return t5;
|
|
81
84
|
}
|
|
82
|
-
|
|
85
|
+
const ACTIVE_RAIL_TILE = '[data-rail-peek][data-active], [data-rail-peek][aria-current="page"], [data-rail-peek][data-state="active"]';
|
|
86
|
+
function sidebarAside(frame) {
|
|
87
|
+
return frame.closest("aside");
|
|
88
|
+
}
|
|
89
|
+
function activeRailTile(frame) {
|
|
90
|
+
return sidebarAside(frame)?.querySelector(ACTIVE_RAIL_TILE) ?? null;
|
|
91
|
+
}
|
|
92
|
+
function sidebarRail(frame) {
|
|
93
|
+
return sidebarAside(frame)?.querySelector("[data-sidebar-rail]") ?? null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The floating panel card and the dock arrow that points from it at its rail
|
|
98
|
+
* tile: the hovered tile while the panel is unpinned, else the active one.
|
|
99
|
+
* `useDockArrow` grows the card out of the tile when it opens.
|
|
100
|
+
*/
|
|
101
|
+
function FloatingCard(t0) {
|
|
102
|
+
const $ = _c(8);
|
|
103
|
+
const {
|
|
104
|
+
hoverTile,
|
|
105
|
+
children
|
|
106
|
+
} = t0;
|
|
107
|
+
const frameRef = useRef(null);
|
|
108
|
+
const cardRef = useRef(null);
|
|
109
|
+
const arrowRef = useRef(null);
|
|
110
|
+
const hoverRef = useRef(hoverTile);
|
|
111
|
+
let t1;
|
|
112
|
+
let t2;
|
|
113
|
+
if ($[0] !== hoverTile) {
|
|
114
|
+
t1 = () => {
|
|
115
|
+
hoverRef.current = hoverTile;
|
|
116
|
+
};
|
|
117
|
+
t2 = [hoverTile];
|
|
118
|
+
$[0] = hoverTile;
|
|
119
|
+
$[1] = t1;
|
|
120
|
+
$[2] = t2;
|
|
121
|
+
} else {
|
|
122
|
+
t1 = $[1];
|
|
123
|
+
t2 = $[2];
|
|
124
|
+
}
|
|
125
|
+
useLayoutEffect(t1, t2);
|
|
126
|
+
let t3;
|
|
127
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
128
|
+
t3 = frame => hoverRef.current ?? activeRailTile(frame);
|
|
129
|
+
$[3] = t3;
|
|
130
|
+
} else {
|
|
131
|
+
t3 = $[3];
|
|
132
|
+
}
|
|
133
|
+
const tile = t3;
|
|
134
|
+
let t4;
|
|
135
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
136
|
+
t4 = {
|
|
137
|
+
frameRef,
|
|
138
|
+
cardRef,
|
|
139
|
+
arrowRef,
|
|
140
|
+
edge: "left",
|
|
141
|
+
tile,
|
|
142
|
+
watch: sidebarRail
|
|
143
|
+
};
|
|
144
|
+
$[4] = t4;
|
|
145
|
+
} else {
|
|
146
|
+
t4 = $[4];
|
|
147
|
+
}
|
|
148
|
+
useDockArrow(t4);
|
|
149
|
+
let t5;
|
|
150
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
151
|
+
t5 = /*#__PURE__*/_jsx(DockArrow, {
|
|
152
|
+
ref: arrowRef,
|
|
153
|
+
edge: "left",
|
|
154
|
+
hairline: true,
|
|
155
|
+
className: "z-10 bg-background"
|
|
156
|
+
});
|
|
157
|
+
$[5] = t5;
|
|
158
|
+
} else {
|
|
159
|
+
t5 = $[5];
|
|
160
|
+
}
|
|
161
|
+
let t6;
|
|
162
|
+
if ($[6] !== children) {
|
|
163
|
+
t6 = /*#__PURE__*/_jsxs("div", {
|
|
164
|
+
ref: frameRef,
|
|
165
|
+
className: "relative flex min-h-0 flex-1 flex-col",
|
|
166
|
+
children: [t5, /*#__PURE__*/_jsx(Card, {
|
|
167
|
+
ref: cardRef,
|
|
168
|
+
"data-sidebar-card": "",
|
|
169
|
+
className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-[calc(var(--radius-lg)+0.25rem)] bg-background",
|
|
170
|
+
children: children
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
$[6] = children;
|
|
174
|
+
$[7] = t6;
|
|
175
|
+
} else {
|
|
176
|
+
t6 = $[7];
|
|
177
|
+
}
|
|
178
|
+
return t6;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Panel column `<div>` beside the rail. When `Sidebar.Root` has
|
|
183
|
+
* `onCollapsedChange`, it floats on desktop: a rounded `Card` inset from the
|
|
184
|
+
* edges, with a `DockArrow` at its rail tile.
|
|
185
|
+
*/
|
|
83
186
|
export function Panel(t0) {
|
|
84
|
-
const $ = _c(
|
|
187
|
+
const $ = _c(25);
|
|
188
|
+
let children;
|
|
85
189
|
let className;
|
|
86
190
|
let collapsed;
|
|
87
191
|
let panelHidden;
|
|
@@ -91,18 +195,21 @@ export function Panel(t0) {
|
|
|
91
195
|
collapsed,
|
|
92
196
|
panelHidden,
|
|
93
197
|
className,
|
|
198
|
+
children,
|
|
94
199
|
...props
|
|
95
200
|
} = t0);
|
|
96
201
|
$[0] = t0;
|
|
97
|
-
$[1] =
|
|
98
|
-
$[2] =
|
|
99
|
-
$[3] =
|
|
100
|
-
$[4] =
|
|
202
|
+
$[1] = children;
|
|
203
|
+
$[2] = className;
|
|
204
|
+
$[3] = collapsed;
|
|
205
|
+
$[4] = panelHidden;
|
|
206
|
+
$[5] = props;
|
|
101
207
|
} else {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
208
|
+
children = $[1];
|
|
209
|
+
className = $[2];
|
|
210
|
+
collapsed = $[3];
|
|
211
|
+
panelHidden = $[4];
|
|
212
|
+
props = $[5];
|
|
106
213
|
}
|
|
107
214
|
const sidebar = useOptionalSidebar();
|
|
108
215
|
const dock = useAppShellPanelDock();
|
|
@@ -110,31 +217,79 @@ export function Panel(t0) {
|
|
|
110
217
|
return null;
|
|
111
218
|
}
|
|
112
219
|
const peeking = sidebar !== null && sidebar.unpinned && !sidebar.collapsed;
|
|
220
|
+
const hidden = !peeking && (collapsed ?? sidebar?.collapsed ?? false);
|
|
221
|
+
if (sidebar !== null && sidebar.isDesktop && sidebar.onCollapsedChange !== null) {
|
|
222
|
+
const t1 = dock ? "" : undefined;
|
|
223
|
+
const t2 = hidden && "md:hidden";
|
|
224
|
+
let t3;
|
|
225
|
+
if ($[6] !== className || $[7] !== t2) {
|
|
226
|
+
t3 = cn("relative my-3 mr-2 flex min-w-0 flex-1 flex-col", t2, className);
|
|
227
|
+
$[6] = className;
|
|
228
|
+
$[7] = t2;
|
|
229
|
+
$[8] = t3;
|
|
230
|
+
} else {
|
|
231
|
+
t3 = $[8];
|
|
232
|
+
}
|
|
233
|
+
const t4 = sidebar.unpinned ? sidebar.peek?.tile ?? null : null;
|
|
234
|
+
let t5;
|
|
235
|
+
if ($[9] !== children || $[10] !== t4) {
|
|
236
|
+
t5 = /*#__PURE__*/_jsx(FloatingCard, {
|
|
237
|
+
hoverTile: t4,
|
|
238
|
+
children: children
|
|
239
|
+
});
|
|
240
|
+
$[9] = children;
|
|
241
|
+
$[10] = t4;
|
|
242
|
+
$[11] = t5;
|
|
243
|
+
} else {
|
|
244
|
+
t5 = $[11];
|
|
245
|
+
}
|
|
246
|
+
let t6;
|
|
247
|
+
if ($[12] !== props || $[13] !== t1 || $[14] !== t3 || $[15] !== t5) {
|
|
248
|
+
t6 = /*#__PURE__*/_jsx("div", {
|
|
249
|
+
"data-shell-dock-panel": t1,
|
|
250
|
+
"data-sidebar-panel": "",
|
|
251
|
+
"data-sidebar-floating": "",
|
|
252
|
+
...props,
|
|
253
|
+
className: t3,
|
|
254
|
+
children: t5
|
|
255
|
+
});
|
|
256
|
+
$[12] = props;
|
|
257
|
+
$[13] = t1;
|
|
258
|
+
$[14] = t3;
|
|
259
|
+
$[15] = t5;
|
|
260
|
+
$[16] = t6;
|
|
261
|
+
} else {
|
|
262
|
+
t6 = $[16];
|
|
263
|
+
}
|
|
264
|
+
return t6;
|
|
265
|
+
}
|
|
113
266
|
const t1 = dock ? "" : undefined;
|
|
114
|
-
const t2 =
|
|
267
|
+
const t2 = hidden && "md:hidden";
|
|
115
268
|
let t3;
|
|
116
|
-
if ($[
|
|
269
|
+
if ($[17] !== className || $[18] !== t2) {
|
|
117
270
|
t3 = cn("relative flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background", t2, className);
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
271
|
+
$[17] = className;
|
|
272
|
+
$[18] = t2;
|
|
273
|
+
$[19] = t3;
|
|
121
274
|
} else {
|
|
122
|
-
t3 = $[
|
|
275
|
+
t3 = $[19];
|
|
123
276
|
}
|
|
124
277
|
let t4;
|
|
125
|
-
if ($[
|
|
278
|
+
if ($[20] !== children || $[21] !== props || $[22] !== t1 || $[23] !== t3) {
|
|
126
279
|
t4 = /*#__PURE__*/_jsx("div", {
|
|
127
280
|
"data-shell-dock-panel": t1,
|
|
128
281
|
"data-sidebar-panel": "",
|
|
129
282
|
...props,
|
|
130
|
-
className: t3
|
|
283
|
+
className: t3,
|
|
284
|
+
children: children
|
|
131
285
|
});
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
286
|
+
$[20] = children;
|
|
287
|
+
$[21] = props;
|
|
288
|
+
$[22] = t1;
|
|
289
|
+
$[23] = t3;
|
|
290
|
+
$[24] = t4;
|
|
136
291
|
} else {
|
|
137
|
-
t4 = $[
|
|
292
|
+
t4 = $[24];
|
|
138
293
|
}
|
|
139
294
|
return t4;
|
|
140
295
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useRef, useState } from "react";
|
|
3
|
+
import { flushSync } from "react-dom";
|
|
3
4
|
import { dockPopIn, dockPopOut } from "../../src/motion/dock-motion.js";
|
|
4
5
|
const OPEN_DELAY_MS = 120;
|
|
5
6
|
const CLOSE_DELAY_MS = 350;
|
|
@@ -72,13 +73,11 @@ export function useSidebarPeek() {
|
|
|
72
73
|
}
|
|
73
74
|
timer.current = window.setTimeout(() => {
|
|
74
75
|
open.current = true;
|
|
75
|
-
setPeeking(true);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
});
|
|
76
|
+
flushSync(() => setPeeking(true));
|
|
77
|
+
const panel = aside.querySelector(PANEL_SELECTOR);
|
|
78
|
+
if (panel && !panel.hasAttribute("data-sidebar-floating")) {
|
|
79
|
+
dockPopIn(panel, tileRef.current, "left");
|
|
80
|
+
}
|
|
82
81
|
}, delayMs);
|
|
83
82
|
};
|
|
84
83
|
$[3] = t3;
|
|
@@ -97,7 +96,10 @@ export function useSidebarPeek() {
|
|
|
97
96
|
if (aside_0.querySelector(OPEN_MENU_TRIGGER)) {
|
|
98
97
|
return;
|
|
99
98
|
}
|
|
100
|
-
|
|
99
|
+
const panel_0 = aside_0.querySelector(PANEL_SELECTOR);
|
|
100
|
+
const card = panel_0?.querySelector("[data-sidebar-card]") ?? panel_0;
|
|
101
|
+
const arrow = panel_0?.querySelector("[data-dock-arrow]");
|
|
102
|
+
dockPopOut(card, tileRef.current, "left", reset, arrow);
|
|
101
103
|
}, CLOSE_DELAY_MS);
|
|
102
104
|
};
|
|
103
105
|
$[4] = t4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
|
|
6
6
|
"type": "module",
|
|
@@ -283,7 +283,10 @@ function Aside({
|
|
|
283
283
|
? "md:w-[var(--app-shell-rail-width)]"
|
|
284
284
|
: "md:w-[var(--app-shell-sidebar-width)]",
|
|
285
285
|
hover !== null && "md:transition-none",
|
|
286
|
-
peeking &&
|
|
286
|
+
peeking &&
|
|
287
|
+
(sidebar.onCollapsedChange
|
|
288
|
+
? "md:bg-transparent md:[&_[data-sidebar-card]]:smooth-shadow-ring-xl"
|
|
289
|
+
: "md:shadow-[8px_0_24px_-12px_rgb(0_0_0/0.18)]"),
|
|
287
290
|
!resize?.isResizing &&
|
|
288
291
|
hover === null &&
|
|
289
292
|
"md:transition-[width] md:[transition-duration:280ms] md:[transition-timing-function:cubic-bezier(0.22,1,0.36,1)]",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef, type ComponentPropsWithoutRef, type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
3
3
|
import { IconX } from "@tabler/icons-react";
|
|
4
4
|
import { Button, type ButtonProps } from "../../src/ui/button";
|
|
5
|
+
import { Card } from "../../src/ui/card";
|
|
5
6
|
import { cn } from "../../src/utils/cn";
|
|
6
7
|
import {
|
|
7
8
|
panelCloseButtonClass,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
sidebarNavItemLeadingClass,
|
|
15
16
|
sidebarNavItemTrailingClass,
|
|
16
17
|
} from "./app-shell-classes";
|
|
18
|
+
import { DockArrow, useDockArrow } from "./DockArrow";
|
|
17
19
|
import { SidebarChromeParts, useOptionalSidebar } from "./SidebarChrome";
|
|
18
20
|
import { useAppShellPanelDock } from "./shell-variant";
|
|
19
21
|
|
|
@@ -64,12 +66,74 @@ export type SidebarPanelRootProps = ComponentPropsWithoutRef<"div"> & {
|
|
|
64
66
|
panelHidden?: boolean;
|
|
65
67
|
};
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
const ACTIVE_RAIL_TILE =
|
|
70
|
+
'[data-rail-peek][data-active], [data-rail-peek][aria-current="page"], [data-rail-peek][data-state="active"]';
|
|
71
|
+
|
|
72
|
+
function sidebarAside(frame: HTMLElement): HTMLElement | null {
|
|
73
|
+
return frame.closest<HTMLElement>("aside");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function activeRailTile(frame: HTMLElement): HTMLElement | null {
|
|
77
|
+
return sidebarAside(frame)?.querySelector<HTMLElement>(ACTIVE_RAIL_TILE) ?? null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function sidebarRail(frame: HTMLElement): Element | null {
|
|
81
|
+
return sidebarAside(frame)?.querySelector("[data-sidebar-rail]") ?? null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The floating panel card and the dock arrow that points from it at its rail
|
|
86
|
+
* tile: the hovered tile while the panel is unpinned, else the active one.
|
|
87
|
+
* `useDockArrow` grows the card out of the tile when it opens.
|
|
88
|
+
*/
|
|
89
|
+
function FloatingCard({ hoverTile, children }: { hoverTile: HTMLElement | null; children: ReactNode }) {
|
|
90
|
+
const frameRef = useRef<HTMLDivElement>(null);
|
|
91
|
+
const cardRef = useRef<HTMLDivElement>(null);
|
|
92
|
+
const arrowRef = useRef<HTMLDivElement>(null);
|
|
93
|
+
const hoverRef = useRef(hoverTile);
|
|
94
|
+
useLayoutEffect(() => {
|
|
95
|
+
hoverRef.current = hoverTile;
|
|
96
|
+
}, [hoverTile]);
|
|
97
|
+
const tile = useCallback((frame: HTMLElement) => hoverRef.current ?? activeRailTile(frame), []);
|
|
98
|
+
useDockArrow({ frameRef, cardRef, arrowRef, edge: "left", tile, watch: sidebarRail });
|
|
99
|
+
return (
|
|
100
|
+
<div ref={frameRef} className="relative flex min-h-0 flex-1 flex-col">
|
|
101
|
+
<DockArrow ref={arrowRef} edge="left" hairline className="z-10 bg-background" />
|
|
102
|
+
<Card
|
|
103
|
+
ref={cardRef}
|
|
104
|
+
data-sidebar-card=""
|
|
105
|
+
className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-[calc(var(--radius-lg)+0.25rem)] bg-background"
|
|
106
|
+
>
|
|
107
|
+
{children}
|
|
108
|
+
</Card>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Panel column `<div>` beside the rail. When `Sidebar.Root` has
|
|
115
|
+
* `onCollapsedChange`, it floats on desktop: a rounded `Card` inset from the
|
|
116
|
+
* edges, with a `DockArrow` at its rail tile.
|
|
117
|
+
*/
|
|
118
|
+
export function Panel({ collapsed, panelHidden, className, children, ...props }: SidebarPanelRootProps) {
|
|
69
119
|
const sidebar = useOptionalSidebar();
|
|
70
120
|
const dock = useAppShellPanelDock();
|
|
71
121
|
if (panelHidden ?? sidebar?.panelHidden ?? false) return null;
|
|
72
122
|
const peeking = sidebar !== null && sidebar.unpinned && !sidebar.collapsed;
|
|
123
|
+
const hidden = !peeking && (collapsed ?? sidebar?.collapsed ?? false);
|
|
124
|
+
if (sidebar !== null && sidebar.isDesktop && sidebar.onCollapsedChange !== null) {
|
|
125
|
+
return (
|
|
126
|
+
<div
|
|
127
|
+
data-shell-dock-panel={dock ? "" : undefined}
|
|
128
|
+
data-sidebar-panel=""
|
|
129
|
+
data-sidebar-floating=""
|
|
130
|
+
{...props}
|
|
131
|
+
className={cn("relative my-3 mr-2 flex min-w-0 flex-1 flex-col", hidden && "md:hidden", className)}
|
|
132
|
+
>
|
|
133
|
+
<FloatingCard hoverTile={sidebar.unpinned ? (sidebar.peek?.tile ?? null) : null}>{children}</FloatingCard>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
73
137
|
return (
|
|
74
138
|
<div
|
|
75
139
|
data-shell-dock-panel={dock ? "" : undefined}
|
|
@@ -77,10 +141,12 @@ export function Panel({ collapsed, panelHidden, className, ...props }: SidebarPa
|
|
|
77
141
|
{...props}
|
|
78
142
|
className={cn(
|
|
79
143
|
"relative flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background",
|
|
80
|
-
|
|
144
|
+
hidden && "md:hidden",
|
|
81
145
|
className,
|
|
82
146
|
)}
|
|
83
|
-
|
|
147
|
+
>
|
|
148
|
+
{children}
|
|
149
|
+
</div>
|
|
84
150
|
);
|
|
85
151
|
}
|
|
86
152
|
|
package/shell/src/SidebarPeek.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useRef, useState, type FocusEvent, type PointerEvent } from "react";
|
|
2
|
+
import { flushSync } from "react-dom";
|
|
2
3
|
import { dockPopIn, dockPopOut } from "../../src/motion/dock-motion";
|
|
3
4
|
|
|
4
5
|
const OPEN_DELAY_MS = 120;
|
|
@@ -77,11 +78,9 @@ export function useSidebarPeek(): SidebarPeek {
|
|
|
77
78
|
if (open.current) return;
|
|
78
79
|
timer.current = window.setTimeout(() => {
|
|
79
80
|
open.current = true;
|
|
80
|
-
setPeeking(true);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (panel) dockPopIn(panel, tileRef.current, "left");
|
|
84
|
-
});
|
|
81
|
+
flushSync(() => setPeeking(true));
|
|
82
|
+
const panel = aside.querySelector<HTMLElement>(PANEL_SELECTOR);
|
|
83
|
+
if (panel && !panel.hasAttribute("data-sidebar-floating")) dockPopIn(panel, tileRef.current, "left");
|
|
85
84
|
}, delayMs);
|
|
86
85
|
};
|
|
87
86
|
|
|
@@ -90,7 +89,10 @@ export function useSidebarPeek(): SidebarPeek {
|
|
|
90
89
|
if (!open.current) return;
|
|
91
90
|
timer.current = window.setTimeout(() => {
|
|
92
91
|
if (aside.querySelector(OPEN_MENU_TRIGGER)) return;
|
|
93
|
-
|
|
92
|
+
const panel = aside.querySelector<HTMLElement>(PANEL_SELECTOR);
|
|
93
|
+
const card = panel?.querySelector<HTMLElement>("[data-sidebar-card]") ?? panel;
|
|
94
|
+
const arrow = panel?.querySelector<HTMLElement>("[data-dock-arrow]");
|
|
95
|
+
dockPopOut(card, tileRef.current, "left", reset, arrow);
|
|
94
96
|
}, CLOSE_DELAY_MS);
|
|
95
97
|
};
|
|
96
98
|
|
|
@@ -72,6 +72,7 @@ export type SidebarRailRootProps = ComponentPropsWithoutRef<"div"> & {
|
|
|
72
72
|
export function Rail({ showDivider = false, className, ...props }: SidebarRailRootProps) {
|
|
73
73
|
return (
|
|
74
74
|
<div
|
|
75
|
+
data-sidebar-rail=""
|
|
75
76
|
{...props}
|
|
76
77
|
className={cn(
|
|
77
78
|
"flex h-full w-[var(--app-shell-rail-width)] shrink-0 flex-col items-center bg-background",
|