@vvedantb/ui 0.59.3 → 0.60.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 CHANGED
@@ -1235,7 +1235,7 @@ Single-plan callers need no change. To move to the multi-plan layout, replace
1235
1235
 
1236
1236
  `SidebarAccountMenu` takes three optional props. Without them it renders as before.
1237
1237
 
1238
- - `themeToggle={{ isDark, onToggle }}`: a "Light mode" / "Dark mode" item after `children`.
1238
+ - `themeToggle={{ isDark, onToggle }}`: a "Light mode" / "Dark mode" item after `children`. Pass `{ theme, onToggle }` instead to cycle light, neutral, dark; `nextThemeInCycle(theme)` gives the theme `onToggle` must set.
1239
1239
  - `signOut={{ onSignOut, description? }}`: a separator and a danger "Sign out" item, last. It opens `SignOutDialog`; Alt-click skips the dialog and `ConfirmSkipHint` shows while Alt is held. The menu owns the dialog state. If `onSignOut` rejects, the dialog buttons enable again.
1240
1240
  - `itemIconSize`: `size` of those two items' icons. Default: the icon's own size.
1241
1241
 
package/app/src/index.ts CHANGED
@@ -42,6 +42,12 @@ export {
42
42
  export { SettingsField } from "./settings/SettingsField.js";
43
43
  export { SettingsStack } from "./settings/SettingsStack.js";
44
44
  export { SettingsToggleRow } from "./settings/SettingsToggleRow.js";
45
+ export {
46
+ THEME_MODES,
47
+ ThemeModePicker,
48
+ type ThemeMode,
49
+ type ThemeModePickerProps,
50
+ } from "./settings/ThemeModePicker.js";
45
51
  export {
46
52
  SettingsEmptyState,
47
53
  type SettingsEmptyStateConfig,
@@ -0,0 +1,94 @@
1
+ import { IconCheck, IconCircleHalf, IconDeviceDesktop, IconMoon, IconSun } from "@tabler/icons-react";
2
+ import { ListEnter } from "../../../src/motion/list-enter";
3
+ import { cn } from "../cn.js";
4
+
5
+ /** A theme the picker can show. `neutral` is `.dark.neutral`. */
6
+ export type ThemeMode = "light" | "neutral" | "dark" | "system";
7
+
8
+ /** Default order: light to dark, then system. */
9
+ export const THEME_MODES = ["light", "neutral", "dark", "system"] as const satisfies readonly ThemeMode[];
10
+
11
+ const LABELS: Record<ThemeMode, string> = { light: "Light", neutral: "Neutral", dark: "Dark", system: "System" };
12
+ const ICONS = { light: IconSun, neutral: IconCircleHalf, dark: IconMoon, system: IconDeviceDesktop };
13
+ // Swatches show the theme itself, so they use fixed colours, not tokens.
14
+ const SWATCHES: Record<ThemeMode, string> = {
15
+ light: "bg-white",
16
+ neutral: "bg-zinc-700",
17
+ dark: "bg-zinc-900",
18
+ system: "bg-linear-to-br from-white to-zinc-900",
19
+ };
20
+ const ICON_COLOURS: Record<ThemeMode, string> = {
21
+ light: "text-amber-500",
22
+ neutral: "text-zinc-300",
23
+ dark: "text-blue-300",
24
+ system: "text-muted-foreground",
25
+ };
26
+
27
+ export type ThemeModePickerProps = {
28
+ /** The selected theme (the stored choice, not the resolved one). */
29
+ value: string | undefined;
30
+ onChange: (mode: ThemeMode) => void;
31
+ /** Themes to show, in order. Default `THEME_MODES`. */
32
+ modes?: readonly ThemeMode[];
33
+ /** Smaller tiles in two columns, for menus and dialogs. Default `false`. */
34
+ compact?: boolean;
35
+ className?: string;
36
+ };
37
+
38
+ /**
39
+ * Theme tiles for an Appearance settings section: a swatch, an icon and a
40
+ * label for each theme, and a check on the selected one. Two columns on a
41
+ * phone, one row from `sm`.
42
+ */
43
+ export function ThemeModePicker({ value, onChange, modes = THEME_MODES, compact = false, className }: ThemeModePickerProps) {
44
+ return (
45
+ <div
46
+ role="group"
47
+ aria-label="Theme"
48
+ className={cn("grid", compact ? "grid-cols-2 gap-1.5" : "grid-cols-2 gap-2 sm:grid-cols-4", className)}
49
+ >
50
+ {modes.map((mode, index) => {
51
+ const active = value === mode;
52
+ const Icon = ICONS[mode];
53
+ return (
54
+ <ListEnter key={mode} index={index} fast slide={false} staggerMax={8} className="h-full">
55
+ <button
56
+ type="button"
57
+ aria-pressed={active}
58
+ onClick={() => onChange(mode)}
59
+ className={cn(
60
+ // The border shows the selected state; idle tiles keep a transparent one to hold their size.
61
+ "relative flex h-full w-full flex-col items-center rounded-surface border font-medium motion-press active:scale-[0.96]",
62
+ compact ? "gap-1 p-2 text-2xs" : "gap-2 p-3 text-xs sm:gap-3 sm:p-4 sm:text-sm",
63
+ active
64
+ ? "border-border bg-primary/8 text-primary"
65
+ : "border-transparent bg-surface-secondary/40 text-muted-foreground hover:bg-surface-secondary/60 hover:text-foreground",
66
+ )}
67
+ >
68
+ {active ? (
69
+ <span
70
+ className={cn(
71
+ "absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground",
72
+ compact ? "right-1 top-1 size-3.5" : "right-2 top-2 size-4",
73
+ )}
74
+ >
75
+ <IconCheck size={compact ? 8 : 10} strokeWidth={3} />
76
+ </span>
77
+ ) : null}
78
+ <div
79
+ className={cn(
80
+ "flex w-full items-center justify-center rounded-lg",
81
+ compact ? "h-8" : "h-12 sm:h-16",
82
+ SWATCHES[mode],
83
+ )}
84
+ >
85
+ <Icon size={compact ? 14 : 22} className={ICON_COLOURS[mode]} />
86
+ </div>
87
+ {LABELS[mode]}
88
+ </button>
89
+ </ListEnter>
90
+ );
91
+ })}
92
+ </div>
93
+ );
94
+ }
@@ -9,6 +9,7 @@ export { SettingsSection } from "./settings/SettingsSection.js";
9
9
  export { SettingsField } from "./settings/SettingsField.js";
10
10
  export { SettingsStack } from "./settings/SettingsStack.js";
11
11
  export { SettingsToggleRow } from "./settings/SettingsToggleRow.js";
12
+ export { THEME_MODES, ThemeModePicker } from "./settings/ThemeModePicker.js";
12
13
  export { SettingsEmptyState } from "./settings/SettingsEmptyState.js";
13
14
  export { DefaultSettingsLayout, SettingsPage } from "./settings/SettingsPage.js";
14
15
  export { createUseStableAuth, resetStableAuthSession, useStableAuth } from "./auth/useStableAuth.js";
@@ -0,0 +1,126 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { IconCheck, IconCircleHalf, IconDeviceDesktop, IconMoon, IconSun } from "@tabler/icons-react";
3
+ import { ListEnter } from "../../../src/motion/list-enter.js";
4
+ import { cn } from "../cn.js";
5
+
6
+ /** A theme the picker can show. `neutral` is `.dark.neutral`. */
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ /** Default order: light to dark, then system. */
9
+ export const THEME_MODES = ["light", "neutral", "dark", "system"];
10
+ const LABELS = {
11
+ light: "Light",
12
+ neutral: "Neutral",
13
+ dark: "Dark",
14
+ system: "System"
15
+ };
16
+ const ICONS = {
17
+ light: IconSun,
18
+ neutral: IconCircleHalf,
19
+ dark: IconMoon,
20
+ system: IconDeviceDesktop
21
+ };
22
+ // Swatches show the theme itself, so they use fixed colours, not tokens.
23
+ const SWATCHES = {
24
+ light: "bg-white",
25
+ neutral: "bg-zinc-700",
26
+ dark: "bg-zinc-900",
27
+ system: "bg-linear-to-br from-white to-zinc-900"
28
+ };
29
+ const ICON_COLOURS = {
30
+ light: "text-amber-500",
31
+ neutral: "text-zinc-300",
32
+ dark: "text-blue-300",
33
+ system: "text-muted-foreground"
34
+ };
35
+ /**
36
+ * Theme tiles for an Appearance settings section: a swatch, an icon and a
37
+ * label for each theme, and a check on the selected one. Two columns on a
38
+ * phone, one row from `sm`.
39
+ */
40
+ export function ThemeModePicker(t0) {
41
+ const $ = _c(15);
42
+ const {
43
+ value,
44
+ onChange,
45
+ modes: t1,
46
+ compact: t2,
47
+ className
48
+ } = t0;
49
+ const modes = t1 === undefined ? THEME_MODES : t1;
50
+ const compact = t2 === undefined ? false : t2;
51
+ const t3 = compact ? "grid-cols-2 gap-1.5" : "grid-cols-2 gap-2 sm:grid-cols-4";
52
+ let t4;
53
+ if ($[0] !== className || $[1] !== t3) {
54
+ t4 = cn("grid", t3, className);
55
+ $[0] = className;
56
+ $[1] = t3;
57
+ $[2] = t4;
58
+ } else {
59
+ t4 = $[2];
60
+ }
61
+ let t5;
62
+ if ($[3] !== compact || $[4] !== modes || $[5] !== onChange || $[6] !== value) {
63
+ let t6;
64
+ if ($[8] !== compact || $[9] !== onChange || $[10] !== value) {
65
+ t6 = (mode, index) => {
66
+ const active = value === mode;
67
+ const Icon = ICONS[mode];
68
+ return /*#__PURE__*/_jsx(ListEnter, {
69
+ index: index,
70
+ fast: true,
71
+ slide: false,
72
+ staggerMax: 8,
73
+ className: "h-full",
74
+ children: /*#__PURE__*/_jsxs("button", {
75
+ type: "button",
76
+ "aria-pressed": active,
77
+ onClick: () => onChange(mode),
78
+ className: cn("relative flex h-full w-full flex-col items-center rounded-surface border font-medium motion-press active:scale-[0.96]", compact ? "gap-1 p-2 text-2xs" : "gap-2 p-3 text-xs sm:gap-3 sm:p-4 sm:text-sm", active ? "border-border bg-primary/8 text-primary" : "border-transparent bg-surface-secondary/40 text-muted-foreground hover:bg-surface-secondary/60 hover:text-foreground"),
79
+ children: [active ? /*#__PURE__*/_jsx("span", {
80
+ className: cn("absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground", compact ? "right-1 top-1 size-3.5" : "right-2 top-2 size-4"),
81
+ children: /*#__PURE__*/_jsx(IconCheck, {
82
+ size: compact ? 8 : 10,
83
+ strokeWidth: 3
84
+ })
85
+ }) : null, /*#__PURE__*/_jsx("div", {
86
+ className: cn("flex w-full items-center justify-center rounded-lg", compact ? "h-8" : "h-12 sm:h-16", SWATCHES[mode]),
87
+ children: /*#__PURE__*/_jsx(Icon, {
88
+ size: compact ? 14 : 22,
89
+ className: ICON_COLOURS[mode]
90
+ })
91
+ }), LABELS[mode]]
92
+ })
93
+ }, mode);
94
+ };
95
+ $[8] = compact;
96
+ $[9] = onChange;
97
+ $[10] = value;
98
+ $[11] = t6;
99
+ } else {
100
+ t6 = $[11];
101
+ }
102
+ t5 = modes.map(t6);
103
+ $[3] = compact;
104
+ $[4] = modes;
105
+ $[5] = onChange;
106
+ $[6] = value;
107
+ $[7] = t5;
108
+ } else {
109
+ t5 = $[7];
110
+ }
111
+ let t6;
112
+ if ($[12] !== t4 || $[13] !== t5) {
113
+ t6 = /*#__PURE__*/_jsx("div", {
114
+ role: "group",
115
+ "aria-label": "Theme",
116
+ className: t4,
117
+ children: t5
118
+ });
119
+ $[12] = t4;
120
+ $[13] = t5;
121
+ $[14] = t6;
122
+ } else {
123
+ t6 = $[14];
124
+ }
125
+ return t6;
126
+ }
@@ -1,6 +1,6 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useState } from "react";
3
- import { IconLogout, IconMoon, IconSun } from "@tabler/icons-react";
3
+ import { IconCircleHalf, IconLogout, IconMoon, IconSun } from "@tabler/icons-react";
4
4
  import { ConfirmSkipHint, skipConfirmTitle } from "../../app/src/confirm/ConfirmSkipHint.js";
5
5
  import { useRequestConfirm } from "../../app/src/confirm/useRequestConfirm.js";
6
6
  import { Button } from "../../src/ui/button.js";
@@ -98,13 +98,9 @@ export function SidebarAccountMenu(t0) {
98
98
  }
99
99
  let t9;
100
100
  if ($[12] !== itemIconSize || $[13] !== themeToggle) {
101
- t9 = themeToggle ? /*#__PURE__*/_jsxs(DropdownMenuItem, {
102
- onSelect: () => themeToggle.onToggle(),
103
- children: [themeToggle.isDark ? /*#__PURE__*/_jsx(IconSun, {
104
- size: itemIconSize
105
- }) : /*#__PURE__*/_jsx(IconMoon, {
106
- size: itemIconSize
107
- }), themeToggle.isDark ? "Light mode" : "Dark mode"]
101
+ t9 = themeToggle ? /*#__PURE__*/_jsx(ThemeItem, {
102
+ toggle: themeToggle,
103
+ iconSize: itemIconSize
108
104
  }) : null;
109
105
  $[12] = itemIconSize;
110
106
  $[13] = themeToggle;
@@ -654,3 +650,68 @@ export function SidebarAccountMenuPlaceholder(t0) {
654
650
  }
655
651
  return t2;
656
652
  }
653
+ /** The theme the menu item moves to: light, then neutral, then dark, then light. */
654
+ export function nextThemeInCycle(theme) {
655
+ if (theme === "dark") return "light";
656
+ if (theme === "neutral") return "dark";
657
+ return "neutral";
658
+ }
659
+ const THEME_ITEM = {
660
+ light: {
661
+ label: "Light mode",
662
+ Icon: IconSun
663
+ },
664
+ neutral: {
665
+ label: "Neutral mode",
666
+ Icon: IconCircleHalf
667
+ },
668
+ dark: {
669
+ label: "Dark mode",
670
+ Icon: IconMoon
671
+ }
672
+ };
673
+ function ThemeItem(t0) {
674
+ const $ = _c(9);
675
+ const {
676
+ toggle,
677
+ iconSize
678
+ } = t0;
679
+ const next = "theme" in toggle ? nextThemeInCycle(toggle.theme) : toggle.isDark ? "light" : "dark";
680
+ const {
681
+ label,
682
+ Icon
683
+ } = THEME_ITEM[next];
684
+ let t1;
685
+ if ($[0] !== toggle) {
686
+ t1 = () => toggle.onToggle();
687
+ $[0] = toggle;
688
+ $[1] = t1;
689
+ } else {
690
+ t1 = $[1];
691
+ }
692
+ let t2;
693
+ if ($[2] !== Icon || $[3] !== iconSize) {
694
+ t2 = /*#__PURE__*/_jsx(Icon, {
695
+ size: iconSize
696
+ });
697
+ $[2] = Icon;
698
+ $[3] = iconSize;
699
+ $[4] = t2;
700
+ } else {
701
+ t2 = $[4];
702
+ }
703
+ let t3;
704
+ if ($[5] !== label || $[6] !== t1 || $[7] !== t2) {
705
+ t3 = /*#__PURE__*/_jsxs(DropdownMenuItem, {
706
+ onSelect: t1,
707
+ children: [t2, label]
708
+ });
709
+ $[5] = label;
710
+ $[6] = t1;
711
+ $[7] = t2;
712
+ $[8] = t3;
713
+ } else {
714
+ t3 = $[8];
715
+ }
716
+ return t3;
717
+ }
@@ -15,7 +15,7 @@ export { SidebarRail, RailTile, RailDivider, RailCollapseTile, shellDockTileProp
15
15
  export { SidebarResizeHandle, useAppShellResize } from "./SidebarResize.js";
16
16
  export { SidebarIconTooltip } from "./SidebarIconTooltip.js";
17
17
  export { SidebarPanel } from "./SidebarPanel.js";
18
- export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "./SidebarAccountMenu.js";
18
+ export { SidebarAccountMenu, SidebarAccountMenuPlaceholder, nextThemeInCycle } from "./SidebarAccountMenu.js";
19
19
  export { SignOutDialog } from "./SignOutDialog.js";
20
20
  export { PageHeaderBar } from "./PageHeaderBar.js";
21
21
  export { PageWrapper } from "./PageWrapper.js";
@@ -183,7 +183,7 @@ export { SidebarRail, RailTile, RailDivider, RailCollapseTile, shellDockTileProp
183
183
  export { SidebarResizeHandle, useAppShellResize } from "../shell/src/SidebarResize.js";
184
184
  export { SidebarIconTooltip } from "../shell/src/SidebarIconTooltip.js";
185
185
  export { SidebarPanel } from "../shell/src/SidebarPanel.js";
186
- export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "../shell/src/SidebarAccountMenu.js";
186
+ export { SidebarAccountMenu, SidebarAccountMenuPlaceholder, nextThemeInCycle } from "../shell/src/SidebarAccountMenu.js";
187
187
  export { SignOutDialog } from "../shell/src/SignOutDialog.js";
188
188
  export { PageHeaderBar } from "../shell/src/PageHeaderBar.js";
189
189
  export { PageWrapper } from "../shell/src/PageWrapper.js";
@@ -214,6 +214,7 @@ export { SettingsSection } from "../app/src/settings/SettingsSection.js";
214
214
  export { SettingsField } from "../app/src/settings/SettingsField.js";
215
215
  export { SettingsStack } from "../app/src/settings/SettingsStack.js";
216
216
  export { SettingsToggleRow } from "../app/src/settings/SettingsToggleRow.js";
217
+ export { THEME_MODES, ThemeModePicker } from "../app/src/settings/ThemeModePicker.js";
217
218
  export { SettingsEmptyState } from "../app/src/settings/SettingsEmptyState.js";
218
219
  export { DefaultSettingsLayout, SettingsPage } from "../app/src/settings/SettingsPage.js";
219
220
  export { applyThemeClass, createThemeProvider, getSystemTheme } from "../app/src/theme/createThemeProvider.js";
package/dist/src/index.js CHANGED
@@ -183,7 +183,7 @@ export { SidebarRail, RailTile, RailDivider, RailCollapseTile, shellDockTileProp
183
183
  export { SidebarResizeHandle, useAppShellResize } from "../shell/src/SidebarResize.js";
184
184
  export { SidebarIconTooltip } from "../shell/src/SidebarIconTooltip.js";
185
185
  export { SidebarPanel } from "../shell/src/SidebarPanel.js";
186
- export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "../shell/src/SidebarAccountMenu.js";
186
+ export { SidebarAccountMenu, SidebarAccountMenuPlaceholder, nextThemeInCycle } from "../shell/src/SidebarAccountMenu.js";
187
187
  export { SignOutDialog } from "../shell/src/SignOutDialog.js";
188
188
  export { PageHeaderBar } from "../shell/src/PageHeaderBar.js";
189
189
  export { PageWrapper } from "../shell/src/PageWrapper.js";
@@ -26,12 +26,16 @@
26
26
  *
27
27
  * It also brings the `text-*` type scale with size-specific
28
28
  * tracking (css/type-scale.css), including the `3xs`, `2xs` and `2sm` tiers.
29
+ *
30
+ * It also brings the sliding pill (css/tabs.css), which the rail troughs
31
+ * (`RailGroup`) and the sliding tabs need to place their pill.
29
32
  */
30
33
 
31
34
  @import "./css/clear-input.css";
32
35
  @import "./css/scrollbar-thin.css";
33
36
  @import "./css/motion.css";
34
37
  @import "./css/type-scale.css";
38
+ @import "./css/tabs.css";
35
39
 
36
40
  @custom-variant dark (&:where(.dark, .dark *));
37
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.59.3",
3
+ "version": "0.60.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
1
  import { useState, type ComponentPropsWithoutRef, type ReactNode } from "react";
2
- import { IconLogout, IconMoon, IconSun } from "@tabler/icons-react";
2
+ import { IconCircleHalf, IconLogout, IconMoon, IconSun } from "@tabler/icons-react";
3
3
  import { ConfirmSkipHint, skipConfirmTitle } from "../../app/src/confirm/ConfirmSkipHint";
4
4
  import { useRequestConfirm } from "../../app/src/confirm/useRequestConfirm";
5
5
  import { Button, type ButtonProps } from "../../src/ui/button";
@@ -51,8 +51,12 @@ export type SidebarAccountMenuProps = {
51
51
  >;
52
52
  /** Menu items after the label and separator. */
53
53
  children?: ReactNode;
54
- /** Adds a "Light mode" / "Dark mode" item after `children`. */
55
- themeToggle?: { isDark: boolean; onToggle: () => void };
54
+ /**
55
+ * Adds a theme item after `children`. With `isDark` it names the other of
56
+ * light and dark. With `theme` it names the next theme in the cycle light,
57
+ * neutral, dark (system counts as light), and `onToggle` must move to it.
58
+ */
59
+ themeToggle?: { isDark: boolean; onToggle: () => void } | { theme: string | undefined; onToggle: () => void };
56
60
  /**
57
61
  * Adds a separator and a danger "Sign out" item last. Selecting it opens
58
62
  * `SignOutDialog` (Alt-click skips it, with `ConfirmSkipHint`). The menu owns
@@ -114,12 +118,7 @@ export function SidebarAccountMenu({
114
118
  <AccountLabel userName={name} email={email} imageUrl={imageUrl} stacked={stackedLabel} />
115
119
  <AccountSeparator />
116
120
  {children}
117
- {themeToggle ? (
118
- <DropdownMenuItem onSelect={() => themeToggle.onToggle()}>
119
- {themeToggle.isDark ? <IconSun size={itemIconSize} /> : <IconMoon size={itemIconSize} />}
120
- {themeToggle.isDark ? "Light mode" : "Dark mode"}
121
- </DropdownMenuItem>
122
- ) : null}
121
+ {themeToggle ? <ThemeItem toggle={themeToggle} iconSize={itemIconSize} /> : null}
123
122
  {signOut ? (
124
123
  <>
125
124
  <DropdownMenuSeparator />
@@ -331,3 +330,29 @@ export type SidebarAccountMenuPlaceholderProps = { className?: string };
331
330
  export function SidebarAccountMenuPlaceholder({ className }: SidebarAccountMenuPlaceholderProps) {
332
331
  return <div className={cn("size-11 rounded-lg bg-surface-tertiary md:size-10", className)} />;
333
332
  }
333
+
334
+ type NextTheme = "light" | "neutral" | "dark";
335
+
336
+ /** The theme the menu item moves to: light, then neutral, then dark, then light. */
337
+ export function nextThemeInCycle(theme: string | undefined): NextTheme {
338
+ if (theme === "dark") return "light";
339
+ if (theme === "neutral") return "dark";
340
+ return "neutral";
341
+ }
342
+
343
+ const THEME_ITEM = {
344
+ light: { label: "Light mode", Icon: IconSun },
345
+ neutral: { label: "Neutral mode", Icon: IconCircleHalf },
346
+ dark: { label: "Dark mode", Icon: IconMoon },
347
+ };
348
+
349
+ function ThemeItem({ toggle, iconSize }: { toggle: NonNullable<SidebarAccountMenuProps["themeToggle"]>; iconSize?: number }) {
350
+ const next: NextTheme = "theme" in toggle ? nextThemeInCycle(toggle.theme) : toggle.isDark ? "light" : "dark";
351
+ const { label, Icon } = THEME_ITEM[next];
352
+ return (
353
+ <DropdownMenuItem onSelect={() => toggle.onToggle()}>
354
+ <Icon size={iconSize} />
355
+ {label}
356
+ </DropdownMenuItem>
357
+ );
358
+ }
@@ -55,7 +55,7 @@ export { SidebarIconTooltip } from "./SidebarIconTooltip.js";
55
55
  export type { SidebarIconTooltipProps } from "./SidebarIconTooltip.js";
56
56
  export { SidebarPanel } from "./SidebarPanel.js";
57
57
  export type { SidebarPanelProps } from "./SidebarPanel.js";
58
- export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "./SidebarAccountMenu.js";
58
+ export { SidebarAccountMenu, SidebarAccountMenuPlaceholder, nextThemeInCycle } from "./SidebarAccountMenu.js";
59
59
  export type {
60
60
  SidebarAccountMenuProps,
61
61
  SidebarAccountMenuPlaceholderProps,
package/src/client.ts CHANGED
@@ -280,7 +280,7 @@ export { SidebarIconTooltip } from "../shell/src/SidebarIconTooltip";
280
280
  export type { SidebarIconTooltipProps } from "../shell/src/SidebarIconTooltip";
281
281
  export { SidebarPanel } from "../shell/src/SidebarPanel";
282
282
  export type { SidebarPanelProps } from "../shell/src/SidebarPanel";
283
- export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "../shell/src/SidebarAccountMenu";
283
+ export { SidebarAccountMenu, SidebarAccountMenuPlaceholder, nextThemeInCycle } from "../shell/src/SidebarAccountMenu";
284
284
  export type {
285
285
  SidebarAccountMenuProps,
286
286
  SidebarAccountMenuPlaceholderProps,
@@ -420,6 +420,7 @@ export { SettingsSection, type SettingsSectionConfig } from "../app/src/settings
420
420
  export { SettingsField } from "../app/src/settings/SettingsField";
421
421
  export { SettingsStack } from "../app/src/settings/SettingsStack";
422
422
  export { SettingsToggleRow } from "../app/src/settings/SettingsToggleRow";
423
+ export { THEME_MODES, ThemeModePicker, type ThemeMode, type ThemeModePickerProps } from "../app/src/settings/ThemeModePicker";
423
424
  export { SettingsEmptyState, type SettingsEmptyStateConfig } from "../app/src/settings/SettingsEmptyState";
424
425
  export {
425
426
  DefaultSettingsLayout,
package/src/index.ts CHANGED
@@ -281,7 +281,7 @@ export { SidebarIconTooltip } from "../shell/src/SidebarIconTooltip";
281
281
  export type { SidebarIconTooltipProps } from "../shell/src/SidebarIconTooltip";
282
282
  export { SidebarPanel } from "../shell/src/SidebarPanel";
283
283
  export type { SidebarPanelProps } from "../shell/src/SidebarPanel";
284
- export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "../shell/src/SidebarAccountMenu";
284
+ export { SidebarAccountMenu, SidebarAccountMenuPlaceholder, nextThemeInCycle } from "../shell/src/SidebarAccountMenu";
285
285
  export type {
286
286
  SidebarAccountMenuProps,
287
287
  SidebarAccountMenuPlaceholderProps,
@@ -26,12 +26,16 @@
26
26
  *
27
27
  * It also brings the `text-*` type scale with size-specific
28
28
  * tracking (css/type-scale.css), including the `3xs`, `2xs` and `2sm` tiers.
29
+ *
30
+ * It also brings the sliding pill (css/tabs.css), which the rail troughs
31
+ * (`RailGroup`) and the sliding tabs need to place their pill.
29
32
  */
30
33
 
31
34
  @import "./css/clear-input.css";
32
35
  @import "./css/scrollbar-thin.css";
33
36
  @import "./css/motion.css";
34
37
  @import "./css/type-scale.css";
38
+ @import "./css/tabs.css";
35
39
 
36
40
  @custom-variant dark (&:where(.dark, .dark *));
37
41