@cbrl/design 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.
Files changed (37) hide show
  1. package/README.md +73 -0
  2. package/dist/components/app-shell.d.ts +45 -10
  3. package/dist/components/app-shell.js +214 -25
  4. package/dist/components/badge.js +1 -1
  5. package/dist/components/button-group.d.ts +1 -1
  6. package/dist/components/button-group.js +1 -1
  7. package/dist/components/button.js +1 -1
  8. package/dist/components/container.d.ts +1 -1
  9. package/dist/components/container.js +1 -1
  10. package/dist/components/dropdown-menu.js +1 -1
  11. package/dist/components/field.d.ts +1 -1
  12. package/dist/components/field.js +1 -1
  13. package/dist/components/list.js +1 -1
  14. package/dist/components/main.js +1 -1
  15. package/dist/components/page-header.js +3 -3
  16. package/dist/components/settings-dialog-mobile.d.ts +23 -0
  17. package/dist/components/settings-dialog-mobile.js +198 -0
  18. package/dist/components/settings-dialog.d.ts +32 -1
  19. package/dist/components/settings-dialog.js +63 -9
  20. package/dist/components/settings-mobile-blocks.d.ts +25 -0
  21. package/dist/components/settings-mobile-blocks.js +126 -0
  22. package/dist/components/sidebar-core.js +2 -2
  23. package/dist/components/sidebar-menu.js +1 -1
  24. package/dist/components/status-dot.js +1 -1
  25. package/dist/components/tabs.d.ts +1 -1
  26. package/dist/components/tabs.js +1 -1
  27. package/dist/components/typography.js +1 -1
  28. package/dist/components/user-menu.js +2 -1
  29. package/dist/components/workspace-picker.d.ts +21 -0
  30. package/dist/components/workspace-picker.js +51 -0
  31. package/dist/globals.css +33 -0
  32. package/dist/hooks/use-mobile.d.ts +1 -0
  33. package/dist/hooks/use-mobile.js +14 -7
  34. package/dist/index.d.ts +7 -4
  35. package/dist/index.js +2 -1
  36. package/dist/lib/mobile-chrome.js +12 -0
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -300,6 +300,37 @@ and so is the Claude-app behavior: inside `SidebarProvider`, wrap the shell in
300
300
  `AppToolbar`; leave `APP_TOOLBAR_HEIGHT` free at the top of the sidebar and of
301
301
  the content. `useSidebarPeek()` tells whether the sidebar is peeking.
302
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.
333
+
303
334
  ### Tabs and scrolling strips
304
335
 
305
336
  `TabsList` (both variants) never hides the active tab: when the tabs don't
@@ -429,6 +460,48 @@ hash and would close the dialog at once. The hook re-states the URL through
429
460
  `history.replaceState` on `hashchange` (keeping `history.state`, also in
430
461
  `open`/`close`) so the router adopts it; outside Next this is a no-op.
431
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
+
432
505
  Uncontrolled use: `defaultOpen`/`defaultValue`. Slots: `settings-dialog`,
433
506
  `settings-dialog-nav`, `settings-dialog-content`, `settings-group`,
434
507
  `settings-item`.
@@ -7,6 +7,27 @@ export type AppShellNavLink = (item: NavItem, props: {
7
7
  onNavigate: () => void;
8
8
  children: React.ReactNode;
9
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
+ };
10
31
  export type AppShellProps = {
11
32
  /**
12
33
  * Brand block at the top of the sidebar (product/tenant name, logo).
@@ -23,13 +44,19 @@ export type AppShellProps = {
23
44
  /** Sidebar footer — typically the account/user menu (wide trigger: avatar +
24
45
  * identity + chevron). Lives at the bottom of the sidebar on `md+`. */
25
46
  footer?: React.ReactNode;
26
- /** Compact account menu for the mobile header. Below `md` the sidebar (and its
27
- * `footer`) is off-canvas, so the account/Settings/Sign-out menu is otherwise
28
- * unreachable without opening the nav sheet (#1374). This slot surfaces the
29
- * SAME menu in the header — but as its COMPACT trigger (a bare avatar button),
30
- * not the wide sidebar footer, which would overflow a phone header. Rendered
31
- * `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. */
32
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;
33
60
  /** Left of the top header, after the trigger (e.g. a context switcher). */
34
61
  headerStart?: React.ReactNode;
35
62
  /** Right of the top header (e.g. notifications). */
@@ -37,10 +64,11 @@ export type AppShellProps = {
37
64
  /**
38
65
  * Primary action on top of the sidebar (e.g. "Criar", "Publicar imóvel"),
39
66
  * drawn like the Claude app's "new chat": the first row of the sidebar list,
40
- * styled as the primary button, in the same rhythm as the nav items. Rendered through
41
- * `renderNavLink`, like the nav items.
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.
42
70
  */
43
- primaryAction?: NavItem;
71
+ primaryAction?: AppShellAction;
44
72
  /**
45
73
  * Sidebar collapse behavior. Defaults to `offcanvas`, the Claude-app chrome:
46
74
  * a fixed toolbar (toggle, back, forward), the sidebar fully hidden when
@@ -54,6 +82,13 @@ export type AppShellProps = {
54
82
  toolbarLabels?: Partial<AppToolbarLabels>;
55
83
  /** Accessible label for the nav landmark. Defaults to `Navegação principal`. */
56
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;
57
92
  /** Whether the sidebar starts expanded (uncontrolled). Defaults to `true`. */
58
93
  defaultOpen?: boolean;
59
94
  /**
@@ -65,4 +100,4 @@ export type AppShellProps = {
65
100
  onOpenChange?: (open: boolean) => void;
66
101
  children: React.ReactNode;
67
102
  };
68
- export declare function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, primaryAction, collapsible, toolbarLabels, 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;
@@ -1,6 +1,10 @@
1
1
  "use client";
2
+ import { useMobileState } from "../hooks/use-mobile.js";
2
3
  import { cn } from "../lib/cn.js";
4
+ import { initials } from "../lib/initials.js";
5
+ import { MOBILE_BAR, MOBILE_BAR_ROW, MOBILE_ROUND_BUTTON } from "../lib/mobile-chrome.js";
3
6
  import { isActive } from "../lib/nav.js";
7
+ import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
4
8
  import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInset, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar } from "./sidebar-core.js";
5
9
  import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "./sidebar-menu.js";
6
10
  import { AppToolbar, PeekSidebar, SidebarPeekProvider } from "./sidebar-peek.js";
@@ -8,12 +12,45 @@ import { TooltipProvider } from "./tooltip.js";
8
12
  import "react";
9
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
14
  // src/components/app-shell.tsx
11
- function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, primaryAction, collapsible = "offcanvas", toolbarLabels, navLabel = "Navegação principal", defaultOpen = true, open, onOpenChange, children }) {
15
+ const isCallback = (action) => "onSelect" in action;
16
+ /** The action's element: the app's link for a route, a button for a callback. */
17
+ function renderAction(action, renderNavLink, onNavigate, children) {
18
+ if (!isCallback(action)) return renderNavLink(action, {
19
+ onNavigate,
20
+ children
21
+ });
22
+ return /* @__PURE__ */ jsx("button", {
23
+ type: "button",
24
+ onClick: () => {
25
+ onNavigate();
26
+ action.onSelect();
27
+ },
28
+ children
29
+ });
30
+ }
31
+ function AppShell({ brand, sections, pathname, renderNavLink, footer, account, mobileAccount, headerStart, headerEnd, primaryAction, collapsible = "offcanvas", toolbarLabels, navLabel = "Navegação principal", title, menuLabel = "Abrir menu", defaultOpen = true, open, onOpenChange, children }) {
32
+ const mobileState = useMobileState();
33
+ const isMobile = mobileState === true;
12
34
  const peek = collapsible === "offcanvas";
35
+ const activeLabel = sections.flatMap((section) => section.items).find((item) => isActive(item, pathname))?.label;
13
36
  const desktopBar = !peek || Boolean(headerStart) || Boolean(headerEnd);
14
37
  let toolbarRow;
15
38
  if (peek) toolbarRow = desktopBar ? "md:pt-14" : "md:pt-12";
16
- const sidebar = /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ const sidebar = isMobile ? /* @__PURE__ */ jsx(MobileSidebar, {
40
+ brand,
41
+ headerStart,
42
+ account: drawerAccount(mobileAccount, account, footer),
43
+ primaryAction,
44
+ renderNavLink,
45
+ children: /* @__PURE__ */ jsx(ShellNav, {
46
+ sections,
47
+ pathname,
48
+ renderNavLink,
49
+ navLabel,
50
+ labelTooltips: false,
51
+ mobile: true
52
+ })
53
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
17
54
  /* @__PURE__ */ jsx(SidebarHeader, {
18
55
  className: cn(toolbarRow, !brand && "p-0"),
19
56
  children: brand ? /* @__PURE__ */ jsx("div", {
@@ -45,44 +82,47 @@ function AppShell({ brand, sections, pathname, renderNavLink, footer, account, h
45
82
  children: [sidebar, /* @__PURE__ */ jsx(SidebarRail, {})]
46
83
  }),
47
84
  /* @__PURE__ */ jsxs(SidebarInset, { children: [
48
- /* @__PURE__ */ jsx(ShellHeader, {
49
- account,
50
- headerStart,
51
- headerEnd,
52
- toolbar: peek,
53
- desktop: desktopBar
85
+ /* @__PURE__ */ jsx(ShellHeaders, {
86
+ mobile: mobileState,
87
+ phone: {
88
+ title: title ?? activeLabel,
89
+ menuLabel,
90
+ end: headerEnd
91
+ },
92
+ desktop: {
93
+ headerStart,
94
+ headerEnd,
95
+ toolbar: peek,
96
+ desktop: desktopBar
97
+ }
54
98
  }),
55
99
  desktopBar ? null : /* @__PURE__ */ jsx("div", {
56
100
  "aria-hidden": true,
57
101
  className: "hidden h-12 shrink-0 md:block"
58
102
  }),
59
- /* @__PURE__ */ jsx("div", {
60
- "data-slot": "app-scroll",
61
- className: "min-h-0 flex-1 [scrollbar-gutter:stable] overflow-y-auto overscroll-contain has-[[data-fills-viewport]]:[scrollbar-gutter:auto]",
103
+ /* @__PURE__ */ jsx(ShellScroll, {
104
+ mobile: mobileState,
62
105
  children
63
106
  })
64
107
  ] })
65
108
  ] })
66
109
  }) });
67
110
  }
68
- function ShellHeader({ account, headerStart, headerEnd, toolbar, desktop }) {
69
- const { isMobile, open } = useSidebar();
111
+ function ShellHeader({ headerStart, headerEnd, toolbar, desktop, className }) {
112
+ const { open } = useSidebar();
70
113
  return /* @__PURE__ */ jsxs("header", {
71
- className: cn("border-border bg-card/60 z-30 flex h-14 shrink-0 items-center gap-3 border-b px-4 backdrop-blur md:px-6", toolbar && !open && "md:pl-28", !desktop && "md:hidden"),
114
+ className: cn("border-border bg-card/60 z-30 flex h-14 shrink-0 items-center gap-3 border-b px-4 backdrop-blur md:px-6", toolbar && !open && "md:pl-28", !desktop && "md:hidden", className),
72
115
  children: [
73
116
  /* @__PURE__ */ jsx(SidebarTrigger, { className: toolbar ? "md:hidden" : void 0 }),
74
117
  headerStart,
75
- /* @__PURE__ */ jsxs("div", {
118
+ /* @__PURE__ */ jsx("div", {
76
119
  className: "ml-auto flex items-center gap-2",
77
- children: [account && isMobile ? /* @__PURE__ */ jsx("div", {
78
- className: "flex items-center",
79
- children: account
80
- }) : null, headerEnd]
120
+ children: headerEnd
81
121
  })
82
122
  ]
83
123
  });
84
124
  }
85
- function ShellNav({ sections, pathname, renderNavLink, navLabel, primaryAction, labelTooltips }) {
125
+ function ShellNav({ sections, pathname, renderNavLink, navLabel, primaryAction, labelTooltips, mobile = false }) {
86
126
  const { setOpenMobile } = useSidebar();
87
127
  const onNavigate = () => setOpenMobile(false);
88
128
  const content = (item) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(item.icon, {}), /* @__PURE__ */ jsx("span", { children: item.label })] });
@@ -92,21 +132,19 @@ function ShellNav({ sections, pathname, renderNavLink, navLabel, primaryAction,
92
132
  asChild: true,
93
133
  tooltip: labelTooltips ? primaryAction.label : void 0,
94
134
  className: "bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground font-medium shadow-xs",
95
- children: renderNavLink(primaryAction, {
96
- onNavigate,
97
- children: content(primaryAction)
98
- })
135
+ children: renderAction(primaryAction, renderNavLink, onNavigate, content(primaryAction))
99
136
  }) }) })
100
137
  }) : null, /* @__PURE__ */ jsx("nav", {
101
138
  "aria-label": navLabel,
102
139
  children: sections.map((section, index) => /* @__PURE__ */ jsxs(SidebarGroup, {
103
140
  className: primaryAction && index === 0 ? "pt-0" : void 0,
104
141
  children: [section.label ? /* @__PURE__ */ jsx(SidebarGroupLabel, { children: section.label }) : null, /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, {
105
- className: "gap-0.5",
142
+ className: mobile ? "gap-1" : "gap-0.5",
106
143
  children: section.items.map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
107
144
  asChild: true,
108
145
  isActive: isActive(item, pathname),
109
146
  tooltip: labelTooltips ? item.label : void 0,
147
+ className: mobile ? MOBILE_NAV_ROW : void 0,
110
148
  children: renderNavLink(item, {
111
149
  onNavigate,
112
150
  children: content(item)
@@ -116,4 +154,155 @@ function ShellNav({ sections, pathname, renderNavLink, navLabel, primaryAction,
116
154
  }, section.label))
117
155
  })] });
118
156
  }
157
+ const MOBILE_NAV_ROW = "h-12 gap-4 rounded-xl px-3 text-base [&_svg]:size-6";
158
+ const MOBILE_ACCOUNT = cn("[&_[data-sidebar=menu-button]]:bg-muted [&_[data-sidebar=menu-button]]:border-border/60 [&_[data-sidebar=menu-button]]:size-11 [&_[data-sidebar=menu-button]]:justify-center [&_[data-sidebar=menu-button]]:rounded-full [&_[data-sidebar=menu-button]]:border [&_[data-sidebar=menu-button]]:p-0 [&_[data-sidebar=menu-button]]:shadow-sm", "[&_[data-sidebar=menu-button]>*:not(:first-child)]:hidden [&_[data-sidebar=menu-button]>:first-child]:size-11 [&_[data-sidebar=menu-button]>:first-child]:rounded-full [&_[data-sidebar=menu-button]>:first-child]:bg-transparent", "[&_[data-slot=avatar-fallback]]:rounded-full [&_[data-slot=avatar-fallback]]:bg-transparent [&_[data-slot=avatar-fallback]]:text-base [&_[data-slot=avatar-image]]:rounded-full [&_[data-slot=sidebar-menu]]:w-auto");
159
+ /** Two lines, the second shorter — the Claude app's menu glyph. */
160
+ function MenuGlyph() {
161
+ return /* @__PURE__ */ jsx("svg", {
162
+ "aria-hidden": true,
163
+ viewBox: "0 0 24 24",
164
+ fill: "none",
165
+ stroke: "currentColor",
166
+ strokeWidth: 1.75,
167
+ strokeLinecap: "round",
168
+ children: /* @__PURE__ */ jsx("path", { d: "M4 8h16M4 16h10" })
169
+ });
170
+ }
171
+ /**
172
+ * Phone header: the round menu button on the left, the screen title centered
173
+ * and the app's header actions on the right. Clears the status bar.
174
+ */
175
+ function MobileHeader({ title, menuLabel, end, className }) {
176
+ const { setOpenMobile } = useSidebar();
177
+ return /* @__PURE__ */ jsx("header", {
178
+ "data-slot": "mobile-header",
179
+ className: cn(MOBILE_BAR, "pt-safe px-safe absolute inset-x-0 top-0", className),
180
+ children: /* @__PURE__ */ jsxs("div", {
181
+ className: cn("relative flex items-center gap-2 px-4", MOBILE_BAR_ROW),
182
+ children: [
183
+ /* @__PURE__ */ jsx("button", {
184
+ type: "button",
185
+ "aria-label": menuLabel,
186
+ className: MOBILE_ROUND_BUTTON,
187
+ onClick: () => setOpenMobile(true),
188
+ children: /* @__PURE__ */ jsx(MenuGlyph, {})
189
+ }),
190
+ title ? /* @__PURE__ */ jsx("div", {
191
+ "data-slot": "mobile-header-title",
192
+ className: "pointer-events-none absolute inset-x-20 truncate text-center text-base font-semibold",
193
+ children: title
194
+ }) : null,
195
+ /* @__PURE__ */ jsx("div", {
196
+ className: "ml-auto flex items-center gap-2",
197
+ children: end
198
+ })
199
+ ]
200
+ })
201
+ });
202
+ }
203
+ /** The create action as a pill (Claude's "Nova conversa" / "Novo projeto"). */
204
+ function PrimaryPill({ item }) {
205
+ return /* @__PURE__ */ jsxs("span", {
206
+ className: "bg-primary text-primary-foreground pointer-events-auto inline-flex h-12 items-center gap-2.5 rounded-full px-5 text-base font-medium shadow-lg [&_svg]:size-5",
207
+ children: [/* @__PURE__ */ jsx(item.icon, { "aria-hidden": true }), item.label]
208
+ });
209
+ }
210
+ /**
211
+ * The sidebar as a phone sheet, laid out like the Claude app: brand on top,
212
+ * native-size routes and, at the bottom, the account avatar on the left with
213
+ * the create pill beside it.
214
+ */
215
+ function MobileSidebar({ brand, headerStart, account, primaryAction, renderNavLink, children }) {
216
+ const { setOpenMobile } = useSidebar();
217
+ const onNavigate = () => setOpenMobile(false);
218
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
219
+ /* @__PURE__ */ jsxs(SidebarHeader, {
220
+ className: "gap-3 px-4 pt-4",
221
+ children: [brand ? /* @__PURE__ */ jsx("div", {
222
+ className: "flex min-h-11 items-center gap-2 text-2xl font-semibold",
223
+ children: brand
224
+ }) : null, headerStart ? /* @__PURE__ */ jsx("div", {
225
+ className: "flex items-center",
226
+ children: headerStart
227
+ }) : null]
228
+ }),
229
+ /* @__PURE__ */ jsx(SidebarContent, {
230
+ className: "px-2",
231
+ children
232
+ }),
233
+ /* @__PURE__ */ jsxs(SidebarFooter, {
234
+ className: "min-h-4 flex-row items-center justify-between gap-3 px-4 pb-4",
235
+ children: [/* @__PURE__ */ jsx("div", {
236
+ "data-slot": "mobile-account",
237
+ className: cn("flex items-center", MOBILE_ACCOUNT),
238
+ children: account
239
+ }), primaryAction ? renderAction(primaryAction, renderNavLink, onNavigate, /* @__PURE__ */ jsx(PrimaryPill, { item: primaryAction })) : null]
240
+ })
241
+ ] });
242
+ }
243
+ /**
244
+ * The SOLE content scroller (the document does not scroll — see the
245
+ * inner-scroll contract in SidebarProvider). `overscroll-contain` stops a
246
+ * nested scroller (e.g. the agenda grid) from chaining out and yanking the
247
+ * shell. `scrollbar-gutter: stable` keeps the content from shifting when a
248
+ * page starts to scroll; a screen that fills the viewport (marks itself
249
+ * `data-fills-viewport`, e.g. a calendar grid) gets the gutter back. On
250
+ * phones the translucent header floats over it (Claude app): the content
251
+ * starts below the header and scrolls under it, and clears the home indicator.
252
+ */
253
+ const PHONE_SCROLL = "pb-safe pt-[calc(env(safe-area-inset-top,0px)+4rem)] [scroll-padding-top:calc(env(safe-area-inset-top,0px)+4rem)]";
254
+ const PHONE_SCROLL_CSS = "max-md:pb-safe max-md:pt-[calc(env(safe-area-inset-top,0px)+4rem)] max-md:[scroll-padding-top:calc(env(safe-area-inset-top,0px)+4rem)]";
255
+ function ShellScroll({ mobile, children }) {
256
+ let phone;
257
+ if (mobile === true) phone = PHONE_SCROLL;
258
+ else if (mobile === void 0) phone = PHONE_SCROLL_CSS;
259
+ return /* @__PURE__ */ jsx("div", {
260
+ "data-slot": "app-scroll",
261
+ className: cn("min-h-0 flex-1 [scrollbar-gutter:stable] overflow-y-auto overscroll-contain has-[[data-fills-viewport]]:[scrollbar-gutter:auto]", phone),
262
+ children
263
+ });
264
+ }
265
+ /** The drawer's account slot: initials button, else the compact menu, else the footer. */
266
+ function drawerAccount(mobileAccount, account, footer) {
267
+ if (mobileAccount) return /* @__PURE__ */ jsx(MobileAccountButton, { account: mobileAccount });
268
+ return account ?? footer;
269
+ }
270
+ /** The Claude app's round "KC": the initials (or photo); tapping opens settings. */
271
+ function MobileAccountButton({ account }) {
272
+ const { setOpenMobile } = useSidebar();
273
+ return /* @__PURE__ */ jsx("button", {
274
+ type: "button",
275
+ "aria-label": account.label,
276
+ className: MOBILE_ROUND_BUTTON,
277
+ onClick: () => {
278
+ setOpenMobile(false);
279
+ account.onOpen();
280
+ },
281
+ children: /* @__PURE__ */ jsxs(Avatar, {
282
+ className: "size-full bg-transparent",
283
+ children: [account.avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
284
+ src: account.avatarUrl,
285
+ alt: ""
286
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, {
287
+ className: "bg-transparent text-base font-medium",
288
+ children: initials(account.name, account.secondary ?? null)
289
+ })]
290
+ })
291
+ });
292
+ }
293
+ /**
294
+ * The phone header or the desktop one, on the sidebar's own `isMobile` signal
295
+ * (#1374). Before hydration (`undefined`) both render and CSS shows one, so a
296
+ * phone never paints the desktop header first.
297
+ */
298
+ function ShellHeaders({ mobile, phone, desktop }) {
299
+ const unknown = mobile === void 0;
300
+ return /* @__PURE__ */ jsxs(Fragment, { children: [mobile === false ? null : /* @__PURE__ */ jsx(MobileHeader, {
301
+ ...phone,
302
+ className: unknown ? "md:hidden" : void 0
303
+ }), mobile === true ? null : /* @__PURE__ */ jsx(ShellHeader, {
304
+ ...desktop,
305
+ className: unknown ? "max-md:hidden" : void 0
306
+ })] });
307
+ }
119
308
  export { AppShell };
@@ -1,8 +1,8 @@
1
1
  import { cn } from "../lib/cn.js";
2
2
  import "react";
3
- import { cva } from "class-variance-authority";
4
3
  import { Slot } from "radix-ui";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { cva } from "class-variance-authority";
6
6
  // src/components/badge.tsx
7
7
  const badgeVariants = cva("group/badge focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:ring-[3px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:pointer-events-none [&>svg]:size-3!", {
8
8
  variants: {
@@ -2,7 +2,7 @@ import { Separator } from "./separator.js";
2
2
  import * as React from "react";
3
3
  import { VariantProps } from "class-variance-authority";
4
4
  declare const buttonGroupVariants: (props?: ({
5
- orientation?: "horizontal" | "vertical" | null | undefined;
5
+ orientation?: "vertical" | "horizontal" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>): React.JSX.Element;
8
8
  declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<'div'> & {
@@ -1,9 +1,9 @@
1
1
  import { cn } from "../lib/cn.js";
2
2
  import { Separator as Separator$1 } from "./separator.js";
3
3
  import "react";
4
- import { cva } from "class-variance-authority";
5
4
  import { Slot } from "radix-ui";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { cva } from "class-variance-authority";
7
7
  // src/components/button-group.tsx
8
8
  const buttonGroupVariants = cva("group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
9
9
  variants: { orientation: {
@@ -1,8 +1,8 @@
1
1
  import { cn } from "../lib/cn.js";
2
2
  import "react";
3
- import { cva } from "class-variance-authority";
4
3
  import { Slot } from "radix-ui";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { cva } from "class-variance-authority";
6
6
  // src/components/button.tsx
7
7
  const buttonVariants = cva("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
8
8
  variants: {
@@ -9,7 +9,7 @@ import { VariantProps } from "class-variance-authority";
9
9
  */
10
10
  declare const containerVariants: (props?: ({
11
11
  size?: "sm" | "lg" | "prose" | "md" | "xl" | null | undefined;
12
- gutter?: "sm" | "md" | "none" | null | undefined;
12
+ gutter?: "sm" | "none" | "md" | null | undefined;
13
13
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
14
  type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants> & {
15
15
  /** Render the single child (e.g. `<main>`, `<section>`) with the container classes. */
@@ -1,8 +1,8 @@
1
1
  import { cn } from "../lib/cn.js";
2
2
  import "react";
3
- import { cva } from "class-variance-authority";
4
3
  import { Slot } from "radix-ui";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { cva } from "class-variance-authority";
6
6
  // src/components/container.tsx
7
7
  /**
8
8
  * Horizontal page container: centers content, caps its width and (optionally)
@@ -98,7 +98,7 @@ function DropdownMenuSeparator({ className, ...props }) {
98
98
  function DropdownMenuShortcut({ className, ...props }) {
99
99
  return /* @__PURE__ */ jsx("span", {
100
100
  "data-slot": "dropdown-menu-shortcut",
101
- className: cn("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest", className),
101
+ className: cn("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest max-md:hidden", className),
102
102
  ...props
103
103
  });
104
104
  }
@@ -7,7 +7,7 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
7
7
  }): React.JSX.Element;
8
8
  declare function FieldGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
9
9
  declare const fieldVariants: (props?: ({
10
- orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
10
+ orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
12
  declare function Field({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>): React.JSX.Element;
13
13
  declare function FieldContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
@@ -3,8 +3,8 @@ import { cn } from "../lib/cn.js";
3
3
  import { Label } from "./label.js";
4
4
  import { Separator } from "./separator.js";
5
5
  import * as React from "react";
6
- import { cva } from "class-variance-authority";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { cva } from "class-variance-authority";
8
8
  // src/components/field.tsx
9
9
  function FieldSet({ className, ...props }) {
10
10
  return /* @__PURE__ */ jsx("fieldset", {
@@ -6,9 +6,9 @@ import { Pagination } from "./pagination.js";
6
6
  import { Select as Select$1, SelectContent, SelectItem, SelectTrigger } from "./select.js";
7
7
  import { Skeleton } from "./skeleton.js";
8
8
  import * as React from "react";
9
- import { cva } from "class-variance-authority";
10
9
  import { Slot } from "radix-ui";
11
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { cva } from "class-variance-authority";
12
12
  import { Search } from "lucide-react";
13
13
  // src/components/list.tsx
14
14
  const listVariants = cva("group/list flex flex-col", {
@@ -1,7 +1,7 @@
1
1
  import { cn } from "../lib/cn.js";
2
2
  import "react";
3
- import { cva } from "class-variance-authority";
4
3
  import { jsx } from "react/jsx-runtime";
4
+ import { cva } from "class-variance-authority";
5
5
  // src/components/main.tsx
6
6
  const frameVariants = cva("w-full flex-1 p-6", {
7
7
  variants: { width: {
@@ -11,10 +11,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
11
11
  function PageHeader({ title, description, actions, className, ...props }) {
12
12
  return /* @__PURE__ */ jsxs("div", {
13
13
  "data-slot": "page-header",
14
- className: cn("flex flex-wrap items-center justify-between gap-2", className),
14
+ className: cn("flex flex-wrap items-center justify-between gap-2", !actions && "max-md:sr-only", className),
15
15
  ...props,
16
16
  children: [/* @__PURE__ */ jsxs("div", {
17
- className: "min-w-0 flex-1",
17
+ className: "min-w-0 flex-1 max-md:sr-only",
18
18
  children: [/* @__PURE__ */ jsx("h1", {
19
19
  className: "text-xl font-semibold tracking-tight md:text-2xl",
20
20
  children: title
@@ -34,7 +34,7 @@ function PageHeader({ title, description, actions, className, ...props }) {
34
34
  function PageHeaderSkeleton({ titleWidth = "w-40", descriptionWidth = "w-64", className, ...props }) {
35
35
  return /* @__PURE__ */ jsxs("div", {
36
36
  "data-slot": "page-header-skeleton",
37
- className,
37
+ className: cn("max-md:hidden", className),
38
38
  ...props,
39
39
  children: [/* @__PURE__ */ jsx(Skeleton, { className: cn("h-6 md:h-7", titleWidth) }), descriptionWidth ? /* @__PURE__ */ jsx(Skeleton, { className: cn("mt-1 h-4 md:h-5", descriptionWidth) }) : null]
40
40
  });
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ export type SettingsAboutLink = {
3
+ label: string;
4
+ href: string;
5
+ /** `document` for in-app documents (licenses); defaults to an external link. */
6
+ kind?: 'external' | 'document';
7
+ };
8
+ export type SettingsAbout = {
9
+ /** First line of the menu, e.g. `Fluxi v1.4.2 (a1b2c3d)`. */
10
+ version?: React.ReactNode;
11
+ /** Policies, terms, licenses. */
12
+ links?: readonly SettingsAboutLink[];
13
+ /** After a divider (help and support). */
14
+ support?: readonly SettingsAboutLink[];
15
+ };
16
+ export type SettingsDialogAccount<K extends string = string> = {
17
+ name: string | null;
18
+ /** E-mail / handle (and plan), the card's second line. */
19
+ secondary?: string | null;
20
+ avatarUrl?: string | null;
21
+ /** Section the card opens (e.g. the profile). */
22
+ section?: K;
23
+ };