@snapdragonsnursery/react-components 1.9.0 → 1.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/package.json
CHANGED
|
@@ -173,6 +173,7 @@ export function AppSidebar({
|
|
|
173
173
|
navItems,
|
|
174
174
|
projects,
|
|
175
175
|
user,
|
|
176
|
+
version,
|
|
176
177
|
...props
|
|
177
178
|
}) {
|
|
178
179
|
return (
|
|
@@ -198,6 +199,11 @@ export function AppSidebar({
|
|
|
198
199
|
<SidebarTrigger aria-label="Toggle sidebar" />
|
|
199
200
|
</div>
|
|
200
201
|
<NavUser user={user ?? data.user} />
|
|
202
|
+
{version ? (
|
|
203
|
+
<div className="mt-1 text-xs text-muted-foreground">
|
|
204
|
+
<a href="/changelog" title="View changelog" className="hover:underline">v{version}</a>
|
|
205
|
+
</div>
|
|
206
|
+
) : null}
|
|
201
207
|
</SidebarFooter>
|
|
202
208
|
<SidebarRail />
|
|
203
209
|
</Sidebar>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { Laptop, Moon, Sun } from "lucide-react"
|
|
4
|
+
import { Laptop, Moon, Sun, SunMoon } from "lucide-react"
|
|
5
|
+
import { Button } from "./ui/button"
|
|
5
6
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
DropdownMenu,
|
|
8
|
+
DropdownMenuContent,
|
|
9
|
+
DropdownMenuItem,
|
|
10
|
+
DropdownMenuLabel,
|
|
11
|
+
DropdownMenuSeparator,
|
|
12
|
+
DropdownMenuTrigger,
|
|
13
|
+
} from "./ui/dropdown-menu"
|
|
8
14
|
|
|
9
15
|
// Simple theme manager that toggles the `dark` class on <html>.
|
|
10
16
|
// Persists the preference to localStorage under `ui-theme`.
|
|
@@ -40,23 +46,31 @@ export function ThemeModeToggle() {
|
|
|
40
46
|
return () => mq.removeEventListener("change", handler)
|
|
41
47
|
}, [mode])
|
|
42
48
|
|
|
43
|
-
const
|
|
44
|
-
const next = mode === "system" ? "light" : mode === "light" ? "dark" : "system"
|
|
45
|
-
setMode(next)
|
|
46
|
-
window.localStorage.setItem(STORAGE_KEY, next)
|
|
47
|
-
applyTheme(next)
|
|
48
|
-
}, [mode])
|
|
49
|
-
|
|
50
|
-
const icon = mode === "system" ? <Laptop /> : mode === "light" ? <Sun /> : <Moon />
|
|
51
|
-
const label = mode === "system" ? "Auto" : mode === "light" ? "Light" : "Dark"
|
|
49
|
+
const currentIcon = mode === "light" ? <Sun className="h-4 w-4" /> : mode === "dark" ? <Moon className="h-4 w-4" /> : <SunMoon className="h-4 w-4" />
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
<DropdownMenu>
|
|
53
|
+
<DropdownMenuTrigger asChild>
|
|
54
|
+
<Button variant="ghost" size="icon" className="h-7 w-7 p-0" aria-label={`Theme: ${mode}`}>
|
|
55
|
+
{currentIcon}
|
|
56
|
+
<span className="sr-only">Toggle theme</span>
|
|
57
|
+
</Button>
|
|
58
|
+
</DropdownMenuTrigger>
|
|
59
|
+
<DropdownMenuContent align="end" sideOffset={6} className="w-36">
|
|
60
|
+
<DropdownMenuLabel>Theme</DropdownMenuLabel>
|
|
61
|
+
<DropdownMenuSeparator />
|
|
62
|
+
<DropdownMenuItem onClick={() => { setMode("system"); window.localStorage.setItem(STORAGE_KEY, "system"); applyTheme("system") }} className={mode === "system" ? "font-medium" : ""}>
|
|
63
|
+
<Laptop className="mr-2 h-4 w-4" /> Auto
|
|
64
|
+
</DropdownMenuItem>
|
|
65
|
+
<DropdownMenuItem onClick={() => { setMode("light"); window.localStorage.setItem(STORAGE_KEY, "light"); applyTheme("light") }} className={mode === "light" ? "font-medium" : ""}>
|
|
66
|
+
<Sun className="mr-2 h-4 w-4" /> Light
|
|
67
|
+
</DropdownMenuItem>
|
|
68
|
+
<DropdownMenuItem onClick={() => { setMode("dark"); window.localStorage.setItem(STORAGE_KEY, "dark"); applyTheme("dark") }} className={mode === "dark" ? "font-medium" : ""}>
|
|
69
|
+
<Moon className="mr-2 h-4 w-4" /> Dark
|
|
70
|
+
</DropdownMenuItem>
|
|
71
|
+
</DropdownMenuContent>
|
|
72
|
+
</DropdownMenu>
|
|
58
73
|
)
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
export default ThemeModeToggle
|
|
62
|
-
|
|
@@ -117,7 +117,7 @@ function SidebarProvider({
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
className={cn(
|
|
120
|
-
"group/sidebar-wrapper has-data-[variant=inset]:bg-
|
|
120
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-inset flex min-h-svh w-full",
|
|
121
121
|
className
|
|
122
122
|
)}
|
|
123
123
|
{...props}>
|
|
@@ -233,7 +233,7 @@ function SidebarTrigger({
|
|
|
233
233
|
data-slot="sidebar-trigger"
|
|
234
234
|
variant="ghost"
|
|
235
235
|
size="icon"
|
|
236
|
-
className={cn("
|
|
236
|
+
className={cn("h-7 w-7 p-0", className)}
|
|
237
237
|
onClick={(event) => {
|
|
238
238
|
onClick?.(event)
|
|
239
239
|
toggleSidebar()
|
|
@@ -280,7 +280,7 @@ function SidebarInset({
|
|
|
280
280
|
<main
|
|
281
281
|
data-slot="sidebar-inset"
|
|
282
282
|
className={cn(
|
|
283
|
-
"bg-
|
|
283
|
+
"bg-inset relative flex w-full flex-1 flex-col",
|
|
284
284
|
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
|
|
285
285
|
className
|
|
286
286
|
)}
|
package/src/index.d.ts
CHANGED
|
@@ -66,7 +66,22 @@ export function configureTelemetry(...args: any[]): any
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
// Sidebar + UI exports
|
|
69
|
-
export
|
|
69
|
+
export interface AppSidebarProps {
|
|
70
|
+
sites?: any
|
|
71
|
+
activeSiteId?: any
|
|
72
|
+
onSiteChange?: (item: any) => void
|
|
73
|
+
sitesLoading?: boolean
|
|
74
|
+
rooms?: any
|
|
75
|
+
activeRoomId?: any
|
|
76
|
+
onRoomChange?: (item: any) => void
|
|
77
|
+
roomsLoading?: boolean
|
|
78
|
+
roomBaseColor?: string
|
|
79
|
+
navItems?: any
|
|
80
|
+
projects?: any
|
|
81
|
+
user?: any
|
|
82
|
+
version?: string
|
|
83
|
+
}
|
|
84
|
+
export const AppSidebar: React.ComponentType<AppSidebarProps>
|
|
70
85
|
export const Sidebar: React.ComponentType<any>
|
|
71
86
|
export const SidebarContent: React.ComponentType<any>
|
|
72
87
|
export const SidebarFooter: React.ComponentType<any>
|