beez-ui 0.10.0 → 0.11.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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/dist/components/account-menu.d.ts +5 -2
- package/dist/components/account-menu.js +148 -143
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +40 -3
- package/dist/components/sidebar.js +257 -101
- package/dist/hooks/use-sidebar-persistence.d.ts +1 -1
- package/dist/hooks/use-sidebar-persistence.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -9,18 +9,21 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
9
9
|
*/
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { ChevronRight, PanelLeftIcon } from "lucide-react";
|
|
12
|
+
import { Slot } from "radix-ui";
|
|
12
13
|
import { AnimatePresence, motion } from "motion/react";
|
|
13
14
|
import { createPortal } from "react-dom";
|
|
14
15
|
import { useIsHydrated } from "../hooks/use-is-hydrated.js";
|
|
15
16
|
import { useIsMobile } from "../hooks/use-mobile.js";
|
|
16
17
|
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
17
18
|
import { saveSidebarCookie, saveSidebarPreference, useSidebarPersistence } from "../hooks/use-sidebar-persistence.js";
|
|
19
|
+
import { SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME } from "../constants/sidebar.js";
|
|
18
20
|
import { cn } from "../lib/utils.js";
|
|
19
21
|
import { MotionSlot } from "../motion/motion-slot.js";
|
|
20
22
|
import { SharedLayoutBg } from "../motion/shared-layout-bg.js";
|
|
21
23
|
import { MOTION_EASE, MOTION_EASE_DRAWER, MOTION_LIST_ITEM_DISTANCE, MOTION_TIMING, SPRING_LAYOUT } from "../motion/tokens.js";
|
|
22
24
|
import { Link } from "./link.js";
|
|
23
|
-
import {
|
|
25
|
+
import { SidebarPanelContext } from "./sidebar-panel-context.js";
|
|
26
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
27
|
import { createElement as _createElement } from "react";
|
|
25
28
|
const SIDEBAR_WIDTH = "16rem";
|
|
26
29
|
const SIDEBAR_WIDTH_ICON = "4.25rem";
|
|
@@ -109,7 +112,6 @@ const FOCUSABLE_SELECTOR = [
|
|
|
109
112
|
"[tabindex]:not([tabindex='-1'])"
|
|
110
113
|
].join(",");
|
|
111
114
|
const SidebarContext = React.createContext(null);
|
|
112
|
-
const SidebarPanelContext = React.createContext(null);
|
|
113
115
|
/**
|
|
114
116
|
* Reads the sidebar state shared by `SidebarProvider`.
|
|
115
117
|
* @returns Open state for desktop and mobile, viewport and motion flags, and state setters.
|
|
@@ -121,20 +123,26 @@ function useSidebar() {
|
|
|
121
123
|
}
|
|
122
124
|
return context;
|
|
123
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Reads the state of the enclosing `Sidebar` panel, so product content can adapt to the icon rail
|
|
128
|
+
* without depending on its DOM attributes.
|
|
129
|
+
* @returns Whether the panel is collapsed to its icon rail (always false in the mobile sheet), its
|
|
130
|
+
* collapse mode and its side.
|
|
131
|
+
*/
|
|
124
132
|
function useSidebarPanel() {
|
|
125
133
|
const context = React.use(SidebarPanelContext);
|
|
126
134
|
if (!context) {
|
|
127
|
-
throw new Error("
|
|
135
|
+
throw new Error("useSidebarPanel must be used within a Sidebar.");
|
|
128
136
|
}
|
|
129
137
|
return context;
|
|
130
138
|
}
|
|
131
139
|
/**
|
|
132
140
|
* 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
|
|
141
|
+
* @param props - Controlled or default state for both viewports, persistence options and wrapper attributes.
|
|
134
142
|
* @returns The wrapper that lays out the sidebar next to its inset.
|
|
135
143
|
*/
|
|
136
144
|
function SidebarProvider(t0) {
|
|
137
|
-
const $ = _c(
|
|
145
|
+
const $ = _c(57);
|
|
138
146
|
let children;
|
|
139
147
|
let className;
|
|
140
148
|
let onOpenChange;
|
|
@@ -146,8 +154,10 @@ function SidebarProvider(t0) {
|
|
|
146
154
|
let style;
|
|
147
155
|
let t1;
|
|
148
156
|
let t2;
|
|
157
|
+
let t3;
|
|
158
|
+
let t4;
|
|
149
159
|
if ($[0] !== t0) {
|
|
150
|
-
({children, open: openProp, defaultOpen: t1, onOpenChange, openMobile: openMobileProp, defaultOpenMobile: t2, onOpenMobileChange, storageKey, className, style, ...props} = t0);
|
|
160
|
+
({children, open: openProp, defaultOpen: t1, onOpenChange, openMobile: openMobileProp, defaultOpenMobile: t2, onOpenMobileChange, storageKey, cookieName: t3, cookieMaxAge: t4, className, style, ...props} = t0);
|
|
151
161
|
$[0] = t0;
|
|
152
162
|
$[1] = children;
|
|
153
163
|
$[2] = className;
|
|
@@ -160,6 +170,8 @@ function SidebarProvider(t0) {
|
|
|
160
170
|
$[9] = style;
|
|
161
171
|
$[10] = t1;
|
|
162
172
|
$[11] = t2;
|
|
173
|
+
$[12] = t3;
|
|
174
|
+
$[13] = t4;
|
|
163
175
|
} else {
|
|
164
176
|
children = $[1];
|
|
165
177
|
className = $[2];
|
|
@@ -172,9 +184,13 @@ function SidebarProvider(t0) {
|
|
|
172
184
|
style = $[9];
|
|
173
185
|
t1 = $[10];
|
|
174
186
|
t2 = $[11];
|
|
187
|
+
t3 = $[12];
|
|
188
|
+
t4 = $[13];
|
|
175
189
|
}
|
|
176
190
|
const defaultOpen = t1 === undefined ? true : t1;
|
|
177
191
|
const defaultOpenMobile = t2 === undefined ? false : t2;
|
|
192
|
+
const cookieName = t3 === undefined ? SIDEBAR_COOKIE_NAME : t3;
|
|
193
|
+
const cookieMaxAge = t4 === undefined ? SIDEBAR_COOKIE_MAX_AGE : t4;
|
|
178
194
|
const [internalOpen, setInternalOpen] = React.useState(null);
|
|
179
195
|
const [internalOpenMobile, setInternalOpenMobile] = React.useState(defaultOpenMobile);
|
|
180
196
|
const persistedOpen = useSidebarPersistence(storageKey);
|
|
@@ -186,62 +202,64 @@ function SidebarProvider(t0) {
|
|
|
186
202
|
const openMobile = openMobileProp ?? internalOpenMobile;
|
|
187
203
|
const state = open ? "expanded" : "collapsed";
|
|
188
204
|
const mobileWidth = style?.["--sidebar-width-mobile"] ?? SIDEBAR_WIDTH_MOBILE;
|
|
189
|
-
let
|
|
190
|
-
if ($[
|
|
191
|
-
|
|
205
|
+
let t5;
|
|
206
|
+
if ($[14] !== cookieMaxAge || $[15] !== cookieName || $[16] !== onOpenChange || $[17] !== openProp || $[18] !== storageKey) {
|
|
207
|
+
t5 = (nextOpen) => {
|
|
192
208
|
if (openProp === undefined) {
|
|
193
209
|
setInternalOpen(nextOpen);
|
|
194
210
|
}
|
|
195
211
|
onOpenChange?.(nextOpen);
|
|
196
212
|
saveSidebarPreference(storageKey, nextOpen);
|
|
197
|
-
saveSidebarCookie(nextOpen);
|
|
213
|
+
saveSidebarCookie(nextOpen, cookieName, cookieMaxAge);
|
|
198
214
|
};
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
215
|
+
$[14] = cookieMaxAge;
|
|
216
|
+
$[15] = cookieName;
|
|
217
|
+
$[16] = onOpenChange;
|
|
218
|
+
$[17] = openProp;
|
|
219
|
+
$[18] = storageKey;
|
|
220
|
+
$[19] = t5;
|
|
203
221
|
} else {
|
|
204
|
-
|
|
222
|
+
t5 = $[19];
|
|
205
223
|
}
|
|
206
|
-
const setOpen =
|
|
207
|
-
let
|
|
208
|
-
if ($[
|
|
209
|
-
|
|
224
|
+
const setOpen = t5;
|
|
225
|
+
let t6;
|
|
226
|
+
if ($[20] !== onOpenMobileChange || $[21] !== openMobileProp) {
|
|
227
|
+
t6 = (nextOpen_0) => {
|
|
210
228
|
if (openMobileProp === undefined) {
|
|
211
229
|
setInternalOpenMobile(nextOpen_0);
|
|
212
230
|
}
|
|
213
231
|
onOpenMobileChange?.(nextOpen_0);
|
|
214
232
|
};
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
233
|
+
$[20] = onOpenMobileChange;
|
|
234
|
+
$[21] = openMobileProp;
|
|
235
|
+
$[22] = t6;
|
|
218
236
|
} else {
|
|
219
|
-
|
|
237
|
+
t6 = $[22];
|
|
220
238
|
}
|
|
221
|
-
const setOpenMobile =
|
|
222
|
-
let
|
|
223
|
-
if ($[
|
|
224
|
-
|
|
239
|
+
const setOpenMobile = t6;
|
|
240
|
+
let t7;
|
|
241
|
+
if ($[23] !== isMobile || $[24] !== open || $[25] !== openMobile || $[26] !== setOpen || $[27] !== setOpenMobile) {
|
|
242
|
+
t7 = () => {
|
|
225
243
|
if (isMobile) {
|
|
226
244
|
setOpenMobile(!openMobile);
|
|
227
245
|
} else {
|
|
228
246
|
setOpen(!open);
|
|
229
247
|
}
|
|
230
248
|
};
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
249
|
+
$[23] = isMobile;
|
|
250
|
+
$[24] = open;
|
|
251
|
+
$[25] = openMobile;
|
|
252
|
+
$[26] = setOpen;
|
|
253
|
+
$[27] = setOpenMobile;
|
|
254
|
+
$[28] = t7;
|
|
237
255
|
} else {
|
|
238
|
-
|
|
256
|
+
t7 = $[28];
|
|
239
257
|
}
|
|
240
|
-
const toggleSidebar =
|
|
241
|
-
let
|
|
242
|
-
let
|
|
243
|
-
if ($[
|
|
244
|
-
|
|
258
|
+
const toggleSidebar = t7;
|
|
259
|
+
let t8;
|
|
260
|
+
let t9;
|
|
261
|
+
if ($[29] !== toggleSidebar) {
|
|
262
|
+
t8 = () => {
|
|
245
263
|
const handleShortcut = (event) => {
|
|
246
264
|
if (event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
247
265
|
event.preventDefault();
|
|
@@ -251,21 +269,21 @@ function SidebarProvider(t0) {
|
|
|
251
269
|
window.addEventListener("keydown", handleShortcut);
|
|
252
270
|
return () => window.removeEventListener("keydown", handleShortcut);
|
|
253
271
|
};
|
|
254
|
-
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
272
|
+
t9 = [toggleSidebar];
|
|
273
|
+
$[29] = toggleSidebar;
|
|
274
|
+
$[30] = t8;
|
|
275
|
+
$[31] = t9;
|
|
258
276
|
} else {
|
|
259
|
-
|
|
260
|
-
|
|
277
|
+
t8 = $[30];
|
|
278
|
+
t9 = $[31];
|
|
261
279
|
}
|
|
262
|
-
React.useEffect(
|
|
263
|
-
const
|
|
264
|
-
let
|
|
265
|
-
if ($[
|
|
266
|
-
|
|
280
|
+
React.useEffect(t8, t9);
|
|
281
|
+
const t10 = `${generatedId}-active`;
|
|
282
|
+
let t11;
|
|
283
|
+
if ($[32] !== isMobile || $[33] !== mobileWidth || $[34] !== open || $[35] !== openMobile || $[36] !== reduce || $[37] !== setOpen || $[38] !== setOpenMobile || $[39] !== state || $[40] !== t10 || $[41] !== toggleSidebar) {
|
|
284
|
+
t11 = {
|
|
267
285
|
isMobile,
|
|
268
|
-
layoutId:
|
|
286
|
+
layoutId: t10,
|
|
269
287
|
mobileWidth,
|
|
270
288
|
open,
|
|
271
289
|
openMobile,
|
|
@@ -276,75 +294,75 @@ function SidebarProvider(t0) {
|
|
|
276
294
|
toggleSidebar,
|
|
277
295
|
triggerRef
|
|
278
296
|
};
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
} else {
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
const contextValue =
|
|
294
|
-
let
|
|
295
|
-
if ($[
|
|
296
|
-
|
|
297
|
+
$[32] = isMobile;
|
|
298
|
+
$[33] = mobileWidth;
|
|
299
|
+
$[34] = open;
|
|
300
|
+
$[35] = openMobile;
|
|
301
|
+
$[36] = reduce;
|
|
302
|
+
$[37] = setOpen;
|
|
303
|
+
$[38] = setOpenMobile;
|
|
304
|
+
$[39] = state;
|
|
305
|
+
$[40] = t10;
|
|
306
|
+
$[41] = toggleSidebar;
|
|
307
|
+
$[42] = t11;
|
|
308
|
+
} else {
|
|
309
|
+
t11 = $[42];
|
|
310
|
+
}
|
|
311
|
+
const contextValue = t11;
|
|
312
|
+
let t12;
|
|
313
|
+
if ($[43] !== mobileWidth || $[44] !== style) {
|
|
314
|
+
t12 = {
|
|
297
315
|
"--sidebar-width": SIDEBAR_WIDTH,
|
|
298
316
|
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
299
317
|
"--sidebar-width-mobile": mobileWidth,
|
|
300
318
|
...style
|
|
301
319
|
};
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
320
|
+
$[43] = mobileWidth;
|
|
321
|
+
$[44] = style;
|
|
322
|
+
$[45] = t12;
|
|
305
323
|
} else {
|
|
306
|
-
|
|
324
|
+
t12 = $[45];
|
|
307
325
|
}
|
|
308
|
-
let
|
|
309
|
-
if ($[
|
|
310
|
-
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
326
|
+
let t13;
|
|
327
|
+
if ($[46] !== className) {
|
|
328
|
+
t13 = cn("group/sidebar-wrapper flex min-h-svh w-full min-w-0 has-data-[variant=inset]:bg-sidebar", className);
|
|
329
|
+
$[46] = className;
|
|
330
|
+
$[47] = t13;
|
|
313
331
|
} else {
|
|
314
|
-
|
|
332
|
+
t13 = $[47];
|
|
315
333
|
}
|
|
316
|
-
let
|
|
317
|
-
if ($[
|
|
318
|
-
|
|
334
|
+
let t14;
|
|
335
|
+
if ($[48] !== children || $[49] !== props || $[50] !== state || $[51] !== t12 || $[52] !== t13) {
|
|
336
|
+
t14 = /* @__PURE__ */ _jsx("div", {
|
|
319
337
|
...props,
|
|
320
338
|
"data-slot": "sidebar-wrapper",
|
|
321
339
|
"data-state": state,
|
|
322
|
-
style:
|
|
323
|
-
className:
|
|
340
|
+
style: t12,
|
|
341
|
+
className: t13,
|
|
324
342
|
children
|
|
325
343
|
});
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
344
|
+
$[48] = children;
|
|
345
|
+
$[49] = props;
|
|
346
|
+
$[50] = state;
|
|
347
|
+
$[51] = t12;
|
|
348
|
+
$[52] = t13;
|
|
349
|
+
$[53] = t14;
|
|
332
350
|
} else {
|
|
333
|
-
|
|
351
|
+
t14 = $[53];
|
|
334
352
|
}
|
|
335
|
-
let
|
|
336
|
-
if ($[
|
|
337
|
-
|
|
353
|
+
let t15;
|
|
354
|
+
if ($[54] !== contextValue || $[55] !== t14) {
|
|
355
|
+
t15 = /* @__PURE__ */ _jsx(SidebarContext.Provider, {
|
|
338
356
|
value: contextValue,
|
|
339
|
-
children:
|
|
357
|
+
children: t14
|
|
340
358
|
});
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
359
|
+
$[54] = contextValue;
|
|
360
|
+
$[55] = t14;
|
|
361
|
+
$[56] = t15;
|
|
344
362
|
} else {
|
|
345
|
-
|
|
363
|
+
t15 = $[56];
|
|
346
364
|
}
|
|
347
|
-
return
|
|
365
|
+
return t15;
|
|
348
366
|
}
|
|
349
367
|
/** Small-screen sheet: locks page scroll, traps focus and hands it back to the trigger on close. */
|
|
350
368
|
function MobileSidebar(t0) {
|
|
@@ -1172,6 +1190,144 @@ function SidebarFooter(t0) {
|
|
|
1172
1190
|
}
|
|
1173
1191
|
return t2;
|
|
1174
1192
|
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Product text that only makes sense in the expanded sidebar, such as a workspace name or an empty
|
|
1195
|
+
* state: it leaves the layout while the panel is the icon rail and always shows in the mobile sheet.
|
|
1196
|
+
* @param props - Span attributes, or `asChild` to keep the child element.
|
|
1197
|
+
* @returns The content, or nothing in the icon rail.
|
|
1198
|
+
*/
|
|
1199
|
+
function SidebarLabel(t0) {
|
|
1200
|
+
const $ = _c(6);
|
|
1201
|
+
let props;
|
|
1202
|
+
let t1;
|
|
1203
|
+
if ($[0] !== t0) {
|
|
1204
|
+
({asChild: t1, ...props} = t0);
|
|
1205
|
+
$[0] = t0;
|
|
1206
|
+
$[1] = props;
|
|
1207
|
+
$[2] = t1;
|
|
1208
|
+
} else {
|
|
1209
|
+
props = $[1];
|
|
1210
|
+
t1 = $[2];
|
|
1211
|
+
}
|
|
1212
|
+
const asChild = t1 === undefined ? false : t1;
|
|
1213
|
+
const { collapsed } = useSidebarPanel();
|
|
1214
|
+
if (collapsed) {
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
const Component = asChild ? Slot.Root : "span";
|
|
1218
|
+
let t2;
|
|
1219
|
+
if ($[3] !== Component || $[4] !== props) {
|
|
1220
|
+
t2 = /* @__PURE__ */ _jsx(Component, {
|
|
1221
|
+
"data-slot": "sidebar-label",
|
|
1222
|
+
...props
|
|
1223
|
+
});
|
|
1224
|
+
$[3] = Component;
|
|
1225
|
+
$[4] = props;
|
|
1226
|
+
$[5] = t2;
|
|
1227
|
+
} else {
|
|
1228
|
+
t2 = $[5];
|
|
1229
|
+
}
|
|
1230
|
+
return t2;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Header row that identifies the workspace, often the trigger of a workspace switcher. It forwards
|
|
1234
|
+
* its props and ref to the `button`, so it works as `DropdownMenuTrigger asChild`, and keeps its tile
|
|
1235
|
+
* on the menu icon column while the label and trailing content leave in the icon rail.
|
|
1236
|
+
* @param props - Tile, label, trailing content and native button attributes.
|
|
1237
|
+
* @returns The brand button.
|
|
1238
|
+
*/
|
|
1239
|
+
function SidebarBrandButton(t0) {
|
|
1240
|
+
const $ = _c(23);
|
|
1241
|
+
let children;
|
|
1242
|
+
let className;
|
|
1243
|
+
let icon;
|
|
1244
|
+
let props;
|
|
1245
|
+
let t1;
|
|
1246
|
+
let trailing;
|
|
1247
|
+
if ($[0] !== t0) {
|
|
1248
|
+
({icon, trailing, children, className, type: t1, ...props} = t0);
|
|
1249
|
+
$[0] = t0;
|
|
1250
|
+
$[1] = children;
|
|
1251
|
+
$[2] = className;
|
|
1252
|
+
$[3] = icon;
|
|
1253
|
+
$[4] = props;
|
|
1254
|
+
$[5] = t1;
|
|
1255
|
+
$[6] = trailing;
|
|
1256
|
+
} else {
|
|
1257
|
+
children = $[1];
|
|
1258
|
+
className = $[2];
|
|
1259
|
+
icon = $[3];
|
|
1260
|
+
props = $[4];
|
|
1261
|
+
t1 = $[5];
|
|
1262
|
+
trailing = $[6];
|
|
1263
|
+
}
|
|
1264
|
+
const type = t1 === undefined ? "button" : t1;
|
|
1265
|
+
const { collapsed } = useSidebarPanel();
|
|
1266
|
+
const textLabel = typeof children === "string" ? children : undefined;
|
|
1267
|
+
const t2 = collapsed ? textLabel : undefined;
|
|
1268
|
+
const t3 = collapsed ? textLabel : undefined;
|
|
1269
|
+
let t4;
|
|
1270
|
+
if ($[7] !== className) {
|
|
1271
|
+
t4 = cn("flex min-h-10 w-full min-w-0 items-center gap-3 rounded-xl px-2 py-1.5 text-left text-sm font-semibold text-sidebar-foreground outline-none transition-colors", "hover:bg-sidebar-accent/70 focus-visible:bg-sidebar-accent/70 focus-visible:ring-2 focus-visible:ring-sidebar-ring data-[state=open]:bg-sidebar-accent/70", "disabled:cursor-not-allowed disabled:opacity-40", className);
|
|
1272
|
+
$[7] = className;
|
|
1273
|
+
$[8] = t4;
|
|
1274
|
+
} else {
|
|
1275
|
+
t4 = $[8];
|
|
1276
|
+
}
|
|
1277
|
+
let t5;
|
|
1278
|
+
if ($[9] !== icon) {
|
|
1279
|
+
t5 = /* @__PURE__ */ _jsx("span", {
|
|
1280
|
+
"aria-hidden": "true",
|
|
1281
|
+
"data-slot": "sidebar-brand-icon",
|
|
1282
|
+
className: "grid size-7 shrink-0 place-items-center overflow-hidden rounded-lg [&>img]:size-full [&>img]:object-cover",
|
|
1283
|
+
children: icon
|
|
1284
|
+
});
|
|
1285
|
+
$[9] = icon;
|
|
1286
|
+
$[10] = t5;
|
|
1287
|
+
} else {
|
|
1288
|
+
t5 = $[10];
|
|
1289
|
+
}
|
|
1290
|
+
let t6;
|
|
1291
|
+
if ($[11] !== children || $[12] !== collapsed || $[13] !== trailing) {
|
|
1292
|
+
t6 = collapsed ? null : /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsx("span", {
|
|
1293
|
+
className: "min-w-0 flex-1 truncate",
|
|
1294
|
+
children
|
|
1295
|
+
}), trailing ? /* @__PURE__ */ _jsx("span", {
|
|
1296
|
+
"aria-hidden": "true",
|
|
1297
|
+
className: "grid size-4 shrink-0 place-items-center text-sidebar-foreground/70 [&_svg]:size-3.5",
|
|
1298
|
+
children: trailing
|
|
1299
|
+
}) : null] });
|
|
1300
|
+
$[11] = children;
|
|
1301
|
+
$[12] = collapsed;
|
|
1302
|
+
$[13] = trailing;
|
|
1303
|
+
$[14] = t6;
|
|
1304
|
+
} else {
|
|
1305
|
+
t6 = $[14];
|
|
1306
|
+
}
|
|
1307
|
+
let t7;
|
|
1308
|
+
if ($[15] !== props || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6 || $[21] !== type) {
|
|
1309
|
+
t7 = /* @__PURE__ */ _jsxs("button", {
|
|
1310
|
+
"aria-label": t2,
|
|
1311
|
+
title: t3,
|
|
1312
|
+
...props,
|
|
1313
|
+
type,
|
|
1314
|
+
"data-slot": "sidebar-brand-button",
|
|
1315
|
+
className: t4,
|
|
1316
|
+
children: [t5, t6]
|
|
1317
|
+
});
|
|
1318
|
+
$[15] = props;
|
|
1319
|
+
$[16] = t2;
|
|
1320
|
+
$[17] = t3;
|
|
1321
|
+
$[18] = t4;
|
|
1322
|
+
$[19] = t5;
|
|
1323
|
+
$[20] = t6;
|
|
1324
|
+
$[21] = type;
|
|
1325
|
+
$[22] = t7;
|
|
1326
|
+
} else {
|
|
1327
|
+
t7 = $[22];
|
|
1328
|
+
}
|
|
1329
|
+
return t7;
|
|
1330
|
+
}
|
|
1175
1331
|
function SidebarGroup(t0) {
|
|
1176
1332
|
const $ = _c(8);
|
|
1177
1333
|
let className;
|
|
@@ -1839,4 +1995,4 @@ function SidebarMenuButton(t0) {
|
|
|
1839
1995
|
}
|
|
1840
1996
|
return t19;
|
|
1841
1997
|
}
|
|
1842
|
-
export { Sidebar, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar };
|
|
1998
|
+
export { Sidebar, SidebarBrandButton, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar, useSidebarPanel };
|
|
@@ -3,4 +3,4 @@ export declare function useSidebarPersistence(storageKey?: string): boolean | nu
|
|
|
3
3
|
/** Stores an optional preference while retaining usable navigation in private mode. */
|
|
4
4
|
export declare function saveSidebarPreference(storageKey: string | undefined, open: boolean): void;
|
|
5
5
|
/** Writes the cookie that server entrypoints read to render the sidebar in its last state. */
|
|
6
|
-
export declare function saveSidebarCookie(open: boolean): void;
|
|
6
|
+
export declare function saveSidebarCookie(open: boolean, cookieName?: string, maxAgeSeconds?: number): void;
|
|
@@ -44,9 +44,9 @@ export function saveSidebarPreference(storageKey, open) {
|
|
|
44
44
|
} catch {}
|
|
45
45
|
}
|
|
46
46
|
/** Writes the cookie that server entrypoints read to render the sidebar in its last state. */
|
|
47
|
-
export function saveSidebarCookie(open) {
|
|
47
|
+
export function saveSidebarCookie(open, cookieName = SIDEBAR_COOKIE_NAME, maxAgeSeconds = SIDEBAR_COOKIE_MAX_AGE) {
|
|
48
48
|
const value = open ? SIDEBAR_COOKIE_OPEN_VALUE : SIDEBAR_COOKIE_COLLAPSED_VALUE;
|
|
49
49
|
try {
|
|
50
|
-
document.cookie = `${
|
|
50
|
+
document.cookie = `${cookieName}=${value}; path=/; max-age=${maxAgeSeconds}; SameSite=Lax`;
|
|
51
51
|
} catch {}
|
|
52
52
|
}
|