@moontra/moonui-pro 2.5.10 → 2.5.12
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.mjs +42 -27
- package/package.json +1 -1
- package/src/components/sidebar/index.tsx +57 -32
- package/dist/index.d.ts +0 -1997
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
import * as t from 'react';
|
|
4
|
-
import t__default, { useState, useRef, useCallback, forwardRef, createContext, useContext, useMemo,
|
|
4
|
+
import t__default, { useState, useRef, useCallback, forwardRef, createContext, useEffect, useContext, useMemo, useDebugValue, Component, useLayoutEffect } from 'react';
|
|
5
5
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
6
6
|
import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, ChevronLeft, Calendar as Calendar$1, Edit, Trash2, Clock, MapPin, User, GripVertical, MessageCircle, Paperclip, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, CheckSquare, Quote, Palette, Highlighter, Link2, Image as Image$1, Table as Table$1, Settings, Undo, Redo, Eye, RefreshCw, Wand2, Maximize, FileText, Languages, TrendingUp, TrendingDown, ZoomOut, ZoomIn, Download, FileSpreadsheet, FileJson, Maximize2, Move, Menu, Bell, Edit3, LayoutGrid, Upload, Share2, Save, CheckCircle2, Filter, FileDown, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, ExternalLink, CalendarIcon, DollarSign, Users, Github, Star, GitFork, Activity, Server, EyeOff, RotateCw, Zap, Timer, Cpu, MemoryStick, HardDrive, Network, CheckCircle, BarChart3, Video, Music, Archive, File, Columns, XCircle, Grip, Unlock, Minimize2, Map as Map$1, Target, MoreVertical, BellOff, ArrowDownRight, ArrowUpRight } from 'lucide-react';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -56306,37 +56306,58 @@ var TableRow2 = t__default.memo(({
|
|
|
56306
56306
|
return prevRowId === nextRowId && prevProps.isExpanded === nextProps.isExpanded && prevProps.row.getIsSelected() === nextProps.row.getIsSelected() && prevVisibilityKeys === nextVisibilityKeys && prevVisibilityValues === nextVisibilityValues;
|
|
56307
56307
|
});
|
|
56308
56308
|
TableRow2.displayName = "TableRow";
|
|
56309
|
-
var SearchInput = ({
|
|
56309
|
+
var SearchInput = t__default.memo(({
|
|
56310
56310
|
searchInputRef,
|
|
56311
56311
|
searchPlaceholder,
|
|
56312
|
-
|
|
56313
|
-
|
|
56312
|
+
initialValue,
|
|
56313
|
+
onSearchChange,
|
|
56314
56314
|
keyboardShortcuts
|
|
56315
56315
|
}) => {
|
|
56316
|
+
const [localValue, setLocalValue] = useState(initialValue || "");
|
|
56317
|
+
const timeoutRef = useRef();
|
|
56318
|
+
useEffect(() => {
|
|
56319
|
+
setLocalValue(initialValue);
|
|
56320
|
+
}, [initialValue]);
|
|
56321
|
+
const handleChange = useCallback((e) => {
|
|
56322
|
+
const newValue = e.target.value;
|
|
56323
|
+
setLocalValue(newValue);
|
|
56324
|
+
if (timeoutRef.current) {
|
|
56325
|
+
clearTimeout(timeoutRef.current);
|
|
56326
|
+
}
|
|
56327
|
+
timeoutRef.current = setTimeout(() => {
|
|
56328
|
+
onSearchChange(newValue);
|
|
56329
|
+
}, 300);
|
|
56330
|
+
}, [onSearchChange]);
|
|
56331
|
+
useEffect(() => {
|
|
56332
|
+
return () => {
|
|
56333
|
+
if (timeoutRef.current) {
|
|
56334
|
+
clearTimeout(timeoutRef.current);
|
|
56335
|
+
}
|
|
56336
|
+
};
|
|
56337
|
+
}, []);
|
|
56316
56338
|
return /* @__PURE__ */ jsx("div", { className: "p-4 border-b", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
56317
|
-
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
56339
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" }),
|
|
56318
56340
|
/* @__PURE__ */ jsx(
|
|
56319
56341
|
"input",
|
|
56320
56342
|
{
|
|
56321
56343
|
ref: searchInputRef,
|
|
56322
|
-
type: "
|
|
56344
|
+
type: "text",
|
|
56323
56345
|
placeholder: searchPlaceholder,
|
|
56324
|
-
value,
|
|
56325
|
-
onChange:
|
|
56346
|
+
value: localValue,
|
|
56347
|
+
onChange: handleChange,
|
|
56326
56348
|
autoComplete: "off",
|
|
56327
56349
|
autoCorrect: "off",
|
|
56328
56350
|
autoCapitalize: "off",
|
|
56329
56351
|
spellCheck: "false",
|
|
56330
56352
|
className: "w-full h-10 pl-9 pr-9 text-sm bg-background border border-input rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
56331
|
-
}
|
|
56332
|
-
"sidebar-search-input"
|
|
56353
|
+
}
|
|
56333
56354
|
),
|
|
56334
56355
|
keyboardShortcuts && /* @__PURE__ */ jsxs("kbd", { className: "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 hidden sm:flex", children: [
|
|
56335
56356
|
/* @__PURE__ */ jsx("span", { className: "text-xs", children: "\u2318" }),
|
|
56336
56357
|
"K"
|
|
56337
56358
|
] })
|
|
56338
56359
|
] }) });
|
|
56339
|
-
};
|
|
56360
|
+
});
|
|
56340
56361
|
function Sidebar({
|
|
56341
56362
|
sections,
|
|
56342
56363
|
footer,
|
|
@@ -56572,7 +56593,6 @@ function Sidebar({
|
|
|
56572
56593
|
) })
|
|
56573
56594
|
] }, item.id);
|
|
56574
56595
|
}, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection]);
|
|
56575
|
-
const MemoizedSearchInput = t__default.memo(SearchInput);
|
|
56576
56596
|
const SidebarHeader = t__default.memo(() => {
|
|
56577
56597
|
return /* @__PURE__ */ jsxs("div", { className: cn(
|
|
56578
56598
|
"flex items-center gap-3 p-4 border-b",
|
|
@@ -56607,20 +56627,6 @@ function Sidebar({
|
|
|
56607
56627
|
)
|
|
56608
56628
|
] });
|
|
56609
56629
|
});
|
|
56610
|
-
const SidebarSearch = t__default.memo(() => {
|
|
56611
|
-
if (!showSearch || collapsed && !isMobile)
|
|
56612
|
-
return null;
|
|
56613
|
-
return /* @__PURE__ */ jsx(
|
|
56614
|
-
MemoizedSearchInput,
|
|
56615
|
-
{
|
|
56616
|
-
searchInputRef,
|
|
56617
|
-
searchPlaceholder,
|
|
56618
|
-
value: searchQuery,
|
|
56619
|
-
onChange: handleSearch,
|
|
56620
|
-
keyboardShortcuts
|
|
56621
|
-
}
|
|
56622
|
-
);
|
|
56623
|
-
});
|
|
56624
56630
|
const SidebarMenuContent = t__default.memo(() => {
|
|
56625
56631
|
return /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "p-4 space-y-6", children: [
|
|
56626
56632
|
pinnedItems.length > 0 && (!collapsed || isMobile) && /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -56669,7 +56675,16 @@ function Sidebar({
|
|
|
56669
56675
|
const SidebarContent = t__default.memo(() => {
|
|
56670
56676
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56671
56677
|
/* @__PURE__ */ jsx(SidebarHeader, {}),
|
|
56672
|
-
/* @__PURE__ */ jsx(
|
|
56678
|
+
showSearch && (!collapsed || isMobile) && /* @__PURE__ */ jsx(
|
|
56679
|
+
SearchInput,
|
|
56680
|
+
{
|
|
56681
|
+
searchInputRef,
|
|
56682
|
+
searchPlaceholder,
|
|
56683
|
+
initialValue: searchQuery,
|
|
56684
|
+
onSearchChange: handleSearch,
|
|
56685
|
+
keyboardShortcuts
|
|
56686
|
+
}
|
|
56687
|
+
),
|
|
56673
56688
|
/* @__PURE__ */ jsx(SidebarMenuContent, {}),
|
|
56674
56689
|
/* @__PURE__ */ jsx(SidebarFooter, {})
|
|
56675
56690
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.12",
|
|
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",
|
|
@@ -36,31 +36,64 @@ import {
|
|
|
36
36
|
DropdownMenuTrigger,
|
|
37
37
|
} from '../ui/dropdown-menu'
|
|
38
38
|
|
|
39
|
-
// Search Input Component -
|
|
40
|
-
const SearchInput = ({
|
|
41
|
-
searchInputRef,
|
|
39
|
+
// Search Input Component - with local state to prevent focus loss
|
|
40
|
+
const SearchInput = React.memo(({
|
|
41
|
+
searchInputRef,
|
|
42
42
|
searchPlaceholder,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
keyboardShortcuts
|
|
43
|
+
initialValue,
|
|
44
|
+
onSearchChange,
|
|
45
|
+
keyboardShortcuts
|
|
46
46
|
}: {
|
|
47
47
|
searchInputRef: React.RefObject<HTMLInputElement | null>
|
|
48
48
|
searchPlaceholder: string
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
initialValue: string
|
|
50
|
+
onSearchChange: (value: string) => void
|
|
51
51
|
keyboardShortcuts: boolean
|
|
52
52
|
}) => {
|
|
53
|
+
// Local state to prevent focus loss
|
|
54
|
+
const [localValue, setLocalValue] = useState<string>(initialValue || '')
|
|
55
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>()
|
|
56
|
+
|
|
57
|
+
// Update local value when initial value changes from parent
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setLocalValue(initialValue)
|
|
60
|
+
}, [initialValue])
|
|
61
|
+
|
|
62
|
+
// Handle input changes locally and debounce to parent
|
|
63
|
+
const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
|
64
|
+
const newValue = e.target.value
|
|
65
|
+
setLocalValue(newValue)
|
|
66
|
+
|
|
67
|
+
// Clear previous timeout
|
|
68
|
+
if (timeoutRef.current) {
|
|
69
|
+
clearTimeout(timeoutRef.current)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Debounce the parent update
|
|
73
|
+
timeoutRef.current = setTimeout(() => {
|
|
74
|
+
onSearchChange(newValue)
|
|
75
|
+
}, 300)
|
|
76
|
+
}, [onSearchChange])
|
|
77
|
+
|
|
78
|
+
// Cleanup timeout on unmount
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
return () => {
|
|
81
|
+
if (timeoutRef.current) {
|
|
82
|
+
clearTimeout(timeoutRef.current)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, [])
|
|
86
|
+
|
|
53
87
|
return (
|
|
54
88
|
<div className="p-4 border-b">
|
|
55
89
|
<div className="relative">
|
|
56
|
-
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
90
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
|
|
57
91
|
<input
|
|
58
|
-
key="sidebar-search-input"
|
|
59
92
|
ref={searchInputRef}
|
|
60
|
-
type="
|
|
93
|
+
type="text"
|
|
61
94
|
placeholder={searchPlaceholder}
|
|
62
|
-
value={
|
|
63
|
-
onChange={
|
|
95
|
+
value={localValue}
|
|
96
|
+
onChange={handleChange}
|
|
64
97
|
autoComplete="off"
|
|
65
98
|
autoCorrect="off"
|
|
66
99
|
autoCapitalize="off"
|
|
@@ -75,7 +108,7 @@ const SearchInput = ({
|
|
|
75
108
|
</div>
|
|
76
109
|
</div>
|
|
77
110
|
)
|
|
78
|
-
}
|
|
111
|
+
})
|
|
79
112
|
|
|
80
113
|
export interface SidebarItem {
|
|
81
114
|
id: string
|
|
@@ -178,7 +211,7 @@ export function Sidebar({
|
|
|
178
211
|
const [expandedSections, setExpandedSections] = useState<string[]>([])
|
|
179
212
|
const [currentSearchQuery, setCurrentSearchQuery] = useState(searchQuery)
|
|
180
213
|
const [pinnedItems, setPinnedItems] = useState<string[]>([])
|
|
181
|
-
const searchInputRef = useRef<HTMLInputElement>(null)
|
|
214
|
+
const searchInputRef = useRef<HTMLInputElement | null>(null)
|
|
182
215
|
const mouseX = useMotionValue(0)
|
|
183
216
|
const mouseY = useMotionValue(0)
|
|
184
217
|
const springX = useSpring(mouseX, { stiffness: 300, damping: 30 })
|
|
@@ -451,8 +484,6 @@ export function Sidebar({
|
|
|
451
484
|
}, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection])
|
|
452
485
|
|
|
453
486
|
|
|
454
|
-
// Memoize SearchInput to prevent recreation
|
|
455
|
-
const MemoizedSearchInput = React.memo(SearchInput)
|
|
456
487
|
|
|
457
488
|
// Header Component
|
|
458
489
|
const SidebarHeader = React.memo(() => {
|
|
@@ -498,20 +529,6 @@ export function Sidebar({
|
|
|
498
529
|
)
|
|
499
530
|
})
|
|
500
531
|
|
|
501
|
-
// Search Component - Use memoized version
|
|
502
|
-
const SidebarSearch = React.memo(() => {
|
|
503
|
-
if (!showSearch || (collapsed && !isMobile)) return null
|
|
504
|
-
|
|
505
|
-
return (
|
|
506
|
-
<MemoizedSearchInput
|
|
507
|
-
searchInputRef={searchInputRef}
|
|
508
|
-
searchPlaceholder={searchPlaceholder}
|
|
509
|
-
value={searchQuery}
|
|
510
|
-
onChange={handleSearch}
|
|
511
|
-
keyboardShortcuts={keyboardShortcuts}
|
|
512
|
-
/>
|
|
513
|
-
)
|
|
514
|
-
})
|
|
515
532
|
|
|
516
533
|
// Menu Content
|
|
517
534
|
const SidebarMenuContent = React.memo(() => {
|
|
@@ -596,7 +613,15 @@ export function Sidebar({
|
|
|
596
613
|
return (
|
|
597
614
|
<>
|
|
598
615
|
<SidebarHeader />
|
|
599
|
-
|
|
616
|
+
{showSearch && (!collapsed || isMobile) && (
|
|
617
|
+
<SearchInput
|
|
618
|
+
searchInputRef={searchInputRef}
|
|
619
|
+
searchPlaceholder={searchPlaceholder}
|
|
620
|
+
initialValue={searchQuery}
|
|
621
|
+
onSearchChange={handleSearch}
|
|
622
|
+
keyboardShortcuts={keyboardShortcuts}
|
|
623
|
+
/>
|
|
624
|
+
)}
|
|
600
625
|
<SidebarMenuContent />
|
|
601
626
|
<SidebarFooter />
|
|
602
627
|
</>
|