@moontra/moonui-pro 2.5.2 → 2.5.4
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/dist/index.d.ts +2 -1
- package/dist/index.mjs +8 -7
- package/package.json +1 -1
- package/src/components/sidebar/index.tsx +9 -7
package/dist/index.d.ts
CHANGED
|
@@ -1851,6 +1851,7 @@ interface SidebarConfig {
|
|
|
1851
1851
|
animatedBackground?: boolean;
|
|
1852
1852
|
keyboardShortcuts?: boolean;
|
|
1853
1853
|
persistState?: boolean;
|
|
1854
|
+
persistKey?: string;
|
|
1854
1855
|
onStateChange?: (state: SidebarState) => void;
|
|
1855
1856
|
customStyles?: {
|
|
1856
1857
|
background?: string;
|
|
@@ -1872,7 +1873,7 @@ interface SidebarProps extends SidebarConfig {
|
|
|
1872
1873
|
activePath?: string;
|
|
1873
1874
|
onNavigate?: (href: string) => void;
|
|
1874
1875
|
}
|
|
1875
|
-
declare function Sidebar({ sections, footer, showSearch, searchPlaceholder, onSearchChange, showThemeToggle, theme, onThemeChange, branding, collapsible, defaultCollapsed, floatingActionButton, glassmorphism, animatedBackground, keyboardShortcuts, persistState, onStateChange, customStyles, className, activePath, onNavigate }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
1876
|
+
declare function Sidebar({ sections, footer, showSearch, searchPlaceholder, onSearchChange, showThemeToggle, theme, onThemeChange, branding, collapsible, defaultCollapsed, floatingActionButton, glassmorphism, animatedBackground, keyboardShortcuts, persistState, persistKey, onStateChange, customStyles, className, activePath, onNavigate }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
1876
1877
|
|
|
1877
1878
|
declare const enhancedButtonVariants: (props?: ({
|
|
1878
1879
|
variant?: "link" | "default" | "ghost" | "outline" | "secondary" | "destructive" | "gradient" | "glow" | null | undefined;
|
package/dist/index.mjs
CHANGED
|
@@ -56323,6 +56323,7 @@ function Sidebar({
|
|
|
56323
56323
|
animatedBackground = false,
|
|
56324
56324
|
keyboardShortcuts = true,
|
|
56325
56325
|
persistState = true,
|
|
56326
|
+
persistKey = "moonui-sidebar-state",
|
|
56326
56327
|
onStateChange,
|
|
56327
56328
|
customStyles,
|
|
56328
56329
|
className,
|
|
@@ -56342,7 +56343,7 @@ function Sidebar({
|
|
|
56342
56343
|
const springY = useSpring(mouseY, { stiffness: 300, damping: 30 });
|
|
56343
56344
|
useEffect(() => {
|
|
56344
56345
|
if (persistState && typeof window !== "undefined") {
|
|
56345
|
-
const savedState = localStorage.getItem(
|
|
56346
|
+
const savedState = localStorage.getItem(persistKey);
|
|
56346
56347
|
if (savedState) {
|
|
56347
56348
|
const state = JSON.parse(savedState);
|
|
56348
56349
|
setCollapsed(state.collapsed);
|
|
@@ -56350,7 +56351,7 @@ function Sidebar({
|
|
|
56350
56351
|
setPinnedItems(state.pinnedItems || []);
|
|
56351
56352
|
}
|
|
56352
56353
|
}
|
|
56353
|
-
}, [persistState]);
|
|
56354
|
+
}, [persistState, persistKey]);
|
|
56354
56355
|
useEffect(() => {
|
|
56355
56356
|
if (persistState && typeof window !== "undefined") {
|
|
56356
56357
|
const state = {
|
|
@@ -56360,10 +56361,10 @@ function Sidebar({
|
|
|
56360
56361
|
pinnedItems,
|
|
56361
56362
|
recentItems: []
|
|
56362
56363
|
};
|
|
56363
|
-
localStorage.setItem(
|
|
56364
|
+
localStorage.setItem(persistKey, JSON.stringify(state));
|
|
56364
56365
|
onStateChange?.(state);
|
|
56365
56366
|
}
|
|
56366
|
-
}, [collapsed, expandedSections, searchQuery, pinnedItems, persistState, onStateChange]);
|
|
56367
|
+
}, [collapsed, expandedSections, searchQuery, pinnedItems, persistState, persistKey, onStateChange]);
|
|
56367
56368
|
useEffect(() => {
|
|
56368
56369
|
const checkMobile = () => {
|
|
56369
56370
|
setIsMobile(window.innerWidth < 768);
|
|
@@ -56570,7 +56571,7 @@ function Sidebar({
|
|
|
56570
56571
|
(section) => section.items.filter((item) => pinnedItems.includes(item.id))
|
|
56571
56572
|
).map((item) => renderItem(item)) })
|
|
56572
56573
|
] }),
|
|
56573
|
-
/* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx("div", { className: "p-4 space-y-6", children: sections.map((section, index) => {
|
|
56574
|
+
/* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "p-4 space-y-6", children: sections.map((section, index) => {
|
|
56574
56575
|
const filteredItems = filterItems(section.items, searchQuery);
|
|
56575
56576
|
if (filteredItems.length === 0)
|
|
56576
56577
|
return null;
|
|
@@ -56609,7 +56610,7 @@ function Sidebar({
|
|
|
56609
56610
|
] })
|
|
56610
56611
|
] });
|
|
56611
56612
|
const sidebarClasses = cn(
|
|
56612
|
-
"flex h-full
|
|
56613
|
+
"flex h-full flex-col bg-background border-r",
|
|
56613
56614
|
glassmorphism && "bg-background/80 backdrop-blur-xl border-white/10",
|
|
56614
56615
|
collapsed && !isMobile && "w-16",
|
|
56615
56616
|
!collapsed && !isMobile && "w-64",
|
|
@@ -56642,7 +56643,7 @@ function Sidebar({
|
|
|
56642
56643
|
] }) }) })
|
|
56643
56644
|
] });
|
|
56644
56645
|
}
|
|
56645
|
-
return /* @__PURE__ */ jsxs("aside", { className: cn(sidebarClasses, "sidebar-container hidden md:flex
|
|
56646
|
+
return /* @__PURE__ */ jsxs("aside", { className: cn(sidebarClasses, "sidebar-container hidden md:flex"), children: [
|
|
56646
56647
|
animatedBackground && /* @__PURE__ */ jsx(
|
|
56647
56648
|
motion.div,
|
|
56648
56649
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.4",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -80,6 +80,7 @@ export interface SidebarConfig {
|
|
|
80
80
|
animatedBackground?: boolean
|
|
81
81
|
keyboardShortcuts?: boolean
|
|
82
82
|
persistState?: boolean
|
|
83
|
+
persistKey?: string
|
|
83
84
|
onStateChange?: (state: SidebarState) => void
|
|
84
85
|
customStyles?: {
|
|
85
86
|
background?: string
|
|
@@ -121,6 +122,7 @@ export function Sidebar({
|
|
|
121
122
|
animatedBackground = false,
|
|
122
123
|
keyboardShortcuts = true,
|
|
123
124
|
persistState = true,
|
|
125
|
+
persistKey = 'moonui-sidebar-state',
|
|
124
126
|
onStateChange,
|
|
125
127
|
customStyles,
|
|
126
128
|
className,
|
|
@@ -142,7 +144,7 @@ export function Sidebar({
|
|
|
142
144
|
// Load persisted state
|
|
143
145
|
useEffect(() => {
|
|
144
146
|
if (persistState && typeof window !== 'undefined') {
|
|
145
|
-
const savedState = localStorage.getItem(
|
|
147
|
+
const savedState = localStorage.getItem(persistKey)
|
|
146
148
|
if (savedState) {
|
|
147
149
|
const state = JSON.parse(savedState) as SidebarState
|
|
148
150
|
setCollapsed(state.collapsed)
|
|
@@ -150,7 +152,7 @@ export function Sidebar({
|
|
|
150
152
|
setPinnedItems(state.pinnedItems || [])
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
|
-
}, [persistState])
|
|
155
|
+
}, [persistState, persistKey])
|
|
154
156
|
|
|
155
157
|
// Save state changes
|
|
156
158
|
useEffect(() => {
|
|
@@ -162,10 +164,10 @@ export function Sidebar({
|
|
|
162
164
|
pinnedItems,
|
|
163
165
|
recentItems: []
|
|
164
166
|
}
|
|
165
|
-
localStorage.setItem(
|
|
167
|
+
localStorage.setItem(persistKey, JSON.stringify(state))
|
|
166
168
|
onStateChange?.(state)
|
|
167
169
|
}
|
|
168
|
-
}, [collapsed, expandedSections, searchQuery, pinnedItems, persistState, onStateChange])
|
|
170
|
+
}, [collapsed, expandedSections, searchQuery, pinnedItems, persistState, persistKey, onStateChange])
|
|
169
171
|
|
|
170
172
|
// Check mobile
|
|
171
173
|
useEffect(() => {
|
|
@@ -454,7 +456,7 @@ export function Sidebar({
|
|
|
454
456
|
)}
|
|
455
457
|
|
|
456
458
|
{/* Main Content */}
|
|
457
|
-
<ScrollArea className="flex-1">
|
|
459
|
+
<ScrollArea className="flex-1 overflow-y-auto">
|
|
458
460
|
<div className="p-4 space-y-6">
|
|
459
461
|
{sections.map((section, index) => {
|
|
460
462
|
const filteredItems = filterItems(section.items, searchQuery)
|
|
@@ -520,7 +522,7 @@ export function Sidebar({
|
|
|
520
522
|
)
|
|
521
523
|
|
|
522
524
|
const sidebarClasses = cn(
|
|
523
|
-
"flex h-full
|
|
525
|
+
"flex h-full flex-col bg-background border-r",
|
|
524
526
|
glassmorphism && "bg-background/80 backdrop-blur-xl border-white/10",
|
|
525
527
|
collapsed && !isMobile && "w-16",
|
|
526
528
|
!collapsed && !isMobile && "w-64",
|
|
@@ -562,7 +564,7 @@ export function Sidebar({
|
|
|
562
564
|
}
|
|
563
565
|
|
|
564
566
|
return (
|
|
565
|
-
<aside className={cn(sidebarClasses, "sidebar-container hidden md:flex
|
|
567
|
+
<aside className={cn(sidebarClasses, "sidebar-container hidden md:flex")}>
|
|
566
568
|
{animatedBackground && (
|
|
567
569
|
<motion.div
|
|
568
570
|
className="absolute inset-0 opacity-30"
|