@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
@@ -1,77 +1,308 @@
1
1
  "use client";
2
+ import { useMobileState } from "../hooks/use-mobile.js";
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";
2
6
  import { isActive } from "../lib/nav.js";
7
+ import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
3
8
  import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInset, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar } from "./sidebar-core.js";
4
9
  import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "./sidebar-menu.js";
10
+ import { AppToolbar, PeekSidebar, SidebarPeekProvider } from "./sidebar-peek.js";
5
11
  import { TooltipProvider } from "./tooltip.js";
6
12
  import "react";
7
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
14
  // src/components/app-shell.tsx
9
- function AppShell({ brand, sections, pathname, renderNavLink, footer, account, headerStart, headerEnd, collapsible = "icon", navLabel = "Navegação principal", defaultOpen = true, open, onOpenChange, children }) {
10
- return /* @__PURE__ */ jsx(TooltipProvider, {
11
- delayDuration: 0,
12
- children: /* @__PURE__ */ jsxs(SidebarProvider, {
13
- defaultOpen,
14
- open,
15
- onOpenChange,
16
- children: [/* @__PURE__ */ jsxs(Sidebar, {
17
- collapsible,
18
- children: [
19
- /* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx("div", {
20
- className: "flex items-center gap-2 px-2 py-1.5",
21
- children: brand
22
- }) }),
23
- /* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(ShellNav, {
24
- sections,
25
- pathname,
26
- renderNavLink,
27
- navLabel
28
- }) }),
29
- footer ? /* @__PURE__ */ jsx(SidebarFooter, { children: footer }) : null,
30
- /* @__PURE__ */ jsx(SidebarRail, {})
31
- ]
32
- }), /* @__PURE__ */ jsxs(SidebarInset, { children: [/* @__PURE__ */ jsx(ShellHeader, {
33
- account,
34
- headerStart,
35
- headerEnd
36
- }), /* @__PURE__ */ jsx("div", {
37
- "data-slot": "app-scroll",
38
- className: "min-h-0 flex-1 overflow-y-auto overscroll-contain",
39
- children
40
- })] })]
41
- })
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
42
29
  });
43
30
  }
44
- function ShellHeader({ account, headerStart, headerEnd }) {
45
- const { isMobile } = useSidebar();
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;
34
+ const peek = collapsible === "offcanvas";
35
+ const activeLabel = sections.flatMap((section) => section.items).find((item) => isActive(item, pathname))?.label;
36
+ const desktopBar = !peek || Boolean(headerStart) || Boolean(headerEnd);
37
+ let toolbarRow;
38
+ if (peek) toolbarRow = desktopBar ? "md:pt-14" : "md:pt-12";
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: [
54
+ /* @__PURE__ */ jsx(SidebarHeader, {
55
+ className: cn(toolbarRow, !brand && "p-0"),
56
+ children: brand ? /* @__PURE__ */ jsx("div", {
57
+ className: "flex items-center gap-2 px-2 py-1.5",
58
+ children: brand
59
+ }) : null
60
+ }),
61
+ /* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(ShellNav, {
62
+ sections,
63
+ pathname,
64
+ renderNavLink,
65
+ navLabel,
66
+ primaryAction,
67
+ labelTooltips: collapsible === "icon"
68
+ }) }),
69
+ footer ? /* @__PURE__ */ jsx(SidebarFooter, { children: footer }) : null
70
+ ] });
71
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(SidebarProvider, {
72
+ defaultOpen,
73
+ open,
74
+ onOpenChange,
75
+ children: /* @__PURE__ */ jsxs(SidebarPeekProvider, { children: [
76
+ peek ? /* @__PURE__ */ jsx(AppToolbar, {
77
+ labels: toolbarLabels,
78
+ className: desktopBar ? "h-14" : "h-12"
79
+ }) : null,
80
+ peek ? /* @__PURE__ */ jsx(PeekSidebar, { children: sidebar }) : /* @__PURE__ */ jsxs(Sidebar, {
81
+ collapsible,
82
+ children: [sidebar, /* @__PURE__ */ jsx(SidebarRail, {})]
83
+ }),
84
+ /* @__PURE__ */ jsxs(SidebarInset, { children: [
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
+ }
98
+ }),
99
+ desktopBar ? null : /* @__PURE__ */ jsx("div", {
100
+ "aria-hidden": true,
101
+ className: "hidden h-12 shrink-0 md:block"
102
+ }),
103
+ /* @__PURE__ */ jsx(ShellScroll, {
104
+ mobile: mobileState,
105
+ children
106
+ })
107
+ ] })
108
+ ] })
109
+ }) });
110
+ }
111
+ function ShellHeader({ headerStart, headerEnd, toolbar, desktop, className }) {
112
+ const { open } = useSidebar();
46
113
  return /* @__PURE__ */ jsxs("header", {
47
- className: "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",
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),
48
115
  children: [
49
- /* @__PURE__ */ jsx(SidebarTrigger, {}),
116
+ /* @__PURE__ */ jsx(SidebarTrigger, { className: toolbar ? "md:hidden" : void 0 }),
50
117
  headerStart,
51
- /* @__PURE__ */ jsxs("div", {
118
+ /* @__PURE__ */ jsx("div", {
52
119
  className: "ml-auto flex items-center gap-2",
53
- children: [account && isMobile ? /* @__PURE__ */ jsx("div", {
54
- className: "flex items-center",
55
- children: account
56
- }) : null, headerEnd]
120
+ children: headerEnd
57
121
  })
58
122
  ]
59
123
  });
60
124
  }
61
- function ShellNav({ sections, pathname, renderNavLink, navLabel }) {
125
+ function ShellNav({ sections, pathname, renderNavLink, navLabel, primaryAction, labelTooltips, mobile = false }) {
62
126
  const { setOpenMobile } = useSidebar();
63
127
  const onNavigate = () => setOpenMobile(false);
64
- return /* @__PURE__ */ jsx("nav", {
65
- "aria-label": navLabel,
66
- children: sections.map((section) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [section.label ? /* @__PURE__ */ jsx(SidebarGroupLabel, { children: section.label }) : null, /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: section.items.map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
128
+ const content = (item) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(item.icon, {}), /* @__PURE__ */ jsx("span", { children: item.label })] });
129
+ return /* @__PURE__ */ jsxs(Fragment, { children: [primaryAction ? /* @__PURE__ */ jsx(SidebarGroup, {
130
+ className: "pb-0.5",
131
+ children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
67
132
  asChild: true,
68
- isActive: isActive(item, pathname),
69
- tooltip: item.label,
70
- children: renderNavLink(item, {
71
- onNavigate,
72
- children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(item.icon, {}), /* @__PURE__ */ jsx("span", { children: item.label })] })
73
- })
74
- }) }, item.href)) }) })] }, section.label))
133
+ tooltip: labelTooltips ? primaryAction.label : void 0,
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",
135
+ children: renderAction(primaryAction, renderNavLink, onNavigate, content(primaryAction))
136
+ }) }) })
137
+ }) : null, /* @__PURE__ */ jsx("nav", {
138
+ "aria-label": navLabel,
139
+ children: sections.map((section, index) => /* @__PURE__ */ jsxs(SidebarGroup, {
140
+ className: primaryAction && index === 0 ? "pt-0" : void 0,
141
+ children: [section.label ? /* @__PURE__ */ jsx(SidebarGroupLabel, { children: section.label }) : null, /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, {
142
+ className: mobile ? "gap-1" : "gap-0.5",
143
+ children: section.items.map((item) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
144
+ asChild: true,
145
+ isActive: isActive(item, pathname),
146
+ tooltip: labelTooltips ? item.label : void 0,
147
+ className: mobile ? MOBILE_NAV_ROW : void 0,
148
+ children: renderNavLink(item, {
149
+ onNavigate,
150
+ children: content(item)
151
+ })
152
+ }) }, item.href))
153
+ }) })]
154
+ }, section.label))
155
+ })] });
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
+ })
75
201
  });
76
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
+ }
77
308
  export { AppShell };
@@ -1,10 +1,15 @@
1
1
  import * as React from "react";
2
2
  import { Avatar as Avatar$1 } from "radix-ui";
3
- declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
3
+ declare function Avatar({ className, size, shape, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
4
4
  size?: 'default' | 'sm' | 'lg';
5
+ /** `square` (rounded corners) for things that are not people: a business, a space. */
6
+ shape?: 'circle' | 'square';
5
7
  }): React.JSX.Element;
6
8
  declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): React.JSX.Element;
7
- declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): React.JSX.Element;
9
+ declare function AvatarFallback({ className, colorSeed, ...props }: React.ComponentProps<typeof Avatar$1.Fallback> & {
10
+ /** A stable id (e.g. a business id): paints the fallback with its own color. */
11
+ colorSeed?: string;
12
+ }): React.JSX.Element;
8
13
  declare function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
9
14
  type AvatarGroupProps = React.ComponentProps<'div'> & {
10
15
  /**
@@ -4,25 +4,47 @@ import * as React from "react";
4
4
  import { Avatar as Avatar$1 } from "radix-ui";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/components/avatar.tsx
7
- function Avatar({ className, size = "default", ...props }) {
7
+ function Avatar({ className, size = "default", shape = "circle", ...props }) {
8
8
  return /* @__PURE__ */ jsx(Avatar$1.Root, {
9
9
  "data-slot": "avatar",
10
10
  "data-size": size,
11
- className: cn("group/avatar after:border-border relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className),
11
+ "data-shape": shape,
12
+ className: cn("group/avatar after:border-border relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", "data-[shape=square]:rounded-md data-[shape=square]:after:rounded-md", className),
12
13
  ...props
13
14
  });
14
15
  }
15
16
  function AvatarImage({ className, ...props }) {
16
17
  return /* @__PURE__ */ jsx(Avatar$1.Image, {
17
18
  "data-slot": "avatar-image",
18
- className: cn("aspect-square size-full rounded-full object-cover", className),
19
+ className: cn("aspect-square size-full rounded-full object-cover group-data-[shape=square]/avatar:rounded-md", className),
19
20
  ...props
20
21
  });
21
22
  }
22
- function AvatarFallback({ className, ...props }) {
23
+ /**
24
+ * Fallback colors picked by `colorSeed`: solid enough to tell items apart at a
25
+ * glance (e.g. which business is active), readable with white initials in
26
+ * both themes.
27
+ */
28
+ const AVATAR_COLORS = [
29
+ "bg-sky-600 text-white",
30
+ "bg-emerald-600 text-white",
31
+ "bg-amber-600 text-white",
32
+ "bg-rose-600 text-white",
33
+ "bg-violet-600 text-white",
34
+ "bg-teal-600 text-white",
35
+ "bg-orange-600 text-white",
36
+ "bg-indigo-600 text-white"
37
+ ];
38
+ /** Stable palette index for a seed (same seed, same color, everywhere). */
39
+ function avatarColorIndex(seed) {
40
+ let hash = 0;
41
+ for (const char of seed) hash = hash * 31 + char.charCodeAt(0) >>> 0;
42
+ return hash % AVATAR_COLORS.length;
43
+ }
44
+ function AvatarFallback({ className, colorSeed, ...props }) {
23
45
  return /* @__PURE__ */ jsx(Avatar$1.Fallback, {
24
46
  "data-slot": "avatar-fallback",
25
- className: cn("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs", className),
47
+ className: cn("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[shape=square]/avatar:rounded-md group-data-[size=sm]/avatar:text-xs", colorSeed === void 0 ? void 0 : AVATAR_COLORS[avatarColorIndex(colorSeed)], className),
26
48
  ...props
27
49
  });
28
50
  }
@@ -55,4 +77,4 @@ function AvatarGroupCount({ className, ...props }) {
55
77
  ...props
56
78
  });
57
79
  }
58
- export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage };
80
+ export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, avatarColorIndex };
@@ -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)
@@ -7,7 +7,11 @@ declare function DropdownMenuContent({ className, align, sideOffset, ...props }:
7
7
  declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenu$1.Group>): React.JSX.Element;
8
8
  declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenu$1.Item> & {
9
9
  inset?: boolean;
10
- variant?: 'default' | 'destructive';
10
+ /**
11
+ * `highlight`: blue label and icon on the usual background, for the menu's
12
+ * creation action (e.g. "Novo negócio…"), as in Notion.
13
+ */
14
+ variant?: 'default' | 'destructive' | 'highlight';
11
15
  }): React.JSX.Element;
12
16
  declare function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof DropdownMenu$1.CheckboxItem> & {
13
17
  inset?: boolean;
@@ -43,7 +43,7 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
43
43
  "data-slot": "dropdown-menu-item",
44
44
  "data-inset": inset,
45
45
  "data-variant": variant,
46
- className: cn("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
46
+ className: cn("group/dropdown-menu-item focus:bg-accent data-[variant=default]:focus:text-accent-foreground data-[variant=default]:focus:**:text-accent-foreground data-[variant=highlight]:text-blue-600 dark:data-[variant=highlight]:text-blue-400 data-[variant=highlight]:*:[svg]:text-current data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
47
47
  ...props
48
48
  });
49
49
  }
@@ -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
  }
@@ -112,7 +112,7 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
112
112
  return /* @__PURE__ */ jsxs(DropdownMenu$1.SubTrigger, {
113
113
  "data-slot": "dropdown-menu-sub-trigger",
114
114
  "data-inset": inset,
115
- className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
115
+ className: cn("focus:bg-accent data-[variant=default]:focus:text-accent-foreground data-[variant=default]:focus:**:text-accent-foreground data-[variant=highlight]:text-blue-600 dark:data-[variant=highlight]:text-blue-400 data-[variant=highlight]:*:[svg]:text-current data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
116
116
  ...props,
117
117
  children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
118
118
  });
@@ -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
+ };