beez-ui 0.9.1 → 0.10.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.
@@ -1,40 +1,119 @@
1
1
  "use client";
2
2
  import { c as _c } from "react/compiler-runtime";
3
+ /**
4
+ * Animated application sidebar adapted from beui.dev/components/motion/animated-sidebar: the rail
5
+ * morphs its width with a spring, labels fade out of the icon rail, a shared pill follows the
6
+ * hovered and active items, submenus unfold with a stagger, and small screens get a focus-trapped
7
+ * sheet. Links route through the `BeezUIProvider` adapter and the open state keeps the
8
+ * `sidebar_state` cookie contract read by server entrypoints.
9
+ */
3
10
  import * as React from "react";
4
- import { cva } from "class-variance-authority";
5
- import { Slot } from "radix-ui";
11
+ import { ChevronRight, PanelLeftIcon } from "lucide-react";
12
+ import { AnimatePresence, motion } from "motion/react";
13
+ import { createPortal } from "react-dom";
14
+ import { useIsHydrated } from "../hooks/use-is-hydrated.js";
6
15
  import { useIsMobile } from "../hooks/use-mobile.js";
7
- import { useSidebarPersistence, saveSidebarPreference } from "../hooks/use-sidebar-persistence.js";
8
- import { GlideSlot } from "../motion/glide-slot.js";
9
- import { MotionSlot } from "../motion/motion-slot.js";
10
- import { MOTION_EASE_DRAWER } from "../motion/tokens.js";
16
+ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
17
+ import { saveSidebarCookie, saveSidebarPreference, useSidebarPersistence } from "../hooks/use-sidebar-persistence.js";
11
18
  import { cn } from "../lib/utils.js";
12
- import { SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME } from "../constants/sidebar.js";
13
- import { Button } from "./button.js";
14
- import { Input } from "./input.js";
15
- import { Separator } from "./separator.js";
16
- import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
17
- import { Skeleton } from "./skeleton.js";
18
- import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
19
- import { PanelLeftIcon } from "lucide-react";
19
+ import { MotionSlot } from "../motion/motion-slot.js";
20
+ import { SharedLayoutBg } from "../motion/shared-layout-bg.js";
21
+ import { MOTION_EASE, MOTION_EASE_DRAWER, MOTION_LIST_ITEM_DISTANCE, MOTION_TIMING, SPRING_LAYOUT } from "../motion/tokens.js";
22
+ import { Link } from "./link.js";
20
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { createElement as _createElement } from "react";
21
25
  const SIDEBAR_WIDTH = "16rem";
26
+ const SIDEBAR_WIDTH_ICON = "4.25rem";
22
27
  const SIDEBAR_WIDTH_MOBILE = "18rem";
23
- const SIDEBAR_WIDTH_ICON = "3rem";
24
28
  const SIDEBAR_KEYBOARD_SHORTCUT = "b";
25
- /** Drawer curve shared by the collapse transitions: quick start, long gentle settle. */
26
- const SIDEBAR_EASE = `cubic-bezier(${MOTION_EASE_DRAWER.join(", ")})`;
27
- const SIDEBAR_MENU_SKELETON_TEXT_WIDTH = "70%";
28
- function subscribeToClientMount() {
29
- return () => {};
30
- }
31
- function getClientMountSnapshot() {
32
- return true;
33
- }
34
- function getServerMountSnapshot() {
35
- return false;
36
- }
29
+ const EXTERNAL_LINK_TARGET = "_blank";
30
+ const EXTERNAL_LINK_REL = "noreferrer noopener";
31
+ /** Distance, in pixels, labels and chevrons drift while fading out of the icon rail. */
32
+ const SIDEBAR_LABEL_DRIFT_PX = 4;
33
+ /** Chevron rotation, in degrees, of an expanded group. */
34
+ const SIDEBAR_CHEVRON_EXPANDED_DEGREES = 90;
35
+ /** Blur, in pixels, submenu items shed as they unfold. */
36
+ const SIDEBAR_SUBMENU_ITEM_BLUR_PX = 3;
37
+ const PANEL_TRANSITION = {
38
+ duration: .36,
39
+ ease: MOTION_EASE_DRAWER
40
+ };
41
+ /**
42
+ * The desktop rail settles at a hard zero-width boundary. Keep the spring critically damped so it
43
+ * cannot overshoot, pause against that boundary, and then snap back during the final frame.
44
+ */
45
+ const SIDEBAR_MORPH_TRANSITION = {
46
+ type: "spring",
47
+ stiffness: 380,
48
+ damping: 35,
49
+ mass: .75
50
+ };
51
+ const LABEL_ENTER_TRANSITION = {
52
+ duration: MOTION_TIMING.message,
53
+ delay: .08,
54
+ ease: MOTION_EASE
55
+ };
56
+ const LABEL_EXIT_TRANSITION = {
57
+ duration: MOTION_TIMING.exit,
58
+ ease: MOTION_EASE
59
+ };
60
+ const REDUCED_TRANSITION = {
61
+ duration: .16,
62
+ ease: MOTION_EASE
63
+ };
64
+ const INSTANT_TRANSITION = { duration: 0 };
65
+ const SUBMENU_VARIANTS = {
66
+ closed: {
67
+ opacity: 0,
68
+ clipPath: "inset(0 0 100% 0 round 8px)",
69
+ transition: {
70
+ duration: MOTION_TIMING.fast,
71
+ ease: MOTION_EASE,
72
+ staggerChildren: .025,
73
+ staggerDirection: -1
74
+ }
75
+ },
76
+ open: {
77
+ opacity: 1,
78
+ clipPath: "inset(0 0 0% 0 round 8px)",
79
+ transition: {
80
+ duration: MOTION_TIMING.message,
81
+ delayChildren: MOTION_TIMING.listStagger,
82
+ ease: MOTION_EASE,
83
+ staggerChildren: .045
84
+ }
85
+ }
86
+ };
87
+ const SUBMENU_ITEM_VARIANTS = {
88
+ closed: {
89
+ opacity: 0,
90
+ y: -MOTION_LIST_ITEM_DISTANCE,
91
+ filter: `blur(${SIDEBAR_SUBMENU_ITEM_BLUR_PX}px)`
92
+ },
93
+ open: {
94
+ opacity: 1,
95
+ y: 0,
96
+ filter: "blur(0px)",
97
+ transition: {
98
+ duration: MOTION_TIMING.enter,
99
+ ease: MOTION_EASE
100
+ }
101
+ }
102
+ };
103
+ const FOCUSABLE_SELECTOR = [
104
+ "a[href]",
105
+ "button:not([disabled])",
106
+ "input:not([disabled])",
107
+ "select:not([disabled])",
108
+ "textarea:not([disabled])",
109
+ "[tabindex]:not([tabindex='-1'])"
110
+ ].join(",");
37
111
  const SidebarContext = React.createContext(null);
112
+ const SidebarPanelContext = React.createContext(null);
113
+ /**
114
+ * Reads the sidebar state shared by `SidebarProvider`.
115
+ * @returns Open state for desktop and mobile, viewport and motion flags, and state setters.
116
+ */
38
117
  function useSidebar() {
39
118
  const context = React.use(SidebarContext);
40
119
  if (!context) {
@@ -42,724 +121,914 @@ function useSidebar() {
42
121
  }
43
122
  return context;
44
123
  }
124
+ function useSidebarPanel() {
125
+ const context = React.use(SidebarPanelContext);
126
+ if (!context) {
127
+ throw new Error("Sidebar parts must be used within an Sidebar.");
128
+ }
129
+ return context;
130
+ }
131
+ /**
132
+ * Owns the open state of the sidebar, the ⌘B / Ctrl+B shortcut and the layout wrapper.
133
+ * @param props - Controlled or default state for both viewports, persistence key and wrapper attributes.
134
+ * @returns The wrapper that lays out the sidebar next to its inset.
135
+ */
45
136
  function SidebarProvider(t0) {
46
- const $ = _c(38);
137
+ const $ = _c(53);
47
138
  let children;
48
139
  let className;
140
+ let onOpenChange;
141
+ let onOpenMobileChange;
142
+ let openMobileProp;
49
143
  let openProp;
50
144
  let props;
51
- let setOpenProp;
52
145
  let storageKey;
53
146
  let style;
54
147
  let t1;
148
+ let t2;
55
149
  if ($[0] !== t0) {
56
- ({defaultOpen: t1, storageKey, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props} = t0);
150
+ ({children, open: openProp, defaultOpen: t1, onOpenChange, openMobile: openMobileProp, defaultOpenMobile: t2, onOpenMobileChange, storageKey, className, style, ...props} = t0);
57
151
  $[0] = t0;
58
152
  $[1] = children;
59
153
  $[2] = className;
60
- $[3] = openProp;
61
- $[4] = props;
62
- $[5] = setOpenProp;
63
- $[6] = storageKey;
64
- $[7] = style;
65
- $[8] = t1;
154
+ $[3] = onOpenChange;
155
+ $[4] = onOpenMobileChange;
156
+ $[5] = openMobileProp;
157
+ $[6] = openProp;
158
+ $[7] = props;
159
+ $[8] = storageKey;
160
+ $[9] = style;
161
+ $[10] = t1;
162
+ $[11] = t2;
66
163
  } else {
67
164
  children = $[1];
68
165
  className = $[2];
69
- openProp = $[3];
70
- props = $[4];
71
- setOpenProp = $[5];
72
- storageKey = $[6];
73
- style = $[7];
74
- t1 = $[8];
166
+ onOpenChange = $[3];
167
+ onOpenMobileChange = $[4];
168
+ openMobileProp = $[5];
169
+ openProp = $[6];
170
+ props = $[7];
171
+ storageKey = $[8];
172
+ style = $[9];
173
+ t1 = $[10];
174
+ t2 = $[11];
75
175
  }
76
176
  const defaultOpen = t1 === undefined ? true : t1;
77
- const isMobile = useIsMobile();
78
- const [openMobile, setOpenMobile] = React.useState(false);
79
- const [_open, _setOpen] = React.useState(null);
177
+ const defaultOpenMobile = t2 === undefined ? false : t2;
178
+ const [internalOpen, setInternalOpen] = React.useState(null);
179
+ const [internalOpenMobile, setInternalOpenMobile] = React.useState(defaultOpenMobile);
80
180
  const persistedOpen = useSidebarPersistence(storageKey);
81
- const open = openProp ?? _open ?? persistedOpen ?? defaultOpen;
82
- let t2;
83
- if ($[9] !== open || $[10] !== setOpenProp || $[11] !== storageKey) {
84
- t2 = (value) => {
85
- const openState = typeof value === "function" ? value(open) : value;
86
- if (setOpenProp) {
87
- setOpenProp(openState);
88
- } else {
89
- _setOpen(openState);
181
+ const isMobile = useIsMobile();
182
+ const reduce = usePrefersReducedMotion();
183
+ const generatedId = React.useId();
184
+ const triggerRef = React.useRef(null);
185
+ const open = openProp ?? internalOpen ?? persistedOpen ?? defaultOpen;
186
+ const openMobile = openMobileProp ?? internalOpenMobile;
187
+ const state = open ? "expanded" : "collapsed";
188
+ const mobileWidth = style?.["--sidebar-width-mobile"] ?? SIDEBAR_WIDTH_MOBILE;
189
+ let t3;
190
+ if ($[12] !== onOpenChange || $[13] !== openProp || $[14] !== storageKey) {
191
+ t3 = (nextOpen) => {
192
+ if (openProp === undefined) {
193
+ setInternalOpen(nextOpen);
90
194
  }
91
- saveSidebarPreference(storageKey, openState);
92
- try {
93
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}; SameSite=Lax`;
94
- } catch {}
195
+ onOpenChange?.(nextOpen);
196
+ saveSidebarPreference(storageKey, nextOpen);
197
+ saveSidebarCookie(nextOpen);
95
198
  };
96
- $[9] = open;
97
- $[10] = setOpenProp;
98
- $[11] = storageKey;
99
- $[12] = t2;
100
- } else {
101
- t2 = $[12];
102
- }
103
- const setOpen = t2;
104
- let t3;
105
- if ($[13] !== isMobile || $[14] !== setOpen) {
106
- t3 = () => isMobile ? setOpenMobile(_temp) : setOpen(_temp2);
107
- $[13] = isMobile;
108
- $[14] = setOpen;
199
+ $[12] = onOpenChange;
200
+ $[13] = openProp;
201
+ $[14] = storageKey;
109
202
  $[15] = t3;
110
203
  } else {
111
204
  t3 = $[15];
112
205
  }
113
- const toggleSidebar = t3;
206
+ const setOpen = t3;
114
207
  let t4;
208
+ if ($[16] !== onOpenMobileChange || $[17] !== openMobileProp) {
209
+ t4 = (nextOpen_0) => {
210
+ if (openMobileProp === undefined) {
211
+ setInternalOpenMobile(nextOpen_0);
212
+ }
213
+ onOpenMobileChange?.(nextOpen_0);
214
+ };
215
+ $[16] = onOpenMobileChange;
216
+ $[17] = openMobileProp;
217
+ $[18] = t4;
218
+ } else {
219
+ t4 = $[18];
220
+ }
221
+ const setOpenMobile = t4;
115
222
  let t5;
116
- if ($[16] !== toggleSidebar) {
117
- t4 = () => {
118
- const handleKeyDown = (event) => {
119
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
223
+ if ($[19] !== isMobile || $[20] !== open || $[21] !== openMobile || $[22] !== setOpen || $[23] !== setOpenMobile) {
224
+ t5 = () => {
225
+ if (isMobile) {
226
+ setOpenMobile(!openMobile);
227
+ } else {
228
+ setOpen(!open);
229
+ }
230
+ };
231
+ $[19] = isMobile;
232
+ $[20] = open;
233
+ $[21] = openMobile;
234
+ $[22] = setOpen;
235
+ $[23] = setOpenMobile;
236
+ $[24] = t5;
237
+ } else {
238
+ t5 = $[24];
239
+ }
240
+ const toggleSidebar = t5;
241
+ let t6;
242
+ let t7;
243
+ if ($[25] !== toggleSidebar) {
244
+ t6 = () => {
245
+ const handleShortcut = (event) => {
246
+ if (event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
120
247
  event.preventDefault();
121
248
  toggleSidebar();
122
249
  }
123
250
  };
124
- window.addEventListener("keydown", handleKeyDown);
125
- return () => window.removeEventListener("keydown", handleKeyDown);
251
+ window.addEventListener("keydown", handleShortcut);
252
+ return () => window.removeEventListener("keydown", handleShortcut);
126
253
  };
127
- t5 = [toggleSidebar];
128
- $[16] = toggleSidebar;
129
- $[17] = t4;
130
- $[18] = t5;
254
+ t7 = [toggleSidebar];
255
+ $[25] = toggleSidebar;
256
+ $[26] = t6;
257
+ $[27] = t7;
131
258
  } else {
132
- t4 = $[17];
133
- t5 = $[18];
259
+ t6 = $[26];
260
+ t7 = $[27];
134
261
  }
135
- React.useEffect(t4, t5);
136
- const state = open ? "expanded" : "collapsed";
137
- let t6;
138
- if ($[19] !== isMobile || $[20] !== open || $[21] !== openMobile || $[22] !== setOpen || $[23] !== state || $[24] !== toggleSidebar) {
139
- t6 = {
140
- state,
141
- open,
142
- setOpen,
262
+ React.useEffect(t6, t7);
263
+ const t8 = `${generatedId}-active`;
264
+ let t9;
265
+ if ($[28] !== isMobile || $[29] !== mobileWidth || $[30] !== open || $[31] !== openMobile || $[32] !== reduce || $[33] !== setOpen || $[34] !== setOpenMobile || $[35] !== state || $[36] !== t8 || $[37] !== toggleSidebar) {
266
+ t9 = {
143
267
  isMobile,
268
+ layoutId: t8,
269
+ mobileWidth,
270
+ open,
144
271
  openMobile,
272
+ reduce,
273
+ setOpen,
145
274
  setOpenMobile,
146
- toggleSidebar
275
+ state,
276
+ toggleSidebar,
277
+ triggerRef
147
278
  };
148
- $[19] = isMobile;
149
- $[20] = open;
150
- $[21] = openMobile;
151
- $[22] = setOpen;
152
- $[23] = state;
153
- $[24] = toggleSidebar;
154
- $[25] = t6;
155
- } else {
156
- t6 = $[25];
157
- }
158
- const contextValue = t6;
159
- let t7;
160
- if ($[26] !== style) {
161
- t7 = {
279
+ $[28] = isMobile;
280
+ $[29] = mobileWidth;
281
+ $[30] = open;
282
+ $[31] = openMobile;
283
+ $[32] = reduce;
284
+ $[33] = setOpen;
285
+ $[34] = setOpenMobile;
286
+ $[35] = state;
287
+ $[36] = t8;
288
+ $[37] = toggleSidebar;
289
+ $[38] = t9;
290
+ } else {
291
+ t9 = $[38];
292
+ }
293
+ const contextValue = t9;
294
+ let t10;
295
+ if ($[39] !== mobileWidth || $[40] !== style) {
296
+ t10 = {
162
297
  "--sidebar-width": SIDEBAR_WIDTH,
163
298
  "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
164
- "--sidebar-ease": SIDEBAR_EASE,
299
+ "--sidebar-width-mobile": mobileWidth,
165
300
  ...style
166
301
  };
167
- $[26] = style;
168
- $[27] = t7;
302
+ $[39] = mobileWidth;
303
+ $[40] = style;
304
+ $[41] = t10;
169
305
  } else {
170
- t7 = $[27];
306
+ t10 = $[41];
171
307
  }
172
- const t8 = t7;
173
- let t9;
174
- if ($[28] !== className) {
175
- t9 = cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className);
176
- $[28] = className;
177
- $[29] = t9;
308
+ let t11;
309
+ if ($[42] !== className) {
310
+ t11 = cn("group/sidebar-wrapper flex min-h-svh w-full min-w-0 has-data-[variant=inset]:bg-sidebar", className);
311
+ $[42] = className;
312
+ $[43] = t11;
178
313
  } else {
179
- t9 = $[29];
314
+ t11 = $[43];
180
315
  }
181
- let t10;
182
- if ($[30] !== children || $[31] !== props || $[32] !== t8 || $[33] !== t9) {
183
- t10 = /* @__PURE__ */ _jsx("div", {
184
- "data-slot": "sidebar-wrapper",
185
- style: t8,
186
- className: t9,
316
+ let t12;
317
+ if ($[44] !== children || $[45] !== props || $[46] !== state || $[47] !== t10 || $[48] !== t11) {
318
+ t12 = /* @__PURE__ */ _jsx("div", {
187
319
  ...props,
320
+ "data-slot": "sidebar-wrapper",
321
+ "data-state": state,
322
+ style: t10,
323
+ className: t11,
188
324
  children
189
325
  });
190
- $[30] = children;
191
- $[31] = props;
192
- $[32] = t8;
193
- $[33] = t9;
194
- $[34] = t10;
326
+ $[44] = children;
327
+ $[45] = props;
328
+ $[46] = state;
329
+ $[47] = t10;
330
+ $[48] = t11;
331
+ $[49] = t12;
332
+ } else {
333
+ t12 = $[49];
334
+ }
335
+ let t13;
336
+ if ($[50] !== contextValue || $[51] !== t12) {
337
+ t13 = /* @__PURE__ */ _jsx(SidebarContext.Provider, {
338
+ value: contextValue,
339
+ children: t12
340
+ });
341
+ $[50] = contextValue;
342
+ $[51] = t12;
343
+ $[52] = t13;
344
+ } else {
345
+ t13 = $[52];
346
+ }
347
+ return t13;
348
+ }
349
+ /** Small-screen sheet: locks page scroll, traps focus and hands it back to the trigger on close. */
350
+ function MobileSidebar(t0) {
351
+ const $ = _c(54);
352
+ const { ariaLabel, children, className, side } = t0;
353
+ const context = useSidebar();
354
+ const isHydrated = useIsHydrated();
355
+ const panelRef = React.useRef(null);
356
+ const [hidden, setHidden] = React.useState(!context.openMobile);
357
+ const openMobileRef = React.useRef(context.openMobile);
358
+ const { mobileWidth, openMobile, reduce, setOpenMobile, triggerRef } = context;
359
+ let t1;
360
+ let t2;
361
+ if ($[0] !== openMobile) {
362
+ t1 = () => {
363
+ openMobileRef.current = openMobile;
364
+ if (openMobile) {
365
+ setHidden(false);
366
+ }
367
+ };
368
+ t2 = [openMobile];
369
+ $[0] = openMobile;
370
+ $[1] = t1;
371
+ $[2] = t2;
195
372
  } else {
196
- t10 = $[34];
373
+ t1 = $[1];
374
+ t2 = $[2];
375
+ }
376
+ React.useEffect(t1, t2);
377
+ let t3;
378
+ let t4;
379
+ if ($[3] !== openMobile || $[4] !== triggerRef) {
380
+ t3 = () => {
381
+ if (!openMobile) {
382
+ return;
383
+ }
384
+ const body = document.body;
385
+ const scrollY = window.scrollY;
386
+ const previousBodyStyles = {
387
+ left: body.style.left,
388
+ overflow: body.style.overflow,
389
+ position: body.style.position,
390
+ right: body.style.right,
391
+ top: body.style.top
392
+ };
393
+ body.style.position = "fixed";
394
+ body.style.top = `-${scrollY}px`;
395
+ body.style.left = "0";
396
+ body.style.right = "0";
397
+ body.style.overflow = "hidden";
398
+ const restoreTriggerFocus = () => triggerRef.current?.focus({ preventScroll: true });
399
+ const focusFrame = requestAnimationFrame(() => {
400
+ const firstFocusable = panelRef.current?.querySelector(FOCUSABLE_SELECTOR);
401
+ (firstFocusable ?? panelRef.current)?.focus({ preventScroll: true });
402
+ });
403
+ return () => {
404
+ cancelAnimationFrame(focusFrame);
405
+ body.style.position = previousBodyStyles.position;
406
+ body.style.top = previousBodyStyles.top;
407
+ body.style.left = previousBodyStyles.left;
408
+ body.style.right = previousBodyStyles.right;
409
+ body.style.overflow = previousBodyStyles.overflow;
410
+ window.scrollTo(0, scrollY);
411
+ restoreTriggerFocus();
412
+ };
413
+ };
414
+ t4 = [openMobile, triggerRef];
415
+ $[3] = openMobile;
416
+ $[4] = triggerRef;
417
+ $[5] = t3;
418
+ $[6] = t4;
419
+ } else {
420
+ t3 = $[5];
421
+ t4 = $[6];
422
+ }
423
+ React.useEffect(t3, t4);
424
+ if (!isHydrated) {
425
+ return null;
426
+ }
427
+ const closedOffset = side === "left" ? "-100%" : "100%";
428
+ const transition = reduce ? REDUCED_TRANSITION : PANEL_TRANSITION;
429
+ let t5;
430
+ if ($[7] !== setOpenMobile) {
431
+ t5 = (event) => {
432
+ if (event.key === "Escape") {
433
+ event.preventDefault();
434
+ setOpenMobile(false);
435
+ return;
436
+ }
437
+ if (event.key !== "Tab") {
438
+ return;
439
+ }
440
+ const focusable = panelRef.current ? Array.from(panelRef.current.querySelectorAll(FOCUSABLE_SELECTOR)) : [];
441
+ if (focusable.length === 0) {
442
+ event.preventDefault();
443
+ panelRef.current?.focus();
444
+ return;
445
+ }
446
+ const firstFocusable_0 = focusable[0];
447
+ const lastFocusable = focusable[focusable.length - 1];
448
+ if (event.shiftKey && document.activeElement === firstFocusable_0) {
449
+ event.preventDefault();
450
+ lastFocusable.focus();
451
+ } else {
452
+ if (!event.shiftKey && document.activeElement === lastFocusable) {
453
+ event.preventDefault();
454
+ firstFocusable_0.focus();
455
+ }
456
+ }
457
+ };
458
+ $[7] = setOpenMobile;
459
+ $[8] = t5;
460
+ } else {
461
+ t5 = $[8];
462
+ }
463
+ const trapFocus = t5;
464
+ const t6 = hidden && !openMobile ? "invisible" : "visible";
465
+ let t7;
466
+ if ($[9] !== t6) {
467
+ t7 = cn("pointer-events-none fixed top-0 left-0 z-50 size-0 md:hidden", t6);
468
+ $[9] = t6;
469
+ $[10] = t7;
470
+ } else {
471
+ t7 = $[10];
472
+ }
473
+ const t8 = openMobile ? 0 : -1;
474
+ const t9 = openMobile ? 1 : 0;
475
+ let t10;
476
+ if ($[11] !== t9) {
477
+ t10 = { opacity: t9 };
478
+ $[11] = t9;
479
+ $[12] = t10;
480
+ } else {
481
+ t10 = $[12];
197
482
  }
198
483
  let t11;
199
- if ($[35] !== contextValue || $[36] !== t10) {
200
- t11 = /* @__PURE__ */ _jsx(SidebarContext.Provider, {
201
- value: contextValue,
202
- children: t10
484
+ if ($[13] !== setOpenMobile) {
485
+ t11 = () => setOpenMobile(false);
486
+ $[13] = setOpenMobile;
487
+ $[14] = t11;
488
+ } else {
489
+ t11 = $[14];
490
+ }
491
+ const t12 = openMobile ? "pointer-events-auto" : "pointer-events-none";
492
+ let t13;
493
+ if ($[15] !== t12) {
494
+ t13 = cn("fixed inset-0 bg-black/40", t12);
495
+ $[15] = t12;
496
+ $[16] = t13;
497
+ } else {
498
+ t13 = $[16];
499
+ }
500
+ let t14;
501
+ if ($[17] !== t10 || $[18] !== t11 || $[19] !== t13 || $[20] !== t8 || $[21] !== transition) {
502
+ t14 = /* @__PURE__ */ _jsx(motion.button, {
503
+ type: "button",
504
+ "aria-label": "Close sidebar",
505
+ "data-slot": "sidebar-overlay",
506
+ tabIndex: t8,
507
+ initial: false,
508
+ animate: t10,
509
+ transition,
510
+ onClick: t11,
511
+ className: t13
203
512
  });
204
- $[35] = contextValue;
205
- $[36] = t10;
206
- $[37] = t11;
513
+ $[17] = t10;
514
+ $[18] = t11;
515
+ $[19] = t13;
516
+ $[20] = t8;
517
+ $[21] = transition;
518
+ $[22] = t14;
519
+ } else {
520
+ t14 = $[22];
521
+ }
522
+ const t15 = !openMobile;
523
+ const t16 = !openMobile;
524
+ const t17 = openMobile ? "expanded" : "collapsed";
525
+ const t18 = reduce ? openMobile ? 1 : 0 : 1;
526
+ const t19 = reduce ? 0 : openMobile ? "0%" : closedOffset;
527
+ let t20;
528
+ if ($[23] !== t18 || $[24] !== t19) {
529
+ t20 = {
530
+ opacity: t18,
531
+ x: t19
532
+ };
533
+ $[23] = t18;
534
+ $[24] = t19;
535
+ $[25] = t20;
207
536
  } else {
208
- t11 = $[37];
537
+ t20 = $[25];
209
538
  }
210
- return t11;
211
- }
212
- function _temp2(open_1) {
213
- return !open_1;
214
- }
215
- function _temp(open_0) {
216
- return !open_0;
539
+ let t21;
540
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
541
+ t21 = () => {
542
+ if (!openMobileRef.current) {
543
+ setHidden(true);
544
+ }
545
+ };
546
+ $[26] = t21;
547
+ } else {
548
+ t21 = $[26];
549
+ }
550
+ let t22;
551
+ if ($[27] !== mobileWidth) {
552
+ t22 = { "--sidebar-width-mobile": mobileWidth };
553
+ $[27] = mobileWidth;
554
+ $[28] = t22;
555
+ } else {
556
+ t22 = $[28];
557
+ }
558
+ const t23 = t22;
559
+ const t24 = side === "left" ? "left-0 border-r" : "right-0 border-l";
560
+ const t25 = !openMobile && "pointer-events-none";
561
+ let t26;
562
+ if ($[29] !== className || $[30] !== t24 || $[31] !== t25) {
563
+ t26 = cn("pointer-events-auto fixed inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden outline-none", "border-sidebar-border bg-sidebar text-sidebar-foreground shadow-2xl will-change-transform", t24, t25, className);
564
+ $[29] = className;
565
+ $[30] = t24;
566
+ $[31] = t25;
567
+ $[32] = t26;
568
+ } else {
569
+ t26 = $[32];
570
+ }
571
+ let t27;
572
+ if ($[33] !== side) {
573
+ t27 = {
574
+ collapsed: false,
575
+ collapsible: "none",
576
+ side
577
+ };
578
+ $[33] = side;
579
+ $[34] = t27;
580
+ } else {
581
+ t27 = $[34];
582
+ }
583
+ let t28;
584
+ if ($[35] !== children || $[36] !== t27) {
585
+ t28 = /* @__PURE__ */ _jsx(SidebarPanelContext.Provider, {
586
+ value: t27,
587
+ children
588
+ });
589
+ $[35] = children;
590
+ $[36] = t27;
591
+ $[37] = t28;
592
+ } else {
593
+ t28 = $[37];
594
+ }
595
+ let t29;
596
+ if ($[38] !== ariaLabel || $[39] !== side || $[40] !== t15 || $[41] !== t16 || $[42] !== t17 || $[43] !== t20 || $[44] !== t23 || $[45] !== t26 || $[46] !== t28 || $[47] !== transition || $[48] !== trapFocus) {
597
+ t29 = /* @__PURE__ */ _jsx(motion.div, {
598
+ ref: panelRef,
599
+ role: "dialog",
600
+ "aria-modal": "true",
601
+ "aria-label": ariaLabel,
602
+ "aria-hidden": t15,
603
+ inert: t16,
604
+ tabIndex: -1,
605
+ "data-slot": "sidebar",
606
+ "data-mobile": "true",
607
+ "data-state": t17,
608
+ "data-side": side,
609
+ initial: false,
610
+ animate: t20,
611
+ transition,
612
+ onAnimationComplete: t21,
613
+ onKeyDown: trapFocus,
614
+ style: t23,
615
+ className: t26,
616
+ children: t28
617
+ });
618
+ $[38] = ariaLabel;
619
+ $[39] = side;
620
+ $[40] = t15;
621
+ $[41] = t16;
622
+ $[42] = t17;
623
+ $[43] = t20;
624
+ $[44] = t23;
625
+ $[45] = t26;
626
+ $[46] = t28;
627
+ $[47] = transition;
628
+ $[48] = trapFocus;
629
+ $[49] = t29;
630
+ } else {
631
+ t29 = $[49];
632
+ }
633
+ let t30;
634
+ if ($[50] !== t14 || $[51] !== t29 || $[52] !== t7) {
635
+ t30 = createPortal(/* @__PURE__ */ _jsxs("div", {
636
+ className: t7,
637
+ children: [t14, t29]
638
+ }), document.body);
639
+ $[50] = t14;
640
+ $[51] = t29;
641
+ $[52] = t7;
642
+ $[53] = t30;
643
+ } else {
644
+ t30 = $[53];
645
+ }
646
+ return t30;
217
647
  }
648
+ /**
649
+ * Renders the sidebar: a width-morphing rail on desktop and a sheet on small screens.
650
+ * @param props - Side, variant, collapse mode, accessible name and panel classes.
651
+ * @returns The desktop rail, the mobile sheet portal, or an always-expanded panel.
652
+ */
218
653
  function Sidebar(t0) {
219
- const $ = _c(48);
654
+ const $ = _c(55);
220
655
  let children;
221
656
  let className;
222
- let dir;
657
+ let panelClassName;
223
658
  let props;
659
+ let style;
224
660
  let t1;
225
661
  let t2;
226
662
  let t3;
663
+ let t4;
227
664
  if ($[0] !== t0) {
228
- ({side: t1, variant: t2, collapsible: t3, className, children, dir, ...props} = t0);
665
+ ({side: t1, variant: t2, collapsible: t3, ariaLabel: t4, children, className, panelClassName, style, ...props} = t0);
229
666
  $[0] = t0;
230
667
  $[1] = children;
231
668
  $[2] = className;
232
- $[3] = dir;
669
+ $[3] = panelClassName;
233
670
  $[4] = props;
234
- $[5] = t1;
235
- $[6] = t2;
236
- $[7] = t3;
671
+ $[5] = style;
672
+ $[6] = t1;
673
+ $[7] = t2;
674
+ $[8] = t3;
675
+ $[9] = t4;
237
676
  } else {
238
677
  children = $[1];
239
678
  className = $[2];
240
- dir = $[3];
679
+ panelClassName = $[3];
241
680
  props = $[4];
242
- t1 = $[5];
243
- t2 = $[6];
244
- t3 = $[7];
681
+ style = $[5];
682
+ t1 = $[6];
683
+ t2 = $[7];
684
+ t3 = $[8];
685
+ t4 = $[9];
245
686
  }
246
687
  const side = t1 === undefined ? "left" : t1;
247
688
  const variant = t2 === undefined ? "sidebar" : t2;
248
- const collapsible = t3 === undefined ? "offcanvas" : t3;
249
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
250
- if (collapsible === "none") {
251
- let t4;
252
- if ($[8] !== className) {
253
- t4 = cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className);
254
- $[8] = className;
255
- $[9] = t4;
256
- } else {
257
- t4 = $[9];
258
- }
689
+ const collapsible = t3 === undefined ? "icon" : t3;
690
+ const ariaLabel = t4 === undefined ? "Sidebar" : t4;
691
+ const context = useSidebar();
692
+ const collapsed = collapsible !== "none" && !context.open;
693
+ const offcanvas = collapsed && collapsible === "offcanvas";
694
+ const width = offcanvas ? "0px" : collapsed ? "var(--sidebar-width-icon)" : "var(--sidebar-width)";
695
+ if (context.isMobile && collapsible !== "none") {
259
696
  let t5;
260
- if ($[10] !== children || $[11] !== props || $[12] !== t4) {
261
- t5 = /* @__PURE__ */ _jsx("div", {
262
- "data-slot": "sidebar",
263
- className: t4,
264
- ...props,
697
+ if ($[10] !== ariaLabel || $[11] !== children || $[12] !== className || $[13] !== side) {
698
+ t5 = /* @__PURE__ */ _jsx(MobileSidebar, {
699
+ ariaLabel,
700
+ className,
701
+ side,
265
702
  children
266
703
  });
267
- $[10] = children;
268
- $[11] = props;
269
- $[12] = t4;
270
- $[13] = t5;
704
+ $[10] = ariaLabel;
705
+ $[11] = children;
706
+ $[12] = className;
707
+ $[13] = side;
708
+ $[14] = t5;
271
709
  } else {
272
- t5 = $[13];
710
+ t5 = $[14];
273
711
  }
274
712
  return t5;
275
713
  }
276
- if (isMobile) {
277
- let t4;
278
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
279
- t4 = { "--sidebar-width": SIDEBAR_WIDTH_MOBILE };
280
- $[14] = t4;
281
- } else {
282
- t4 = $[14];
283
- }
284
- let t5;
285
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
286
- t5 = /* @__PURE__ */ _jsxs(SheetHeader, {
287
- className: "sr-only",
288
- children: [/* @__PURE__ */ _jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ _jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
289
- });
290
- $[15] = t5;
291
- } else {
292
- t5 = $[15];
293
- }
294
- let t6;
295
- if ($[16] !== children) {
296
- t6 = /* @__PURE__ */ _jsx("div", {
297
- className: "flex h-full w-full flex-col",
298
- children
299
- });
300
- $[16] = children;
301
- $[17] = t6;
302
- } else {
303
- t6 = $[17];
304
- }
305
- let t7;
306
- if ($[18] !== dir || $[19] !== side || $[20] !== t6) {
307
- t7 = /* @__PURE__ */ _jsxs(SheetContent, {
308
- dir,
309
- "data-sidebar": "sidebar",
310
- "data-slot": "sidebar",
311
- "data-mobile": "true",
312
- className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
313
- style: t4,
314
- side,
315
- children: [t5, t6]
316
- });
317
- $[18] = dir;
318
- $[19] = side;
319
- $[20] = t6;
320
- $[21] = t7;
321
- } else {
322
- t7 = $[21];
323
- }
324
- let t8;
325
- if ($[22] !== openMobile || $[23] !== props || $[24] !== setOpenMobile || $[25] !== t7) {
326
- t8 = /* @__PURE__ */ _jsx(Sheet, {
327
- open: openMobile,
328
- onOpenChange: setOpenMobile,
329
- ...props,
330
- children: t7
331
- });
332
- $[22] = openMobile;
333
- $[23] = props;
334
- $[24] = setOpenMobile;
335
- $[25] = t7;
336
- $[26] = t8;
337
- } else {
338
- t8 = $[26];
339
- }
340
- return t8;
341
- }
342
- const t4 = state === "collapsed" ? collapsible : "";
343
- const t5 = variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)";
714
+ const t5 = collapsed ? "collapsed" : "expanded";
344
715
  let t6;
345
- if ($[27] !== t5) {
346
- t6 = cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-300 ease-(--sidebar-ease)", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", t5);
347
- $[27] = t5;
348
- $[28] = t6;
716
+ if ($[15] !== width) {
717
+ t6 = { width };
718
+ $[15] = width;
719
+ $[16] = t6;
349
720
  } else {
350
- t6 = $[28];
721
+ t6 = $[16];
351
722
  }
352
- let t7;
353
- if ($[29] !== t6) {
354
- t7 = /* @__PURE__ */ _jsx("div", {
355
- "data-slot": "sidebar-gap",
356
- className: t6
357
- });
358
- $[29] = t6;
359
- $[30] = t7;
360
- } else {
361
- t7 = $[30];
362
- }
363
- const t8 = variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l";
364
- let t9;
365
- if ($[31] !== className || $[32] !== t8) {
366
- t9 = cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-300 ease-(--sidebar-ease) data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex", t8, className);
367
- $[31] = className;
368
- $[32] = t8;
369
- $[33] = t9;
723
+ const t7 = context.reduce ? INSTANT_TRANSITION : SIDEBAR_MORPH_TRANSITION;
724
+ const t8 = collapsible === "none" ? "block" : "hidden md:block";
725
+ const t9 = side === "right" && "order-last";
726
+ let t10;
727
+ if ($[17] !== className || $[18] !== t8 || $[19] !== t9) {
728
+ t10 = cn("group/sidebar peer relative h-auto shrink-0 text-sidebar-foreground will-change-[width]", t8, t9, className);
729
+ $[17] = className;
730
+ $[18] = t8;
731
+ $[19] = t9;
732
+ $[20] = t10;
733
+ } else {
734
+ t10 = $[20];
735
+ }
736
+ const t11 = offcanvas ? 0 : 1;
737
+ const t12 = offcanvas ? side === "left" ? "-100%" : "100%" : "0%";
738
+ let t13;
739
+ if ($[21] !== t11 || $[22] !== t12) {
740
+ t13 = {
741
+ opacity: t11,
742
+ x: t12
743
+ };
744
+ $[21] = t11;
745
+ $[22] = t12;
746
+ $[23] = t13;
747
+ } else {
748
+ t13 = $[23];
749
+ }
750
+ const t14 = context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION;
751
+ const t15 = collapsible === "offcanvas" && "w-(--sidebar-width)";
752
+ const t16 = collapsible === "none" && "h-auto";
753
+ const t17 = variant === "sidebar" && (side === "left" ? "border-r border-sidebar-border" : "border-l border-sidebar-border");
754
+ const t18 = variant === "floating" && "m-2 h-[calc(100svh-1rem)] rounded-2xl border border-sidebar-border shadow-sm";
755
+ const t19 = variant === "inset" && "m-2 h-[calc(100svh-1rem)] rounded-2xl";
756
+ let t20;
757
+ if ($[24] !== panelClassName || $[25] !== t15 || $[26] !== t16 || $[27] !== t17 || $[28] !== t18 || $[29] !== t19) {
758
+ t20 = cn("sticky top-0 flex h-svh w-full flex-col overflow-hidden bg-sidebar", t15, t16, t17, t18, t19, panelClassName);
759
+ $[24] = panelClassName;
760
+ $[25] = t15;
761
+ $[26] = t16;
762
+ $[27] = t17;
763
+ $[28] = t18;
764
+ $[29] = t19;
765
+ $[30] = t20;
766
+ } else {
767
+ t20 = $[30];
768
+ }
769
+ let t21;
770
+ if ($[31] !== collapsed || $[32] !== collapsible || $[33] !== side) {
771
+ t21 = {
772
+ collapsed,
773
+ collapsible,
774
+ side
775
+ };
776
+ $[31] = collapsed;
777
+ $[32] = collapsible;
778
+ $[33] = side;
779
+ $[34] = t21;
370
780
  } else {
371
- t9 = $[33];
781
+ t21 = $[34];
372
782
  }
373
- let t10;
374
- if ($[34] !== children) {
375
- t10 = /* @__PURE__ */ _jsx("div", {
376
- "data-sidebar": "sidebar",
377
- "data-slot": "sidebar-inner",
378
- className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",
783
+ let t22;
784
+ if ($[35] !== children || $[36] !== t21) {
785
+ t22 = /* @__PURE__ */ _jsx(SidebarPanelContext.Provider, {
786
+ value: t21,
379
787
  children
380
788
  });
381
- $[34] = children;
382
- $[35] = t10;
383
- } else {
384
- t10 = $[35];
385
- }
386
- let t11;
387
- if ($[36] !== props || $[37] !== side || $[38] !== t10 || $[39] !== t9) {
388
- t11 = /* @__PURE__ */ _jsx("div", {
389
- "data-slot": "sidebar-container",
390
- "data-side": side,
391
- className: t9,
392
- ...props,
393
- children: t10
789
+ $[35] = children;
790
+ $[36] = t21;
791
+ $[37] = t22;
792
+ } else {
793
+ t22 = $[37];
794
+ }
795
+ let t23;
796
+ if ($[38] !== t13 || $[39] !== t14 || $[40] !== t20 || $[41] !== t22) {
797
+ t23 = /* @__PURE__ */ _jsx(motion.div, {
798
+ initial: false,
799
+ animate: t13,
800
+ transition: t14,
801
+ "data-slot": "sidebar-inner",
802
+ className: t20,
803
+ children: t22
394
804
  });
395
- $[36] = props;
396
- $[37] = side;
397
- $[38] = t10;
398
- $[39] = t9;
399
- $[40] = t11;
805
+ $[38] = t13;
806
+ $[39] = t14;
807
+ $[40] = t20;
808
+ $[41] = t22;
809
+ $[42] = t23;
400
810
  } else {
401
- t11 = $[40];
811
+ t23 = $[42];
402
812
  }
403
- let t12;
404
- if ($[41] !== side || $[42] !== state || $[43] !== t11 || $[44] !== t4 || $[45] !== t7 || $[46] !== variant) {
405
- t12 = /* @__PURE__ */ _jsxs("div", {
406
- className: "group peer hidden text-sidebar-foreground md:block",
407
- "data-state": state,
408
- "data-collapsible": t4,
813
+ let t24;
814
+ if ($[43] !== ariaLabel || $[44] !== collapsible || $[45] !== props || $[46] !== side || $[47] !== style || $[48] !== t10 || $[49] !== t23 || $[50] !== t5 || $[51] !== t6 || $[52] !== t7 || $[53] !== variant) {
815
+ t24 = /* @__PURE__ */ _jsx(motion.aside, {
816
+ ...props,
817
+ initial: false,
818
+ "aria-label": ariaLabel,
819
+ "data-slot": "sidebar",
820
+ "data-state": t5,
821
+ "data-collapsible": collapsible,
409
822
  "data-variant": variant,
410
823
  "data-side": side,
411
- "data-slot": "sidebar",
412
- children: [t7, t11]
824
+ animate: t6,
825
+ transition: t7,
826
+ style,
827
+ className: t10,
828
+ children: t23
413
829
  });
414
- $[41] = side;
415
- $[42] = state;
416
- $[43] = t11;
417
- $[44] = t4;
418
- $[45] = t7;
419
- $[46] = variant;
420
- $[47] = t12;
421
- } else {
422
- t12 = $[47];
423
- }
424
- return t12;
830
+ $[43] = ariaLabel;
831
+ $[44] = collapsible;
832
+ $[45] = props;
833
+ $[46] = side;
834
+ $[47] = style;
835
+ $[48] = t10;
836
+ $[49] = t23;
837
+ $[50] = t5;
838
+ $[51] = t6;
839
+ $[52] = t7;
840
+ $[53] = variant;
841
+ $[54] = t24;
842
+ } else {
843
+ t24 = $[54];
844
+ }
845
+ return t24;
425
846
  }
426
- function SidebarTrigger(t0) {
427
- const $ = _c(15);
847
+ /**
848
+ * Button that toggles the desktop rail or the mobile sheet; shows a panel icon unless given children.
849
+ * @param props - Native button attributes.
850
+ * @returns The toggle button.
851
+ */
852
+ function SidebarTrigger({ children, className, onClick, ref, type = "button", ...props }) {
853
+ const context = useSidebar();
854
+ const expanded = context.isMobile ? context.openMobile : context.open;
855
+ return /* @__PURE__ */ _jsx("button", {
856
+ ...props,
857
+ ref: (node) => {
858
+ context.triggerRef.current = node;
859
+ if (typeof ref === "function") return ref(node);
860
+ if (ref) ref.current = node;
861
+ },
862
+ type,
863
+ "aria-label": props["aria-label"] ?? "Toggle sidebar",
864
+ "aria-expanded": expanded,
865
+ "data-slot": "sidebar-trigger",
866
+ "data-state": expanded ? "expanded" : "collapsed",
867
+ onClick: (event) => {
868
+ onClick?.(event);
869
+ if (!event.defaultPrevented) context.toggleSidebar();
870
+ },
871
+ className: cn("inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none [&_svg]:size-4", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", className),
872
+ children: children ?? /* @__PURE__ */ _jsx(PanelLeftIcon, { "aria-hidden": "true" })
873
+ });
874
+ }
875
+ /**
876
+ * Button that closes the sidebar on the current viewport.
877
+ * @param props - Native button attributes; the content is the consumer's icon or text.
878
+ * @returns The close button.
879
+ */
880
+ function SidebarClose(t0) {
881
+ const $ = _c(16);
428
882
  let className;
429
883
  let onClick;
430
884
  let props;
885
+ let t1;
431
886
  if ($[0] !== t0) {
432
- ({className, onClick, ...props} = t0);
887
+ ({className, onClick, type: t1, ...props} = t0);
433
888
  $[0] = t0;
434
889
  $[1] = className;
435
890
  $[2] = onClick;
436
891
  $[3] = props;
892
+ $[4] = t1;
437
893
  } else {
438
894
  className = $[1];
439
895
  onClick = $[2];
440
896
  props = $[3];
897
+ t1 = $[4];
441
898
  }
442
- const { toggleSidebar } = useSidebar();
443
- let t1;
444
- if ($[4] !== className) {
445
- t1 = cn(className);
446
- $[4] = className;
447
- $[5] = t1;
448
- } else {
449
- t1 = $[5];
450
- }
451
- let t2;
452
- if ($[6] !== onClick || $[7] !== toggleSidebar) {
453
- t2 = (event) => {
899
+ const type = t1 === undefined ? "button" : t1;
900
+ const context = useSidebar();
901
+ const t2 = props["aria-label"] ?? "Close sidebar";
902
+ let t3;
903
+ if ($[5] !== context || $[6] !== onClick) {
904
+ t3 = (event) => {
454
905
  onClick?.(event);
455
- toggleSidebar();
906
+ if (event.defaultPrevented) {
907
+ return;
908
+ }
909
+ if (context.isMobile) {
910
+ context.setOpenMobile(false);
911
+ } else {
912
+ context.setOpen(false);
913
+ }
456
914
  };
915
+ $[5] = context;
457
916
  $[6] = onClick;
458
- $[7] = toggleSidebar;
459
- $[8] = t2;
917
+ $[7] = t3;
460
918
  } else {
461
- t2 = $[8];
919
+ t3 = $[7];
462
920
  }
463
- let t3;
464
921
  let t4;
465
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
466
- t3 = /* @__PURE__ */ _jsx(PanelLeftIcon, {});
467
- t4 = /* @__PURE__ */ _jsx("span", {
468
- className: "sr-only",
469
- children: "Toggle Sidebar"
470
- });
471
- $[9] = t3;
472
- $[10] = t4;
922
+ if ($[8] !== className) {
923
+ t4 = cn("inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none", "focus-visible:ring-2 focus-visible:ring-ring", className);
924
+ $[8] = className;
925
+ $[9] = t4;
473
926
  } else {
474
- t3 = $[9];
475
- t4 = $[10];
927
+ t4 = $[9];
476
928
  }
477
929
  let t5;
478
- if ($[11] !== props || $[12] !== t1 || $[13] !== t2) {
479
- t5 = /* @__PURE__ */ _jsxs(Button, {
480
- "data-sidebar": "trigger",
481
- "data-slot": "sidebar-trigger",
482
- variant: "ghost",
483
- size: "icon-sm",
484
- className: t1,
485
- onClick: t2,
930
+ if ($[10] !== props || $[11] !== t2 || $[12] !== t3 || $[13] !== t4 || $[14] !== type) {
931
+ t5 = /* @__PURE__ */ _jsx("button", {
486
932
  ...props,
487
- children: [t3, t4]
933
+ type,
934
+ "aria-label": t2,
935
+ "data-slot": "sidebar-close",
936
+ onClick: t3,
937
+ className: t4
488
938
  });
489
- $[11] = props;
490
- $[12] = t1;
491
- $[13] = t2;
492
- $[14] = t5;
939
+ $[10] = props;
940
+ $[11] = t2;
941
+ $[12] = t3;
942
+ $[13] = t4;
943
+ $[14] = type;
944
+ $[15] = t5;
493
945
  } else {
494
- t5 = $[14];
946
+ t5 = $[15];
495
947
  }
496
948
  return t5;
497
949
  }
950
+ /**
951
+ * Thin hit area on the sidebar edge that toggles it with the pointer.
952
+ * @param props - Native button attributes.
953
+ * @returns The rail button, outside the tab order.
954
+ */
498
955
  function SidebarRail(t0) {
499
- const $ = _c(9);
500
- let className;
501
- let props;
502
- if ($[0] !== t0) {
503
- ({className, ...props} = t0);
504
- $[0] = t0;
505
- $[1] = className;
506
- $[2] = props;
507
- } else {
508
- className = $[1];
509
- props = $[2];
510
- }
511
- const { toggleSidebar } = useSidebar();
512
- let t1;
513
- if ($[3] !== className) {
514
- t1 = cn("absolute inset-y-0 z-20 hidden w-4 transition-all duration-300 ease-(--sidebar-ease) group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className);
515
- $[3] = className;
516
- $[4] = t1;
517
- } else {
518
- t1 = $[4];
519
- }
520
- let t2;
521
- if ($[5] !== props || $[6] !== t1 || $[7] !== toggleSidebar) {
522
- t2 = /* @__PURE__ */ _jsx("button", {
523
- "data-sidebar": "rail",
524
- "data-slot": "sidebar-rail",
525
- "aria-label": "Toggle Sidebar",
526
- tabIndex: -1,
527
- onClick: toggleSidebar,
528
- title: "Toggle Sidebar",
529
- className: t1,
530
- ...props
531
- });
532
- $[5] = props;
533
- $[6] = t1;
534
- $[7] = toggleSidebar;
535
- $[8] = t2;
536
- } else {
537
- t2 = $[8];
538
- }
539
- return t2;
540
- }
541
- function SidebarInset(t0) {
542
- const $ = _c(8);
543
- let className;
544
- let props;
545
- if ($[0] !== t0) {
546
- ({className, ...props} = t0);
547
- $[0] = t0;
548
- $[1] = className;
549
- $[2] = props;
550
- } else {
551
- className = $[1];
552
- props = $[2];
553
- }
554
- let t1;
555
- if ($[3] !== className) {
556
- t1 = cn("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className);
557
- $[3] = className;
558
- $[4] = t1;
559
- } else {
560
- t1 = $[4];
561
- }
562
- let t2;
563
- if ($[5] !== props || $[6] !== t1) {
564
- t2 = /* @__PURE__ */ _jsx("main", {
565
- "data-slot": "sidebar-inset",
566
- className: t1,
567
- ...props
568
- });
569
- $[5] = props;
570
- $[6] = t1;
571
- $[7] = t2;
572
- } else {
573
- t2 = $[7];
574
- }
575
- return t2;
576
- }
577
- function SidebarInput(t0) {
578
- const $ = _c(8);
579
- let className;
580
- let props;
581
- if ($[0] !== t0) {
582
- ({className, ...props} = t0);
583
- $[0] = t0;
584
- $[1] = className;
585
- $[2] = props;
586
- } else {
587
- className = $[1];
588
- props = $[2];
589
- }
590
- let t1;
591
- if ($[3] !== className) {
592
- t1 = cn("h-8 w-full bg-background shadow-none", className);
593
- $[3] = className;
594
- $[4] = t1;
595
- } else {
596
- t1 = $[4];
597
- }
598
- let t2;
599
- if ($[5] !== props || $[6] !== t1) {
600
- t2 = /* @__PURE__ */ _jsx(Input, {
601
- "data-slot": "sidebar-input",
602
- "data-sidebar": "input",
603
- className: t1,
604
- ...props
605
- });
606
- $[5] = props;
607
- $[6] = t1;
608
- $[7] = t2;
609
- } else {
610
- t2 = $[7];
611
- }
612
- return t2;
613
- }
614
- function SidebarHeader(t0) {
615
- const $ = _c(8);
956
+ const $ = _c(17);
616
957
  let className;
958
+ let onClick;
617
959
  let props;
618
- if ($[0] !== t0) {
619
- ({className, ...props} = t0);
620
- $[0] = t0;
621
- $[1] = className;
622
- $[2] = props;
623
- } else {
624
- className = $[1];
625
- props = $[2];
626
- }
627
960
  let t1;
628
- if ($[3] !== className) {
629
- t1 = cn("flex flex-col gap-2 p-2", className);
630
- $[3] = className;
631
- $[4] = t1;
632
- } else {
633
- t1 = $[4];
634
- }
635
- let t2;
636
- if ($[5] !== props || $[6] !== t1) {
637
- t2 = /* @__PURE__ */ _jsx("div", {
638
- "data-slot": "sidebar-header",
639
- "data-sidebar": "header",
640
- className: t1,
641
- ...props
642
- });
643
- $[5] = props;
644
- $[6] = t1;
645
- $[7] = t2;
646
- } else {
647
- t2 = $[7];
648
- }
649
- return t2;
650
- }
651
- function SidebarFooter(t0) {
652
- const $ = _c(8);
653
- let className;
654
- let props;
655
961
  if ($[0] !== t0) {
656
- ({className, ...props} = t0);
962
+ ({className, onClick, type: t1, ...props} = t0);
657
963
  $[0] = t0;
658
964
  $[1] = className;
659
- $[2] = props;
660
- } else {
661
- className = $[1];
662
- props = $[2];
663
- }
664
- let t1;
665
- if ($[3] !== className) {
666
- t1 = cn("flex flex-col gap-2 p-2", className);
667
- $[3] = className;
965
+ $[2] = onClick;
966
+ $[3] = props;
668
967
  $[4] = t1;
669
- } else {
670
- t1 = $[4];
671
- }
672
- let t2;
673
- if ($[5] !== props || $[6] !== t1) {
674
- t2 = /* @__PURE__ */ _jsx("div", {
675
- "data-slot": "sidebar-footer",
676
- "data-sidebar": "footer",
677
- className: t1,
678
- ...props
679
- });
680
- $[5] = props;
681
- $[6] = t1;
682
- $[7] = t2;
683
- } else {
684
- t2 = $[7];
685
- }
686
- return t2;
687
- }
688
- function SidebarSeparator(t0) {
689
- const $ = _c(8);
690
- let className;
691
- let props;
692
- if ($[0] !== t0) {
693
- ({className, ...props} = t0);
694
- $[0] = t0;
695
- $[1] = className;
696
- $[2] = props;
697
968
  } else {
698
969
  className = $[1];
699
- props = $[2];
700
- }
701
- let t1;
702
- if ($[3] !== className) {
703
- t1 = cn("mx-2 w-auto bg-sidebar-border", className);
704
- $[3] = className;
705
- $[4] = t1;
706
- } else {
970
+ onClick = $[2];
971
+ props = $[3];
707
972
  t1 = $[4];
708
973
  }
709
- let t2;
710
- if ($[5] !== props || $[6] !== t1) {
711
- t2 = /* @__PURE__ */ _jsx(Separator, {
712
- "data-slot": "sidebar-separator",
713
- "data-sidebar": "separator",
714
- className: t1,
715
- ...props
716
- });
717
- $[5] = props;
718
- $[6] = t1;
719
- $[7] = t2;
720
- } else {
721
- t2 = $[7];
722
- }
723
- return t2;
724
- }
725
- function SidebarContent(t0) {
726
- const $ = _c(8);
727
- let className;
728
- let props;
729
- if ($[0] !== t0) {
730
- ({className, ...props} = t0);
731
- $[0] = t0;
732
- $[1] = className;
733
- $[2] = props;
974
+ const type = t1 === undefined ? "button" : t1;
975
+ const context = useSidebar();
976
+ const panel = useSidebarPanel();
977
+ const t2 = panel.side;
978
+ const t3 = props["aria-label"] ?? "Toggle sidebar";
979
+ let t4;
980
+ if ($[5] !== context || $[6] !== onClick) {
981
+ t4 = (event) => {
982
+ onClick?.(event);
983
+ if (!event.defaultPrevented) {
984
+ context.toggleSidebar();
985
+ }
986
+ };
987
+ $[5] = context;
988
+ $[6] = onClick;
989
+ $[7] = t4;
734
990
  } else {
735
- className = $[1];
736
- props = $[2];
991
+ t4 = $[7];
737
992
  }
738
- let t1;
739
- if ($[3] !== className) {
740
- t1 = cn("no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className);
741
- $[3] = className;
742
- $[4] = t1;
993
+ let t5;
994
+ if ($[8] !== className) {
995
+ t5 = cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block", "after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-sidebar-border", "data-[side=left]:left-full data-[side=right]:right-0 data-[side=right]:translate-x-1/2", className);
996
+ $[8] = className;
997
+ $[9] = t5;
743
998
  } else {
744
- t1 = $[4];
999
+ t5 = $[9];
745
1000
  }
746
- let t2;
747
- if ($[5] !== props || $[6] !== t1) {
748
- t2 = /* @__PURE__ */ _jsx("div", {
749
- "data-slot": "sidebar-content",
750
- "data-sidebar": "content",
751
- className: t1,
752
- ...props
1001
+ let t6;
1002
+ if ($[10] !== panel.side || $[11] !== props || $[12] !== t3 || $[13] !== t4 || $[14] !== t5 || $[15] !== type) {
1003
+ t6 = /* @__PURE__ */ _jsx("button", {
1004
+ ...props,
1005
+ type,
1006
+ "data-slot": "sidebar-rail",
1007
+ "data-side": t2,
1008
+ "aria-label": t3,
1009
+ title: "Toggle sidebar",
1010
+ tabIndex: -1,
1011
+ onClick: t4,
1012
+ className: t5
753
1013
  });
754
- $[5] = props;
755
- $[6] = t1;
756
- $[7] = t2;
1014
+ $[10] = panel.side;
1015
+ $[11] = props;
1016
+ $[12] = t3;
1017
+ $[13] = t4;
1018
+ $[14] = t5;
1019
+ $[15] = type;
1020
+ $[16] = t6;
757
1021
  } else {
758
- t2 = $[7];
1022
+ t6 = $[16];
759
1023
  }
760
- return t2;
1024
+ return t6;
761
1025
  }
762
- function SidebarGroup(t0) {
1026
+ /**
1027
+ * Main content area laid out next to the sidebar.
1028
+ * @param props - Motion-enabled `main` attributes.
1029
+ * @returns The content landmark.
1030
+ */
1031
+ function SidebarInset(t0) {
763
1032
  const $ = _c(8);
764
1033
  let className;
765
1034
  let props;
@@ -774,7 +1043,7 @@ function SidebarGroup(t0) {
774
1043
  }
775
1044
  let t1;
776
1045
  if ($[3] !== className) {
777
- t1 = cn("relative flex w-full min-w-0 flex-col p-2", className);
1046
+ t1 = cn("relative flex min-h-svh min-w-0 flex-1 flex-col bg-background", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm", className);
778
1047
  $[3] = className;
779
1048
  $[4] = t1;
780
1049
  } else {
@@ -782,11 +1051,10 @@ function SidebarGroup(t0) {
782
1051
  }
783
1052
  let t2;
784
1053
  if ($[5] !== props || $[6] !== t1) {
785
- t2 = /* @__PURE__ */ _jsx("div", {
786
- "data-slot": "sidebar-group",
787
- "data-sidebar": "group",
788
- className: t1,
789
- ...props
1054
+ t2 = /* @__PURE__ */ _jsx(motion.main, {
1055
+ ...props,
1056
+ "data-slot": "sidebar-inset",
1057
+ className: t1
790
1058
  });
791
1059
  $[5] = props;
792
1060
  $[6] = t1;
@@ -794,95 +1062,9 @@ function SidebarGroup(t0) {
794
1062
  } else {
795
1063
  t2 = $[7];
796
1064
  }
797
- return t2;
798
- }
799
- function SidebarGroupLabel(t0) {
800
- const $ = _c(10);
801
- let className;
802
- let props;
803
- let t1;
804
- if ($[0] !== t0) {
805
- ({className, asChild: t1, ...props} = t0);
806
- $[0] = t0;
807
- $[1] = className;
808
- $[2] = props;
809
- $[3] = t1;
810
- } else {
811
- className = $[1];
812
- props = $[2];
813
- t1 = $[3];
814
- }
815
- const asChild = t1 === undefined ? false : t1;
816
- const Comp = asChild ? Slot.Root : "div";
817
- let t2;
818
- if ($[4] !== className) {
819
- t2 = cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-300 ease-(--sidebar-ease) group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", className);
820
- $[4] = className;
821
- $[5] = t2;
822
- } else {
823
- t2 = $[5];
824
- }
825
- let t3;
826
- if ($[6] !== Comp || $[7] !== props || $[8] !== t2) {
827
- t3 = /* @__PURE__ */ _jsx(Comp, {
828
- "data-slot": "sidebar-group-label",
829
- "data-sidebar": "group-label",
830
- className: t2,
831
- ...props
832
- });
833
- $[6] = Comp;
834
- $[7] = props;
835
- $[8] = t2;
836
- $[9] = t3;
837
- } else {
838
- t3 = $[9];
839
- }
840
- return t3;
841
- }
842
- function SidebarGroupAction(t0) {
843
- const $ = _c(10);
844
- let className;
845
- let props;
846
- let t1;
847
- if ($[0] !== t0) {
848
- ({className, asChild: t1, ...props} = t0);
849
- $[0] = t0;
850
- $[1] = className;
851
- $[2] = props;
852
- $[3] = t1;
853
- } else {
854
- className = $[1];
855
- props = $[2];
856
- t1 = $[3];
857
- }
858
- const asChild = t1 === undefined ? false : t1;
859
- const Comp = asChild ? Slot.Root : "button";
860
- let t2;
861
- if ($[4] !== className) {
862
- t2 = cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", className);
863
- $[4] = className;
864
- $[5] = t2;
865
- } else {
866
- t2 = $[5];
867
- }
868
- let t3;
869
- if ($[6] !== Comp || $[7] !== props || $[8] !== t2) {
870
- t3 = /* @__PURE__ */ _jsx(Comp, {
871
- "data-slot": "sidebar-group-action",
872
- "data-sidebar": "group-action",
873
- className: t2,
874
- ...props
875
- });
876
- $[6] = Comp;
877
- $[7] = props;
878
- $[8] = t2;
879
- $[9] = t3;
880
- } else {
881
- t3 = $[9];
882
- }
883
- return t3;
1065
+ return t2;
884
1066
  }
885
- function SidebarGroupContent(t0) {
1067
+ function SidebarHeader(t0) {
886
1068
  const $ = _c(8);
887
1069
  let className;
888
1070
  let props;
@@ -897,7 +1079,7 @@ function SidebarGroupContent(t0) {
897
1079
  }
898
1080
  let t1;
899
1081
  if ($[3] !== className) {
900
- t1 = cn("w-full text-sm", className);
1082
+ t1 = cn("flex shrink-0 flex-col gap-2 p-3", className);
901
1083
  $[3] = className;
902
1084
  $[4] = t1;
903
1085
  } else {
@@ -906,10 +1088,9 @@ function SidebarGroupContent(t0) {
906
1088
  let t2;
907
1089
  if ($[5] !== props || $[6] !== t1) {
908
1090
  t2 = /* @__PURE__ */ _jsx("div", {
909
- "data-slot": "sidebar-group-content",
910
- "data-sidebar": "group-content",
911
- className: t1,
912
- ...props
1091
+ ...props,
1092
+ "data-slot": "sidebar-header",
1093
+ className: t1
913
1094
  });
914
1095
  $[5] = props;
915
1096
  $[6] = t1;
@@ -919,7 +1100,7 @@ function SidebarGroupContent(t0) {
919
1100
  }
920
1101
  return t2;
921
1102
  }
922
- function SidebarMenu(t0) {
1103
+ function SidebarContent(t0) {
923
1104
  const $ = _c(8);
924
1105
  let className;
925
1106
  let props;
@@ -934,7 +1115,7 @@ function SidebarMenu(t0) {
934
1115
  }
935
1116
  let t1;
936
1117
  if ($[3] !== className) {
937
- t1 = cn("flex w-full min-w-0 flex-col gap-1", className);
1118
+ t1 = cn("flex min-h-0 flex-1 flex-col gap-2 overflow-x-hidden overflow-y-auto overscroll-contain px-2 py-2", className);
938
1119
  $[3] = className;
939
1120
  $[4] = t1;
940
1121
  } else {
@@ -942,14 +1123,10 @@ function SidebarMenu(t0) {
942
1123
  }
943
1124
  let t2;
944
1125
  if ($[5] !== props || $[6] !== t1) {
945
- t2 = /* @__PURE__ */ _jsx(GlideSlot, {
946
- preset: "sidebar",
947
- children: /* @__PURE__ */ _jsx("ul", {
948
- "data-slot": "sidebar-menu",
949
- "data-sidebar": "menu",
950
- className: t1,
951
- ...props
952
- })
1126
+ t2 = /* @__PURE__ */ _jsx("div", {
1127
+ ...props,
1128
+ "data-slot": "sidebar-content",
1129
+ className: t1
953
1130
  });
954
1131
  $[5] = props;
955
1132
  $[6] = t1;
@@ -959,7 +1136,7 @@ function SidebarMenu(t0) {
959
1136
  }
960
1137
  return t2;
961
1138
  }
962
- function SidebarMenuItem(t0) {
1139
+ function SidebarFooter(t0) {
963
1140
  const $ = _c(8);
964
1141
  let className;
965
1142
  let props;
@@ -974,7 +1151,7 @@ function SidebarMenuItem(t0) {
974
1151
  }
975
1152
  let t1;
976
1153
  if ($[3] !== className) {
977
- t1 = cn("group/menu-item relative", className);
1154
+ t1 = cn("flex shrink-0 flex-col gap-2 border-t border-sidebar-border p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", className);
978
1155
  $[3] = className;
979
1156
  $[4] = t1;
980
1157
  } else {
@@ -982,11 +1159,10 @@ function SidebarMenuItem(t0) {
982
1159
  }
983
1160
  let t2;
984
1161
  if ($[5] !== props || $[6] !== t1) {
985
- t2 = /* @__PURE__ */ _jsx("li", {
986
- "data-slot": "sidebar-menu-item",
987
- "data-sidebar": "menu-item",
988
- className: t1,
989
- ...props
1162
+ t2 = /* @__PURE__ */ _jsx("div", {
1163
+ ...props,
1164
+ "data-slot": "sidebar-footer",
1165
+ className: t1
990
1166
  });
991
1167
  $[5] = props;
992
1168
  $[6] = t1;
@@ -996,195 +1172,85 @@ function SidebarMenuItem(t0) {
996
1172
  }
997
1173
  return t2;
998
1174
  }
999
- const sidebarMenuButtonVariants = cva("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
1000
- variants: {
1001
- variant: {
1002
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
1003
- outline: "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"
1004
- },
1005
- size: {
1006
- default: "h-8 text-sm",
1007
- sm: "h-7 text-xs",
1008
- lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
1009
- }
1010
- },
1011
- defaultVariants: {
1012
- variant: "default",
1013
- size: "default"
1014
- }
1015
- });
1016
- function SidebarMenuButton(t0) {
1017
- const $ = _c(28);
1175
+ function SidebarGroup(t0) {
1176
+ const $ = _c(8);
1018
1177
  let className;
1019
1178
  let props;
1020
- let t1;
1021
- let t2;
1022
- let t3;
1023
- let t4;
1024
- let tooltip;
1025
1179
  if ($[0] !== t0) {
1026
- ({asChild: t1, isActive: t2, variant: t3, size: t4, tooltip, className, ...props} = t0);
1180
+ ({className, ...props} = t0);
1027
1181
  $[0] = t0;
1028
1182
  $[1] = className;
1029
1183
  $[2] = props;
1030
- $[3] = t1;
1031
- $[4] = t2;
1032
- $[5] = t3;
1033
- $[6] = t4;
1034
- $[7] = tooltip;
1035
1184
  } else {
1036
1185
  className = $[1];
1037
1186
  props = $[2];
1038
- t1 = $[3];
1039
- t2 = $[4];
1040
- t3 = $[5];
1041
- t4 = $[6];
1042
- tooltip = $[7];
1043
- }
1044
- const asChild = t1 === undefined ? false : t1;
1045
- const isActive = t2 === undefined ? false : t2;
1046
- const variant = t3 === undefined ? "default" : t3;
1047
- const size = t4 === undefined ? "default" : t4;
1048
- const Comp = asChild ? Slot.Root : "button";
1049
- const { isMobile, state } = useSidebar();
1050
- const hasMounted = React.useSyncExternalStore(subscribeToClientMount, getClientMountSnapshot, getServerMountSnapshot);
1051
- let t5;
1052
- if ($[8] !== className || $[9] !== size || $[10] !== variant) {
1053
- t5 = cn(sidebarMenuButtonVariants({
1054
- variant,
1055
- size
1056
- }), className);
1057
- $[8] = className;
1058
- $[9] = size;
1059
- $[10] = variant;
1060
- $[11] = t5;
1061
- } else {
1062
- t5 = $[11];
1063
- }
1064
- let t6;
1065
- if ($[12] !== Comp || $[13] !== isActive || $[14] !== props || $[15] !== size || $[16] !== t5) {
1066
- t6 = /* @__PURE__ */ _jsx(MotionSlot, {
1067
- kind: "subtle-press",
1068
- children: /* @__PURE__ */ _jsx(Comp, {
1069
- "data-slot": "sidebar-menu-button",
1070
- "data-sidebar": "menu-button",
1071
- "data-size": size,
1072
- "data-active": isActive,
1073
- className: t5,
1074
- ...props
1075
- })
1076
- });
1077
- $[12] = Comp;
1078
- $[13] = isActive;
1079
- $[14] = props;
1080
- $[15] = size;
1081
- $[16] = t5;
1082
- $[17] = t6;
1083
- } else {
1084
- t6 = $[17];
1085
- }
1086
- const button = t6;
1087
- if (!tooltip || !hasMounted) {
1088
- return button;
1089
- }
1090
- if (typeof tooltip === "string") {
1091
- let t7;
1092
- if ($[18] !== tooltip) {
1093
- t7 = { children: tooltip };
1094
- $[18] = tooltip;
1095
- $[19] = t7;
1096
- } else {
1097
- t7 = $[19];
1098
- }
1099
- tooltip = t7;
1100
1187
  }
1101
- let t7;
1102
- if ($[20] !== button) {
1103
- t7 = /* @__PURE__ */ _jsx(TooltipTrigger, {
1104
- asChild: true,
1105
- children: button
1106
- });
1107
- $[20] = button;
1108
- $[21] = t7;
1188
+ let t1;
1189
+ if ($[3] !== className) {
1190
+ t1 = cn("flex w-full min-w-0 flex-col px-1 py-1.5", className);
1191
+ $[3] = className;
1192
+ $[4] = t1;
1109
1193
  } else {
1110
- t7 = $[21];
1194
+ t1 = $[4];
1111
1195
  }
1112
- const t8 = state !== "collapsed" || isMobile;
1113
- let t9;
1114
- if ($[22] !== t8 || $[23] !== tooltip) {
1115
- t9 = /* @__PURE__ */ _jsx(TooltipContent, {
1116
- side: "right",
1117
- align: "center",
1118
- hidden: t8,
1119
- ...tooltip
1196
+ let t2;
1197
+ if ($[5] !== props || $[6] !== t1) {
1198
+ t2 = /* @__PURE__ */ _jsx("div", {
1199
+ ...props,
1200
+ "data-slot": "sidebar-group",
1201
+ className: t1
1120
1202
  });
1121
- $[22] = t8;
1122
- $[23] = tooltip;
1123
- $[24] = t9;
1124
- } else {
1125
- t9 = $[24];
1126
- }
1127
- let t10;
1128
- if ($[25] !== t7 || $[26] !== t9) {
1129
- t10 = /* @__PURE__ */ _jsxs(Tooltip, { children: [t7, t9] });
1130
- $[25] = t7;
1131
- $[26] = t9;
1132
- $[27] = t10;
1203
+ $[5] = props;
1204
+ $[6] = t1;
1205
+ $[7] = t2;
1133
1206
  } else {
1134
- t10 = $[27];
1207
+ t2 = $[7];
1135
1208
  }
1136
- return t10;
1209
+ return t2;
1137
1210
  }
1138
- function SidebarMenuAction(t0) {
1139
- const $ = _c(12);
1211
+ /** Section heading that fades out of the icon rail and is hidden from assistive technology there. */
1212
+ function SidebarGroupLabel(t0) {
1213
+ const $ = _c(10);
1140
1214
  let className;
1141
1215
  let props;
1142
- let t1;
1143
- let t2;
1144
1216
  if ($[0] !== t0) {
1145
- ({className, asChild: t1, showOnHover: t2, ...props} = t0);
1217
+ ({className, ...props} = t0);
1146
1218
  $[0] = t0;
1147
1219
  $[1] = className;
1148
1220
  $[2] = props;
1149
- $[3] = t1;
1150
- $[4] = t2;
1151
1221
  } else {
1152
1222
  className = $[1];
1153
1223
  props = $[2];
1154
- t1 = $[3];
1155
- t2 = $[4];
1156
1224
  }
1157
- const asChild = t1 === undefined ? false : t1;
1158
- const showOnHover = t2 === undefined ? false : t2;
1159
- const Comp = asChild ? Slot.Root : "button";
1160
- const t3 = showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0";
1161
- let t4;
1162
- if ($[5] !== className || $[6] !== t3) {
1163
- t4 = cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", t3, className);
1164
- $[5] = className;
1165
- $[6] = t3;
1166
- $[7] = t4;
1225
+ const { collapsed } = useSidebarPanel();
1226
+ const t1 = collapsed ? "opacity-0" : "opacity-100";
1227
+ let t2;
1228
+ if ($[3] !== className || $[4] !== t1) {
1229
+ t2 = cn("mb-1 h-7 overflow-hidden px-2 text-[10px] font-medium tracking-[0.14em] text-sidebar-foreground/70 uppercase transition-opacity", t1, className);
1230
+ $[3] = className;
1231
+ $[4] = t1;
1232
+ $[5] = t2;
1167
1233
  } else {
1168
- t4 = $[7];
1234
+ t2 = $[5];
1169
1235
  }
1170
- let t5;
1171
- if ($[8] !== Comp || $[9] !== props || $[10] !== t4) {
1172
- t5 = /* @__PURE__ */ _jsx(Comp, {
1173
- "data-slot": "sidebar-menu-action",
1174
- "data-sidebar": "menu-action",
1175
- className: t4,
1176
- ...props
1236
+ let t3;
1237
+ if ($[6] !== collapsed || $[7] !== props || $[8] !== t2) {
1238
+ t3 = /* @__PURE__ */ _jsx("div", {
1239
+ ...props,
1240
+ "aria-hidden": collapsed,
1241
+ "data-slot": "sidebar-group-label",
1242
+ className: t2
1177
1243
  });
1178
- $[8] = Comp;
1179
- $[9] = props;
1180
- $[10] = t4;
1181
- $[11] = t5;
1244
+ $[6] = collapsed;
1245
+ $[7] = props;
1246
+ $[8] = t2;
1247
+ $[9] = t3;
1182
1248
  } else {
1183
- t5 = $[11];
1249
+ t3 = $[9];
1184
1250
  }
1185
- return t5;
1251
+ return t3;
1186
1252
  }
1187
- function SidebarMenuBadge(t0) {
1253
+ function SidebarGroupContent(t0) {
1188
1254
  const $ = _c(8);
1189
1255
  let className;
1190
1256
  let props;
@@ -1199,7 +1265,7 @@ function SidebarMenuBadge(t0) {
1199
1265
  }
1200
1266
  let t1;
1201
1267
  if ($[3] !== className) {
1202
- t1 = cn("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground", className);
1268
+ t1 = cn("w-full min-w-0", className);
1203
1269
  $[3] = className;
1204
1270
  $[4] = t1;
1205
1271
  } else {
@@ -1208,10 +1274,9 @@ function SidebarMenuBadge(t0) {
1208
1274
  let t2;
1209
1275
  if ($[5] !== props || $[6] !== t1) {
1210
1276
  t2 = /* @__PURE__ */ _jsx("div", {
1211
- "data-slot": "sidebar-menu-badge",
1212
- "data-sidebar": "menu-badge",
1213
- className: t1,
1214
- ...props
1277
+ ...props,
1278
+ "data-slot": "sidebar-group-content",
1279
+ className: t1
1215
1280
  });
1216
1281
  $[5] = props;
1217
1282
  $[6] = t1;
@@ -1221,79 +1286,47 @@ function SidebarMenuBadge(t0) {
1221
1286
  }
1222
1287
  return t2;
1223
1288
  }
1224
- function SidebarMenuSkeleton(t0) {
1225
- const $ = _c(14);
1289
+ /** Menu list whose items share a hover pill that glides between them. */
1290
+ function SidebarMenu(t0) {
1291
+ const $ = _c(8);
1226
1292
  let className;
1227
1293
  let props;
1228
- let t1;
1229
1294
  if ($[0] !== t0) {
1230
- ({className, showIcon: t1, ...props} = t0);
1295
+ ({className, ...props} = t0);
1231
1296
  $[0] = t0;
1232
1297
  $[1] = className;
1233
1298
  $[2] = props;
1234
- $[3] = t1;
1235
1299
  } else {
1236
1300
  className = $[1];
1237
1301
  props = $[2];
1238
- t1 = $[3];
1239
- }
1240
- const showIcon = t1 === undefined ? false : t1;
1241
- let t2;
1242
- if ($[4] !== className) {
1243
- t2 = cn("flex h-8 items-center gap-2 rounded-md px-2", className);
1244
- $[4] = className;
1245
- $[5] = t2;
1246
- } else {
1247
- t2 = $[5];
1248
- }
1249
- let t3;
1250
- if ($[6] !== showIcon) {
1251
- t3 = showIcon && /* @__PURE__ */ _jsx(Skeleton, {
1252
- className: "size-4 rounded-md",
1253
- "data-sidebar": "menu-skeleton-icon"
1254
- });
1255
- $[6] = showIcon;
1256
- $[7] = t3;
1257
- } else {
1258
- t3 = $[7];
1259
- }
1260
- let t4;
1261
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1262
- t4 = { "--skeleton-width": SIDEBAR_MENU_SKELETON_TEXT_WIDTH };
1263
- $[8] = t4;
1264
- } else {
1265
- t4 = $[8];
1266
1302
  }
1267
- let t5;
1268
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1269
- t5 = /* @__PURE__ */ _jsx(Skeleton, {
1270
- className: "h-4 max-w-(--skeleton-width) flex-1",
1271
- "data-sidebar": "menu-skeleton-text",
1272
- style: t4
1273
- });
1274
- $[9] = t5;
1303
+ let t1;
1304
+ if ($[3] !== className) {
1305
+ t1 = cn("flex w-full min-w-0 list-none flex-col gap-0.5", className);
1306
+ $[3] = className;
1307
+ $[4] = t1;
1275
1308
  } else {
1276
- t5 = $[9];
1309
+ t1 = $[4];
1277
1310
  }
1278
- let t6;
1279
- if ($[10] !== props || $[11] !== t2 || $[12] !== t3) {
1280
- t6 = /* @__PURE__ */ _jsxs("div", {
1281
- "data-slot": "sidebar-menu-skeleton",
1282
- "data-sidebar": "menu-skeleton",
1283
- className: t2,
1311
+ let t2;
1312
+ if ($[5] !== props || $[6] !== t1) {
1313
+ t2 = /* @__PURE__ */ _jsx(SharedLayoutBg, {
1284
1314
  ...props,
1285
- children: [t3, t5]
1315
+ inset: 0,
1316
+ pillClassName: "rounded-xl bg-sidebar-accent/70",
1317
+ pillContainerClassName: "inset-y-auto top-0 h-9",
1318
+ "data-slot": "sidebar-menu",
1319
+ className: t1
1286
1320
  });
1287
- $[10] = props;
1288
- $[11] = t2;
1289
- $[12] = t3;
1290
- $[13] = t6;
1321
+ $[5] = props;
1322
+ $[6] = t1;
1323
+ $[7] = t2;
1291
1324
  } else {
1292
- t6 = $[13];
1325
+ t2 = $[7];
1293
1326
  }
1294
- return t6;
1327
+ return t2;
1295
1328
  }
1296
- function SidebarMenuSub(t0) {
1329
+ function SidebarMenuItem(t0) {
1297
1330
  const $ = _c(8);
1298
1331
  let className;
1299
1332
  let props;
@@ -1308,7 +1341,7 @@ function SidebarMenuSub(t0) {
1308
1341
  }
1309
1342
  let t1;
1310
1343
  if ($[3] !== className) {
1311
- t1 = cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden", className);
1344
+ t1 = cn("relative", className);
1312
1345
  $[3] = className;
1313
1346
  $[4] = t1;
1314
1347
  } else {
@@ -1316,11 +1349,12 @@ function SidebarMenuSub(t0) {
1316
1349
  }
1317
1350
  let t2;
1318
1351
  if ($[5] !== props || $[6] !== t1) {
1319
- t2 = /* @__PURE__ */ _jsx("ul", {
1320
- "data-slot": "sidebar-menu-sub",
1321
- "data-sidebar": "menu-sub",
1322
- className: t1,
1323
- ...props
1352
+ t2 = /* @__PURE__ */ _jsx(motion.li, {
1353
+ ...props,
1354
+ layout: "position",
1355
+ transition: SPRING_LAYOUT,
1356
+ "data-slot": "sidebar-menu-item",
1357
+ className: t1
1324
1358
  });
1325
1359
  $[5] = props;
1326
1360
  $[6] = t1;
@@ -1330,6 +1364,69 @@ function SidebarMenuSub(t0) {
1330
1364
  }
1331
1365
  return t2;
1332
1366
  }
1367
+ /**
1368
+ * Nested list that unfolds with a clip and staggered items.
1369
+ * @param props - Open state and motion-enabled list attributes.
1370
+ * @returns The submenu while open and the sidebar is expanded.
1371
+ */
1372
+ function SidebarMenuSub(t0) {
1373
+ const $ = _c(14);
1374
+ let children;
1375
+ let className;
1376
+ let open;
1377
+ let props;
1378
+ if ($[0] !== t0) {
1379
+ ({open, children, className, ...props} = t0);
1380
+ $[0] = t0;
1381
+ $[1] = children;
1382
+ $[2] = className;
1383
+ $[3] = open;
1384
+ $[4] = props;
1385
+ } else {
1386
+ children = $[1];
1387
+ className = $[2];
1388
+ open = $[3];
1389
+ props = $[4];
1390
+ }
1391
+ const context = useSidebar();
1392
+ const panel = useSidebarPanel();
1393
+ let t1;
1394
+ if ($[5] !== children || $[6] !== className || $[7] !== context || $[8] !== open || $[9] !== panel || $[10] !== props) {
1395
+ t1 = open && !panel.collapsed ? /* @__PURE__ */ _createElement(motion.ul, {
1396
+ ...props,
1397
+ key: "sidebar-submenu",
1398
+ variants: context.reduce ? undefined : SUBMENU_VARIANTS,
1399
+ initial: context.reduce ? false : "closed",
1400
+ animate: context.reduce ? { opacity: 1 } : "open",
1401
+ exit: context.reduce ? { opacity: 0 } : "closed",
1402
+ transition: context.reduce ? { duration: MOTION_TIMING.exit } : undefined,
1403
+ "data-slot": "sidebar-menu-sub",
1404
+ className: cn("relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-l border-sidebar-border pl-3", className)
1405
+ }, children) : null;
1406
+ $[5] = children;
1407
+ $[6] = className;
1408
+ $[7] = context;
1409
+ $[8] = open;
1410
+ $[9] = panel;
1411
+ $[10] = props;
1412
+ $[11] = t1;
1413
+ } else {
1414
+ t1 = $[11];
1415
+ }
1416
+ let t2;
1417
+ if ($[12] !== t1) {
1418
+ t2 = /* @__PURE__ */ _jsx(AnimatePresence, {
1419
+ initial: false,
1420
+ mode: "popLayout",
1421
+ children: t1
1422
+ });
1423
+ $[12] = t1;
1424
+ $[13] = t2;
1425
+ } else {
1426
+ t2 = $[13];
1427
+ }
1428
+ return t2;
1429
+ }
1333
1430
  function SidebarMenuSubItem(t0) {
1334
1431
  const $ = _c(8);
1335
1432
  let className;
@@ -1345,7 +1442,7 @@ function SidebarMenuSubItem(t0) {
1345
1442
  }
1346
1443
  let t1;
1347
1444
  if ($[3] !== className) {
1348
- t1 = cn("group/menu-sub-item relative", className);
1445
+ t1 = cn("relative min-w-0", className);
1349
1446
  $[3] = className;
1350
1447
  $[4] = t1;
1351
1448
  } else {
@@ -1353,11 +1450,11 @@ function SidebarMenuSubItem(t0) {
1353
1450
  }
1354
1451
  let t2;
1355
1452
  if ($[5] !== props || $[6] !== t1) {
1356
- t2 = /* @__PURE__ */ _jsx("li", {
1453
+ t2 = /* @__PURE__ */ _jsx(motion.li, {
1454
+ ...props,
1455
+ variants: SUBMENU_ITEM_VARIANTS,
1357
1456
  "data-slot": "sidebar-menu-sub-item",
1358
- "data-sidebar": "menu-sub-item",
1359
- className: t1,
1360
- ...props
1457
+ className: t1
1361
1458
  });
1362
1459
  $[5] = props;
1363
1460
  $[6] = t1;
@@ -1367,62 +1464,379 @@ function SidebarMenuSubItem(t0) {
1367
1464
  }
1368
1465
  return t2;
1369
1466
  }
1370
- function SidebarMenuSubButton(t0) {
1371
- const $ = _c(14);
1372
- let className;
1373
- let props;
1374
- let t1;
1467
+ /** Renders a menu action as a routed link or a button, both with the subtle press feedback. */
1468
+ function SidebarPressable(t0) {
1469
+ const $ = _c(19);
1470
+ const { slot, href, disabled, target, rel, isActive, ariaExpanded, ariaLabel, title, className, children, onClick } = t0;
1471
+ const t1 = isActive ? "page" : undefined;
1375
1472
  let t2;
1473
+ if ($[0] !== ariaExpanded || $[1] !== ariaLabel || $[2] !== className || $[3] !== isActive || $[4] !== onClick || $[5] !== slot || $[6] !== t1 || $[7] !== title) {
1474
+ t2 = {
1475
+ "data-slot": slot,
1476
+ "data-active": isActive,
1477
+ "aria-current": t1,
1478
+ "aria-expanded": ariaExpanded,
1479
+ "aria-label": ariaLabel,
1480
+ title,
1481
+ className,
1482
+ onClick
1483
+ };
1484
+ $[0] = ariaExpanded;
1485
+ $[1] = ariaLabel;
1486
+ $[2] = className;
1487
+ $[3] = isActive;
1488
+ $[4] = onClick;
1489
+ $[5] = slot;
1490
+ $[6] = t1;
1491
+ $[7] = title;
1492
+ $[8] = t2;
1493
+ } else {
1494
+ t2 = $[8];
1495
+ }
1496
+ const sharedProps = t2;
1376
1497
  let t3;
1377
- if ($[0] !== t0) {
1378
- ({asChild: t1, size: t2, isActive: t3, className, ...props} = t0);
1379
- $[0] = t0;
1380
- $[1] = className;
1381
- $[2] = props;
1382
- $[3] = t1;
1383
- $[4] = t2;
1384
- $[5] = t3;
1498
+ if ($[9] !== children || $[10] !== disabled || $[11] !== href || $[12] !== rel || $[13] !== sharedProps || $[14] !== target) {
1499
+ t3 = href ? /* @__PURE__ */ _jsx(Link, {
1500
+ ...sharedProps,
1501
+ href,
1502
+ target,
1503
+ rel: rel ?? (target === EXTERNAL_LINK_TARGET ? EXTERNAL_LINK_REL : undefined),
1504
+ "aria-disabled": disabled || undefined,
1505
+ tabIndex: disabled ? -1 : undefined,
1506
+ children
1507
+ }) : /* @__PURE__ */ _jsx("button", {
1508
+ ...sharedProps,
1509
+ type: "button",
1510
+ disabled,
1511
+ children
1512
+ });
1513
+ $[9] = children;
1514
+ $[10] = disabled;
1515
+ $[11] = href;
1516
+ $[12] = rel;
1517
+ $[13] = sharedProps;
1518
+ $[14] = target;
1519
+ $[15] = t3;
1385
1520
  } else {
1386
- className = $[1];
1387
- props = $[2];
1388
- t1 = $[3];
1389
- t2 = $[4];
1390
- t3 = $[5];
1521
+ t3 = $[15];
1391
1522
  }
1392
- const asChild = t1 === undefined ? false : t1;
1393
- const size = t2 === undefined ? "md" : t2;
1394
- const isActive = t3 === undefined ? false : t3;
1395
- const Comp = asChild ? Slot.Root : "a";
1523
+ const element = t3;
1396
1524
  let t4;
1397
- if ($[6] !== className) {
1398
- t4 = cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", className);
1399
- $[6] = className;
1400
- $[7] = t4;
1525
+ if ($[16] !== disabled || $[17] !== element) {
1526
+ t4 = disabled ? element : /* @__PURE__ */ _jsx(MotionSlot, {
1527
+ kind: "subtle-press",
1528
+ children: element
1529
+ });
1530
+ $[16] = disabled;
1531
+ $[17] = element;
1532
+ $[18] = t4;
1401
1533
  } else {
1402
- t4 = $[7];
1534
+ t4 = $[18];
1403
1535
  }
1404
- let t5;
1405
- if ($[8] !== Comp || $[9] !== isActive || $[10] !== props || $[11] !== size || $[12] !== t4) {
1406
- t5 = /* @__PURE__ */ _jsx(MotionSlot, {
1407
- kind: "subtle-press",
1408
- children: /* @__PURE__ */ _jsx(Comp, {
1409
- "data-slot": "sidebar-menu-sub-button",
1410
- "data-sidebar": "menu-sub-button",
1411
- "data-size": size,
1412
- "data-active": isActive,
1413
- className: t4,
1414
- ...props
1415
- })
1536
+ return t4;
1537
+ }
1538
+ /**
1539
+ * Submenu entry; shows a dot when no icon is given.
1540
+ * @param props - Label, icon, link or select handler, active and disabled state.
1541
+ * @returns The submenu link or button.
1542
+ */
1543
+ function SidebarMenuSubButton(t0) {
1544
+ const $ = _c(25);
1545
+ const { children, icon, href, isActive: t1, disabled: t2, closeOnSelect: t3, target, rel, onSelect, className } = t0;
1546
+ const isActive = t1 === undefined ? false : t1;
1547
+ const disabled = t2 === undefined ? false : t2;
1548
+ const closeOnSelect = t3 === undefined ? true : t3;
1549
+ const context = useSidebar();
1550
+ let t4;
1551
+ if ($[0] !== closeOnSelect || $[1] !== context || $[2] !== disabled || $[3] !== onSelect) {
1552
+ t4 = (event) => {
1553
+ if (disabled) {
1554
+ event.preventDefault();
1555
+ return;
1556
+ }
1557
+ onSelect?.();
1558
+ if (context.isMobile && closeOnSelect) {
1559
+ context.setOpenMobile(false);
1560
+ }
1561
+ };
1562
+ $[0] = closeOnSelect;
1563
+ $[1] = context;
1564
+ $[2] = disabled;
1565
+ $[3] = onSelect;
1566
+ $[4] = t4;
1567
+ } else {
1568
+ t4 = $[4];
1569
+ }
1570
+ const select = t4;
1571
+ const t5 = isActive && "bg-sidebar-accent/70 text-sidebar-accent-foreground";
1572
+ const t6 = disabled && "cursor-not-allowed opacity-40";
1573
+ let t7;
1574
+ if ($[5] !== className || $[6] !== t5 || $[7] !== t6) {
1575
+ t7 = cn("flex min-h-8 w-full min-w-0 items-center gap-2 rounded-lg px-2 text-left text-xs outline-none", "text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground", "focus-visible:bg-sidebar-accent/70 focus-visible:ring-2 focus-visible:ring-sidebar-ring", t5, t6, className);
1576
+ $[5] = className;
1577
+ $[6] = t5;
1578
+ $[7] = t6;
1579
+ $[8] = t7;
1580
+ } else {
1581
+ t7 = $[8];
1582
+ }
1583
+ let t8;
1584
+ if ($[9] !== icon) {
1585
+ t8 = icon ?? /* @__PURE__ */ _jsx("span", { className: "size-1 rounded-full bg-current" });
1586
+ $[9] = icon;
1587
+ $[10] = t8;
1588
+ } else {
1589
+ t8 = $[10];
1590
+ }
1591
+ let t9;
1592
+ if ($[11] !== t8) {
1593
+ t9 = /* @__PURE__ */ _jsx("span", {
1594
+ "aria-hidden": "true",
1595
+ className: "grid size-4 shrink-0 place-items-center",
1596
+ children: t8
1416
1597
  });
1417
- $[8] = Comp;
1418
- $[9] = isActive;
1419
- $[10] = props;
1420
- $[11] = size;
1421
- $[12] = t4;
1422
- $[13] = t5;
1598
+ $[11] = t8;
1599
+ $[12] = t9;
1423
1600
  } else {
1424
- t5 = $[13];
1601
+ t9 = $[12];
1425
1602
  }
1426
- return t5;
1603
+ let t10;
1604
+ if ($[13] !== children) {
1605
+ t10 = /* @__PURE__ */ _jsx("span", {
1606
+ className: "min-w-0 flex-1 truncate",
1607
+ children
1608
+ });
1609
+ $[13] = children;
1610
+ $[14] = t10;
1611
+ } else {
1612
+ t10 = $[14];
1613
+ }
1614
+ let t11;
1615
+ if ($[15] !== disabled || $[16] !== href || $[17] !== isActive || $[18] !== rel || $[19] !== select || $[20] !== t10 || $[21] !== t7 || $[22] !== t9 || $[23] !== target) {
1616
+ t11 = /* @__PURE__ */ _jsxs(SidebarPressable, {
1617
+ slot: "sidebar-menu-sub-button",
1618
+ href,
1619
+ disabled,
1620
+ target,
1621
+ rel,
1622
+ isActive,
1623
+ onClick: select,
1624
+ className: t7,
1625
+ children: [t9, t10]
1626
+ });
1627
+ $[15] = disabled;
1628
+ $[16] = href;
1629
+ $[17] = isActive;
1630
+ $[18] = rel;
1631
+ $[19] = select;
1632
+ $[20] = t10;
1633
+ $[21] = t7;
1634
+ $[22] = t9;
1635
+ $[23] = target;
1636
+ $[24] = t11;
1637
+ } else {
1638
+ t11 = $[24];
1639
+ }
1640
+ return t11;
1641
+ }
1642
+ /**
1643
+ * Top-level menu entry: the active one carries a pill that glides between entries, and the label
1644
+ * fades out of the icon rail, leaving a string label as accessible name and native tooltip.
1645
+ * @param props - Label, icon, badge, link or select handler, submenu and active state.
1646
+ * @returns The menu link or button.
1647
+ */
1648
+ function SidebarMenuButton(t0) {
1649
+ const $ = _c(50);
1650
+ const { children, icon, badge, href, isActive: t1, ariaExpanded, disabled: t2, closeOnSelect, target, rel, onSelect, className } = t0;
1651
+ const isActive = t1 === undefined ? false : t1;
1652
+ const disabled = t2 === undefined ? false : t2;
1653
+ const context = useSidebar();
1654
+ const panel = useSidebarPanel();
1655
+ const textLabel = typeof children === "string" ? children : undefined;
1656
+ const collapsedLabel = panel.collapsed ? textLabel : undefined;
1657
+ let t3;
1658
+ if ($[0] !== ariaExpanded || $[1] !== closeOnSelect || $[2] !== context || $[3] !== disabled || $[4] !== onSelect || $[5] !== panel.collapsed) {
1659
+ t3 = (event) => {
1660
+ if (disabled) {
1661
+ event.preventDefault();
1662
+ return;
1663
+ }
1664
+ onSelect?.();
1665
+ const shouldCloseOnSelect = closeOnSelect ?? ariaExpanded === undefined;
1666
+ if (context.isMobile && shouldCloseOnSelect) {
1667
+ context.setOpenMobile(false);
1668
+ }
1669
+ if (ariaExpanded !== undefined && panel.collapsed && !context.isMobile) {
1670
+ context.setOpen(true);
1671
+ }
1672
+ };
1673
+ $[0] = ariaExpanded;
1674
+ $[1] = closeOnSelect;
1675
+ $[2] = context;
1676
+ $[3] = disabled;
1677
+ $[4] = onSelect;
1678
+ $[5] = panel.collapsed;
1679
+ $[6] = t3;
1680
+ } else {
1681
+ t3 = $[6];
1682
+ }
1683
+ const select = t3;
1684
+ const t4 = isActive && "text-sidebar-accent-foreground";
1685
+ const t5 = disabled && "cursor-not-allowed opacity-40";
1686
+ let t6;
1687
+ if ($[7] !== className || $[8] !== t4 || $[9] !== t5) {
1688
+ t6 = cn("relative flex min-h-9 w-full min-w-0 items-center gap-2.5 overflow-hidden rounded-xl px-3 text-left text-sm font-medium outline-none", "text-sidebar-foreground/70 transition-colors hover:text-sidebar-accent-foreground", "focus-visible:bg-sidebar-accent/70 focus-visible:ring-2 focus-visible:ring-sidebar-ring", t4, t5, className);
1689
+ $[7] = className;
1690
+ $[8] = t4;
1691
+ $[9] = t5;
1692
+ $[10] = t6;
1693
+ } else {
1694
+ t6 = $[10];
1695
+ }
1696
+ let t7;
1697
+ if ($[11] !== context.layoutId || $[12] !== context.reduce || $[13] !== isActive) {
1698
+ t7 = isActive ? /* @__PURE__ */ _jsx(motion.span, {
1699
+ "data-slot": "sidebar-menu-active-indicator",
1700
+ layoutId: context.layoutId,
1701
+ transition: context.reduce ? INSTANT_TRANSITION : SPRING_LAYOUT,
1702
+ className: "absolute inset-0 rounded-xl bg-sidebar-accent"
1703
+ }) : null;
1704
+ $[11] = context.layoutId;
1705
+ $[12] = context.reduce;
1706
+ $[13] = isActive;
1707
+ $[14] = t7;
1708
+ } else {
1709
+ t7 = $[14];
1710
+ }
1711
+ let t8;
1712
+ if ($[15] !== icon) {
1713
+ t8 = icon ? /* @__PURE__ */ _jsx("span", {
1714
+ "aria-hidden": "true",
1715
+ className: "relative z-10 grid size-5 shrink-0 place-items-center [&_svg]:size-4",
1716
+ children: icon
1717
+ }) : null;
1718
+ $[15] = icon;
1719
+ $[16] = t8;
1720
+ } else {
1721
+ t8 = $[16];
1722
+ }
1723
+ const t9 = panel.collapsed ? 0 : 1;
1724
+ const t10 = panel.collapsed ? -SIDEBAR_LABEL_DRIFT_PX : 0;
1725
+ let t11;
1726
+ if ($[17] !== t10 || $[18] !== t9) {
1727
+ t11 = {
1728
+ opacity: t9,
1729
+ x: t10
1730
+ };
1731
+ $[17] = t10;
1732
+ $[18] = t9;
1733
+ $[19] = t11;
1734
+ } else {
1735
+ t11 = $[19];
1736
+ }
1737
+ const t12 = context.reduce ? REDUCED_TRANSITION : panel.collapsed ? LABEL_EXIT_TRANSITION : LABEL_ENTER_TRANSITION;
1738
+ const t13 = panel.collapsed;
1739
+ const t14 = panel.collapsed && "pointer-events-none";
1740
+ let t15;
1741
+ if ($[20] !== t14) {
1742
+ t15 = cn("relative z-10 min-w-0 flex-1 truncate", t14);
1743
+ $[20] = t14;
1744
+ $[21] = t15;
1745
+ } else {
1746
+ t15 = $[21];
1747
+ }
1748
+ let t16;
1749
+ if ($[22] !== children || $[23] !== panel.collapsed || $[24] !== t11 || $[25] !== t12 || $[26] !== t15) {
1750
+ t16 = /* @__PURE__ */ _jsx(motion.span, {
1751
+ initial: false,
1752
+ animate: t11,
1753
+ transition: t12,
1754
+ "aria-hidden": t13,
1755
+ className: t15,
1756
+ children
1757
+ });
1758
+ $[22] = children;
1759
+ $[23] = panel.collapsed;
1760
+ $[24] = t11;
1761
+ $[25] = t12;
1762
+ $[26] = t15;
1763
+ $[27] = t16;
1764
+ } else {
1765
+ t16 = $[27];
1766
+ }
1767
+ let t17;
1768
+ if ($[28] !== badge || $[29] !== panel.collapsed) {
1769
+ t17 = badge && !panel.collapsed ? /* @__PURE__ */ _jsx("span", {
1770
+ className: "relative z-10 shrink-0 text-xs text-sidebar-foreground/70",
1771
+ children: badge
1772
+ }) : null;
1773
+ $[28] = badge;
1774
+ $[29] = panel.collapsed;
1775
+ $[30] = t17;
1776
+ } else {
1777
+ t17 = $[30];
1778
+ }
1779
+ let t18;
1780
+ if ($[31] !== ariaExpanded || $[32] !== context.reduce || $[33] !== panel.collapsed) {
1781
+ t18 = ariaExpanded !== undefined ? /* @__PURE__ */ _jsx(motion.span, {
1782
+ "aria-hidden": "true",
1783
+ initial: false,
1784
+ animate: {
1785
+ opacity: panel.collapsed ? 0 : 1,
1786
+ rotate: ariaExpanded ? SIDEBAR_CHEVRON_EXPANDED_DEGREES : 0,
1787
+ x: panel.collapsed ? SIDEBAR_LABEL_DRIFT_PX : 0
1788
+ },
1789
+ transition: context.reduce ? INSTANT_TRANSITION : SPRING_LAYOUT,
1790
+ className: "relative z-10 grid size-4 shrink-0 place-items-center text-sidebar-foreground/70",
1791
+ children: /* @__PURE__ */ _jsx(ChevronRight, { className: "size-3.5" })
1792
+ }) : null;
1793
+ $[31] = ariaExpanded;
1794
+ $[32] = context.reduce;
1795
+ $[33] = panel.collapsed;
1796
+ $[34] = t18;
1797
+ } else {
1798
+ t18 = $[34];
1799
+ }
1800
+ let t19;
1801
+ if ($[35] !== ariaExpanded || $[36] !== collapsedLabel || $[37] !== disabled || $[38] !== href || $[39] !== isActive || $[40] !== rel || $[41] !== select || $[42] !== t16 || $[43] !== t17 || $[44] !== t18 || $[45] !== t6 || $[46] !== t7 || $[47] !== t8 || $[48] !== target) {
1802
+ t19 = /* @__PURE__ */ _jsxs(SidebarPressable, {
1803
+ slot: "sidebar-menu-button",
1804
+ href,
1805
+ disabled,
1806
+ target,
1807
+ rel,
1808
+ isActive,
1809
+ ariaExpanded,
1810
+ ariaLabel: collapsedLabel,
1811
+ title: collapsedLabel,
1812
+ onClick: select,
1813
+ className: t6,
1814
+ children: [
1815
+ t7,
1816
+ t8,
1817
+ t16,
1818
+ t17,
1819
+ t18
1820
+ ]
1821
+ });
1822
+ $[35] = ariaExpanded;
1823
+ $[36] = collapsedLabel;
1824
+ $[37] = disabled;
1825
+ $[38] = href;
1826
+ $[39] = isActive;
1827
+ $[40] = rel;
1828
+ $[41] = select;
1829
+ $[42] = t16;
1830
+ $[43] = t17;
1831
+ $[44] = t18;
1832
+ $[45] = t6;
1833
+ $[46] = t7;
1834
+ $[47] = t8;
1835
+ $[48] = target;
1836
+ $[49] = t19;
1837
+ } else {
1838
+ t19 = $[49];
1839
+ }
1840
+ return t19;
1427
1841
  }
1428
- export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
1842
+ export { Sidebar, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar };