@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 +1 -0
- package/dist/shell/src/AppSidebar.js +15 -9
- package/dist/shell/src/SidebarChrome.js +294 -103
- package/dist/shell/src/SidebarPanel.js +201 -42
- package/dist/shell/src/SidebarPeek.js +181 -0
- package/dist/shell/src/SidebarRail.js +52 -39
- package/dist/src/client.js +1 -0
- package/dist/src/index.js +1 -0
- package/package.json +1 -1
- package/shell/src/AppSidebar.tsx +7 -0
- package/shell/src/Sidebar.tsx +1 -0
- package/shell/src/SidebarChrome.tsx +101 -5
- package/shell/src/SidebarPanel.tsx +77 -7
- package/shell/src/SidebarPeek.ts +129 -0
- package/shell/src/SidebarRail.tsx +17 -1
- package/src/client.ts +2 -0
- package/src/index.ts +2 -0
|
@@ -1,15 +1,18 @@
|
|
|
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";
|
|
7
|
-
import {
|
|
9
|
+
import { DockArrow, useDockArrow } from "./DockArrow.js";
|
|
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";
|
|
10
13
|
/** Sidebar panel column beside the rail: a header and the app's body. Composed from `Sidebar.Panel` parts. */
|
|
11
14
|
export function SidebarPanel(t0) {
|
|
12
|
-
const $ = _c(
|
|
15
|
+
const $ = _c(16);
|
|
13
16
|
const {
|
|
14
17
|
title,
|
|
15
18
|
headerTrailing,
|
|
@@ -21,6 +24,7 @@ export function SidebarPanel(t0) {
|
|
|
21
24
|
children
|
|
22
25
|
} = t0;
|
|
23
26
|
const collapsed = t1 === undefined ? false : t1;
|
|
27
|
+
const pin = Boolean(useOptionalSidebar()?.onCollapsedChange);
|
|
24
28
|
let t2;
|
|
25
29
|
if ($[0] !== title) {
|
|
26
30
|
t2 = /*#__PURE__*/_jsx(PanelTitle, {
|
|
@@ -32,9 +36,9 @@ export function SidebarPanel(t0) {
|
|
|
32
36
|
t2 = $[1];
|
|
33
37
|
}
|
|
34
38
|
let t3;
|
|
35
|
-
if ($[2] !== closeButtonClassName || $[3] !== closeLabel || $[4] !== headerTrailing || $[5] !== onClose) {
|
|
36
|
-
t3 = headerTrailing || onClose ? /*#__PURE__*/_jsxs(PanelActions, {
|
|
37
|
-
children: [headerTrailing, onClose ? /*#__PURE__*/_jsx(PanelClose, {
|
|
39
|
+
if ($[2] !== closeButtonClassName || $[3] !== closeLabel || $[4] !== headerTrailing || $[5] !== onClose || $[6] !== pin) {
|
|
40
|
+
t3 = headerTrailing || onClose || pin ? /*#__PURE__*/_jsxs(PanelActions, {
|
|
41
|
+
children: [headerTrailing, /*#__PURE__*/_jsx(SidebarChromeParts.PinButton, {}), onClose ? /*#__PURE__*/_jsx(PanelClose, {
|
|
38
42
|
onClick: onClose,
|
|
39
43
|
label: closeLabel,
|
|
40
44
|
className: closeButtonClassName
|
|
@@ -44,42 +48,144 @@ export function SidebarPanel(t0) {
|
|
|
44
48
|
$[3] = closeLabel;
|
|
45
49
|
$[4] = headerTrailing;
|
|
46
50
|
$[5] = onClose;
|
|
47
|
-
$[6] =
|
|
51
|
+
$[6] = pin;
|
|
52
|
+
$[7] = t3;
|
|
48
53
|
} else {
|
|
49
|
-
t3 = $[
|
|
54
|
+
t3 = $[7];
|
|
50
55
|
}
|
|
51
56
|
let t4;
|
|
52
|
-
if ($[
|
|
57
|
+
if ($[8] !== t2 || $[9] !== t3) {
|
|
53
58
|
t4 = /*#__PURE__*/_jsxs(PanelHeader, {
|
|
54
59
|
children: [t2, t3]
|
|
55
60
|
});
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
61
|
+
$[8] = t2;
|
|
62
|
+
$[9] = t3;
|
|
63
|
+
$[10] = t4;
|
|
59
64
|
} else {
|
|
60
|
-
t4 = $[
|
|
65
|
+
t4 = $[10];
|
|
61
66
|
}
|
|
62
67
|
let t5;
|
|
63
|
-
if ($[
|
|
68
|
+
if ($[11] !== children || $[12] !== className || $[13] !== collapsed || $[14] !== t4) {
|
|
64
69
|
t5 = /*#__PURE__*/_jsxs(Panel, {
|
|
65
70
|
collapsed: collapsed,
|
|
66
71
|
panelHidden: false,
|
|
67
72
|
className: className,
|
|
68
73
|
children: [t4, children]
|
|
69
74
|
});
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
+
$[11] = children;
|
|
76
|
+
$[12] = className;
|
|
77
|
+
$[13] = collapsed;
|
|
78
|
+
$[14] = t4;
|
|
79
|
+
$[15] = t5;
|
|
75
80
|
} else {
|
|
76
|
-
t5 = $[
|
|
81
|
+
t5 = $[15];
|
|
77
82
|
}
|
|
78
83
|
return t5;
|
|
79
84
|
}
|
|
80
|
-
|
|
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
|
+
*/
|
|
81
186
|
export function Panel(t0) {
|
|
82
|
-
const $ = _c(
|
|
187
|
+
const $ = _c(25);
|
|
188
|
+
let children;
|
|
83
189
|
let className;
|
|
84
190
|
let collapsed;
|
|
85
191
|
let panelHidden;
|
|
@@ -89,48 +195,101 @@ export function Panel(t0) {
|
|
|
89
195
|
collapsed,
|
|
90
196
|
panelHidden,
|
|
91
197
|
className,
|
|
198
|
+
children,
|
|
92
199
|
...props
|
|
93
200
|
} = t0);
|
|
94
201
|
$[0] = t0;
|
|
95
|
-
$[1] =
|
|
96
|
-
$[2] =
|
|
97
|
-
$[3] =
|
|
98
|
-
$[4] =
|
|
202
|
+
$[1] = children;
|
|
203
|
+
$[2] = className;
|
|
204
|
+
$[3] = collapsed;
|
|
205
|
+
$[4] = panelHidden;
|
|
206
|
+
$[5] = props;
|
|
99
207
|
} else {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
208
|
+
children = $[1];
|
|
209
|
+
className = $[2];
|
|
210
|
+
collapsed = $[3];
|
|
211
|
+
panelHidden = $[4];
|
|
212
|
+
props = $[5];
|
|
104
213
|
}
|
|
105
214
|
const sidebar = useOptionalSidebar();
|
|
106
215
|
const dock = useAppShellPanelDock();
|
|
107
216
|
if (panelHidden ?? sidebar?.panelHidden ?? false) {
|
|
108
217
|
return null;
|
|
109
218
|
}
|
|
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
|
+
}
|
|
110
266
|
const t1 = dock ? "" : undefined;
|
|
111
|
-
const t2 =
|
|
267
|
+
const t2 = hidden && "md:hidden";
|
|
112
268
|
let t3;
|
|
113
|
-
if ($[
|
|
269
|
+
if ($[17] !== className || $[18] !== t2) {
|
|
114
270
|
t3 = cn("relative flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background", t2, className);
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
271
|
+
$[17] = className;
|
|
272
|
+
$[18] = t2;
|
|
273
|
+
$[19] = t3;
|
|
118
274
|
} else {
|
|
119
|
-
t3 = $[
|
|
275
|
+
t3 = $[19];
|
|
120
276
|
}
|
|
121
277
|
let t4;
|
|
122
|
-
if ($[
|
|
278
|
+
if ($[20] !== children || $[21] !== props || $[22] !== t1 || $[23] !== t3) {
|
|
123
279
|
t4 = /*#__PURE__*/_jsx("div", {
|
|
124
280
|
"data-shell-dock-panel": t1,
|
|
281
|
+
"data-sidebar-panel": "",
|
|
125
282
|
...props,
|
|
126
|
-
className: t3
|
|
283
|
+
className: t3,
|
|
284
|
+
children: children
|
|
127
285
|
});
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
286
|
+
$[20] = children;
|
|
287
|
+
$[21] = props;
|
|
288
|
+
$[22] = t1;
|
|
289
|
+
$[23] = t3;
|
|
290
|
+
$[24] = t4;
|
|
132
291
|
} else {
|
|
133
|
-
t4 = $[
|
|
292
|
+
t4 = $[24];
|
|
134
293
|
}
|
|
135
294
|
return t4;
|
|
136
295
|
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { flushSync } from "react-dom";
|
|
4
|
+
import { dockPopIn, dockPopOut } from "../../src/motion/dock-motion.js";
|
|
5
|
+
const OPEN_DELAY_MS = 120;
|
|
6
|
+
const CLOSE_DELAY_MS = 350;
|
|
7
|
+
const OPEN_MENU_TRIGGER = '[aria-haspopup][aria-expanded="true"]';
|
|
8
|
+
const PANEL_SELECTOR = "[data-sidebar-panel]";
|
|
9
|
+
function peekTile(target) {
|
|
10
|
+
if (!(target instanceof Element)) return null;
|
|
11
|
+
const tile = target.closest("[data-rail-peek]");
|
|
12
|
+
return tile && tile.closest(PANEL_SELECTOR) === null ? tile : null;
|
|
13
|
+
}
|
|
14
|
+
function inPanel(target) {
|
|
15
|
+
return target instanceof Element && target.closest(PANEL_SELECTOR) !== null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hover and focus state of an unpinned sidebar. The panel opens as an overlay
|
|
19
|
+
* when the pointer or focus is on a rail item that has `data-rail-peek` (rail
|
|
20
|
+
* links and tabs have it), and stays open while the pointer or focus is on a
|
|
21
|
+
* rail item or in the panel. It grows out of the hovered item with
|
|
22
|
+
* `dockPopIn` and shrinks back with `dockPopOut`. It stays open while a menu
|
|
23
|
+
* opened from the sidebar is open. `Sidebar.Root` makes one when none is
|
|
24
|
+
* passed; pass your own to read `previewPath` or `previewValue` and show the
|
|
25
|
+
* hovered item's panel without navigating.
|
|
26
|
+
*/
|
|
27
|
+
export function useSidebarPeek() {
|
|
28
|
+
const $ = _c(12);
|
|
29
|
+
const [peeking, setPeeking] = useState(false);
|
|
30
|
+
const [tile, setTile] = useState(null);
|
|
31
|
+
const timer = useRef(undefined);
|
|
32
|
+
const open = useRef(false);
|
|
33
|
+
const tileRef = useRef(null);
|
|
34
|
+
let t0;
|
|
35
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
36
|
+
t0 = () => window.clearTimeout(timer.current);
|
|
37
|
+
$[0] = t0;
|
|
38
|
+
} else {
|
|
39
|
+
t0 = $[0];
|
|
40
|
+
}
|
|
41
|
+
const cancelPending = t0;
|
|
42
|
+
let t1;
|
|
43
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
+
t1 = () => {
|
|
45
|
+
cancelPending();
|
|
46
|
+
open.current = false;
|
|
47
|
+
setPeeking(false);
|
|
48
|
+
setTile(null);
|
|
49
|
+
};
|
|
50
|
+
$[1] = t1;
|
|
51
|
+
} else {
|
|
52
|
+
t1 = $[1];
|
|
53
|
+
}
|
|
54
|
+
const reset = t1;
|
|
55
|
+
let t2;
|
|
56
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
57
|
+
t2 = () => {
|
|
58
|
+
cancelPending();
|
|
59
|
+
open.current = true;
|
|
60
|
+
setPeeking(true);
|
|
61
|
+
};
|
|
62
|
+
$[2] = t2;
|
|
63
|
+
} else {
|
|
64
|
+
t2 = $[2];
|
|
65
|
+
}
|
|
66
|
+
const hold = t2;
|
|
67
|
+
let t3;
|
|
68
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
69
|
+
t3 = (aside, delayMs) => {
|
|
70
|
+
cancelPending();
|
|
71
|
+
if (open.current) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
timer.current = window.setTimeout(() => {
|
|
75
|
+
open.current = true;
|
|
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
|
+
}
|
|
81
|
+
}, delayMs);
|
|
82
|
+
};
|
|
83
|
+
$[3] = t3;
|
|
84
|
+
} else {
|
|
85
|
+
t3 = $[3];
|
|
86
|
+
}
|
|
87
|
+
const scheduleOpen = t3;
|
|
88
|
+
let t4;
|
|
89
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t4 = aside_0 => {
|
|
91
|
+
cancelPending();
|
|
92
|
+
if (!open.current) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
timer.current = window.setTimeout(() => {
|
|
96
|
+
if (aside_0.querySelector(OPEN_MENU_TRIGGER)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
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);
|
|
103
|
+
}, CLOSE_DELAY_MS);
|
|
104
|
+
};
|
|
105
|
+
$[4] = t4;
|
|
106
|
+
} else {
|
|
107
|
+
t4 = $[4];
|
|
108
|
+
}
|
|
109
|
+
const scheduleClose = t4;
|
|
110
|
+
let t5;
|
|
111
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
112
|
+
t5 = (aside_1, next, delayMs_0) => {
|
|
113
|
+
tileRef.current = next;
|
|
114
|
+
setTile(next);
|
|
115
|
+
scheduleOpen(aside_1, delayMs_0);
|
|
116
|
+
};
|
|
117
|
+
$[5] = t5;
|
|
118
|
+
} else {
|
|
119
|
+
t5 = $[5];
|
|
120
|
+
}
|
|
121
|
+
const onTile = t5;
|
|
122
|
+
let t6;
|
|
123
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
124
|
+
t6 = {
|
|
125
|
+
onPointerOver: event => {
|
|
126
|
+
const next_0 = peekTile(event.target);
|
|
127
|
+
if (next_0) {
|
|
128
|
+
onTile(event.currentTarget, next_0, OPEN_DELAY_MS);
|
|
129
|
+
} else {
|
|
130
|
+
if (inPanel(event.target)) {
|
|
131
|
+
cancelPending();
|
|
132
|
+
} else {
|
|
133
|
+
scheduleClose(event.currentTarget);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
onPointerLeave: event_0 => scheduleClose(event_0.currentTarget),
|
|
138
|
+
onFocus: event_1 => {
|
|
139
|
+
const next_1 = peekTile(event_1.target);
|
|
140
|
+
if (next_1) {
|
|
141
|
+
onTile(event_1.currentTarget, next_1, 0);
|
|
142
|
+
} else {
|
|
143
|
+
if (inPanel(event_1.target)) {
|
|
144
|
+
cancelPending();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
onBlur: event_2 => {
|
|
149
|
+
if (peekTile(event_2.relatedTarget) === null && !inPanel(event_2.relatedTarget)) {
|
|
150
|
+
scheduleClose(event_2.currentTarget);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
$[6] = t6;
|
|
155
|
+
} else {
|
|
156
|
+
t6 = $[6];
|
|
157
|
+
}
|
|
158
|
+
const handlers = t6;
|
|
159
|
+
const previewPath = peeking && tile instanceof HTMLAnchorElement ? tile.pathname : null;
|
|
160
|
+
const previewValue = peeking && tile ? tile.dataset.railPeek || null : null;
|
|
161
|
+
let t7;
|
|
162
|
+
if ($[7] !== peeking || $[8] !== previewPath || $[9] !== previewValue || $[10] !== tile) {
|
|
163
|
+
t7 = {
|
|
164
|
+
peeking,
|
|
165
|
+
previewPath,
|
|
166
|
+
previewValue,
|
|
167
|
+
tile,
|
|
168
|
+
handlers,
|
|
169
|
+
reset,
|
|
170
|
+
hold
|
|
171
|
+
};
|
|
172
|
+
$[7] = peeking;
|
|
173
|
+
$[8] = previewPath;
|
|
174
|
+
$[9] = previewValue;
|
|
175
|
+
$[10] = tile;
|
|
176
|
+
$[11] = t7;
|
|
177
|
+
} else {
|
|
178
|
+
t7 = $[11];
|
|
179
|
+
}
|
|
180
|
+
return t7;
|
|
181
|
+
}
|
|
@@ -210,6 +210,7 @@ export function Rail(t0) {
|
|
|
210
210
|
let t4;
|
|
211
211
|
if ($[7] !== props || $[8] !== t3) {
|
|
212
212
|
t4 = /*#__PURE__*/_jsx("div", {
|
|
213
|
+
"data-sidebar-rail": "",
|
|
213
214
|
...props,
|
|
214
215
|
className: t3
|
|
215
216
|
});
|
|
@@ -498,12 +499,13 @@ export function RailFooter(t0) {
|
|
|
498
499
|
}
|
|
499
500
|
/** Rail tile with a right-side tooltip. Renders a native `<button>`, its child with `asChild`, or a tabs trigger with `tabValue`. */
|
|
500
501
|
export function RailItem(t0) {
|
|
501
|
-
const $ = _c(
|
|
502
|
+
const $ = _c(32);
|
|
502
503
|
let app;
|
|
503
504
|
let badge;
|
|
504
505
|
let children;
|
|
505
506
|
let className;
|
|
506
507
|
let label;
|
|
508
|
+
let peek;
|
|
507
509
|
let props;
|
|
508
510
|
let t1;
|
|
509
511
|
let t2;
|
|
@@ -519,6 +521,7 @@ export function RailItem(t0) {
|
|
|
519
521
|
badge,
|
|
520
522
|
asChild: t3,
|
|
521
523
|
tabValue,
|
|
524
|
+
peek,
|
|
522
525
|
className,
|
|
523
526
|
app,
|
|
524
527
|
children,
|
|
@@ -530,55 +533,58 @@ export function RailItem(t0) {
|
|
|
530
533
|
$[3] = children;
|
|
531
534
|
$[4] = className;
|
|
532
535
|
$[5] = label;
|
|
533
|
-
$[6] =
|
|
534
|
-
$[7] =
|
|
535
|
-
$[8] =
|
|
536
|
-
$[9] =
|
|
537
|
-
$[10] =
|
|
538
|
-
$[11] =
|
|
536
|
+
$[6] = peek;
|
|
537
|
+
$[7] = props;
|
|
538
|
+
$[8] = t1;
|
|
539
|
+
$[9] = t2;
|
|
540
|
+
$[10] = t3;
|
|
541
|
+
$[11] = tabValue;
|
|
542
|
+
$[12] = tooltip;
|
|
539
543
|
} else {
|
|
540
544
|
app = $[1];
|
|
541
545
|
badge = $[2];
|
|
542
546
|
children = $[3];
|
|
543
547
|
className = $[4];
|
|
544
548
|
label = $[5];
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
549
|
+
peek = $[6];
|
|
550
|
+
props = $[7];
|
|
551
|
+
t1 = $[8];
|
|
552
|
+
t2 = $[9];
|
|
553
|
+
t3 = $[10];
|
|
554
|
+
tabValue = $[11];
|
|
555
|
+
tooltip = $[12];
|
|
551
556
|
}
|
|
552
557
|
const active = t1 === undefined ? false : t1;
|
|
553
558
|
const showTooltip = t2 === undefined ? true : t2;
|
|
554
559
|
const asChild = t3 === undefined ? false : t3;
|
|
555
560
|
const grouped = use(RailGroupContext);
|
|
561
|
+
const peekValue = typeof peek === "string" ? peek : peek ?? (asChild || tabValue !== undefined) ? tabValue ?? "" : undefined;
|
|
556
562
|
let t4;
|
|
557
|
-
if ($[
|
|
563
|
+
if ($[13] !== active || $[14] !== app || $[15] !== asChild || $[16] !== badge || $[17] !== children || $[18] !== className || $[19] !== grouped || $[20] !== label || $[21] !== peekValue || $[22] !== props || $[23] !== showTooltip || $[24] !== tabValue || $[25] !== tooltip) {
|
|
558
564
|
const stateClass = railTileStateClass(active, grouped);
|
|
559
565
|
let t5;
|
|
560
|
-
if ($[
|
|
566
|
+
if ($[27] !== active || $[28] !== grouped) {
|
|
561
567
|
t5 = grouped ? {
|
|
562
568
|
"data-rail-tile": "",
|
|
563
569
|
"data-active": active ? "" : undefined
|
|
564
570
|
} : undefined;
|
|
565
|
-
$[
|
|
566
|
-
$[
|
|
567
|
-
$[
|
|
571
|
+
$[27] = active;
|
|
572
|
+
$[28] = grouped;
|
|
573
|
+
$[29] = t5;
|
|
568
574
|
} else {
|
|
569
|
-
t5 = $[
|
|
575
|
+
t5 = $[29];
|
|
570
576
|
}
|
|
571
577
|
const groupMarks = t5;
|
|
572
578
|
const AppIcon = app ? APP_ICONS[app] : null;
|
|
573
579
|
let t6;
|
|
574
|
-
if ($[
|
|
580
|
+
if ($[30] !== AppIcon) {
|
|
575
581
|
t6 = AppIcon ? /*#__PURE__*/_jsx(AppIcon, {
|
|
576
582
|
size: SIDEBAR_RAIL_APP_ICON_SIZE
|
|
577
583
|
}) : null;
|
|
578
|
-
$[
|
|
579
|
-
$[
|
|
584
|
+
$[30] = AppIcon;
|
|
585
|
+
$[31] = t6;
|
|
580
586
|
} else {
|
|
581
|
-
t6 = $[
|
|
587
|
+
t6 = $[31];
|
|
582
588
|
}
|
|
583
589
|
const appIcon = t6;
|
|
584
590
|
const content = appIcon ?? children;
|
|
@@ -589,6 +595,7 @@ export function RailItem(t0) {
|
|
|
589
595
|
...props,
|
|
590
596
|
value: tabValue,
|
|
591
597
|
...groupMarks,
|
|
598
|
+
"data-rail-peek": peekValue,
|
|
592
599
|
className: cn(railTileClass, "group relative", stateClass, className),
|
|
593
600
|
children: [content, /*#__PURE__*/_jsx("span", {
|
|
594
601
|
className: "sr-only",
|
|
@@ -599,6 +606,7 @@ export function RailItem(t0) {
|
|
|
599
606
|
"aria-label": label,
|
|
600
607
|
"aria-current": active ? "page" : undefined,
|
|
601
608
|
...groupMarks,
|
|
609
|
+
"data-rail-peek": peekValue,
|
|
602
610
|
className: cn(railTileClass, "group", stateClass, className),
|
|
603
611
|
children: [appIcon, /*#__PURE__*/_jsx(Slottable, {
|
|
604
612
|
children: children
|
|
@@ -608,29 +616,34 @@ export function RailItem(t0) {
|
|
|
608
616
|
...props,
|
|
609
617
|
"aria-label": label,
|
|
610
618
|
...groupMarks,
|
|
619
|
+
"data-rail-peek": peekValue,
|
|
611
620
|
className: cn(railTileClass, "group", stateClass, className),
|
|
612
621
|
children: [content, badge]
|
|
613
622
|
})
|
|
614
623
|
});
|
|
615
|
-
$[
|
|
616
|
-
$[
|
|
617
|
-
$[
|
|
618
|
-
$[
|
|
619
|
-
$[
|
|
620
|
-
$[
|
|
621
|
-
$[
|
|
622
|
-
$[
|
|
623
|
-
$[
|
|
624
|
-
$[
|
|
625
|
-
$[
|
|
626
|
-
$[
|
|
627
|
-
$[
|
|
628
|
-
|
|
629
|
-
|
|
624
|
+
$[13] = active;
|
|
625
|
+
$[14] = app;
|
|
626
|
+
$[15] = asChild;
|
|
627
|
+
$[16] = badge;
|
|
628
|
+
$[17] = children;
|
|
629
|
+
$[18] = className;
|
|
630
|
+
$[19] = grouped;
|
|
631
|
+
$[20] = label;
|
|
632
|
+
$[21] = peekValue;
|
|
633
|
+
$[22] = props;
|
|
634
|
+
$[23] = showTooltip;
|
|
635
|
+
$[24] = tabValue;
|
|
636
|
+
$[25] = tooltip;
|
|
637
|
+
$[26] = t4;
|
|
638
|
+
} else {
|
|
639
|
+
t4 = $[26];
|
|
630
640
|
}
|
|
631
641
|
return t4;
|
|
632
642
|
}
|
|
633
|
-
/**
|
|
643
|
+
/**
|
|
644
|
+
* Legacy name of `Sidebar.RailItem`.
|
|
645
|
+
* @alias
|
|
646
|
+
*/
|
|
634
647
|
export const RailTile = RailItem;
|
|
635
648
|
/** Short horizontal rule between rail items. */
|
|
636
649
|
export function RailSeparator(t0) {
|
package/dist/src/client.js
CHANGED
|
@@ -147,6 +147,7 @@ export { useAppShellVariant } from "../shell/src/shell-variant.js";
|
|
|
147
147
|
export { popInShellPanelNextFrame, popOutShellPanel, toggleShellPanel } from "../shell/src/shell-panel-motion.js";
|
|
148
148
|
export { ButtonTrack, buttonTrackClass } from "../shell/src/ButtonTrack.js";
|
|
149
149
|
export { SidePanelTabs, popOutSidePanel, SIDE_PANEL_RAIL_WIDTH_PX, SIDE_PANEL_RAIL_LABELLED_WIDTH_PX } from "../shell/src/SidePanelTabs.js";
|
|
150
|
+
export { useSidebarPeek } from "../shell/src/SidebarPeek.js";
|
|
150
151
|
export { DockArrow, useDockArrow } from "../shell/src/DockArrow.js";
|
|
151
152
|
export { AppSidebar } from "../shell/src/AppSidebar.js";
|
|
152
153
|
export * from "../shell/src/Sidebar.js";
|