@snapdragonsnursery/react-components 1.9.0 → 1.10.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
|
@@ -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" 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}>
|
|
@@ -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
|
)}
|