@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,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/typography.tsx
6
6
  const typographyVariants = cva("", {
7
7
  variants: { variant: {
@@ -24,4 +24,21 @@ export type UserMenuProps = {
24
24
  * and any links are wired by the consumer — this component is presentation. */
25
25
  children: React.ReactNode;
26
26
  };
27
+ /**
28
+ * Width of the account menu's popup (17rem, 272px — the Claude app's). Apps
29
+ * composing their own account menu (e.g. with a context switcher) use it on
30
+ * their `DropdownMenuContent` so every app's menu has the same size.
31
+ */
32
+ export declare const USER_MENU_WIDTH = "w-68";
33
+ /**
34
+ * Who is signed in, on top of an account menu (name over e-mail, optionally
35
+ * with the avatar). `UserMenu` draws it; apps composing their own account
36
+ * menu put it first in their `DropdownMenuContent`.
37
+ */
38
+ export declare function DropdownMenuAccountHeader({ name, secondary, avatarUrl }: {
39
+ name: string | null;
40
+ secondary?: string | null;
41
+ /** Pass it (even `null`) to show the avatar beside the identity. */
42
+ avatarUrl?: string | null;
43
+ }): React.JSX.Element;
27
44
  export declare function UserMenu({ name, secondary, avatarUrl, triggerLabel, trigger, align, children }: UserMenuProps): React.JSX.Element;
@@ -12,6 +12,39 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  function userMenuInitials(name, secondary) {
13
13
  return initials(name, secondary);
14
14
  }
15
+ /**
16
+ * Width of the account menu's popup (17rem, 272px — the Claude app's). Apps
17
+ * composing their own account menu (e.g. with a context switcher) use it on
18
+ * their `DropdownMenuContent` so every app's menu has the same size.
19
+ */
20
+ const USER_MENU_WIDTH = "w-68";
21
+ /**
22
+ * Who is signed in, on top of an account menu (name over e-mail, optionally
23
+ * with the avatar). `UserMenu` draws it; apps composing their own account
24
+ * menu put it first in their `DropdownMenuContent`.
25
+ */
26
+ function DropdownMenuAccountHeader({ name, secondary = null, avatarUrl }) {
27
+ return /* @__PURE__ */ jsxs(DropdownMenuLabel, {
28
+ "data-slot": "dropdown-menu-account-header",
29
+ className: "flex items-center gap-2 font-normal",
30
+ children: [avatarUrl === void 0 ? null : /* @__PURE__ */ jsxs(Avatar, {
31
+ size: "default",
32
+ children: [avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
33
+ src: avatarUrl,
34
+ alt: name ?? secondary ?? ""
35
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: initials(name, secondary) })]
36
+ }), /* @__PURE__ */ jsxs("span", {
37
+ className: "flex min-w-0 flex-col gap-1",
38
+ children: [name ? /* @__PURE__ */ jsx("span", {
39
+ className: "text-foreground truncate text-sm font-medium",
40
+ children: name
41
+ }) : null, secondary ? /* @__PURE__ */ jsx("span", {
42
+ className: "truncate text-xs",
43
+ children: secondary
44
+ }) : null]
45
+ })]
46
+ });
47
+ }
15
48
  function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Account", trigger, align = "end", children }) {
16
49
  return /* @__PURE__ */ jsxs(DropdownMenu, {
17
50
  modal: false,
@@ -20,10 +53,11 @@ function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Ac
20
53
  children: trigger ?? /* @__PURE__ */ jsx(Button, {
21
54
  variant: "ghost",
22
55
  size: "icon-lg",
23
- className: "rounded-full",
56
+ className: "rounded-full max-md:size-11",
24
57
  "aria-label": triggerLabel,
25
58
  children: /* @__PURE__ */ jsxs(Avatar, {
26
59
  size: "default",
60
+ className: "max-md:size-11",
27
61
  children: [avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
28
62
  src: avatarUrl,
29
63
  alt: name ?? secondary ?? ""
@@ -32,18 +66,12 @@ function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Ac
32
66
  })
33
67
  }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
34
68
  align,
35
- className: "w-56",
36
- children: [name || secondary ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(DropdownMenuLabel, {
37
- className: "flex flex-col gap-1 font-normal",
38
- children: [name ? /* @__PURE__ */ jsx("span", {
39
- className: "text-sm font-medium",
40
- children: name
41
- }) : null, secondary ? /* @__PURE__ */ jsx("span", {
42
- className: "text-muted-foreground truncate text-xs",
43
- children: secondary
44
- }) : null]
69
+ className: USER_MENU_WIDTH,
70
+ children: [name || secondary ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuAccountHeader, {
71
+ name,
72
+ secondary
45
73
  }), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }) : null, children]
46
74
  })]
47
75
  });
48
76
  }
49
- export { UserMenu, userMenuInitials };
77
+ export { DropdownMenuAccountHeader, USER_MENU_WIDTH, UserMenu, userMenuInitials };
@@ -0,0 +1,21 @@
1
+ import * as React from "react";
2
+ export type WorkspacePickerItem = {
3
+ id: string;
4
+ name: string;
5
+ /** Small line over the name ("Team", "Free", "Pessoal"). */
6
+ kind?: string;
7
+ icon?: React.ComponentType<{
8
+ className?: string;
9
+ }>;
10
+ };
11
+ export type WorkspacePickerProps = {
12
+ /** Logo / product name on top. */
13
+ brand?: React.ReactNode;
14
+ title: React.ReactNode;
15
+ items: readonly WorkspacePickerItem[];
16
+ onSelect: (id: string) => void;
17
+ /** Under everything, e.g. a "Usar outro e-mail" link. */
18
+ footer?: React.ReactNode;
19
+ className?: string;
20
+ };
21
+ export declare function WorkspacePicker({ brand, title, items, onSelect, footer, className }: WorkspacePickerProps): React.JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/workspace-picker.tsx
5
+ function WorkspacePicker({ brand, title, items, onSelect, footer, className }) {
6
+ return /* @__PURE__ */ jsxs("div", {
7
+ "data-slot": "workspace-picker",
8
+ className: cn("bg-background pt-safe pb-safe px-safe flex min-h-dvh flex-col items-center", className),
9
+ children: [
10
+ /* @__PURE__ */ jsx("div", {
11
+ className: "flex h-20 items-center justify-center text-2xl font-semibold",
12
+ children: brand
13
+ }),
14
+ /* @__PURE__ */ jsxs("div", {
15
+ className: "flex w-full max-w-md flex-1 flex-col justify-center gap-8 px-4",
16
+ children: [/* @__PURE__ */ jsx("h1", {
17
+ className: "text-center text-3xl font-semibold tracking-tight",
18
+ children: title
19
+ }), /* @__PURE__ */ jsx("ul", {
20
+ className: "bg-card overflow-hidden rounded-3xl border",
21
+ children: items.map(({ id, name, kind, icon: Icon }) => /* @__PURE__ */ jsx("li", {
22
+ className: "border-b last:border-b-0",
23
+ children: /* @__PURE__ */ jsxs("button", {
24
+ type: "button",
25
+ onClick: () => onSelect(id),
26
+ className: "active:bg-muted hover:bg-muted/60 flex min-h-18 w-full cursor-pointer items-center gap-4 px-6 py-3 text-left",
27
+ children: [Icon ? /* @__PURE__ */ jsx(Icon, {
28
+ "aria-hidden": true,
29
+ className: "text-muted-foreground size-7 shrink-0"
30
+ }) : null, /* @__PURE__ */ jsxs("span", {
31
+ className: "grid min-w-0",
32
+ children: [kind ? /* @__PURE__ */ jsx("span", {
33
+ className: "text-muted-foreground text-sm",
34
+ children: kind
35
+ }) : null, /* @__PURE__ */ jsx("span", {
36
+ className: "truncate text-lg",
37
+ children: name
38
+ })]
39
+ })]
40
+ })
41
+ }, id))
42
+ })]
43
+ }),
44
+ footer ? /* @__PURE__ */ jsx("div", {
45
+ className: "flex min-h-24 items-center justify-center",
46
+ children: footer
47
+ }) : null
48
+ ]
49
+ });
50
+ }
51
+ export { WorkspacePicker };
package/dist/globals.css CHANGED
@@ -48,6 +48,39 @@
48
48
  html:has([data-slot='sidebar-wrapper']) {
49
49
  overflow-y: hidden;
50
50
  }
51
+ html {
52
+ -webkit-text-size-adjust: 100%;
53
+ -webkit-tap-highlight-color: transparent;
54
+ }
55
+ /*
56
+ * Phones (below `md`, the same breakpoint where the shell folds): the root
57
+ * goes to 17px, the iOS body size. Every rem-based size follows, so the type
58
+ * lands on the iOS Dynamic Type scale — text-base = Body (17), text-sm ≈
59
+ * Subheadline (15), text-xs ≈ Footnote (13) — and icons, rows and touch
60
+ * targets grow with it. Desktop (md+) keeps 16px, untouched.
61
+ */
62
+ @media (max-width: 767px) {
63
+ html {
64
+ font-size: 106.25%;
65
+ }
66
+ }
67
+ }
68
+
69
+ /*
70
+ * Safe areas (notch, status bar, iPhone home indicator, Android gesture bar).
71
+ * They are only non-zero when the app sets `viewport-fit=cover` (Next.js:
72
+ * `viewport.viewportFit = 'cover'`); then the shell pads itself with them.
73
+ * Apps can use the same utilities on their own fixed/full-screen surfaces.
74
+ */
75
+ @utility pt-safe {
76
+ padding-top: env(safe-area-inset-top, 0px);
77
+ }
78
+ @utility pb-safe {
79
+ padding-bottom: env(safe-area-inset-bottom, 0px);
80
+ }
81
+ @utility px-safe {
82
+ padding-left: env(safe-area-inset-left, 0px);
83
+ padding-right: env(safe-area-inset-right, 0px);
51
84
  }
52
85
 
53
86
  /*
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ export type AutosaveResult = {
3
+ ok: true;
4
+ } | {
5
+ ok: false;
6
+ error: string;
7
+ };
8
+ export type AutosaveFormOptions = {
9
+ /** Persists the form (e.g. a server action); `ok: false` keeps the field dirty and shows `error`. */
10
+ submit: (formData: FormData) => Promise<AutosaveResult>;
11
+ /** Short confirmation toast after a save ("Negócio atualizado."). */
12
+ successMessage: string;
13
+ /** After a successful save (e.g. the router's refresh). */
14
+ onSaved?: () => void;
15
+ };
16
+ /**
17
+ * Settings fields that save themselves, as in the Claude app — no "Salvar"
18
+ * button: a text field saves when it loses focus or on Enter, Escape undoes
19
+ * the edit, a select/switch saves on change (call `saveSoon`). Nothing is
20
+ * sent when nothing changed; an invalid form (a required field left empty)
21
+ * goes back to the saved values. Spread `formProps` on the `<form>` and give
22
+ * its fields `defaultValue`s.
23
+ */
24
+ export declare function useAutosaveForm({ submit, successMessage, onSaved }: AutosaveFormOptions): {
25
+ /** The last save's error, for the row's description. */
26
+ error: string | null;
27
+ pending: boolean;
28
+ /** Saves after the current event (for selects, switches, pickers). */
29
+ saveSoon: () => void;
30
+ formProps: {
31
+ ref: React.RefObject<HTMLFormElement | null>;
32
+ onBlur: () => void;
33
+ onKeyDown: (event: React.KeyboardEvent<HTMLFormElement>) => void;
34
+ onSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
35
+ };
36
+ };
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { toast } from "sonner";
4
+ // src/hooks/use-autosave-form.ts
5
+ function snapshot(form) {
6
+ return JSON.stringify(Array.from(new FormData(form).entries()));
7
+ }
8
+ /** A text field holding an edit not saved yet (Escape undoes it). */
9
+ function isDirtyField(element) {
10
+ return (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) && element.value !== element.defaultValue;
11
+ }
12
+ /**
13
+ * Settings fields that save themselves, as in the Claude app — no "Salvar"
14
+ * button: a text field saves when it loses focus or on Enter, Escape undoes
15
+ * the edit, a select/switch saves on change (call `saveSoon`). Nothing is
16
+ * sent when nothing changed; an invalid form (a required field left empty)
17
+ * goes back to the saved values. Spread `formProps` on the `<form>` and give
18
+ * its fields `defaultValue`s.
19
+ */
20
+ function useAutosaveForm({ submit, successMessage, onSaved }) {
21
+ const formRef = React.useRef(null);
22
+ const saved = React.useRef(null);
23
+ const [error, setError] = React.useState(null);
24
+ const [pending, startTransition] = React.useTransition();
25
+ React.useEffect(() => {
26
+ if (formRef.current && saved.current === null) saved.current = snapshot(formRef.current);
27
+ }, []);
28
+ const save = () => {
29
+ const form = formRef.current;
30
+ if (!form) return;
31
+ if (!form.checkValidity()) {
32
+ form.reset();
33
+ return;
34
+ }
35
+ const current = snapshot(form);
36
+ const previous = saved.current;
37
+ if (current === previous) return;
38
+ saved.current = current;
39
+ startTransition(async () => {
40
+ const result = await submit(new FormData(form));
41
+ if (!result.ok) {
42
+ saved.current = previous;
43
+ setError(result.error);
44
+ return;
45
+ }
46
+ setError(null);
47
+ toast.success(successMessage);
48
+ onSaved?.();
49
+ });
50
+ };
51
+ const onKeyDown = (event) => {
52
+ const target = event.target;
53
+ if (event.key === "Enter" && target instanceof HTMLInputElement) {
54
+ event.preventDefault();
55
+ target.blur();
56
+ }
57
+ if (event.key === "Escape" && (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) && target.value !== target.defaultValue) {
58
+ event.preventDefault();
59
+ target.value = target.defaultValue;
60
+ }
61
+ };
62
+ return {
63
+ /** The last save's error, for the row's description. */
64
+ error,
65
+ pending,
66
+ /** Saves after the current event (for selects, switches, pickers). */
67
+ saveSoon: () => {
68
+ setTimeout(save, 0);
69
+ },
70
+ formProps: {
71
+ ref: formRef,
72
+ onBlur: save,
73
+ onKeyDown,
74
+ onSubmit: (event) => {
75
+ event.preventDefault();
76
+ save();
77
+ }
78
+ }
79
+ };
80
+ }
81
+ export { isDirtyField, useAutosaveForm };
@@ -1 +1,2 @@
1
+ /** Phone or not; `false` until the browser says (see `useMobileState`). */
1
2
  export declare function useIsMobile(): boolean;
@@ -1,17 +1,24 @@
1
1
  import * as React from "react";
2
2
  // src/hooks/use-mobile.ts
3
3
  const MOBILE_BREAKPOINT = 768;
4
- function useIsMobile() {
4
+ /**
5
+ * Phone or not, and `undefined` until the browser says (server render and
6
+ * hydration) — so chrome can render both layouts gated by CSS meanwhile,
7
+ * instead of flashing the desktop one on phones.
8
+ */
9
+ function useMobileState() {
5
10
  const [isMobile, setIsMobile] = React.useState(void 0);
6
11
  React.useEffect(() => {
7
12
  const mql = window.matchMedia(`(max-width: 767px)`);
8
- const onChange = () => {
9
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
10
- };
13
+ const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
11
14
  mql.addEventListener("change", onChange);
12
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
15
+ onChange();
13
16
  return () => mql.removeEventListener("change", onChange);
14
17
  }, []);
15
- return !!isMobile;
18
+ return isMobile;
19
+ }
20
+ /** Phone or not; `false` until the browser says (see `useMobileState`). */
21
+ function useIsMobile() {
22
+ return useMobileState() === true;
16
23
  }
17
- export { useIsMobile };
24
+ export { useIsMobile, useMobileState };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { cn } from "./lib/cn.js";
2
2
  import { initials } from "./lib/initials.js";
3
3
  import { NavItem, NavMatch, NavSection, hasActiveChild, isActive } from "./lib/nav.js";
4
- import { AppShell, AppShellNavLink, AppShellProps } from "./components/app-shell.js";
5
- import { UserMenu, UserMenuProps, userMenuInitials } from "./components/user-menu.js";
6
- import { Calendar } from "./components/calendar.js";
4
+ import { AppShell, AppShellAction, AppShellMobileAccount, AppShellNavLink, AppShellProps } from "./components/app-shell.js";
5
+ import { SettingsAppearanceLabels, SettingsSignOut, SettingsWorkspace, SettingsWorkspaces } from "./components/settings-mobile-blocks.js";
6
+ import { WorkspacePicker, WorkspacePickerItem, WorkspacePickerProps } from "./components/workspace-picker.js";
7
7
  import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/sidebar-core.js";
8
- import { DateField, DateFieldProps } from "./components/date-field.js";
8
+ import { DropdownMenuAccountHeader, USER_MENU_WIDTH, UserMenu, UserMenuProps, userMenuInitials } from "./components/user-menu.js";
9
9
  import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
10
+ import { Calendar } from "./components/calendar.js";
11
+ import { DateField, DateFieldProps } from "./components/date-field.js";
10
12
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog.js";
11
13
  import { AuthSplitScreen, AuthSplitScreenProps } from "./components/auth-split-screen.js";
12
14
  import { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from "./components/avatar.js";
@@ -43,20 +45,25 @@ import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, Tabl
43
45
  import { Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, tabsListVariants } from "./components/tabs.js";
44
46
  import { Textarea } from "./components/textarea.js";
45
47
  import { ThemeProvider } from "./components/theme-provider.js";
48
+ import { ThemeChoice, ThemeSetting, ThemeSettingLabels } from "./components/theme-setting.js";
46
49
  import { ThemeToggle, ThemeToggleLabels, ThemeToggleProps } from "./components/theme-toggle.js";
47
50
  import { Typography, typographyVariants } from "./components/typography.js";
51
+ import { AccountSettings, AccountSettingsLabels, SettingsAccount } from "./components/account-settings.js";
48
52
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
49
53
  import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
50
54
  import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
51
55
  import { Separator } from "./components/separator.js";
52
56
  import { SettingRow, SettingRowGroup } from "./components/setting-row.js";
53
- import { SettingsDialog, SettingsDialogProps, SettingsDialogSection } from "./components/settings-dialog.js";
57
+ import { SettingsDialog, SettingsDialogLabels, SettingsDialogProps, SettingsDialogSection, SettingsEmpty, SettingsGroup, SettingsItem, matchSections } from "./components/settings-dialog.js";
58
+ import { SettingsAbout, SettingsAboutLink, SettingsDialogAccount } from "./components/settings-dialog-mobile.js";
54
59
  import { SettingsSection } from "./components/settings-section.js";
55
60
  import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.js";
56
61
  import "./components/sidebar.js";
62
+ import { APP_TOOLBAR_HEIGHT, AppToolbar, AppToolbarLabels, PeekSidebar, SidebarPeekProvider, useSidebarPeek } from "./components/sidebar-peek.js";
57
63
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
64
+ import { AutosaveFormOptions, AutosaveResult, useAutosaveForm } from "./hooks/use-autosave-form.js";
58
65
  import { ElementSize, useElementSize } from "./hooks/use-element-size.js";
59
66
  import { HashSection, useHashSection } from "./hooks/use-hash-section.js";
60
67
  import { useIsMobile } from "./hooks/use-mobile.js";
61
68
  import { ScrollStripEdges, useScrollStrip } from "./hooks/use-scroll-strip.js";
62
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, type AppShellNavLink, type AppShellProps, AuthSplitScreen, type AuthSplitScreenProps, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, type BrandIconProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Container, type ContainerProps, DateField, type DateFieldProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ElementSize, EmptyState, type EmptyStateProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GoogleIcon, type HashSection, HighlightedTextarea, Input, InputGroup, InputGroupAddon, InputGroupInput, Label, List, type ListEmptyContent, type ListFilterConfig, ListItem, ListItemActions, ListItemContent, ListItemDescription, type ListItemDescriptor, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, type ListPaginationConfig, type ListProps, type ListSearchConfig, Main, type NavItem, type NavMatch, type NavSection, PageHeader, type PageHeaderProps, PageHeaderSkeleton, type PageHeaderSkeletonProps, Pagination, type PaginationProps, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, type ScrollStripEdges, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsDialog, type SettingsDialogProps, type SettingsDialogSection, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StatusDot, type StatusDotProps, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, type ThemeToggleLabels, type ThemeToggleProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, type UserMenuProps, WhatsappIcon, badgeVariants, buttonGroupVariants, buttonVariants, cn, containerVariants, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, statusDotVariants, tabsListVariants, typographyVariants, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, userMenuInitials };
69
+ export { APP_TOOLBAR_HEIGHT, AccountSettings, type AccountSettingsLabels, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, type AppShellAction, type AppShellMobileAccount, type AppShellNavLink, type AppShellProps, AppToolbar, type AppToolbarLabels, AuthSplitScreen, type AuthSplitScreenProps, type AutosaveFormOptions, type AutosaveResult, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, type BrandIconProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Container, type ContainerProps, DateField, type DateFieldProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuAccountHeader, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ElementSize, EmptyState, type EmptyStateProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GoogleIcon, type HashSection, HighlightedTextarea, Input, InputGroup, InputGroupAddon, InputGroupInput, Label, List, type ListEmptyContent, type ListFilterConfig, ListItem, ListItemActions, ListItemContent, ListItemDescription, type ListItemDescriptor, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, type ListPaginationConfig, type ListProps, type ListSearchConfig, Main, type NavItem, type NavMatch, type NavSection, PageHeader, type PageHeaderProps, PageHeaderSkeleton, type PageHeaderSkeletonProps, Pagination, type PaginationProps, PeekSidebar, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, type ScrollStripEdges, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, type SettingsAbout, type SettingsAboutLink, type SettingsAccount, type SettingsAppearanceLabels, SettingsDialog, type SettingsDialogAccount, type SettingsDialogLabels, type SettingsDialogProps, type SettingsDialogSection, SettingsEmpty, SettingsGroup, SettingsItem, SettingsSection, type SettingsSignOut, type SettingsWorkspace, type SettingsWorkspaces, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPeekProvider, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StatusDot, type StatusDotProps, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, type ThemeChoice, ThemeProvider, ThemeSetting, type ThemeSettingLabels, ThemeToggle, type ThemeToggleLabels, type ThemeToggleProps, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, USER_MENU_WIDTH, UserMenu, type UserMenuProps, WhatsappIcon, WorkspacePicker, type WorkspacePickerItem, type WorkspacePickerProps, badgeVariants, buttonGroupVariants, buttonVariants, cn, containerVariants, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, matchSections as matchSettingsSections, statusDotVariants, tabsListVariants, typographyVariants, useAutosaveForm, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, useSidebarPeek, userMenuInitials };
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import { cn } from "./lib/cn.js";
2
2
  import { initials } from "./lib/initials.js";
3
3
  import { hasActiveChild, isActive } from "./lib/nav.js";
4
4
  import { AppShell } from "./components/app-shell.js";
5
- import { UserMenu, userMenuInitials } from "./components/user-menu.js";
5
+ import { WorkspacePicker } from "./components/workspace-picker.js";
6
+ import { DropdownMenuAccountHeader, USER_MENU_WIDTH, UserMenu, userMenuInitials } from "./components/user-menu.js";
6
7
  import { Calendar } from "./components/calendar.js";
7
8
  import { DateField } from "./components/date-field.js";
8
9
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog.js";
@@ -40,21 +41,25 @@ import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, Tabl
40
41
  import { Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, tabsListVariants } from "./components/tabs.js";
41
42
  import { Textarea } from "./components/textarea.js";
42
43
  import { ThemeProvider } from "./components/theme-provider.js";
44
+ import { ThemeSetting } from "./components/theme-setting.js";
43
45
  import { ThemeToggle } from "./components/theme-toggle.js";
44
46
  import { Typography, typographyVariants } from "./components/typography.js";
47
+ import { AccountSettings } from "./components/account-settings.js";
45
48
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/collapsible.js";
46
49
  import { Popover, PopoverContent, PopoverTrigger } from "./components/popover.js";
47
50
  import { ScrollArea, ScrollBar } from "./components/scroll-area.js";
48
51
  import { Separator } from "./components/separator.js";
49
52
  import { SettingRow, SettingRowGroup } from "./components/setting-row.js";
50
- import { SettingsDialog } from "./components/settings-dialog.js";
53
+ import { SettingsDialog, SettingsEmpty, SettingsGroup, SettingsItem, matchSections } from "./components/settings-dialog.js";
51
54
  import { SettingsSection } from "./components/settings-section.js";
52
55
  import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.js";
53
56
  import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./components/sidebar-core.js";
54
57
  import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./components/sidebar-menu.js";
58
+ import { APP_TOOLBAR_HEIGHT, AppToolbar, PeekSidebar, SidebarPeekProvider, useSidebarPeek } from "./components/sidebar-peek.js";
55
59
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip.js";
60
+ import { useAutosaveForm } from "./hooks/use-autosave-form.js";
56
61
  import { useElementSize } from "./hooks/use-element-size.js";
57
62
  import { useHashSection } from "./hooks/use-hash-section.js";
58
63
  import { useIsMobile } from "./hooks/use-mobile.js";
59
64
  import { useScrollStrip } from "./hooks/use-scroll-strip.js";
60
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, AuthSplitScreen, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Container, DateField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GoogleIcon, HighlightedTextarea, Input, InputGroup, InputGroupAddon, InputGroupInput, Label, List, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, Main, PageHeader, PageHeaderSkeleton, Pagination, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsDialog, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StatusDot, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, UserMenu, WhatsappIcon, badgeVariants, buttonGroupVariants, buttonVariants, cn, containerVariants, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, statusDotVariants, tabsListVariants, typographyVariants, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, userMenuInitials };
65
+ export { APP_TOOLBAR_HEIGHT, AccountSettings, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppShell, AppToolbar, AuthSplitScreen, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Container, DateField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuAccountHeader, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GoogleIcon, HighlightedTextarea, Input, InputGroup, InputGroupAddon, InputGroupInput, Label, List, ListItem, ListItemActions, ListItemContent, ListItemDescription, ListItemLeading, ListItemMedia, ListItemMeta, ListItemTitle, ListItemTrailing, Main, PageHeader, PageHeaderSkeleton, Pagination, PeekSidebar, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SettingRow, SettingRowGroup, SettingsDialog, SettingsEmpty, SettingsGroup, SettingsItem, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarPeekProvider, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StatusDot, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsCount, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeSetting, ThemeToggle, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Typography, USER_MENU_WIDTH, UserMenu, WhatsappIcon, WorkspacePicker, badgeVariants, buttonGroupVariants, buttonVariants, cn, containerVariants, hasActiveChild as hasActiveNavChild, initials, isActive as isNavItemActive, listItemVariants, listVariants, mainVariants, matchSections as matchSettingsSections, statusDotVariants, tabsListVariants, typographyVariants, useAutosaveForm, useElementSize, useHashSection, useIsMobile, useScrollStrip, useSidebar, useSidebarPeek, userMenuInitials };
@@ -0,0 +1,12 @@
1
+ // src/lib/mobile-chrome.ts
2
+ /**
3
+ * A bar floating over its scroller, translucent: the content blurs beneath it
4
+ * as it scrolls. Position it (`absolute inset-x-0 top-0`) and give the
5
+ * scroller a top padding of the bar's height.
6
+ */
7
+ const MOBILE_BAR = "bg-background/70 supports-[backdrop-filter]:bg-background/55 z-30 backdrop-blur-xl backdrop-saturate-150";
8
+ /** Height of the bar's row (4rem); pair with `MOBILE_BAR_OFFSET` on the scroller. */
9
+ const MOBILE_BAR_ROW = "h-16";
10
+ /** Round, softly filled icon button of the phone chrome. */
11
+ const MOBILE_ROUND_BUTTON = "bg-muted/80 text-foreground border-border/60 hover:bg-muted active:bg-muted focus-visible:ring-ring/50 inline-flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-full border shadow-sm backdrop-blur outline-none focus-visible:ring-3 [&_svg]:size-5";
12
+ export { MOBILE_BAR, MOBILE_BAR_ROW, MOBILE_ROUND_BUTTON };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbrl/design",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Design system on Radix + Tailwind v4: shadcn-style components, layout shells and design tokens with an overridable brand accent.",
5
5
  "license": "MIT",
6
6
  "author": "Kayron Cabral",