@cbrl/design 0.9.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.
Files changed (56) hide show
  1. package/README.md +173 -23
  2. package/dist/components/account-settings.d.ts +24 -0
  3. package/dist/components/account-settings.js +49 -0
  4. package/dist/components/alert-dialog.d.ts +5 -1
  5. package/dist/components/alert-dialog.js +2 -2
  6. package/dist/components/app-shell.d.ts +66 -10
  7. package/dist/components/app-shell.js +284 -53
  8. package/dist/components/avatar.d.ts +7 -2
  9. package/dist/components/avatar.js +28 -6
  10. package/dist/components/badge.js +1 -1
  11. package/dist/components/button-group.d.ts +1 -1
  12. package/dist/components/button-group.js +1 -1
  13. package/dist/components/button.js +1 -1
  14. package/dist/components/container.d.ts +1 -1
  15. package/dist/components/container.js +1 -1
  16. package/dist/components/dropdown-menu.d.ts +5 -1
  17. package/dist/components/dropdown-menu.js +3 -3
  18. package/dist/components/field.d.ts +1 -1
  19. package/dist/components/field.js +1 -1
  20. package/dist/components/list.js +1 -1
  21. package/dist/components/main.js +1 -1
  22. package/dist/components/page-header.js +3 -3
  23. package/dist/components/settings-dialog-mobile.d.ts +23 -0
  24. package/dist/components/settings-dialog-mobile.js +198 -0
  25. package/dist/components/settings-dialog.d.ts +96 -10
  26. package/dist/components/settings-dialog.js +264 -29
  27. package/dist/components/settings-mobile-blocks.d.ts +25 -0
  28. package/dist/components/settings-mobile-blocks.js +126 -0
  29. package/dist/components/sidebar-core.js +7 -7
  30. package/dist/components/sidebar-menu.js +1 -1
  31. package/dist/components/sidebar-peek.d.ts +40 -0
  32. package/dist/components/sidebar-peek.js +204 -0
  33. package/dist/components/status-dot.js +1 -1
  34. package/dist/components/table.d.ts +8 -1
  35. package/dist/components/table.js +5 -4
  36. package/dist/components/tabs.d.ts +1 -1
  37. package/dist/components/tabs.js +1 -1
  38. package/dist/components/theme-provider.d.ts +1 -1
  39. package/dist/components/theme-provider.js +4 -1
  40. package/dist/components/theme-setting.d.ts +12 -0
  41. package/dist/components/theme-setting.js +66 -0
  42. package/dist/components/tooltip.js +7 -1
  43. package/dist/components/typography.js +1 -1
  44. package/dist/components/user-menu.d.ts +17 -0
  45. package/dist/components/user-menu.js +40 -12
  46. package/dist/components/workspace-picker.d.ts +21 -0
  47. package/dist/components/workspace-picker.js +51 -0
  48. package/dist/globals.css +33 -0
  49. package/dist/hooks/use-autosave-form.d.ts +36 -0
  50. package/dist/hooks/use-autosave-form.js +81 -0
  51. package/dist/hooks/use-mobile.d.ts +1 -0
  52. package/dist/hooks/use-mobile.js +14 -7
  53. package/dist/index.d.ts +13 -6
  54. package/dist/index.js +8 -3
  55. package/dist/lib/mobile-chrome.js +12 -0
  56. package/package.json +1 -1
package/README.md CHANGED
@@ -27,13 +27,15 @@ this package.
27
27
 
28
28
  Mount `ThemeProvider` (a client wrapper over `next-themes`, same props) and
29
29
  `<Toaster />` in the root layout if you use dark mode or toasts. `next-themes`
30
- is a peer dependency so the app and the toaster share one theme state.
30
+ is a peer dependency so the app and the toaster share one theme state. It
31
+ defaults to `attribute="class"`, `defaultTheme="system"` and `enableSystem`:
32
+ the app follows the system until the user picks a theme (`ThemeSetting`).
31
33
 
32
34
  ```tsx
33
35
  // src/app/layout.tsx
34
36
  import { ThemeProvider, Toaster } from '@cbrl/design'
35
37
 
36
- ;<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
38
+ ;<ThemeProvider disableTransitionOnChange>
37
39
  {children}
38
40
  <Toaster />
39
41
  </ThemeProvider>
@@ -240,6 +242,20 @@ their built-in close button (default `"Close"`).
240
242
  grouped navigation and footer, sticky header, content inset). Routing stays in
241
243
  the app: you render each nav link, so the package never imports `next`.
242
244
 
245
+ By default (`collapsible="offcanvas"`) it behaves like the Claude app on `md+`:
246
+ a fixed toolbar on the top left holds the sidebar toggle (`Ctrl/⌘+B`) and the
247
+ history back/forward buttons (disabled, as in the Claude app, when the
248
+ browser's Navigation API says there is nowhere to go); collapsed, the sidebar is fully hidden, and
249
+ hovering the toggle or the window's left edge (the rail) slides it in over the
250
+ content until the pointer leaves; clicking pins it, and clicking the rail of a
251
+ pinned sidebar collapses it. `collapsible="icon"` keeps the rail of icons and
252
+ the toggle in the header. Toolbar texts: `toolbarLabels`. With nothing in
253
+ `headerStart`/`headerEnd`, the top bar shows only on phones (where it holds the
254
+ sidebar trigger and `account`), as in the Claude app: put context switchers in
255
+ the account menu and the primary action in `primaryAction` (a nav item: the
256
+ first, highlighted row of the sidebar list, e.g. "Criar"). `brand` is optional; the Claude-app chrome
257
+ leaves it out.
258
+
243
259
  ```tsx
244
260
  'use client'
245
261
 
@@ -273,9 +289,47 @@ export function AppShell({ children }: { children: React.ReactNode }) {
273
289
  }
274
290
  ```
275
291
 
276
- The shell handles the `<nav aria-label>` landmark, the active item, closing the
292
+ The content scrolls in one container that keeps a stable scrollbar gutter (no
293
+ shift when a page starts to scroll); a screen that fills the viewport marks an
294
+ element `data-fills-viewport` to drop the gutter. The shell handles the
295
+ `<nav aria-label>` landmark, the active item, closing the
277
296
  mobile drawer and tooltips when collapsed. The sidebar primitives (`Sidebar`,
278
- `SidebarProvider`, `SidebarMenu*`, `useSidebar`, …) are exported for custom shells.
297
+ `SidebarProvider`, `SidebarMenu*`, `useSidebar`, …) are exported for custom shells,
298
+ and so is the Claude-app behavior: inside `SidebarProvider`, wrap the shell in
299
+ `SidebarPeekProvider` and use `PeekSidebar` (instead of `Sidebar`) and
300
+ `AppToolbar`; leave `APP_TOOLBAR_HEIGHT` free at the top of the sidebar and of
301
+ the content. `useSidebarPeek()` tells whether the sidebar is peeking.
302
+
303
+ #### On phones
304
+
305
+ Below `md` (the same `useIsMobile` signal the sidebar folds on) the shell takes
306
+ the Claude iOS app's layout; tablets and desktops are unchanged:
307
+
308
+ - **Header:** a round menu button on the left, the screen title centered (the
309
+ active nav item's label, or `title`) and `headerEnd` on the right. No border.
310
+ - **Drawer:** most of the screen wide, brand on top, routes as native rows
311
+ (48px, 17px label, 24px icon), `headerStart` under the brand; at the bottom
312
+ the account on the left and the `primaryAction` pill beside it. The account
313
+ is, in order: `mobileAccount` (the Claude app's round initials; tapping runs
314
+ `onOpen`, typically opening the settings — no menu), else `account`, else
315
+ `footer` folded into a round button showing only its first child.
316
+ - **Create:** `primaryAction` also floats as a pill on the bottom right of the
317
+ content (the content scroller leaves room for it).
318
+ - **Safe areas:** the header clears the status bar/notch and the content, the
319
+ drawer and the settings sheet clear the home indicator / gesture bar. They
320
+ only apply when the app opts into edge-to-edge, which every app should:
321
+
322
+ ```ts
323
+ // app/layout.tsx
324
+ export const viewport: Viewport = { viewportFit: 'cover' /* … */ }
325
+ ```
326
+
327
+ The `pt-safe`, `pb-safe` and `px-safe` utilities do the same on an app's own
328
+ fixed or full-screen surfaces.
329
+
330
+ - **Type scale:** the root font is 17px (iOS Body) on phones, so `text-base` is
331
+ 17px, `text-sm` ≈ 15 (Subheadline), `text-xs` ≈ 13 (Footnote), and icons,
332
+ rows and touch targets grow with it. Desktop keeps 16px.
279
333
 
280
334
  ### Tabs and scrolling strips
281
335
 
@@ -309,52 +363,148 @@ return <div ref={ref}>{width > 480 ? <Wide /> : <Narrow />}</div>
309
363
 
310
364
  ### Settings dialog
311
365
 
312
- `SettingsDialog` is the settings-modal shell: a section nav (a column from
313
- `sm`, a sideways-scrolling strip on phones that keeps the active section in
314
- view), a header with the active section's label and description, and a
315
- scrolling content area. The app decides which sections a user sees and loads
316
- each section's data; the dialog only renders `children` for the active one.
317
- `useHashSection(prefix, keys?)` routes it through `#<prefix>/<section>`
318
- (`hashchange` in, `history.replaceState` on switch and close):
366
+ `SettingsDialog` is the settings modal in the Claude app's layout: a
367
+ "Configurações" title bar, a filled search box (with a clear button) over the
368
+ section nav (a column from `sm`, a sideways-scrolling strip on phones that keeps
369
+ the active section in view), and the active section's content. The search
370
+ matches section labels and `keywords`, ignoring case, accents and plurals;
371
+ Enter opens the first match and Escape clears the search before closing.
372
+ Sections sharing a `group` sit together, with a divider between groups.
373
+
374
+ Build sections from `SettingsGroup` (a titled block, optional `action`) and
375
+ `SettingsItem` (label and description on the left, the control on the right).
376
+ The sections every app has ship ready: `AccountSettings` (profile: photo, name,
377
+ e-mail; signing out stays in the user menu) and `ThemeSetting` (system / light /
378
+ dark, system by default). App-specific sections stay in the app, which decides
379
+ which sections a user sees and loads their data; the dialog renders `children`
380
+ for the active one. `useHashSection(prefix, keys?)` routes it through
381
+ `#<prefix>/<section>` (`hashchange` in, `history.replaceState` on switch and
382
+ close):
319
383
 
320
384
  ```tsx
321
385
  'use client'
322
386
 
323
- import { SettingsDialog, useHashSection, type SettingsDialogSection } from '@cbrl/design'
324
- import { CreditCard, User } from 'lucide-react'
387
+ import {
388
+ AccountSettings,
389
+ SettingsDialog,
390
+ SettingsGroup,
391
+ SettingsItem,
392
+ ThemeSetting,
393
+ useHashSection,
394
+ type SettingsAccount,
395
+ type SettingsDialogSection,
396
+ } from '@cbrl/design'
397
+ import { CircleUser, CreditCard, Palette } from 'lucide-react'
325
398
 
326
- type Key = 'profile' | 'billing'
399
+ type Key = 'conta' | 'aparencia' | 'cobranca'
327
400
  const SECTIONS: readonly SettingsDialogSection<Key>[] = [
328
- { key: 'profile', label: 'Perfil', icon: User, description: 'Seu nome e foto.' },
329
- { key: 'billing', label: 'Cobrança', icon: CreditCard },
401
+ { key: 'conta', label: 'Conta', icon: CircleUser, group: 'conta', keywords: ['perfil'] },
402
+ { key: 'aparencia', label: 'Aparência', icon: Palette, group: 'app', keywords: ['tema'] },
403
+ { key: 'cobranca', label: 'Cobrança', icon: CreditCard, group: 'produto' },
330
404
  ]
331
405
 
332
- export function SettingsModal() {
333
- const { section, open, close } = useHashSection<Key>('settings', ['profile', 'billing'])
406
+ export function SettingsModal({ account }: { account: SettingsAccount }) {
407
+ const { section, open, close } = useHashSection<Key>('configuracoes', [
408
+ 'conta',
409
+ 'aparencia',
410
+ 'cobranca',
411
+ ])
334
412
  return (
335
413
  <SettingsDialog
336
414
  open={section !== null}
337
415
  onOpenChange={(next) => !next && close()}
338
416
  sections={SECTIONS}
339
- value={section ?? 'profile'}
417
+ value={section ?? 'conta'}
340
418
  onValueChange={open}
341
- navLabel="Seções de configuração"
342
419
  >
343
- {section === 'billing' ? <BillingPanel /> : <ProfilePanel />}
420
+ {section === 'conta' && <AccountSettings account={account} />}
421
+ {section === 'aparencia' && (
422
+ <SettingsGroup title="Geral">
423
+ <SettingsItem label="Tema">
424
+ <ThemeSetting />
425
+ </SettingsItem>
426
+ </SettingsGroup>
427
+ )}
428
+ {section === 'cobranca' && <BillingPanel />}
344
429
  </SettingsDialog>
345
430
  )
346
431
  }
347
- // Anywhere: <a href="#settings/billing">Cobrança</a>
432
+ // Anywhere: <a href="#configuracoes/cobranca">Cobrança</a>
348
433
  ```
349
434
 
435
+ Rows: `SettingsItem` puts the label (a real `<label>` with `htmlFor`) and an
436
+ optional description on the left and the control on the right, with inputs
437
+ and select triggers at the standard compact width; `layout="stacked"` puts a
438
+ large control (a textarea) under the label. For a variable set of rows (units,
439
+ rules) give the group a `listLabel` and render `SettingsItem as="li"`; an empty
440
+ group shows `SettingsEmpty`. Small actions go in the group's `action`, never as
441
+ big buttons at the end. Fields that save themselves (no "Salvar" button) use `useAutosaveForm({ submit,
442
+ successMessage, onSaved })`: spread `formProps` on the `<form>`; text fields
443
+ (uncontrolled, with `defaultValue`) save on blur or Enter and Escape undoes;
444
+ selects, switches and pickers call `saveSoon()` after changing. A value set
445
+ by a picker goes in a hidden input controlled by state (`value={state}`), then
446
+ `saveSoon()` — an uncontrolled hidden input is reset by React's re-render
447
+ before the save reads it. Pass the router's refresh as `onSaved` when the
448
+ page must reload its data.
449
+
450
+ Account menus composed by apps start with
451
+ `DropdownMenuAccountHeader` (the `UserMenu` header) and use `USER_MENU_WIDTH`.
452
+
453
+ Texts default to pt-BR; override them with `labels` (`title`, `nav`, `search`,
454
+ `searchPlaceholder`, `clearSearch`, `noResults`) on the dialog, and `labels` on
455
+ `AccountSettings` and `ThemeSetting`.
456
+
350
457
  Next.js App Router: a fragment-only navigation (plain `<a href="#…">`, a typed
351
458
  URL) bypasses the router, whose history sync then rewrites the URL without the
352
459
  hash and would close the dialog at once. The hook re-states the URL through
353
460
  `history.replaceState` on `hashchange` (keeping `history.state`, also in
354
461
  `open`/`close`) so the router adopts it; outside Next this is a no-op.
355
462
 
463
+ On phones the dialog is a full-screen sheet, as in the Claude iOS app: its home
464
+ lists the sections in inset cards, one per `group` (the group is the card's
465
+ heading), each row with icon, label and chevron; a row pushes its section with
466
+ a round back button, and every opening starts at the list. Two optional props
467
+ feed that home:
468
+
469
+ ```tsx
470
+ <SettingsDialog
471
+ sections={SECTIONS}
472
+ // Identity card on top; `section` makes it open the profile.
473
+ account={{ name, secondary: `${email} · Free`, avatarUrl, section: 'conta' }}
474
+ // The round (i) in the header: version, policies, then support.
475
+ about={{
476
+ version: `Fluxi v${version} (${commit})`,
477
+ links: [
478
+ { label: 'Termos de uso', href: '/termos' },
479
+ { label: 'Política de privacidade', href: '/privacidade' },
480
+ { label: 'Licenças', href: '/licencas', kind: 'document' },
481
+ ],
482
+ support: [{ label: 'Ajuda e suporte', href: 'https://…' }],
483
+ }}
484
+ />
485
+ ```
486
+
487
+ Three more phone-only props complete the Claude home:
488
+
489
+ - `workspaces` — `{ items, current, onSelect, onAdd?, addLabel? }`: the
490
+ switcher card on top (avatar on the current one, a check, "Adicionar…"); it
491
+ takes the place of the `account` card.
492
+ - `appearance` — the Claro / Escuro / Sistema tiles at the end of the home
493
+ (next-themes). Pass the key of the app's own appearance section instead of
494
+ `true` to drop that section there.
495
+ - `signOut` — `{ onSelect, label? }`: "Sair" as the last row. With the account
496
+ opening the settings directly, this is where signing out lives on phones.
497
+
498
+ `SettingsGroup` turns into a card and `SettingsItem` into a 56px row with a
499
+ 17px label there too, so a section's content needs no phone-specific code.
500
+
501
+ `WorkspacePicker` is the first-run choice ("Escolha uma organização"): brand on
502
+ top, a large title and one card of workspaces (icon, kind over the name), an
503
+ optional footer link; full screen, clear of the safe areas.
504
+
356
505
  Uncontrolled use: `defaultOpen`/`defaultValue`. Slots: `settings-dialog`,
357
- `settings-dialog-nav`, `settings-dialog-content`.
506
+ `settings-dialog-nav`, `settings-dialog-content`, `settings-group`,
507
+ `settings-item`.
358
508
 
359
509
  ### Forms (react-hook-form)
360
510
 
@@ -0,0 +1,24 @@
1
+ export type SettingsAccount = {
2
+ name: string | null;
3
+ email: string | null;
4
+ avatarUrl: string | null;
5
+ };
6
+ export type AccountSettingsLabels = {
7
+ profile: string;
8
+ photo: string;
9
+ name: string;
10
+ email: string;
11
+ };
12
+ export declare function AccountSettings({ account, labels: labelsProp, profileRows, children }: {
13
+ account: SettingsAccount;
14
+ labels?: Partial<AccountSettingsLabels>;
15
+ /**
16
+ * The app's editable profile rows (`SettingsItem`s: full name, phone…),
17
+ * inside the same Perfil group after the photo — everything about the person
18
+ * in one place, as in the Claude app. With them, the read-only Nome row is
19
+ * left out (the app edits the name).
20
+ */
21
+ profileRows?: React.ReactNode;
22
+ /** App-specific groups, after the profile. */
23
+ children?: React.ReactNode;
24
+ }): import("react").JSX.Element;
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { initials } from "../lib/initials.js";
3
+ import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
4
+ import { SettingsGroup, SettingsItem } from "./settings-dialog.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/account-settings.tsx
7
+ const DEFAULT_LABELS = {
8
+ profile: "Perfil",
9
+ photo: "Foto de perfil",
10
+ name: "Nome",
11
+ email: "E-mail"
12
+ };
13
+ function AccountSettings({ account, labels: labelsProp, profileRows, children }) {
14
+ const labels = {
15
+ ...DEFAULT_LABELS,
16
+ ...labelsProp
17
+ };
18
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SettingsGroup, {
19
+ title: labels.profile,
20
+ children: [
21
+ /* @__PURE__ */ jsx(SettingsItem, {
22
+ label: labels.photo,
23
+ children: /* @__PURE__ */ jsxs(Avatar, {
24
+ size: "lg",
25
+ children: [account.avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
26
+ src: account.avatarUrl,
27
+ alt: account.name ?? account.email ?? ""
28
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: initials(account.name, account.email) })]
29
+ })
30
+ }),
31
+ account.name && profileRows === void 0 ? /* @__PURE__ */ jsx(SettingsItem, {
32
+ label: labels.name,
33
+ children: /* @__PURE__ */ jsx("span", {
34
+ className: "text-muted-foreground truncate text-sm",
35
+ children: account.name
36
+ })
37
+ }) : null,
38
+ account.email ? /* @__PURE__ */ jsx(SettingsItem, {
39
+ label: labels.email,
40
+ children: /* @__PURE__ */ jsx("span", {
41
+ className: "text-muted-foreground truncate text-sm",
42
+ children: account.email
43
+ })
44
+ }) : null,
45
+ profileRows
46
+ ]
47
+ }), children] });
48
+ }
49
+ export { AccountSettings };
@@ -1,3 +1,4 @@
1
+ import { buttonVariants } from "./button.js";
1
2
  import * as React from "react";
2
3
  import { AlertDialog as AlertDialog$1 } from "radix-ui";
3
4
  declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialog$1.Root>): React.JSX.Element;
@@ -9,6 +10,9 @@ declare function AlertDialogHeader({ className, ...props }: React.ComponentProps
9
10
  declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
10
11
  declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialog$1.Title>): React.JSX.Element;
11
12
  declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialog$1.Description>): React.JSX.Element;
12
- declare function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof AlertDialog$1.Action>): React.JSX.Element;
13
+ declare function AlertDialogAction({ className, variant, ...props }: React.ComponentProps<typeof AlertDialog$1.Action> & {
14
+ /** Button look of the confirming action (destructive by default). */
15
+ variant?: NonNullable<Parameters<typeof buttonVariants>[0]>['variant'];
16
+ }): React.JSX.Element;
13
17
  declare function AlertDialogCancel({ className, ...props }: React.ComponentProps<typeof AlertDialog$1.Cancel>): React.JSX.Element;
14
18
  export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger };
@@ -65,10 +65,10 @@ function AlertDialogDescription({ className, ...props }) {
65
65
  ...props
66
66
  });
67
67
  }
68
- function AlertDialogAction({ className, ...props }) {
68
+ function AlertDialogAction({ className, variant = "destructive", ...props }) {
69
69
  return /* @__PURE__ */ jsx(AlertDialog$1.Action, {
70
70
  "data-slot": "alert-dialog-action",
71
- className: cn(buttonVariants({ variant: "destructive" }), className),
71
+ className: cn(buttonVariants({ variant }), className),
72
72
  ...props
73
73
  });
74
74
  }
@@ -1,14 +1,40 @@
1
1
  import { NavItem, NavSection } from "../lib/nav.js";
2
2
  import { Sidebar } from "./sidebar-core.js";
3
3
  import "./sidebar.js";
4
+ import { AppToolbarLabels } from "./sidebar-peek.js";
4
5
  import * as React from "react";
5
6
  export type AppShellNavLink = (item: NavItem, props: {
6
7
  onNavigate: () => void;
7
8
  children: React.ReactNode;
8
9
  }) => React.ReactNode;
10
+ /**
11
+ * The shell's create action: a route (`NavItem`, rendered through
12
+ * `renderNavLink`) or a callback (`onSelect`, e.g. opening a dialog). Apps may
13
+ * change it per route ("Nova transação" on Transações, "Novo objetivo" on
14
+ * Objetivos).
15
+ */
16
+ export type AppShellAction = NavItem | {
17
+ label: string;
18
+ icon: React.ComponentType<{
19
+ className?: string;
20
+ }>;
21
+ onSelect: () => void;
22
+ };
23
+ export type AppShellMobileAccount = {
24
+ name: string | null;
25
+ secondary?: string | null;
26
+ avatarUrl?: string | null;
27
+ /** Accessible name, e.g. "Configurações". */
28
+ label: string;
29
+ onOpen: () => void;
30
+ };
9
31
  export type AppShellProps = {
10
- /** Brand block at the top of the sidebar (product/tenant name, logo). */
11
- brand: React.ReactNode;
32
+ /**
33
+ * Brand block at the top of the sidebar (product/tenant name, logo).
34
+ * Optional: the Claude-app chrome has none — the toolbar and
35
+ * `sidebarAction` open the sidebar.
36
+ */
37
+ brand?: React.ReactNode;
12
38
  /** Nav sections, already filtered/resolved by the consumer (RBAC, signals…). */
13
39
  sections: NavSection[];
14
40
  /** Current pathname — drives the active nav highlight. */
@@ -18,21 +44,51 @@ export type AppShellProps = {
18
44
  /** Sidebar footer — typically the account/user menu (wide trigger: avatar +
19
45
  * identity + chevron). Lives at the bottom of the sidebar on `md+`. */
20
46
  footer?: React.ReactNode;
21
- /** Compact account menu for the mobile header. Below `md` the sidebar (and its
22
- * `footer`) is off-canvas, so the account/Settings/Sign-out menu is otherwise
23
- * unreachable without opening the nav sheet (#1374). This slot surfaces the
24
- * SAME menu in the header — but as its COMPACT trigger (a bare avatar button),
25
- * not the wide sidebar footer, which would overflow a phone header. Rendered
26
- * `md:hidden`; on `md+` the sidebar `footer` owns the account menu. */
47
+ /** Compact account menu (a bare avatar button) for phones. Below `md` the
48
+ * sidebar is a drawer and the wide `footer` would not fit, so the drawer's
49
+ * footer shows this one instead, on the left of the create pill — as in the
50
+ * Claude app. Without it the drawer falls back to `footer`, so the account
51
+ * menu (and Settings) is always reachable. On `md+` the sidebar `footer` owns
52
+ * the account menu. */
27
53
  account?: React.ReactNode;
54
+ /**
55
+ * Phones: the Claude app's round avatar with the initials at the bottom of
56
+ * the drawer; tapping it runs `onOpen` (open the settings) — no menu. Wins
57
+ * over `account`/`footer` there.
58
+ */
59
+ mobileAccount?: AppShellMobileAccount;
28
60
  /** Left of the top header, after the trigger (e.g. a context switcher). */
29
61
  headerStart?: React.ReactNode;
30
62
  /** Right of the top header (e.g. notifications). */
31
63
  headerEnd?: React.ReactNode;
32
- /** Sidebar collapse behavior. Defaults to `icon`. */
64
+ /**
65
+ * Primary action on top of the sidebar (e.g. "Criar", "Publicar imóvel"),
66
+ * drawn like the Claude app's "new chat": the first row of the sidebar list,
67
+ * styled as the primary button, in the same rhythm as the nav items. A route
68
+ * goes through `renderNavLink`, like the nav items; a callback is a button.
69
+ * On phones it is the pill at the bottom of the drawer, beside the account.
70
+ */
71
+ primaryAction?: AppShellAction;
72
+ /**
73
+ * Sidebar collapse behavior. Defaults to `offcanvas`, the Claude-app chrome:
74
+ * a fixed toolbar (toggle, back, forward), the sidebar fully hidden when
75
+ * collapsed and peeking over the content on hover. With nothing in
76
+ * `headerStart`/`headerEnd` the top header shows only on phones (where it
77
+ * holds the sidebar trigger and `account`). `icon` keeps a rail of icons and
78
+ * the toggle in the header.
79
+ */
33
80
  collapsible?: React.ComponentProps<typeof Sidebar>['collapsible'];
81
+ /** Texts of the toolbar (offcanvas). */
82
+ toolbarLabels?: Partial<AppToolbarLabels>;
34
83
  /** Accessible label for the nav landmark. Defaults to `Navegação principal`. */
35
84
  navLabel?: string;
85
+ /**
86
+ * Title centered in the phone header (Claude-app style). Defaults to the
87
+ * label of the active nav item.
88
+ */
89
+ title?: React.ReactNode;
90
+ /** Accessible label of the phone header's menu button. */
91
+ menuLabel?: string;
36
92
  /** Whether the sidebar starts expanded (uncontrolled). Defaults to `true`. */
37
93
  defaultOpen?: boolean;
38
94
  /**
@@ -44,4 +100,4 @@ export type AppShellProps = {
44
100
  onOpenChange?: (open: boolean) => void;
45
101
  children: React.ReactNode;
46
102
  };
47
- export declare function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, collapsible, navLabel, defaultOpen, open, onOpenChange, children }: AppShellProps): React.JSX.Element;
103
+ export declare function AppShell({ brand, sections, pathname, renderNavLink, footer, account, mobileAccount, headerStart, headerEnd, primaryAction, collapsible, toolbarLabels, navLabel, title, menuLabel, defaultOpen, open, onOpenChange, children }: AppShellProps): React.JSX.Element;