@cbrl/design 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/components/app-shell.d.ts +45 -10
- package/dist/components/app-shell.js +214 -25
- package/dist/components/badge.js +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/container.d.ts +1 -1
- package/dist/components/container.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/main.js +1 -1
- package/dist/components/page-header.js +3 -3
- package/dist/components/settings-dialog-mobile.d.ts +23 -0
- package/dist/components/settings-dialog-mobile.js +198 -0
- package/dist/components/settings-dialog.d.ts +32 -1
- package/dist/components/settings-dialog.js +63 -9
- package/dist/components/settings-mobile-blocks.d.ts +25 -0
- package/dist/components/settings-mobile-blocks.js +126 -0
- package/dist/components/sidebar-core.js +2 -2
- package/dist/components/sidebar-menu.js +1 -1
- package/dist/components/status-dot.js +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/typography.js +1 -1
- package/dist/components/user-menu.js +2 -1
- package/dist/components/workspace-picker.d.ts +21 -0
- package/dist/components/workspace-picker.js +51 -0
- package/dist/globals.css +33 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +14 -7
- package/dist/index.d.ts +7 -4
- package/dist/index.js +2 -1
- package/dist/lib/mobile-chrome.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { initials } from "../lib/initials.js";
|
|
4
|
+
import { MOBILE_BAR, MOBILE_BAR_ROW, MOBILE_ROUND_BUTTON } from "../lib/mobile-chrome.js";
|
|
5
|
+
import { Avatar as Avatar$1, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
6
|
+
import { DialogDescription, DialogTitle } from "./dialog.js";
|
|
7
|
+
import { DropdownMenu as DropdownMenu$1, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
8
|
+
import { AppearanceCard, SignOutRow, WorkspacesCard } from "./settings-mobile-blocks.js";
|
|
9
|
+
import "react";
|
|
10
|
+
import { Dialog } from "radix-ui";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { ChevronLeft, ChevronRight, ExternalLink, FileText, Info, X } from "lucide-react";
|
|
13
|
+
// src/components/settings-dialog-mobile.tsx
|
|
14
|
+
function groupSections(sections) {
|
|
15
|
+
const groups = [];
|
|
16
|
+
for (const section of sections) {
|
|
17
|
+
const last = groups.at(-1);
|
|
18
|
+
if (last && last.label === section.group) last.items.push(section);
|
|
19
|
+
else groups.push({
|
|
20
|
+
label: section.group,
|
|
21
|
+
items: [section]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return groups;
|
|
25
|
+
}
|
|
26
|
+
function AboutLink({ link }) {
|
|
27
|
+
const Icon = link.kind === "document" ? FileText : ExternalLink;
|
|
28
|
+
const external = link.kind !== "document";
|
|
29
|
+
return /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
30
|
+
asChild: true,
|
|
31
|
+
className: "gap-3 py-2.5 text-base [&_svg]:size-5",
|
|
32
|
+
children: /* @__PURE__ */ jsxs("a", {
|
|
33
|
+
href: link.href,
|
|
34
|
+
target: external ? "_blank" : void 0,
|
|
35
|
+
rel: external ? "noreferrer" : void 0,
|
|
36
|
+
children: [/* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), link.label]
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function AboutMenu({ about, label }) {
|
|
41
|
+
return /* @__PURE__ */ jsxs(DropdownMenu$1, {
|
|
42
|
+
modal: false,
|
|
43
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
44
|
+
"aria-label": label,
|
|
45
|
+
className: MOBILE_ROUND_BUTTON,
|
|
46
|
+
children: /* @__PURE__ */ jsx(Info, { "aria-hidden": true })
|
|
47
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
48
|
+
align: "end",
|
|
49
|
+
className: "w-72 rounded-2xl p-2",
|
|
50
|
+
children: [
|
|
51
|
+
about.version ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
52
|
+
className: "text-foreground px-3 py-2 text-base font-normal",
|
|
53
|
+
children: about.version
|
|
54
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }) : null,
|
|
55
|
+
about.links?.map((link) => /* @__PURE__ */ jsx(AboutLink, { link }, link.href)),
|
|
56
|
+
about.links?.length && about.support?.length ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
|
|
57
|
+
about.support?.map((link) => /* @__PURE__ */ jsx(AboutLink, { link }, link.href))
|
|
58
|
+
]
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function MobileSettings({ sections, current, view, onOpen, onBack, account, about, extras = {}, labels, children }) {
|
|
63
|
+
const active = sections.find((s) => s.key === current);
|
|
64
|
+
const inSection = view === "section" && active !== void 0;
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
66
|
+
"data-slot": "settings-mobile",
|
|
67
|
+
className: "relative flex min-h-0 flex-1 flex-col",
|
|
68
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
69
|
+
"data-slot": "settings-mobile-bar",
|
|
70
|
+
className: cn(MOBILE_BAR, "absolute inset-x-0 top-0 flex items-center px-4", MOBILE_BAR_ROW),
|
|
71
|
+
children: [
|
|
72
|
+
inSection ? /* @__PURE__ */ jsx("button", {
|
|
73
|
+
type: "button",
|
|
74
|
+
"aria-label": labels.back,
|
|
75
|
+
className: MOBILE_ROUND_BUTTON,
|
|
76
|
+
onClick: onBack,
|
|
77
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": true })
|
|
78
|
+
}) : /* @__PURE__ */ jsx(Dialog.Close, {
|
|
79
|
+
"aria-label": labels.close,
|
|
80
|
+
className: MOBILE_ROUND_BUTTON,
|
|
81
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": true })
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx(DialogTitle, {
|
|
84
|
+
className: "pointer-events-none absolute inset-x-20 truncate text-center text-base font-semibold",
|
|
85
|
+
children: inSection ? active.label : labels.title
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx(DialogDescription, {
|
|
88
|
+
className: "sr-only",
|
|
89
|
+
children: inSection ? active.label : labels.title
|
|
90
|
+
}),
|
|
91
|
+
!inSection && about ? /* @__PURE__ */ jsx("div", {
|
|
92
|
+
className: "ml-auto",
|
|
93
|
+
children: /* @__PURE__ */ jsx(AboutMenu, {
|
|
94
|
+
about,
|
|
95
|
+
label: labels.about
|
|
96
|
+
})
|
|
97
|
+
}) : null
|
|
98
|
+
]
|
|
99
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
100
|
+
className: "pb-safe min-h-0 flex-1 overflow-y-auto overscroll-contain pt-16 [scroll-padding-top:4rem]",
|
|
101
|
+
children: inSection ? /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
role: "region",
|
|
103
|
+
"aria-label": active.label,
|
|
104
|
+
"data-slot": "settings-dialog-content",
|
|
105
|
+
className: "grid gap-6 px-4 pt-2 pb-8",
|
|
106
|
+
children: [active.description ? /* @__PURE__ */ jsx("p", {
|
|
107
|
+
className: "text-muted-foreground px-1 text-sm",
|
|
108
|
+
children: active.description
|
|
109
|
+
}) : null, children]
|
|
110
|
+
}) : /* @__PURE__ */ jsx(SettingsHome, {
|
|
111
|
+
label: labels.title,
|
|
112
|
+
sections,
|
|
113
|
+
account,
|
|
114
|
+
extras,
|
|
115
|
+
onOpen
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function AccountCard({ account, onOpen }) {
|
|
121
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Avatar$1, {
|
|
122
|
+
className: "size-12",
|
|
123
|
+
children: [account.avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
|
|
124
|
+
src: account.avatarUrl,
|
|
125
|
+
alt: ""
|
|
126
|
+
}) : null, /* @__PURE__ */ jsx(AvatarFallback, { children: initials(account.name, account.secondary ?? null) })]
|
|
127
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
128
|
+
className: "grid min-w-0 flex-1 text-left",
|
|
129
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
130
|
+
className: "truncate text-base",
|
|
131
|
+
children: account.name
|
|
132
|
+
}), account.secondary ? /* @__PURE__ */ jsx("span", {
|
|
133
|
+
className: "text-muted-foreground truncate text-sm",
|
|
134
|
+
children: account.secondary
|
|
135
|
+
}) : null]
|
|
136
|
+
})] });
|
|
137
|
+
const section = account.section;
|
|
138
|
+
if (section === void 0) return /* @__PURE__ */ jsx("div", {
|
|
139
|
+
className: "bg-card flex items-center gap-3 rounded-2xl p-4",
|
|
140
|
+
children: content
|
|
141
|
+
});
|
|
142
|
+
return /* @__PURE__ */ jsx("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
onClick: () => onOpen(section),
|
|
145
|
+
className: "bg-card active:bg-muted flex cursor-pointer items-center gap-3 rounded-2xl p-4",
|
|
146
|
+
children: content
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/** The home of the phone settings: account card, then a card per group. */
|
|
150
|
+
function SettingsHome({ label, sections, account, extras, onOpen }) {
|
|
151
|
+
let top = null;
|
|
152
|
+
if (extras.workspaces) top = /* @__PURE__ */ jsx(WorkspacesCard, { workspaces: extras.workspaces });
|
|
153
|
+
else if (account) top = /* @__PURE__ */ jsx(AccountCard, {
|
|
154
|
+
account,
|
|
155
|
+
onOpen
|
|
156
|
+
});
|
|
157
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
158
|
+
"aria-label": label,
|
|
159
|
+
className: "grid gap-6 px-4 pt-2 pb-8",
|
|
160
|
+
children: [
|
|
161
|
+
top,
|
|
162
|
+
groupSections(sections).map((group, index) => /* @__PURE__ */ jsxs("section", {
|
|
163
|
+
className: "grid gap-2",
|
|
164
|
+
children: [group.label ? /* @__PURE__ */ jsx("h3", {
|
|
165
|
+
className: "text-muted-foreground px-4 text-sm first-letter:uppercase",
|
|
166
|
+
children: (group.label && extras.groupLabels?.[group.label]) ?? group.label
|
|
167
|
+
}) : null, /* @__PURE__ */ jsx("ul", {
|
|
168
|
+
className: "bg-card overflow-hidden rounded-2xl",
|
|
169
|
+
children: group.items.map(({ key, label: itemLabel, icon: Icon }) => /* @__PURE__ */ jsx("li", {
|
|
170
|
+
className: "group/row",
|
|
171
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
172
|
+
type: "button",
|
|
173
|
+
onClick: () => onOpen(key),
|
|
174
|
+
className: "active:bg-muted flex min-h-14 w-full cursor-pointer items-center gap-4 pl-4 text-left",
|
|
175
|
+
children: [Icon ? /* @__PURE__ */ jsx("span", {
|
|
176
|
+
"aria-hidden": true,
|
|
177
|
+
className: "text-foreground/80 flex shrink-0",
|
|
178
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "size-6" })
|
|
179
|
+
}) : null, /* @__PURE__ */ jsxs("span", {
|
|
180
|
+
className: "border-border flex min-h-14 flex-1 items-center gap-2 border-b pr-4 group-last/row:border-b-0",
|
|
181
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
182
|
+
className: "flex-1 text-base",
|
|
183
|
+
children: itemLabel
|
|
184
|
+
}), /* @__PURE__ */ jsx(ChevronRight, {
|
|
185
|
+
"aria-hidden": true,
|
|
186
|
+
className: "text-muted-foreground size-5"
|
|
187
|
+
})]
|
|
188
|
+
})]
|
|
189
|
+
})
|
|
190
|
+
}, key))
|
|
191
|
+
})]
|
|
192
|
+
}, group.label ?? index)),
|
|
193
|
+
extras.appearance ? /* @__PURE__ */ jsx(AppearanceCard, { labels: extras.appearance }) : null,
|
|
194
|
+
extras.signOut ? /* @__PURE__ */ jsx(SignOutRow, { signOut: extras.signOut }) : null
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
export { MobileSettings };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SettingsAbout, SettingsDialogAccount } from "./settings-dialog-mobile.js";
|
|
2
|
+
import { SettingsSignOut, SettingsWorkspaces } from "./settings-mobile-blocks.js";
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
export type SettingsDialogSection<K extends string = string> = {
|
|
3
5
|
key: K;
|
|
@@ -26,6 +28,17 @@ export type SettingsDialogLabels = {
|
|
|
26
28
|
clearSearch: string;
|
|
27
29
|
/** Shown in the nav when no section matches. */
|
|
28
30
|
noResults: string;
|
|
31
|
+
/** Phones: the back button of a section. */
|
|
32
|
+
back: string;
|
|
33
|
+
/** Phones: the close button. */
|
|
34
|
+
close: string;
|
|
35
|
+
/** Phones: the (i) button with version and links. */
|
|
36
|
+
about: string;
|
|
37
|
+
/** Phones: the theme tiles' heading and names. */
|
|
38
|
+
appearance: string;
|
|
39
|
+
light: string;
|
|
40
|
+
dark: string;
|
|
41
|
+
system: string;
|
|
29
42
|
};
|
|
30
43
|
export type SettingsDialogProps<K extends string = string> = {
|
|
31
44
|
open?: boolean;
|
|
@@ -38,6 +51,24 @@ export type SettingsDialogProps<K extends string = string> = {
|
|
|
38
51
|
defaultValue?: K;
|
|
39
52
|
onValueChange?: (key: K) => void;
|
|
40
53
|
labels?: Partial<SettingsDialogLabels>;
|
|
54
|
+
/**
|
|
55
|
+
* Phones: the identity card on top of the list (Claude-app style); with
|
|
56
|
+
* `section`, tapping it opens that section (e.g. the profile).
|
|
57
|
+
*/
|
|
58
|
+
account?: SettingsDialogAccount<K>;
|
|
59
|
+
/** Phones: the (i) menu in the header — app version, policies, support. */
|
|
60
|
+
about?: SettingsAbout;
|
|
61
|
+
/** Phones: the workspace switcher on top (replaces the `account` card). */
|
|
62
|
+
workspaces?: SettingsWorkspaces;
|
|
63
|
+
/**
|
|
64
|
+
* Phones: the theme tiles (Claro / Escuro / Sistema) right in the home, at
|
|
65
|
+
* the end. Pass the key of the app's appearance section to drop it there.
|
|
66
|
+
*/
|
|
67
|
+
appearance?: boolean | K;
|
|
68
|
+
/** Phones: "Sair" as the last row of the home. */
|
|
69
|
+
signOut?: SettingsSignOut;
|
|
70
|
+
/** Phones: headings of the section groups, by `group` (else the group itself). */
|
|
71
|
+
groupLabels?: Readonly<Record<string, string>>;
|
|
41
72
|
/** Content of the active section; apps switch on the value. */
|
|
42
73
|
children?: React.ReactNode;
|
|
43
74
|
className?: string;
|
|
@@ -53,7 +84,7 @@ export declare function matchSections<K extends string>(sections: readonly Setti
|
|
|
53
84
|
* Typing filters the nav by label and keywords; Enter opens the first match;
|
|
54
85
|
* Escape (or the clear button) empties the search before closing.
|
|
55
86
|
*/
|
|
56
|
-
export declare function SettingsDialog<K extends string>({ open, defaultOpen, onOpenChange, sections, value, defaultValue, onValueChange, labels: labelsProp, children, className }: SettingsDialogProps<K>): React.JSX.Element;
|
|
87
|
+
export declare function SettingsDialog<K extends string>({ open, defaultOpen, onOpenChange, sections, value, defaultValue, onValueChange, labels: labelsProp, account, about, workspaces, appearance, signOut, groupLabels, children, className }: SettingsDialogProps<K>): React.JSX.Element;
|
|
57
88
|
/** A titled block of settings rows ("Perfil", "Geral"…). */
|
|
58
89
|
export declare function SettingsGroup({ title, action, listLabel, children, className }: {
|
|
59
90
|
title?: React.ReactNode;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isDirtyField } from "../hooks/use-autosave-form.js";
|
|
3
|
+
import { useIsMobile } from "../hooks/use-mobile.js";
|
|
3
4
|
import { useScrollStrip } from "../hooks/use-scroll-strip.js";
|
|
4
5
|
import { cn } from "../lib/cn.js";
|
|
5
6
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog.js";
|
|
6
7
|
import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
|
|
7
8
|
import { ScrollArea } from "./scroll-area.js";
|
|
9
|
+
import { MobileSettings } from "./settings-dialog-mobile.js";
|
|
8
10
|
import * as React from "react";
|
|
9
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
import { Search, X } from "lucide-react";
|
|
@@ -15,7 +17,14 @@ const DEFAULT_LABELS = {
|
|
|
15
17
|
search: "Buscar configurações",
|
|
16
18
|
searchPlaceholder: "Procurar",
|
|
17
19
|
clearSearch: "Limpar busca",
|
|
18
|
-
noResults: "Nada encontrado"
|
|
20
|
+
noResults: "Nada encontrado",
|
|
21
|
+
back: "Voltar",
|
|
22
|
+
close: "Fechar",
|
|
23
|
+
about: "Sobre",
|
|
24
|
+
appearance: "Aparência",
|
|
25
|
+
light: "Claro",
|
|
26
|
+
dark: "Escuro",
|
|
27
|
+
system: "Sistema"
|
|
19
28
|
};
|
|
20
29
|
/** Fades only the edges of the phone strip that hide sections (as in the DS). */
|
|
21
30
|
function fadeMask({ start, end }) {
|
|
@@ -50,7 +59,9 @@ function matchSections(sections, query) {
|
|
|
50
59
|
* Typing filters the nav by label and keywords; Enter opens the first match;
|
|
51
60
|
* Escape (or the clear button) empties the search before closing.
|
|
52
61
|
*/
|
|
53
|
-
function SettingsDialog({ open, defaultOpen, onOpenChange, sections, value, defaultValue, onValueChange, labels: labelsProp, children, className }) {
|
|
62
|
+
function SettingsDialog({ open, defaultOpen, onOpenChange, sections, value, defaultValue, onValueChange, labels: labelsProp, account, about, workspaces, appearance, signOut, groupLabels, children, className }) {
|
|
63
|
+
const isMobile = useIsMobile();
|
|
64
|
+
const [mobileView, setMobileView] = React.useState("list");
|
|
54
65
|
const labels = {
|
|
55
66
|
...DEFAULT_LABELS,
|
|
56
67
|
...labelsProp
|
|
@@ -65,6 +76,48 @@ function SettingsDialog({ open, defaultOpen, onOpenChange, sections, value, defa
|
|
|
65
76
|
if (value === void 0) setInner(key);
|
|
66
77
|
onValueChange?.(key);
|
|
67
78
|
};
|
|
79
|
+
if (isMobile) return /* @__PURE__ */ jsx(Dialog, {
|
|
80
|
+
open,
|
|
81
|
+
defaultOpen,
|
|
82
|
+
onOpenChange: (next) => {
|
|
83
|
+
setMobileView("list");
|
|
84
|
+
onOpenChange?.(next);
|
|
85
|
+
},
|
|
86
|
+
children: /* @__PURE__ */ jsx(DialogContent, {
|
|
87
|
+
"data-slot": "settings-dialog",
|
|
88
|
+
showCloseButton: false,
|
|
89
|
+
className: cn("bg-background data-open:slide-in-from-bottom-10 data-closed:slide-out-to-bottom-10 top-[calc(env(safe-area-inset-top,0px)+0.5rem)] bottom-0 left-0 flex h-auto w-full max-w-none translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 data-open:zoom-in-100 data-closed:zoom-out-100 sm:max-w-none", className),
|
|
90
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
91
|
+
onEscapeKeyDown: (event) => {
|
|
92
|
+
if (isDirtyField(document.activeElement)) event.preventDefault();
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ jsx(MobileSettings, {
|
|
95
|
+
sections: typeof appearance === "string" ? sections.filter((s) => s.key !== appearance) : sections,
|
|
96
|
+
extras: {
|
|
97
|
+
workspaces,
|
|
98
|
+
signOut,
|
|
99
|
+
groupLabels,
|
|
100
|
+
appearance: appearance ? {
|
|
101
|
+
title: labels.appearance,
|
|
102
|
+
light: labels.light,
|
|
103
|
+
dark: labels.dark,
|
|
104
|
+
system: labels.system
|
|
105
|
+
} : void 0
|
|
106
|
+
},
|
|
107
|
+
current,
|
|
108
|
+
view: mobileView,
|
|
109
|
+
onOpen: (key) => {
|
|
110
|
+
select(key);
|
|
111
|
+
setMobileView("section");
|
|
112
|
+
},
|
|
113
|
+
onBack: () => setMobileView("list"),
|
|
114
|
+
account,
|
|
115
|
+
about,
|
|
116
|
+
labels,
|
|
117
|
+
children
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
});
|
|
68
121
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
69
122
|
open,
|
|
70
123
|
defaultOpen,
|
|
@@ -190,6 +243,7 @@ function SettingsNav({ label, noResults, sections, current, onSelect }) {
|
|
|
190
243
|
}) : null]
|
|
191
244
|
});
|
|
192
245
|
}
|
|
246
|
+
const GROUP_BODY = "grid max-md:bg-card max-md:rounded-2xl max-md:px-4";
|
|
193
247
|
/** A titled block of settings rows ("Perfil", "Geral"…). */
|
|
194
248
|
function SettingsGroup({ title, action, listLabel, children, className }) {
|
|
195
249
|
return /* @__PURE__ */ jsxs("section", {
|
|
@@ -198,18 +252,18 @@ function SettingsGroup({ title, action, listLabel, children, className }) {
|
|
|
198
252
|
children: [title || action ? /* @__PURE__ */ jsxs("div", {
|
|
199
253
|
className: "flex min-h-8 items-center justify-between gap-4",
|
|
200
254
|
children: [title ? /* @__PURE__ */ jsx("h3", {
|
|
201
|
-
className: "text-sm font-medium",
|
|
255
|
+
className: "text-sm font-medium max-md:text-muted-foreground max-md:px-4 max-md:font-normal",
|
|
202
256
|
children: title
|
|
203
257
|
}) : /* @__PURE__ */ jsx("span", {}), action ? /* @__PURE__ */ jsx("div", {
|
|
204
258
|
className: "flex items-center gap-2",
|
|
205
259
|
children: action
|
|
206
260
|
}) : null]
|
|
207
261
|
}) : null, listLabel === void 0 ? /* @__PURE__ */ jsx("div", {
|
|
208
|
-
className:
|
|
262
|
+
className: GROUP_BODY,
|
|
209
263
|
children
|
|
210
264
|
}) : /* @__PURE__ */ jsx("ul", {
|
|
211
265
|
"aria-label": listLabel,
|
|
212
|
-
className:
|
|
266
|
+
className: GROUP_BODY,
|
|
213
267
|
children
|
|
214
268
|
})]
|
|
215
269
|
});
|
|
@@ -232,7 +286,7 @@ function SettingsItem({ label, description, leading, htmlFor, layout = "inline",
|
|
|
232
286
|
return /* @__PURE__ */ jsxs(Row, {
|
|
233
287
|
"data-slot": "settings-item",
|
|
234
288
|
"data-layout": layout,
|
|
235
|
-
className: cn("flex min-h-12 gap-6 border-b py-2.5 last:border-b-0", stacked ? "flex-col gap-2" : "items-center justify-between", className),
|
|
289
|
+
className: cn("flex min-h-12 gap-6 border-b py-2.5 last:border-b-0 max-md:min-h-14 max-md:gap-4", stacked ? "flex-col gap-2" : "items-center justify-between", className),
|
|
236
290
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
237
291
|
className: "flex min-w-0 items-center gap-3",
|
|
238
292
|
children: [leading ? /* @__PURE__ */ jsx("span", {
|
|
@@ -242,10 +296,10 @@ function SettingsItem({ label, description, leading, htmlFor, layout = "inline",
|
|
|
242
296
|
className: "grid min-w-0 gap-0.5",
|
|
243
297
|
children: [htmlFor ? /* @__PURE__ */ jsx("label", {
|
|
244
298
|
htmlFor,
|
|
245
|
-
className: "text-sm",
|
|
299
|
+
className: "text-sm max-md:text-base",
|
|
246
300
|
children: label
|
|
247
301
|
}) : /* @__PURE__ */ jsx("div", {
|
|
248
|
-
className: "text-sm",
|
|
302
|
+
className: "text-sm max-md:text-base",
|
|
249
303
|
children: label
|
|
250
304
|
}), description ? /* @__PURE__ */ jsx("p", {
|
|
251
305
|
className: "text-muted-foreground text-sm leading-snug",
|
|
@@ -254,7 +308,7 @@ function SettingsItem({ label, description, leading, htmlFor, layout = "inline",
|
|
|
254
308
|
})]
|
|
255
309
|
}), children === void 0 ? null : /* @__PURE__ */ jsx("div", {
|
|
256
310
|
"data-slot": "settings-item-control",
|
|
257
|
-
className: cn(stacked ? "grid" : "flex shrink-0 items-center gap-2 [&_[data-slot=input]]:w-56 [&_[data-slot=select-trigger]]:w-56"),
|
|
311
|
+
className: cn(stacked ? "grid" : "flex shrink-0 items-center gap-2 [&_[data-slot=input]]:w-56 [&_[data-slot=select-trigger]]:w-56 max-md:[&_[data-slot=input]]:w-40 max-md:[&_[data-slot=select-trigger]]:w-40"),
|
|
258
312
|
children
|
|
259
313
|
})]
|
|
260
314
|
});
|
|
@@ -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 };
|
|
@@ -13,7 +13,7 @@ import { PanelLeftIcon } from "lucide-react";
|
|
|
13
13
|
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
14
14
|
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
15
15
|
const SIDEBAR_WIDTH = "20rem";
|
|
16
|
-
const SIDEBAR_WIDTH_MOBILE = "
|
|
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,7 +102,7 @@ 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, {
|
|
@@ -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", {
|
|
@@ -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,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).
|
package/dist/components/tabs.js
CHANGED
|
@@ -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, {
|
|
@@ -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: {
|
|
@@ -53,10 +53,11 @@ function UserMenu({ name, secondary = null, avatarUrl = null, triggerLabel = "Ac
|
|
|
53
53
|
children: trigger ?? /* @__PURE__ */ jsx(Button, {
|
|
54
54
|
variant: "ghost",
|
|
55
55
|
size: "icon-lg",
|
|
56
|
-
className: "rounded-full",
|
|
56
|
+
className: "rounded-full max-md:size-11",
|
|
57
57
|
"aria-label": triggerLabel,
|
|
58
58
|
children: /* @__PURE__ */ jsxs(Avatar, {
|
|
59
59
|
size: "default",
|
|
60
|
+
className: "max-md:size-11",
|
|
60
61
|
children: [avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
|
|
61
62
|
src: avatarUrl,
|
|
62
63
|
alt: name ?? secondary ?? ""
|
|
@@ -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;
|