@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
@@ -0,0 +1,25 @@
1
+ export type SettingsWorkspace = {
2
+ id: string;
3
+ name: string;
4
+ /** Second line: e-mail and plan, kind ("Free", "Team")… */
5
+ description?: string;
6
+ avatarUrl?: string | null;
7
+ };
8
+ export type SettingsWorkspaces = {
9
+ items: readonly SettingsWorkspace[];
10
+ current: string;
11
+ onSelect: (id: string) => void;
12
+ /** "Adicionar conta" / "Novo espaço"; left out without it. */
13
+ onAdd?: () => void;
14
+ addLabel?: string;
15
+ };
16
+ export type SettingsSignOut = {
17
+ label?: string;
18
+ onSelect: () => void;
19
+ };
20
+ export type SettingsAppearanceLabels = {
21
+ title: string;
22
+ light: string;
23
+ dark: string;
24
+ system: string;
25
+ };
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { initials } from "../lib/initials.js";
4
+ import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Check, LogOut, Plus } from "lucide-react";
7
+ import { useTheme } from "next-themes";
8
+ // src/components/settings-mobile-blocks.tsx
9
+ function WorkspacesCard({ workspaces }) {
10
+ return /* @__PURE__ */ jsxs("ul", {
11
+ className: "bg-card overflow-hidden rounded-2xl",
12
+ children: [workspaces.items.map((item) => {
13
+ const current = item.id === workspaces.current;
14
+ return /* @__PURE__ */ jsx("li", {
15
+ className: "group/row",
16
+ children: /* @__PURE__ */ jsxs("button", {
17
+ type: "button",
18
+ "aria-current": current || void 0,
19
+ onClick: () => workspaces.onSelect(item.id),
20
+ className: "active:bg-muted flex w-full cursor-pointer items-center gap-3 pl-4 text-left",
21
+ children: [/* @__PURE__ */ jsx("span", {
22
+ className: "flex size-12 shrink-0 items-center justify-center",
23
+ children: current ? /* @__PURE__ */ jsxs(Avatar, {
24
+ className: "size-12",
25
+ children: [item.avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
26
+ src: item.avatarUrl,
27
+ alt: ""
28
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, {
29
+ className: "bg-background text-base",
30
+ children: initials(item.name, null)
31
+ })]
32
+ }) : null
33
+ }), /* @__PURE__ */ jsxs("span", {
34
+ className: "border-border flex min-h-18 flex-1 items-center gap-2 border-b py-3 pr-4",
35
+ children: [/* @__PURE__ */ jsxs("span", {
36
+ className: "grid min-w-0 flex-1",
37
+ children: [/* @__PURE__ */ jsx("span", {
38
+ className: "truncate text-base",
39
+ children: item.name
40
+ }), item.description ? /* @__PURE__ */ jsx("span", {
41
+ className: "text-muted-foreground truncate text-sm",
42
+ children: item.description
43
+ }) : null]
44
+ }), current ? /* @__PURE__ */ jsx(Check, {
45
+ "aria-hidden": true,
46
+ className: "text-info size-6"
47
+ }) : null]
48
+ })]
49
+ })
50
+ }, item.id);
51
+ }), workspaces.onAdd ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
52
+ type: "button",
53
+ onClick: workspaces.onAdd,
54
+ className: "text-info active:bg-muted flex min-h-14 w-full cursor-pointer items-center gap-3 pl-4 text-left text-base",
55
+ children: [/* @__PURE__ */ jsx("span", {
56
+ className: "flex size-12 shrink-0 items-center justify-center",
57
+ children: /* @__PURE__ */ jsx(Plus, {
58
+ "aria-hidden": true,
59
+ className: "size-6"
60
+ })
61
+ }), workspaces.addLabel ?? "Adicionar"]
62
+ }) }) : null]
63
+ });
64
+ }
65
+ /** A tiny window mock in the theme's colors (the Claude app's tiles). */
66
+ function ThemeTile({ tone }) {
67
+ return /* @__PURE__ */ jsxs("span", {
68
+ "aria-hidden": true,
69
+ className: cn("relative block h-16 w-full overflow-hidden rounded-xl border", tone === "dark" ? "bg-neutral-900 border-neutral-700" : "bg-white border-neutral-200"),
70
+ children: [
71
+ tone === "system" ? /* @__PURE__ */ jsx("span", { className: "absolute inset-0 bg-neutral-900 [clip-path:polygon(100%_0,100%_100%,0_100%)]" }) : null,
72
+ /* @__PURE__ */ jsx("span", { className: "absolute top-3 left-3 h-1 w-8 rounded-full bg-neutral-400" }),
73
+ /* @__PURE__ */ jsx("span", { className: "absolute top-5 left-3 h-1 w-5 rounded-full bg-neutral-400" }),
74
+ /* @__PURE__ */ jsx("span", { className: "bg-primary absolute right-3 bottom-3 size-3 rounded-full" })
75
+ ]
76
+ });
77
+ }
78
+ const TONES = [
79
+ "light",
80
+ "dark",
81
+ "system"
82
+ ];
83
+ function AppearanceCard({ labels }) {
84
+ const { theme, setTheme } = useTheme();
85
+ const value = theme;
86
+ return /* @__PURE__ */ jsxs("section", {
87
+ className: "grid gap-2",
88
+ children: [/* @__PURE__ */ jsx("h3", {
89
+ className: "text-muted-foreground px-4 text-sm",
90
+ children: labels.title
91
+ }), /* @__PURE__ */ jsx("div", {
92
+ role: "radiogroup",
93
+ "aria-label": labels.title,
94
+ className: "bg-card grid grid-cols-3 gap-3 rounded-2xl p-4",
95
+ children: TONES.map((tone) => {
96
+ const checked = value === tone;
97
+ return /* @__PURE__ */ jsxs("button", {
98
+ type: "button",
99
+ role: "radio",
100
+ "aria-checked": checked,
101
+ onClick: () => setTheme(tone),
102
+ className: "group/tile grid cursor-pointer justify-items-center gap-2 outline-none",
103
+ children: [/* @__PURE__ */ jsx("span", {
104
+ className: cn("w-full rounded-2xl p-0.5 ring-2 ring-transparent", checked && "ring-info"),
105
+ children: /* @__PURE__ */ jsx(ThemeTile, { tone })
106
+ }), /* @__PURE__ */ jsx("span", {
107
+ className: cn("text-base", checked ? "text-info" : "text-foreground/80"),
108
+ children: labels[tone]
109
+ })]
110
+ }, tone);
111
+ })
112
+ })]
113
+ });
114
+ }
115
+ function SignOutRow({ signOut }) {
116
+ return /* @__PURE__ */ jsxs("button", {
117
+ type: "button",
118
+ onClick: signOut.onSelect,
119
+ className: "bg-card text-destructive active:bg-muted flex min-h-14 w-full cursor-pointer items-center gap-4 rounded-2xl px-4 text-left text-base",
120
+ children: [/* @__PURE__ */ jsx(LogOut, {
121
+ "aria-hidden": true,
122
+ className: "size-6"
123
+ }), signOut.label ?? "Sair"]
124
+ });
125
+ }
126
+ export { AppearanceCard, SignOutRow, WorkspacesCard };
@@ -12,8 +12,8 @@ import { PanelLeftIcon } from "lucide-react";
12
12
  // src/components/sidebar-core.tsx
13
13
  const SIDEBAR_COOKIE_NAME = "sidebar_state";
14
14
  const SIDEBAR_COOKIE_MAX_AGE = 604800;
15
- const SIDEBAR_WIDTH = "14rem";
16
- const SIDEBAR_WIDTH_MOBILE = "18rem";
15
+ const SIDEBAR_WIDTH = "20rem";
16
+ const SIDEBAR_WIDTH_MOBILE = "min(85vw, 22rem)";
17
17
  const SIDEBAR_WIDTH_ICON = "3rem";
18
18
  const SIDEBAR_KEYBOARD_SHORTCUT = "b";
19
19
  const SidebarContext = React.createContext(null);
@@ -102,12 +102,12 @@ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas"
102
102
  "data-sidebar": "sidebar",
103
103
  "data-slot": "sidebar",
104
104
  "data-mobile": "true",
105
- className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
105
+ className: "bg-sidebar text-sidebar-foreground pt-safe pb-safe w-(--sidebar-width) p-0 [&>button]:hidden",
106
106
  style: cssVars({ "--sidebar-width": SIDEBAR_WIDTH_MOBILE }),
107
107
  side,
108
108
  children: [/* @__PURE__ */ jsxs(SheetHeader, {
109
109
  className: "sr-only",
110
- children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
110
+ children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Barra lateral" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Navegação do aplicativo." })]
111
111
  }), /* @__PURE__ */ jsx("div", {
112
112
  className: "flex h-full w-full flex-col",
113
113
  children
@@ -153,7 +153,7 @@ function SidebarTrigger({ className, onClick, ...props }) {
153
153
  ...props,
154
154
  children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
155
155
  className: "sr-only",
156
- children: "Toggle Sidebar"
156
+ children: "Alternar barra lateral"
157
157
  })]
158
158
  });
159
159
  }
@@ -162,10 +162,10 @@ function SidebarRail({ className, ...props }) {
162
162
  return /* @__PURE__ */ jsx("button", {
163
163
  "data-sidebar": "rail",
164
164
  "data-slot": "sidebar-rail",
165
- "aria-label": "Toggle Sidebar",
165
+ "aria-label": "Alternar barra lateral",
166
166
  tabIndex: -1,
167
167
  onClick: toggleSidebar,
168
- title: "Toggle Sidebar",
168
+ title: "Alternar barra lateral",
169
169
  className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
170
170
  ...props
171
171
  });
@@ -5,9 +5,9 @@ import { Skeleton } from "./skeleton.js";
5
5
  import { Tooltip as Tooltip$1, TooltipContent, TooltipTrigger } from "./tooltip.js";
6
6
  import { useSidebar } from "./sidebar-core.js";
7
7
  import * as React from "react";
8
- import { cva } from "class-variance-authority";
9
8
  import { Slot } from "radix-ui";
10
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { cva } from "class-variance-authority";
11
11
  // src/components/sidebar-menu.tsx
12
12
  function SidebarGroup({ className, ...props }) {
13
13
  return /* @__PURE__ */ jsx("div", {
@@ -0,0 +1,40 @@
1
+ import { Sidebar } from "./sidebar-core.js";
2
+ import "./sidebar.js";
3
+ import * as React from "react";
4
+ /** Whether the collapsed sidebar is peeking over the content right now. */
5
+ export declare function useSidebarPeek(): {
6
+ peeking: boolean;
7
+ };
8
+ /** Goes inside `SidebarProvider`, around `PeekSidebar` and `AppToolbar`. */
9
+ export declare function SidebarPeekProvider({ children }: {
10
+ children: React.ReactNode;
11
+ }): React.JSX.Element;
12
+ /**
13
+ * The DS `Sidebar`, off-canvas when collapsed, that slides in over the
14
+ * content while peeking. Its rail starts a peek from the window's left edge.
15
+ */
16
+ export declare function PeekSidebar({ className, children, ...props }: React.ComponentProps<typeof Sidebar>): React.JSX.Element;
17
+ export type AppToolbarLabels = {
18
+ show: string;
19
+ hide: string;
20
+ back: string;
21
+ forward: string;
22
+ /** Shortcut hint in the toggle's tooltip. */
23
+ shortcut: string;
24
+ };
25
+ /** Space the fixed toolbar takes on top of the sidebar and the content (md+). */
26
+ export declare const APP_TOOLBAR_HEIGHT = "h-12";
27
+ /**
28
+ * Fixed on the top left (md+): the sidebar toggle (hover peeks, click pins)
29
+ * and the history back/forward buttons. Leave `APP_TOOLBAR_HEIGHT` free at the
30
+ * top of the sidebar and of the content.
31
+ */
32
+ export declare function AppToolbar({ labels: labelsProp, onBack, onForward, className }: {
33
+ labels?: Partial<AppToolbarLabels>;
34
+ /** Replaces the browser's history back (the button then stays enabled). */
35
+ onBack?: () => void;
36
+ /** Replaces the browser's history forward (the button then stays enabled). */
37
+ onForward?: () => void;
38
+ /** E.g. `h-14` to line up with a 56px header (default `h-12`). */
39
+ className?: string;
40
+ }): React.JSX.Element;
@@ -0,0 +1,204 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { Button } from "./button.js";
4
+ import { Sidebar, SidebarRail, useSidebar } from "./sidebar-core.js";
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
6
+ import * as React from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { ChevronLeft, ChevronRight, PanelLeft } from "lucide-react";
9
+ // src/components/sidebar-peek.tsx
10
+ /** Pointer grace before a peek closes (crossing gaps, small overshoots). */
11
+ const PEEK_CLOSE_DELAY = 250;
12
+ /** A menu (or popover) opened from the sidebar is on screen: its trigger is open. */
13
+ function hasOpenPopup(container) {
14
+ return container?.querySelector("[data-state=\"open\"]") != null;
15
+ }
16
+ /** A click inside the sidebar or inside a popup it opened (portaled content). */
17
+ function isInsidePeek(target, container) {
18
+ if (!(target instanceof Element)) return false;
19
+ return (container?.contains(target) ?? false) || target.closest("[data-radix-popper-content-wrapper]") !== null;
20
+ }
21
+ const PeekContext = React.createContext(null);
22
+ function usePeek() {
23
+ const peek = React.useContext(PeekContext);
24
+ if (peek === null) throw new Error("usePeek must be used within <SidebarPeekProvider>");
25
+ return peek;
26
+ }
27
+ /** Whether the collapsed sidebar is peeking over the content right now. */
28
+ function useSidebarPeek() {
29
+ return { peeking: usePeek().peeking };
30
+ }
31
+ /** Goes inside `SidebarProvider`, around `PeekSidebar` and `AppToolbar`. */
32
+ function SidebarPeekProvider({ children }) {
33
+ const { open, isMobile } = useSidebar();
34
+ const [peeking, setPeeking] = React.useState(false);
35
+ const timer = React.useRef(null);
36
+ const containerRef = React.useRef(null);
37
+ const outsideClick = React.useRef(null);
38
+ const stopHolding = () => {
39
+ if (outsideClick.current !== null) document.removeEventListener("pointerdown", outsideClick.current, true);
40
+ outsideClick.current = null;
41
+ };
42
+ const clear = () => {
43
+ if (timer.current !== null) clearTimeout(timer.current);
44
+ timer.current = null;
45
+ stopHolding();
46
+ };
47
+ const holdUntilOutsideClick = () => {
48
+ stopHolding();
49
+ const listener = (event) => {
50
+ if (isInsidePeek(event.target, containerRef.current)) return;
51
+ stopHolding();
52
+ setPeeking(false);
53
+ };
54
+ outsideClick.current = listener;
55
+ document.addEventListener("pointerdown", listener, true);
56
+ };
57
+ const value = React.useMemo(() => ({
58
+ peeking: peeking && !open && !isMobile,
59
+ show: () => {
60
+ clear();
61
+ setPeeking(true);
62
+ },
63
+ hideSoon: () => {
64
+ clear();
65
+ timer.current = setTimeout(() => {
66
+ timer.current = null;
67
+ if (hasOpenPopup(containerRef.current)) holdUntilOutsideClick();
68
+ else setPeeking(false);
69
+ }, PEEK_CLOSE_DELAY);
70
+ },
71
+ hideNow: () => {
72
+ clear();
73
+ setPeeking(false);
74
+ },
75
+ containerRef
76
+ }), [
77
+ peeking,
78
+ open,
79
+ isMobile
80
+ ]);
81
+ React.useEffect(() => clear, []);
82
+ return /* @__PURE__ */ jsx(PeekContext.Provider, {
83
+ value,
84
+ children
85
+ });
86
+ }
87
+ /**
88
+ * The DS `Sidebar`, off-canvas when collapsed, that slides in over the
89
+ * content while peeking. Its rail starts a peek from the window's left edge.
90
+ */
91
+ function PeekSidebar({ className, children, ...props }) {
92
+ const { open } = useSidebar();
93
+ const { peeking, show, hideSoon, containerRef } = usePeek();
94
+ return /* @__PURE__ */ jsxs(Sidebar, {
95
+ ref: containerRef,
96
+ collapsible: "offcanvas",
97
+ "data-peeking": peeking || void 0,
98
+ onMouseEnter: peeking ? show : void 0,
99
+ onMouseLeave: peeking ? hideSoon : void 0,
100
+ className: cn(peeking && "!left-0 z-40 shadow-xl", className),
101
+ ...props,
102
+ children: [children, /* @__PURE__ */ jsx(SidebarRail, { onMouseEnter: open ? void 0 : show })]
103
+ });
104
+ }
105
+ const DEFAULT_TOOLBAR_LABELS = {
106
+ show: "Mostrar barra lateral",
107
+ hide: "Ocultar barra lateral",
108
+ back: "Voltar",
109
+ forward: "Avançar",
110
+ shortcut: "Ctrl+B"
111
+ };
112
+ const browserNavigation = () => window.navigation;
113
+ const subscribeHistory = (onChange) => {
114
+ const navigation = browserNavigation();
115
+ navigation?.addEventListener("currententrychange", onChange);
116
+ return () => navigation?.removeEventListener("currententrychange", onChange);
117
+ };
118
+ const historySnapshot = () => {
119
+ const navigation = browserNavigation();
120
+ if (navigation === void 0) return "?";
121
+ return `${navigation.canGoBack ? 1 : 0}|${navigation.canGoForward ? 1 : 0}`;
122
+ };
123
+ /**
124
+ * Whether the browser history can go back / forward, from the Navigation API
125
+ * (`navigation.canGoBack` / `canGoForward`, updated on every entry change —
126
+ * router pushes included). Router-agnostic: it reads the browser, not the app.
127
+ */
128
+ function useHistoryMoves() {
129
+ const snapshot = React.useSyncExternalStore(subscribeHistory, historySnapshot, () => "?");
130
+ if (snapshot === "?") return {
131
+ back: true,
132
+ forward: true
133
+ };
134
+ return {
135
+ back: snapshot.startsWith("1"),
136
+ forward: snapshot.endsWith("1")
137
+ };
138
+ }
139
+ /** Space the fixed toolbar takes on top of the sidebar and the content (md+). */
140
+ const APP_TOOLBAR_HEIGHT = "h-12";
141
+ /**
142
+ * Fixed on the top left (md+): the sidebar toggle (hover peeks, click pins)
143
+ * and the history back/forward buttons. Leave `APP_TOOLBAR_HEIGHT` free at the
144
+ * top of the sidebar and of the content.
145
+ */
146
+ function AppToolbar({ labels: labelsProp, onBack, onForward, className }) {
147
+ const labels = {
148
+ ...DEFAULT_TOOLBAR_LABELS,
149
+ ...labelsProp
150
+ };
151
+ const { open, toggleSidebar } = useSidebar();
152
+ const { show, hideSoon, hideNow } = usePeek();
153
+ const toggleLabel = open ? labels.hide : labels.show;
154
+ const moves = useHistoryMoves();
155
+ return /* @__PURE__ */ jsxs("div", {
156
+ "data-slot": "app-toolbar",
157
+ className: cn("fixed top-0 left-0 z-50 hidden items-center gap-0.5 px-2 md:flex", APP_TOOLBAR_HEIGHT, className),
158
+ children: [
159
+ /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
160
+ asChild: true,
161
+ children: /* @__PURE__ */ jsx(Button, {
162
+ variant: "ghost",
163
+ size: "icon-sm",
164
+ "aria-label": toggleLabel,
165
+ "aria-expanded": open,
166
+ onMouseEnter: open ? void 0 : show,
167
+ onMouseLeave: open ? void 0 : hideSoon,
168
+ onClick: () => {
169
+ hideNow();
170
+ toggleSidebar();
171
+ },
172
+ children: /* @__PURE__ */ jsx(PanelLeft, { "aria-hidden": true })
173
+ })
174
+ }), /* @__PURE__ */ jsxs(TooltipContent, {
175
+ side: "right",
176
+ children: [
177
+ toggleLabel,
178
+ " ",
179
+ /* @__PURE__ */ jsx("kbd", {
180
+ className: "ml-1 opacity-70",
181
+ children: labels.shortcut
182
+ })
183
+ ]
184
+ })] }),
185
+ /* @__PURE__ */ jsx(Button, {
186
+ variant: "ghost",
187
+ size: "icon-sm",
188
+ "aria-label": labels.back,
189
+ disabled: onBack === void 0 && !moves.back,
190
+ onClick: onBack ?? (() => window.history.back()),
191
+ children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": true })
192
+ }),
193
+ /* @__PURE__ */ jsx(Button, {
194
+ variant: "ghost",
195
+ size: "icon-sm",
196
+ "aria-label": labels.forward,
197
+ disabled: onForward === void 0 && !moves.forward,
198
+ onClick: onForward ?? (() => window.history.forward()),
199
+ children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": true })
200
+ })
201
+ ]
202
+ });
203
+ }
204
+ export { APP_TOOLBAR_HEIGHT, AppToolbar, PeekSidebar, SidebarPeekProvider, hasOpenPopup, isInsidePeek, useSidebarPeek };
@@ -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/status-dot.tsx
6
6
  const statusDotVariants = cva("relative inline-flex shrink-0 rounded-full", {
7
7
  variants: {
@@ -1,5 +1,12 @@
1
1
  import * as React from "react";
2
- declare function Table({ className, ...props }: React.ComponentProps<'table'>): React.JSX.Element;
2
+ declare function Table({ className, variant, ...props }: React.ComponentProps<'table'> & {
3
+ /**
4
+ * `settings`: a table inside a settings group, as in the Claude app's
5
+ * "where you signed in" list — small muted header, 44px rows, edges aligned
6
+ * with the group (no side padding on the first/last column), no hover fill.
7
+ */
8
+ variant?: 'default' | 'settings';
9
+ }): React.JSX.Element;
3
10
  declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): React.JSX.Element;
4
11
  declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): React.JSX.Element;
5
12
  declare function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>): React.JSX.Element;
@@ -2,12 +2,13 @@ import { cn } from "../lib/cn.js";
2
2
  import "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  // src/components/table.tsx
5
- function Table({ className, ...props }) {
5
+ function Table({ className, variant = "default", ...props }) {
6
6
  return /* @__PURE__ */ jsx("div", {
7
7
  "data-slot": "table-container",
8
8
  className: "relative w-full overflow-x-auto",
9
9
  children: /* @__PURE__ */ jsx("table", {
10
10
  "data-slot": "table",
11
+ "data-variant": variant,
11
12
  className: cn("w-full caption-bottom text-sm", className),
12
13
  ...props
13
14
  })
@@ -37,21 +38,21 @@ function TableFooter({ className, ...props }) {
37
38
  function TableRow({ className, ...props }) {
38
39
  return /* @__PURE__ */ jsx("tr", {
39
40
  "data-slot": "table-row",
40
- className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className),
41
+ className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors in-data-[variant=settings]:hover:bg-transparent", className),
41
42
  ...props
42
43
  });
43
44
  }
44
45
  function TableHead({ className, ...props }) {
45
46
  return /* @__PURE__ */ jsx("th", {
46
47
  "data-slot": "table-head",
47
- className: cn("text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
48
+ className: cn("text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", "in-data-[variant=settings]:h-8 in-data-[variant=settings]:px-3 in-data-[variant=settings]:text-xs in-data-[variant=settings]:font-normal in-data-[variant=settings]:first:pl-0 in-data-[variant=settings]:last:pr-0", className),
48
49
  ...props
49
50
  });
50
51
  }
51
52
  function TableCell({ className, ...props }) {
52
53
  return /* @__PURE__ */ jsx("td", {
53
54
  "data-slot": "table-cell",
54
- className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
55
+ className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", "in-data-[variant=settings]:h-11 in-data-[variant=settings]:px-3 in-data-[variant=settings]:py-0 in-data-[variant=settings]:[&>*+*]:ml-1.5 in-data-[variant=settings]:first:pl-0 in-data-[variant=settings]:last:pr-0", className),
55
56
  ...props
56
57
  });
57
58
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- import { VariantProps } from "class-variance-authority";
3
2
  import { Tabs as Tabs$1 } from "radix-ui";
3
+ import { VariantProps } from "class-variance-authority";
4
4
  declare function Tabs({ className, ...props }: React.ComponentProps<typeof Tabs$1.Root>): React.JSX.Element;
5
5
  /**
6
6
  * `default`: segmented pill on a muted track (few short options).
@@ -3,9 +3,9 @@ import { useScrollStrip } from "../hooks/use-scroll-strip.js";
3
3
  import { cn } from "../lib/cn.js";
4
4
  import { fadeMask } from "../lib/scroll-target.js";
5
5
  import * as React from "react";
6
- import { cva } from "class-variance-authority";
7
6
  import { Tabs as Tabs$1 } from "radix-ui";
8
7
  import { jsx } from "react/jsx-runtime";
8
+ import { cva } from "class-variance-authority";
9
9
  // src/components/tabs.tsx
10
10
  function Tabs({ className, ...props }) {
11
11
  return /* @__PURE__ */ jsx(Tabs$1.Root, {
@@ -11,5 +11,5 @@ import { ThemeProvider as ThemeProvider$1 } from "next-themes";
11
11
  * </ThemeProvider>
12
12
  * ```
13
13
  */
14
- declare function ThemeProvider({ children, ...props }: React.ComponentProps<typeof ThemeProvider$1>): React.JSX.Element;
14
+ declare function ThemeProvider({ children, attribute, defaultTheme, enableSystem, ...props }: React.ComponentProps<typeof ThemeProvider$1>): React.JSX.Element;
15
15
  export { ThemeProvider };
@@ -13,8 +13,11 @@ import { ThemeProvider as ThemeProvider$1 } from "next-themes";
13
13
  * </ThemeProvider>
14
14
  * ```
15
15
  */
16
- function ThemeProvider({ children, ...props }) {
16
+ function ThemeProvider({ children, attribute = "class", defaultTheme = "system", enableSystem = true, ...props }) {
17
17
  return /* @__PURE__ */ jsx(ThemeProvider$1, {
18
+ attribute,
19
+ defaultTheme,
20
+ enableSystem,
18
21
  ...props,
19
22
  children
20
23
  });
@@ -0,0 +1,12 @@
1
+ export type ThemeChoice = 'system' | 'light' | 'dark';
2
+ export type ThemeSettingLabels = {
3
+ group: string;
4
+ system: string;
5
+ light: string;
6
+ dark: string;
7
+ };
8
+ /** System, light or dark as three icon segments; next-themes stores the choice. */
9
+ export declare function ThemeSetting({ labels: labelsProp, className }: {
10
+ labels?: Partial<ThemeSettingLabels>;
11
+ className?: string;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { Tooltip as Tooltip$1, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
4
+ import { useSyncExternalStore } from "react";
5
+ import { RadioGroup } from "radix-ui";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Monitor, Moon, Sun } from "lucide-react";
8
+ import { useTheme } from "next-themes";
9
+ // src/components/theme-setting.tsx
10
+ const DEFAULT_LABELS = {
11
+ group: "Tema",
12
+ system: "Sistema",
13
+ light: "Claro",
14
+ dark: "Escuro"
15
+ };
16
+ const CHOICES = [
17
+ {
18
+ value: "system",
19
+ icon: Monitor
20
+ },
21
+ {
22
+ value: "light",
23
+ icon: Sun
24
+ },
25
+ {
26
+ value: "dark",
27
+ icon: Moon
28
+ }
29
+ ];
30
+ const subscribeNothing = () => () => {};
31
+ /** True once hydrated: next-themes only knows the stored theme in the browser. */
32
+ function useHydrated() {
33
+ return useSyncExternalStore(subscribeNothing, () => true, () => false);
34
+ }
35
+ /** System, light or dark as three icon segments; next-themes stores the choice. */
36
+ function ThemeSetting({ labels: labelsProp, className }) {
37
+ const labels = {
38
+ ...DEFAULT_LABELS,
39
+ ...labelsProp
40
+ };
41
+ const { theme, setTheme } = useTheme();
42
+ const value = useHydrated() ? theme ?? "system" : void 0;
43
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Root, {
44
+ "aria-label": labels.group,
45
+ value,
46
+ onValueChange: setTheme,
47
+ orientation: "horizontal",
48
+ className: cn("inline-flex gap-0.5", className),
49
+ children: CHOICES.map(({ value: choice, icon: Icon }) => /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
50
+ asChild: true,
51
+ children: /* @__PURE__ */ jsx(RadioGroup.Item, {
52
+ value: choice,
53
+ "aria-label": labels[choice],
54
+ className: "text-muted-foreground hover:text-foreground data-[state=checked]:bg-foreground/10 data-[state=checked]:text-foreground focus-visible:ring-ring/50 flex size-7 cursor-pointer items-center justify-center rounded-sm transition-colors outline-none focus-visible:ring-2",
55
+ children: /* @__PURE__ */ jsx(Icon, {
56
+ "aria-hidden": true,
57
+ className: "size-4"
58
+ })
59
+ })
60
+ }), /* @__PURE__ */ jsx(TooltipContent, {
61
+ side: "bottom",
62
+ children: labels[choice]
63
+ })] }, choice))
64
+ }) });
65
+ }
66
+ export { ThemeSetting };
@@ -4,7 +4,13 @@ import "react";
4
4
  import { Tooltip as Tooltip$1 } from "radix-ui";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/components/tooltip.tsx
7
- function TooltipProvider({ delayDuration = 0, ...props }) {
7
+ /**
8
+ * Hover delay before a tooltip opens: long enough that clicking a button does
9
+ * not flash its tooltip, short enough to still help. Moving between nearby
10
+ * tooltips skips the delay (Radix `skipDelayDuration`).
11
+ */
12
+ const TOOLTIP_DELAY = 500;
13
+ function TooltipProvider({ delayDuration = TOOLTIP_DELAY, ...props }) {
8
14
  return /* @__PURE__ */ jsx(Tooltip$1.Provider, {
9
15
  "data-slot": "tooltip-provider",
10
16
  delayDuration,