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
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ Todos los cambios relevantes de beez-ui se documentan en este archivo con el for
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.11.0] - 2026-10-03
|
|
8
|
+
|
|
9
|
+
- 859b7a6 agrega mejoras al sidebar y persistencia de estado
|
|
10
|
+
|
|
7
11
|
## [0.10.0] - 2026-10-03
|
|
8
12
|
|
|
9
13
|
- 6769ea7 agrega funcionalidad de persistencia y animación al sidebar
|
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ Next y TanStack Router son peers opcionales aislados en sus entrypoints. El prov
|
|
|
162
162
|
|
|
163
163
|
- Tema: `AnimatedThemeToggler` y `ThemedToaster` consumen el contexto compartido. Sus props explícitas de tema siguen disponibles para usos controlados.
|
|
164
164
|
- Navegación: `PaginationNext`, `PaginationPrevious` y `PaginationLink` usan anclas nativas. El prop opcional `component` admite el adaptador del router que elija la app. Sin proveedor usa el elemento nativo; con el proveedor de Next usa su navegación cliente.
|
|
165
|
-
- Sidebar: en `SidebarProvider`, `defaultOpen` y el modo controlado conservan la semántica de LaTribu. Los ítems con `href` navegan con el adaptador de router del proveedor. `storageKey` activa opcionalmente persistencia local segura tras hidratar, sin cambiar la cookie pública `sidebar_state` ni sus siete días de duración.
|
|
165
|
+
- Sidebar: en `SidebarProvider`, `defaultOpen` y el modo controlado conservan la semántica de LaTribu. Los ítems con `href` navegan con el adaptador de router del proveedor. `storageKey` activa opcionalmente persistencia local segura tras hidratar, sin cambiar la cookie pública `sidebar_state` ni sus siete días de duración; `cookieName` y `cookieMaxAge` la reemplazan cuando la app ya lee su propia cookie en el servidor. Para el contenido propio: `SidebarBrandButton` arma la fila de marca (sirve como `DropdownMenuTrigger asChild`), `SidebarLabel` saca del riel de íconos el texto que solo tiene sentido expandido, `useSidebarPanel()` expone `collapsed` y `AccountMenu` con `triggerVariant="sidebar"` se reduce solo al avatar. No dependas de los atributos `data-*` internos del sidebar: pueden cambiar entre versiones.
|
|
166
166
|
- Formularios y tablas: el consumidor provee sus datos, validaciones y callbacks. No se importan servicios, modelos de negocio ni endpoints de agenda-mensual.
|
|
167
167
|
|
|
168
168
|
## Componentes incorporados desde agenda-mensual
|
|
@@ -10,7 +10,7 @@ export interface AccountMenuLabels {
|
|
|
10
10
|
export interface AccountMenuClassNames {
|
|
11
11
|
trigger?: string;
|
|
12
12
|
triggerAvatar?: string;
|
|
13
|
-
/** Name and email block of the `sidebar` trigger
|
|
13
|
+
/** Name and email block of the `sidebar` trigger; it already leaves the icon rail of a collapsed `Sidebar`. */
|
|
14
14
|
triggerText?: string;
|
|
15
15
|
triggerName?: string;
|
|
16
16
|
triggerEmail?: string;
|
|
@@ -40,7 +40,10 @@ export interface AccountMenuProps {
|
|
|
40
40
|
onSignIn?: () => void;
|
|
41
41
|
/** Navigates to a sign-in page through the configured router adapter instead of calling `onSignIn`. */
|
|
42
42
|
signInHref?: string;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* `avatar` shows only the avatar; `sidebar` also shows name, email and a chevron, and inside the
|
|
45
|
+
* icon rail of a collapsed `Sidebar` shrinks to the centered avatar.
|
|
46
|
+
*/
|
|
44
47
|
triggerVariant?: "avatar" | "sidebar";
|
|
45
48
|
/** Adds a connected/disconnected badge to the avatar and greys it out while signed out. */
|
|
46
49
|
showStatusBadge?: boolean;
|
|
@@ -6,6 +6,7 @@ import { getNameInitials } from "../lib/name-initials.js";
|
|
|
6
6
|
import { Avatar, AvatarBadge, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
7
7
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
8
8
|
import { Link } from "./link.js";
|
|
9
|
+
import { useOptionalSidebarPanel } from "./sidebar-panel-context.js";
|
|
9
10
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
12
|
const ACCOUNT_MENU_DEFAULT_LABELS = {
|
|
@@ -105,7 +106,7 @@ function AccountAvatar(t0) {
|
|
|
105
106
|
* @returns The trigger and its menu.
|
|
106
107
|
*/
|
|
107
108
|
export function AccountMenu(t0) {
|
|
108
|
-
const $ = _c(
|
|
109
|
+
const $ = _c(80);
|
|
109
110
|
const { name, email, status, image: t1, avatarFallback, onSignOut, signOutDisabled: t2, onSignIn, signInHref, triggerVariant: t3, showStatusBadge: t4, tooltipLabel, labels, classNames, align: t5, side: t6, sideOffset: t7, children } = t0;
|
|
110
111
|
const image = t1 === undefined ? null : t1;
|
|
111
112
|
const signOutDisabled = t2 === undefined ? false : t2;
|
|
@@ -158,34 +159,38 @@ export function AccountMenu(t0) {
|
|
|
158
159
|
t10 = $[11];
|
|
159
160
|
}
|
|
160
161
|
const avatarProps = t10;
|
|
162
|
+
const sidebarPanel = useOptionalSidebarPanel();
|
|
163
|
+
const showsSidebarIdentity = triggerVariant === "sidebar" && !sidebarPanel?.collapsed;
|
|
161
164
|
const t11 = resolvedLabels.trigger;
|
|
162
165
|
const t12 = triggerVariant === "sidebar" && "w-full min-w-0 gap-2.5 rounded-lg p-1.5 text-left";
|
|
163
|
-
const t13 =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
const t13 = triggerVariant === "sidebar" && !showsSidebarIdentity && "justify-center gap-0";
|
|
167
|
+
const t14 = classNames?.trigger;
|
|
168
|
+
let t15;
|
|
169
|
+
if ($[12] !== t12 || $[13] !== t13 || $[14] !== t14) {
|
|
170
|
+
t15 = cn("inline-flex items-center rounded-full outline-none [-webkit-tap-highlight-color:transparent] transition-[box-shadow,opacity,transform] hover:opacity-90 active:scale-[0.96] focus-visible:shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--ring)] data-[state=open]:shadow-[0_0_0_2px_var(--background),0_0_0_4px_var(--ring)]", t12, t13, t14);
|
|
167
171
|
$[12] = t12;
|
|
168
172
|
$[13] = t13;
|
|
169
173
|
$[14] = t14;
|
|
174
|
+
$[15] = t15;
|
|
170
175
|
} else {
|
|
171
|
-
|
|
176
|
+
t15 = $[15];
|
|
172
177
|
}
|
|
173
|
-
const
|
|
174
|
-
let
|
|
175
|
-
if ($[
|
|
176
|
-
|
|
178
|
+
const t16 = classNames?.triggerAvatar;
|
|
179
|
+
let t17;
|
|
180
|
+
if ($[16] !== avatarProps || $[17] !== t16) {
|
|
181
|
+
t17 = /* @__PURE__ */ _jsx(AccountAvatar, {
|
|
177
182
|
...avatarProps,
|
|
178
|
-
className:
|
|
183
|
+
className: t16
|
|
179
184
|
});
|
|
180
|
-
$[
|
|
181
|
-
$[16] = t15;
|
|
185
|
+
$[16] = avatarProps;
|
|
182
186
|
$[17] = t16;
|
|
187
|
+
$[18] = t17;
|
|
183
188
|
} else {
|
|
184
|
-
|
|
189
|
+
t17 = $[18];
|
|
185
190
|
}
|
|
186
|
-
let
|
|
187
|
-
if ($[
|
|
188
|
-
|
|
191
|
+
let t18;
|
|
192
|
+
if ($[19] !== classNames?.triggerChevron || $[20] !== classNames?.triggerEmail || $[21] !== classNames?.triggerName || $[22] !== classNames?.triggerText || $[23] !== email || $[24] !== name || $[25] !== showsSidebarIdentity) {
|
|
193
|
+
t18 = showsSidebarIdentity ? /* @__PURE__ */ _jsxs(_Fragment, { children: [/* @__PURE__ */ _jsxs("span", {
|
|
189
194
|
className: cn("grid min-w-0 flex-1", classNames?.triggerText),
|
|
190
195
|
children: [/* @__PURE__ */ _jsx("span", {
|
|
191
196
|
className: cn("truncate text-sm font-semibold", classNames?.triggerName),
|
|
@@ -198,142 +203,142 @@ export function AccountMenu(t0) {
|
|
|
198
203
|
"aria-hidden": "true",
|
|
199
204
|
className: cn("size-4 shrink-0 text-muted-foreground", classNames?.triggerChevron)
|
|
200
205
|
})] }) : null;
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
206
|
+
$[19] = classNames?.triggerChevron;
|
|
207
|
+
$[20] = classNames?.triggerEmail;
|
|
208
|
+
$[21] = classNames?.triggerName;
|
|
209
|
+
$[22] = classNames?.triggerText;
|
|
210
|
+
$[23] = email;
|
|
211
|
+
$[24] = name;
|
|
212
|
+
$[25] = showsSidebarIdentity;
|
|
213
|
+
$[26] = t18;
|
|
209
214
|
} else {
|
|
210
|
-
|
|
215
|
+
t18 = $[26];
|
|
211
216
|
}
|
|
212
|
-
let
|
|
213
|
-
if ($[
|
|
217
|
+
let t19;
|
|
218
|
+
if ($[27] !== resolvedLabels.trigger || $[28] !== t15 || $[29] !== t17 || $[30] !== t18 || $[31] !== triggerVariant) {
|
|
214
219
|
const triggerButton = /* @__PURE__ */ _jsxs("button", {
|
|
215
220
|
"data-slot": "account-menu-trigger",
|
|
216
221
|
"data-variant": triggerVariant,
|
|
217
222
|
"aria-label": t11,
|
|
218
223
|
type: "button",
|
|
219
|
-
className:
|
|
220
|
-
children: [
|
|
224
|
+
className: t15,
|
|
225
|
+
children: [t17, t18]
|
|
221
226
|
});
|
|
222
|
-
|
|
227
|
+
t19 = /* @__PURE__ */ _jsx(DropdownMenuTrigger, {
|
|
223
228
|
asChild: true,
|
|
224
229
|
children: triggerButton
|
|
225
230
|
});
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[28] = t16;
|
|
231
|
+
$[27] = resolvedLabels.trigger;
|
|
232
|
+
$[28] = t15;
|
|
229
233
|
$[29] = t17;
|
|
230
|
-
$[30] =
|
|
231
|
-
$[31] =
|
|
234
|
+
$[30] = t18;
|
|
235
|
+
$[31] = triggerVariant;
|
|
236
|
+
$[32] = t19;
|
|
232
237
|
} else {
|
|
233
|
-
|
|
238
|
+
t19 = $[32];
|
|
234
239
|
}
|
|
235
|
-
const trigger =
|
|
236
|
-
let
|
|
237
|
-
if ($[
|
|
238
|
-
|
|
240
|
+
const trigger = t19;
|
|
241
|
+
let t20;
|
|
242
|
+
if ($[33] !== tooltipLabel || $[34] !== trigger) {
|
|
243
|
+
t20 = tooltipLabel ? /* @__PURE__ */ _jsx(TooltipTrigger, {
|
|
239
244
|
asChild: true,
|
|
240
245
|
children: trigger
|
|
241
246
|
}) : trigger;
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
247
|
+
$[33] = tooltipLabel;
|
|
248
|
+
$[34] = trigger;
|
|
249
|
+
$[35] = t20;
|
|
245
250
|
} else {
|
|
246
|
-
|
|
251
|
+
t20 = $[35];
|
|
247
252
|
}
|
|
248
|
-
const
|
|
249
|
-
let
|
|
250
|
-
if ($[
|
|
251
|
-
|
|
252
|
-
$[35] = t20;
|
|
253
|
+
const t21 = classNames?.content;
|
|
254
|
+
let t22;
|
|
255
|
+
if ($[36] !== t21) {
|
|
256
|
+
t22 = cn("min-w-56", t21);
|
|
253
257
|
$[36] = t21;
|
|
258
|
+
$[37] = t22;
|
|
254
259
|
} else {
|
|
255
|
-
|
|
260
|
+
t22 = $[37];
|
|
256
261
|
}
|
|
257
|
-
const
|
|
258
|
-
let
|
|
259
|
-
if ($[
|
|
260
|
-
|
|
261
|
-
$[37] = t22;
|
|
262
|
+
const t23 = classNames?.header;
|
|
263
|
+
let t24;
|
|
264
|
+
if ($[38] !== t23) {
|
|
265
|
+
t24 = cn("grid grid-cols-[auto_minmax(0,1fr)] items-center gap-2.5 px-2 py-1.5", t23);
|
|
262
266
|
$[38] = t23;
|
|
267
|
+
$[39] = t24;
|
|
263
268
|
} else {
|
|
264
|
-
|
|
269
|
+
t24 = $[39];
|
|
265
270
|
}
|
|
266
|
-
const
|
|
267
|
-
let
|
|
268
|
-
if ($[
|
|
269
|
-
|
|
271
|
+
const t25 = classNames?.headerAvatar;
|
|
272
|
+
let t26;
|
|
273
|
+
if ($[40] !== avatarProps || $[41] !== t25) {
|
|
274
|
+
t26 = /* @__PURE__ */ _jsx(AccountAvatar, {
|
|
270
275
|
...avatarProps,
|
|
271
276
|
isDecorative: true,
|
|
272
|
-
className:
|
|
277
|
+
className: t25
|
|
273
278
|
});
|
|
274
|
-
$[
|
|
275
|
-
$[40] = t24;
|
|
279
|
+
$[40] = avatarProps;
|
|
276
280
|
$[41] = t25;
|
|
281
|
+
$[42] = t26;
|
|
277
282
|
} else {
|
|
278
|
-
|
|
283
|
+
t26 = $[42];
|
|
279
284
|
}
|
|
280
|
-
let
|
|
281
|
-
if ($[
|
|
282
|
-
|
|
285
|
+
let t27;
|
|
286
|
+
if ($[43] !== name) {
|
|
287
|
+
t27 = /* @__PURE__ */ _jsx("span", {
|
|
283
288
|
className: "truncate text-sm leading-tight font-semibold",
|
|
284
289
|
children: name
|
|
285
290
|
});
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
291
|
+
$[43] = name;
|
|
292
|
+
$[44] = t27;
|
|
288
293
|
} else {
|
|
289
|
-
|
|
294
|
+
t27 = $[44];
|
|
290
295
|
}
|
|
291
|
-
let
|
|
292
|
-
if ($[
|
|
293
|
-
|
|
296
|
+
let t28;
|
|
297
|
+
if ($[45] !== email) {
|
|
298
|
+
t28 = /* @__PURE__ */ _jsx("span", {
|
|
294
299
|
className: "truncate text-xs leading-tight text-muted-foreground",
|
|
295
300
|
children: email
|
|
296
301
|
});
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
302
|
+
$[45] = email;
|
|
303
|
+
$[46] = t28;
|
|
299
304
|
} else {
|
|
300
|
-
|
|
305
|
+
t28 = $[46];
|
|
301
306
|
}
|
|
302
|
-
let
|
|
303
|
-
if ($[
|
|
304
|
-
|
|
307
|
+
let t29;
|
|
308
|
+
if ($[47] !== t27 || $[48] !== t28) {
|
|
309
|
+
t29 = /* @__PURE__ */ _jsxs("span", {
|
|
305
310
|
className: "grid min-w-0 gap-px",
|
|
306
|
-
children: [
|
|
311
|
+
children: [t27, t28]
|
|
307
312
|
});
|
|
308
|
-
$[46] = t26;
|
|
309
313
|
$[47] = t27;
|
|
310
314
|
$[48] = t28;
|
|
315
|
+
$[49] = t29;
|
|
311
316
|
} else {
|
|
312
|
-
|
|
317
|
+
t29 = $[49];
|
|
313
318
|
}
|
|
314
|
-
let
|
|
315
|
-
if ($[
|
|
316
|
-
|
|
317
|
-
className:
|
|
318
|
-
children: [
|
|
319
|
+
let t30;
|
|
320
|
+
if ($[50] !== t24 || $[51] !== t26 || $[52] !== t29) {
|
|
321
|
+
t30 = /* @__PURE__ */ _jsxs("div", {
|
|
322
|
+
className: t24,
|
|
323
|
+
children: [t26, t29]
|
|
319
324
|
});
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
$[51] = t28;
|
|
325
|
+
$[50] = t24;
|
|
326
|
+
$[51] = t26;
|
|
323
327
|
$[52] = t29;
|
|
324
|
-
} else {
|
|
325
|
-
t29 = $[52];
|
|
326
|
-
}
|
|
327
|
-
let t30;
|
|
328
|
-
if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
|
|
329
|
-
t30 = /* @__PURE__ */ _jsx(DropdownMenuSeparator, {});
|
|
330
328
|
$[53] = t30;
|
|
331
329
|
} else {
|
|
332
330
|
t30 = $[53];
|
|
333
331
|
}
|
|
334
332
|
let t31;
|
|
335
|
-
if ($[54]
|
|
336
|
-
t31 =
|
|
333
|
+
if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
|
|
334
|
+
t31 = /* @__PURE__ */ _jsx(DropdownMenuSeparator, {});
|
|
335
|
+
$[54] = t31;
|
|
336
|
+
} else {
|
|
337
|
+
t31 = $[54];
|
|
338
|
+
}
|
|
339
|
+
let t32;
|
|
340
|
+
if ($[55] !== classNames?.item || $[56] !== isAuthenticated || $[57] !== onSignIn || $[58] !== onSignOut || $[59] !== resolvedLabels.signIn || $[60] !== resolvedLabels.signOut || $[61] !== signInHref || $[62] !== signOutDisabled) {
|
|
341
|
+
t32 = isAuthenticated ? /* @__PURE__ */ _jsxs(DropdownMenuItem, {
|
|
337
342
|
className: classNames?.item,
|
|
338
343
|
disabled: signOutDisabled,
|
|
339
344
|
onSelect: () => void onSignOut(),
|
|
@@ -350,77 +355,77 @@ export function AccountMenu(t0) {
|
|
|
350
355
|
onSelect: () => onSignIn?.(),
|
|
351
356
|
children: [/* @__PURE__ */ _jsx(LogInIcon, { "aria-hidden": "true" }), resolvedLabels.signIn]
|
|
352
357
|
});
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
$[
|
|
356
|
-
$[
|
|
357
|
-
$[
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
360
|
-
$[
|
|
361
|
-
$[
|
|
358
|
+
$[55] = classNames?.item;
|
|
359
|
+
$[56] = isAuthenticated;
|
|
360
|
+
$[57] = onSignIn;
|
|
361
|
+
$[58] = onSignOut;
|
|
362
|
+
$[59] = resolvedLabels.signIn;
|
|
363
|
+
$[60] = resolvedLabels.signOut;
|
|
364
|
+
$[61] = signInHref;
|
|
365
|
+
$[62] = signOutDisabled;
|
|
366
|
+
$[63] = t32;
|
|
362
367
|
} else {
|
|
363
|
-
|
|
368
|
+
t32 = $[63];
|
|
364
369
|
}
|
|
365
|
-
let
|
|
366
|
-
if ($[
|
|
367
|
-
|
|
370
|
+
let t33;
|
|
371
|
+
if ($[64] !== align || $[65] !== children || $[66] !== side || $[67] !== sideOffset || $[68] !== t22 || $[69] !== t30 || $[70] !== t32) {
|
|
372
|
+
t33 = /* @__PURE__ */ _jsxs(DropdownMenuContent, {
|
|
368
373
|
"data-slot": "account-menu-content",
|
|
369
374
|
align,
|
|
370
375
|
side,
|
|
371
376
|
sideOffset,
|
|
372
|
-
className:
|
|
377
|
+
className: t22,
|
|
373
378
|
children: [
|
|
374
|
-
t29,
|
|
375
379
|
t30,
|
|
380
|
+
t31,
|
|
376
381
|
children,
|
|
377
|
-
|
|
382
|
+
t32
|
|
378
383
|
]
|
|
379
384
|
});
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
382
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
$[
|
|
386
|
-
$[69] = t31;
|
|
385
|
+
$[64] = align;
|
|
386
|
+
$[65] = children;
|
|
387
|
+
$[66] = side;
|
|
388
|
+
$[67] = sideOffset;
|
|
389
|
+
$[68] = t22;
|
|
390
|
+
$[69] = t30;
|
|
387
391
|
$[70] = t32;
|
|
392
|
+
$[71] = t33;
|
|
388
393
|
} else {
|
|
389
|
-
|
|
394
|
+
t33 = $[71];
|
|
390
395
|
}
|
|
391
|
-
let
|
|
392
|
-
if ($[
|
|
393
|
-
|
|
394
|
-
$[
|
|
395
|
-
$[72] = t32;
|
|
396
|
+
let t34;
|
|
397
|
+
if ($[72] !== t20 || $[73] !== t33) {
|
|
398
|
+
t34 = /* @__PURE__ */ _jsxs(DropdownMenu, { children: [t20, t33] });
|
|
399
|
+
$[72] = t20;
|
|
396
400
|
$[73] = t33;
|
|
401
|
+
$[74] = t34;
|
|
397
402
|
} else {
|
|
398
|
-
|
|
403
|
+
t34 = $[74];
|
|
399
404
|
}
|
|
400
|
-
const menu =
|
|
405
|
+
const menu = t34;
|
|
401
406
|
if (!tooltipLabel) {
|
|
402
407
|
return menu;
|
|
403
408
|
}
|
|
404
|
-
let
|
|
405
|
-
if ($[
|
|
406
|
-
|
|
409
|
+
let t35;
|
|
410
|
+
if ($[75] !== tooltipLabel) {
|
|
411
|
+
t35 = /* @__PURE__ */ _jsx(TooltipContent, {
|
|
407
412
|
side: "bottom",
|
|
408
413
|
sideOffset: 8,
|
|
409
414
|
children: tooltipLabel
|
|
410
415
|
});
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
416
|
+
$[75] = tooltipLabel;
|
|
417
|
+
$[76] = t35;
|
|
413
418
|
} else {
|
|
414
|
-
|
|
419
|
+
t35 = $[76];
|
|
415
420
|
}
|
|
416
|
-
let
|
|
417
|
-
if ($[
|
|
418
|
-
|
|
419
|
-
$[
|
|
420
|
-
$[77] = t34;
|
|
421
|
+
let t36;
|
|
422
|
+
if ($[77] !== menu || $[78] !== t35) {
|
|
423
|
+
t36 = /* @__PURE__ */ _jsxs(Tooltip, { children: [menu, t35] });
|
|
424
|
+
$[77] = menu;
|
|
421
425
|
$[78] = t35;
|
|
426
|
+
$[79] = t36;
|
|
422
427
|
} else {
|
|
423
|
-
|
|
428
|
+
t36 = $[79];
|
|
424
429
|
}
|
|
425
|
-
return
|
|
430
|
+
return t36;
|
|
426
431
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: panel state shared by the sidebar parts and by components that adapt to the icon rail
|
|
3
|
+
* (such as `AccountMenu`), kept apart so they can read it without importing the sidebar itself.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
export type SidebarPanelState = {
|
|
7
|
+
/** Whether the desktop sidebar is shrunk to its icon rail; always false in the mobile sheet. */
|
|
8
|
+
collapsed: boolean;
|
|
9
|
+
collapsible: "offcanvas" | "icon" | "none";
|
|
10
|
+
side: "left" | "right";
|
|
11
|
+
};
|
|
12
|
+
export declare const SidebarPanelContext: React.Context<SidebarPanelState | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Reads the panel state when rendered inside a `Sidebar`, and `null` anywhere else.
|
|
15
|
+
* @returns The panel state, or `null` outside a sidebar.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useOptionalSidebarPanel(): SidebarPanelState | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* Internal: panel state shared by the sidebar parts and by components that adapt to the icon rail
|
|
4
|
+
* (such as `AccountMenu`), kept apart so they can read it without importing the sidebar itself.
|
|
5
|
+
*/
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
export const SidebarPanelContext = React.createContext(null);
|
|
8
|
+
/**
|
|
9
|
+
* Reads the panel state when rendered inside a `Sidebar`, and `null` anywhere else.
|
|
10
|
+
* @returns The panel state, or `null` outside a sidebar.
|
|
11
|
+
*/
|
|
12
|
+
export function useOptionalSidebarPanel() {
|
|
13
|
+
return React.use(SidebarPanelContext);
|
|
14
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { type HTMLMotionProps } from "motion/react";
|
|
10
|
+
import { type SidebarPanelState } from "./sidebar-panel-context.js";
|
|
10
11
|
type SidebarState = "expanded" | "collapsed";
|
|
11
12
|
type SidebarSide = "left" | "right";
|
|
12
13
|
type SidebarVariant = "sidebar" | "floating" | "inset";
|
|
@@ -31,6 +32,13 @@ type SidebarContextValue = {
|
|
|
31
32
|
* @returns Open state for desktop and mobile, viewport and motion flags, and state setters.
|
|
32
33
|
*/
|
|
33
34
|
declare function useSidebar(): SidebarContextValue;
|
|
35
|
+
/**
|
|
36
|
+
* Reads the state of the enclosing `Sidebar` panel, so product content can adapt to the icon rail
|
|
37
|
+
* without depending on its DOM attributes.
|
|
38
|
+
* @returns Whether the panel is collapsed to its icon rail (always false in the mobile sheet), its
|
|
39
|
+
* collapse mode and its side.
|
|
40
|
+
*/
|
|
41
|
+
declare function useSidebarPanel(): SidebarPanelState;
|
|
34
42
|
type SidebarProviderStyle = React.CSSProperties & {
|
|
35
43
|
"--sidebar-width"?: string;
|
|
36
44
|
"--sidebar-width-icon"?: string;
|
|
@@ -48,14 +56,18 @@ export type SidebarProviderProps = React.ComponentProps<"div"> & {
|
|
|
48
56
|
onOpenMobileChange?: (open: boolean) => void;
|
|
49
57
|
/** Opts into local persistence without changing the shared SSR cookie contract. */
|
|
50
58
|
storageKey?: string;
|
|
59
|
+
/** Cookie that keeps the desktop state for server entrypoints; defaults to `sidebar_state`. */
|
|
60
|
+
cookieName?: string;
|
|
61
|
+
/** Lifetime of that cookie in seconds; defaults to seven days. */
|
|
62
|
+
cookieMaxAge?: number;
|
|
51
63
|
style?: SidebarProviderStyle;
|
|
52
64
|
};
|
|
53
65
|
/**
|
|
54
66
|
* Owns the open state of the sidebar, the ⌘B / Ctrl+B shortcut and the layout wrapper.
|
|
55
|
-
* @param props - Controlled or default state for both viewports, persistence
|
|
67
|
+
* @param props - Controlled or default state for both viewports, persistence options and wrapper attributes.
|
|
56
68
|
* @returns The wrapper that lays out the sidebar next to its inset.
|
|
57
69
|
*/
|
|
58
|
-
declare function SidebarProvider({ children, open: openProp, defaultOpen, onOpenChange, openMobile: openMobileProp, defaultOpenMobile, onOpenMobileChange, storageKey, className, style, ...props }: SidebarProviderProps): React.JSX.Element;
|
|
70
|
+
declare function SidebarProvider({ children, open: openProp, defaultOpen, onOpenChange, openMobile: openMobileProp, defaultOpenMobile, onOpenMobileChange, storageKey, cookieName, cookieMaxAge, className, style, ...props }: SidebarProviderProps): React.JSX.Element;
|
|
59
71
|
export type SidebarProps = Omit<HTMLMotionProps<"aside">, "children"> & {
|
|
60
72
|
children?: React.ReactNode;
|
|
61
73
|
side?: SidebarSide;
|
|
@@ -99,6 +111,31 @@ declare function SidebarInset({ className, ...props }: HTMLMotionProps<"main">):
|
|
|
99
111
|
declare function SidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
100
112
|
declare function SidebarContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
101
113
|
declare function SidebarFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
114
|
+
export type SidebarLabelProps = React.ComponentProps<"span"> & {
|
|
115
|
+
/** Renders the child element instead of a `span`, for example a paragraph. */
|
|
116
|
+
asChild?: boolean;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Product text that only makes sense in the expanded sidebar, such as a workspace name or an empty
|
|
120
|
+
* state: it leaves the layout while the panel is the icon rail and always shows in the mobile sheet.
|
|
121
|
+
* @param props - Span attributes, or `asChild` to keep the child element.
|
|
122
|
+
* @returns The content, or nothing in the icon rail.
|
|
123
|
+
*/
|
|
124
|
+
declare function SidebarLabel({ asChild, ...props }: SidebarLabelProps): React.JSX.Element | null;
|
|
125
|
+
export type SidebarBrandButtonProps = React.ComponentProps<"button"> & {
|
|
126
|
+
/** Square tile such as a logo or initials; it stays visible in the icon rail. */
|
|
127
|
+
icon: React.ReactNode;
|
|
128
|
+
/** Trailing affordance such as a chevron, hidden in the icon rail. */
|
|
129
|
+
trailing?: React.ReactNode;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Header row that identifies the workspace, often the trigger of a workspace switcher. It forwards
|
|
133
|
+
* its props and ref to the `button`, so it works as `DropdownMenuTrigger asChild`, and keeps its tile
|
|
134
|
+
* on the menu icon column while the label and trailing content leave in the icon rail.
|
|
135
|
+
* @param props - Tile, label, trailing content and native button attributes.
|
|
136
|
+
* @returns The brand button.
|
|
137
|
+
*/
|
|
138
|
+
declare function SidebarBrandButton({ icon, trailing, children, className, type, ...props }: SidebarBrandButtonProps): React.JSX.Element;
|
|
102
139
|
declare function SidebarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
103
140
|
/** Section heading that fades out of the icon rail and is hidden from assistive technology there. */
|
|
104
141
|
declare function SidebarGroupLabel({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
@@ -155,4 +192,4 @@ export type SidebarMenuButtonProps = SidebarActionProps & {
|
|
|
155
192
|
* @returns The menu link or button.
|
|
156
193
|
*/
|
|
157
194
|
declare function SidebarMenuButton({ children, icon, badge, href, isActive, ariaExpanded, disabled, closeOnSelect, target, rel, onSelect, className, }: SidebarMenuButtonProps): React.JSX.Element;
|
|
158
|
-
export { Sidebar, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar, };
|
|
195
|
+
export { Sidebar, SidebarBrandButton, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar, useSidebarPanel, };
|