@moontra/moonui-pro 2.5.6 → 2.5.7

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 CHANGED
@@ -1821,6 +1821,7 @@ interface SidebarItem {
1821
1821
  items?: SidebarItem[];
1822
1822
  action?: () => void;
1823
1823
  tooltip?: string;
1824
+ filteredChildren?: SidebarItem[];
1824
1825
  }
1825
1826
  interface SidebarSection {
1826
1827
  id: string;
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge';
3
3
  import * as t from 'react';
4
4
  import t__default, { useState, useRef, useCallback, forwardRef, createContext, useContext, useMemo, useEffect, useDebugValue, Component, useLayoutEffect } from 'react';
5
5
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
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, ExternalLink, CalendarIcon, DollarSign, Users, Github, Star, GitFork, Activity, Server, EyeOff, RotateCw, Zap, Monitor, Timer, Cpu, MemoryStick, HardDrive, Network, CheckCircle, BarChart3, Video, Music, Archive, File, Columns, Sun, Moon, XCircle, Grip, Unlock, Minimize2, Map as Map$1, Target, MoreVertical, BellOff, ArrowDownRight, ArrowUpRight } from 'lucide-react';
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';
8
8
  import { cva } from 'class-variance-authority';
9
9
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -56444,10 +56444,13 @@ function Sidebar({
56444
56444
  const filteredSections = useMemo(() => {
56445
56445
  return sections.map((section) => ({
56446
56446
  ...section,
56447
- filteredItems: filterItems(section.items, searchQuery)
56447
+ filteredItems: filterItems(section.items, searchQuery).map((item) => ({
56448
+ ...item,
56449
+ filteredChildren: item.items ? filterItems(item.items, searchQuery) : void 0
56450
+ }))
56448
56451
  })).filter((section) => section.filteredItems.length > 0);
56449
56452
  }, [sections, searchQuery, filterItems]);
56450
- const renderItem = useCallback((item, depth = 0) => {
56453
+ const renderItem = useCallback((item, depth = 0, filteredChildren) => {
56451
56454
  const isActive2 = item.href === activePath;
56452
56455
  const isPinned = pinnedItems.includes(item.id);
56453
56456
  const hasChildren = item.items && item.items.length > 0;
@@ -56507,7 +56510,7 @@ function Sidebar({
56507
56510
  /* @__PURE__ */ jsx(ItemWrapper, { children: itemContent }),
56508
56511
  /* @__PURE__ */ jsx(MoonUITooltipContentPro, { side: "right", children: /* @__PURE__ */ jsx("p", { children: item.tooltip }) })
56509
56512
  ] }) }) : itemContent,
56510
- hasChildren && !collapsed && /* @__PURE__ */ jsx(AnimatePresence, { children: isExpanded && /* @__PURE__ */ jsx(
56513
+ hasChildren && !collapsed && filteredChildren && /* @__PURE__ */ jsx(AnimatePresence, { children: isExpanded && /* @__PURE__ */ jsx(
56511
56514
  motion.div,
56512
56515
  {
56513
56516
  initial: { height: 0, opacity: 0 },
@@ -56515,14 +56518,14 @@ function Sidebar({
56515
56518
  exit: { height: 0, opacity: 0 },
56516
56519
  transition: { duration: 0.2 },
56517
56520
  className: "overflow-hidden",
56518
- children: /* @__PURE__ */ jsx("div", { className: "pt-1 space-y-1", children: filterItems(item.items, searchQuery).map(
56521
+ children: /* @__PURE__ */ jsx("div", { className: "pt-1 space-y-1", children: filteredChildren.map(
56519
56522
  (child) => renderItem(child, depth + 1)
56520
56523
  ) })
56521
56524
  }
56522
56525
  ) })
56523
56526
  ] }, item.id);
56524
- }, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection, searchQuery, filterItems]);
56525
- const SidebarContent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
56527
+ }, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection]);
56528
+ const SidebarContent = t__default.memo(() => /* @__PURE__ */ jsxs(Fragment, { children: [
56526
56529
  /* @__PURE__ */ jsxs("div", { className: cn(
56527
56530
  "flex items-center gap-3 p-4 border-b",
56528
56531
  collapsed && !isMobile && "justify-center px-2"
@@ -56568,8 +56571,13 @@ function Sidebar({
56568
56571
  setSearchQuery(e.target.value);
56569
56572
  onSearchChange?.(e.target.value);
56570
56573
  },
56574
+ autoComplete: "off",
56575
+ autoCorrect: "off",
56576
+ autoCapitalize: "off",
56577
+ spellCheck: "false",
56571
56578
  className: "pl-9 pr-9"
56572
- }
56579
+ },
56580
+ "sidebar-search-input"
56573
56581
  ),
56574
56582
  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: [
56575
56583
  /* @__PURE__ */ jsx("span", { className: "text-xs", children: "\u2318" }),
@@ -56584,7 +56592,7 @@ function Sidebar({
56584
56592
  ] }),
56585
56593
  /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "p-4 space-y-6", children: filteredSections.map((section, index) => /* @__PURE__ */ jsxs("div", { children: [
56586
56594
  section.title && (!collapsed || isMobile) && /* @__PURE__ */ jsx("h4", { className: "text-xs font-medium text-muted-foreground mb-2", children: section.title }),
56587
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: section.filteredItems.map((item) => renderItem(item)) }),
56595
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: section.filteredItems.map((item) => renderItem(item, 0, item.filteredChildren)) }),
56588
56596
  section.showDivider && index < filteredSections.length - 1 && /* @__PURE__ */ jsx(MoonUISeparatorPro, { className: "mt-4" })
56589
56597
  ] }, section.id)) }) }),
56590
56598
  footer && /* @__PURE__ */ jsxs("div", { className: "border-t p-4", children: [
@@ -56614,7 +56622,7 @@ function Sidebar({
56614
56622
  ] })
56615
56623
  ] })
56616
56624
  ] })
56617
- ] });
56625
+ ] }));
56618
56626
  const sidebarClasses = cn(
56619
56627
  "flex h-full flex-col bg-background border-r",
56620
56628
  glassmorphism && "bg-background/80 backdrop-blur-xl border-white/10",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
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",
@@ -48,6 +48,7 @@ export interface SidebarItem {
48
48
  items?: SidebarItem[]
49
49
  action?: () => void
50
50
  tooltip?: string
51
+ filteredChildren?: SidebarItem[]
51
52
  }
52
53
 
53
54
  export interface SidebarSection {
@@ -273,11 +274,14 @@ export function Sidebar({
273
274
  const filteredSections = useMemo(() => {
274
275
  return sections.map(section => ({
275
276
  ...section,
276
- filteredItems: filterItems(section.items, searchQuery)
277
+ filteredItems: filterItems(section.items, searchQuery).map(item => ({
278
+ ...item,
279
+ filteredChildren: item.items ? filterItems(item.items, searchQuery) : undefined
280
+ }))
277
281
  })).filter(section => section.filteredItems.length > 0)
278
282
  }, [sections, searchQuery, filterItems])
279
283
 
280
- const renderItem = useCallback((item: SidebarItem, depth = 0) => {
284
+ const renderItem = useCallback((item: SidebarItem, depth = 0, filteredChildren?: SidebarItem[]) => {
281
285
  const isActive = item.href === activePath
282
286
  const isPinned = pinnedItems.includes(item.id)
283
287
  const hasChildren = item.items && item.items.length > 0
@@ -361,7 +365,7 @@ export function Sidebar({
361
365
  itemContent
362
366
  )}
363
367
 
364
- {hasChildren && !collapsed && (
368
+ {hasChildren && !collapsed && filteredChildren && (
365
369
  <AnimatePresence>
366
370
  {isExpanded && (
367
371
  <motion.div
@@ -372,7 +376,7 @@ export function Sidebar({
372
376
  className="overflow-hidden"
373
377
  >
374
378
  <div className="pt-1 space-y-1">
375
- {filterItems(item.items!, searchQuery).map(child =>
379
+ {filteredChildren.map(child =>
376
380
  renderItem(child, depth + 1)
377
381
  )}
378
382
  </div>
@@ -382,9 +386,9 @@ export function Sidebar({
382
386
  )}
383
387
  </div>
384
388
  )
385
- }, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection, searchQuery, filterItems])
389
+ }, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection])
386
390
 
387
- const SidebarContent = () => (
391
+ const SidebarContent = React.memo(() => (
388
392
  <>
389
393
  {/* Header */}
390
394
  <div className={cn(
@@ -432,6 +436,7 @@ export function Sidebar({
432
436
  <div className="relative">
433
437
  <Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
434
438
  <Input
439
+ key="sidebar-search-input"
435
440
  ref={searchInputRef}
436
441
  type="search"
437
442
  placeholder={searchPlaceholder}
@@ -440,6 +445,10 @@ export function Sidebar({
440
445
  setSearchQuery(e.target.value)
441
446
  onSearchChange?.(e.target.value)
442
447
  }}
448
+ autoComplete="off"
449
+ autoCorrect="off"
450
+ autoCapitalize="off"
451
+ spellCheck="false"
443
452
  className="pl-9 pr-9"
444
453
  />
445
454
  {keyboardShortcuts && (
@@ -474,7 +483,7 @@ export function Sidebar({
474
483
  </h4>
475
484
  )}
476
485
  <div className="space-y-1">
477
- {section.filteredItems.map(item => renderItem(item))}
486
+ {section.filteredItems.map(item => renderItem(item, 0, item.filteredChildren))}
478
487
  </div>
479
488
  {section.showDivider && index < filteredSections.length - 1 && (
480
489
  <Separator className="mt-4" />
@@ -522,7 +531,7 @@ export function Sidebar({
522
531
  </div>
523
532
  )}
524
533
  </>
525
- )
534
+ ))
526
535
 
527
536
  const sidebarClasses = cn(
528
537
  "flex h-full flex-col bg-background border-r",