@moontra/moonui-pro 2.5.9 → 2.5.10

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 CHANGED
@@ -56306,16 +56306,13 @@ 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 = t__default.memo(({
56309
+ var SearchInput = ({
56310
56310
  searchInputRef,
56311
56311
  searchPlaceholder,
56312
56312
  value,
56313
56313
  onChange,
56314
56314
  keyboardShortcuts
56315
56315
  }) => {
56316
- const handleChange = useCallback((e) => {
56317
- onChange(e.target.value);
56318
- }, [onChange]);
56319
56316
  return /* @__PURE__ */ jsx("div", { className: "p-4 border-b", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
56320
56317
  /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
56321
56318
  /* @__PURE__ */ jsx(
@@ -56325,20 +56322,21 @@ var SearchInput = t__default.memo(({
56325
56322
  type: "search",
56326
56323
  placeholder: searchPlaceholder,
56327
56324
  value,
56328
- onChange: handleChange,
56325
+ onChange: (e) => onChange(e.target.value),
56329
56326
  autoComplete: "off",
56330
56327
  autoCorrect: "off",
56331
56328
  autoCapitalize: "off",
56332
56329
  spellCheck: "false",
56333
56330
  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"
56334
- }
56331
+ },
56332
+ "sidebar-search-input"
56335
56333
  ),
56336
56334
  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: [
56337
56335
  /* @__PURE__ */ jsx("span", { className: "text-xs", children: "\u2318" }),
56338
56336
  "K"
56339
56337
  ] })
56340
56338
  ] }) });
56341
- });
56339
+ };
56342
56340
  function Sidebar({
56343
56341
  sections,
56344
56342
  footer,
@@ -56574,6 +56572,7 @@ function Sidebar({
56574
56572
  ) })
56575
56573
  ] }, item.id);
56576
56574
  }, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection]);
56575
+ const MemoizedSearchInput = t__default.memo(SearchInput);
56577
56576
  const SidebarHeader = t__default.memo(() => {
56578
56577
  return /* @__PURE__ */ jsxs("div", { className: cn(
56579
56578
  "flex items-center gap-3 p-4 border-b",
@@ -56608,11 +56607,11 @@ function Sidebar({
56608
56607
  )
56609
56608
  ] });
56610
56609
  });
56611
- const searchElement = useMemo(() => {
56612
- if (!showSearch)
56610
+ const SidebarSearch = t__default.memo(() => {
56611
+ if (!showSearch || collapsed && !isMobile)
56613
56612
  return null;
56614
56613
  return /* @__PURE__ */ jsx(
56615
- SearchInput,
56614
+ MemoizedSearchInput,
56616
56615
  {
56617
56616
  searchInputRef,
56618
56617
  searchPlaceholder,
@@ -56621,9 +56620,6 @@ function Sidebar({
56621
56620
  keyboardShortcuts
56622
56621
  }
56623
56622
  );
56624
- }, [showSearch, searchPlaceholder, searchQuery, handleSearch, keyboardShortcuts]);
56625
- const SidebarSearch = t__default.memo(() => {
56626
- return showSearch && (!collapsed || isMobile) ? searchElement : null;
56627
56623
  });
56628
56624
  const SidebarMenuContent = t__default.memo(() => {
56629
56625
  return /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "p-4 space-y-6", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.5.9",
3
+ "version": "2.5.10",
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,8 +36,8 @@ import {
36
36
  DropdownMenuTrigger,
37
37
  } from '../ui/dropdown-menu'
38
38
 
39
- // Search Input Component
40
- const SearchInput = React.memo(({
39
+ // Search Input Component - Pure functional to prevent recreation
40
+ const SearchInput = ({
41
41
  searchInputRef,
42
42
  searchPlaceholder,
43
43
  value,
@@ -50,20 +50,17 @@ const SearchInput = React.memo(({
50
50
  onChange: (value: string) => void
51
51
  keyboardShortcuts: boolean
52
52
  }) => {
53
- const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
54
- onChange(e.target.value)
55
- }, [onChange])
56
-
57
53
  return (
58
54
  <div className="p-4 border-b">
59
55
  <div className="relative">
60
56
  <Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
61
57
  <input
58
+ key="sidebar-search-input"
62
59
  ref={searchInputRef}
63
60
  type="search"
64
61
  placeholder={searchPlaceholder}
65
62
  value={value}
66
- onChange={handleChange}
63
+ onChange={(e) => onChange(e.target.value)}
67
64
  autoComplete="off"
68
65
  autoCorrect="off"
69
66
  autoCapitalize="off"
@@ -78,7 +75,7 @@ const SearchInput = React.memo(({
78
75
  </div>
79
76
  </div>
80
77
  )
81
- })
78
+ }
82
79
 
83
80
  export interface SidebarItem {
84
81
  id: string
@@ -454,6 +451,9 @@ export function Sidebar({
454
451
  }, [activePath, pinnedItems, expandedSections, collapsed, customStyles, handleItemClick, toggleSection])
455
452
 
456
453
 
454
+ // Memoize SearchInput to prevent recreation
455
+ const MemoizedSearchInput = React.memo(SearchInput)
456
+
457
457
  // Header Component
458
458
  const SidebarHeader = React.memo(() => {
459
459
  return (
@@ -498,12 +498,12 @@ export function Sidebar({
498
498
  )
499
499
  })
500
500
 
501
- // Search element with controlled value
502
- const searchElement = useMemo(() => {
503
- if (!showSearch) return null
501
+ // Search Component - Use memoized version
502
+ const SidebarSearch = React.memo(() => {
503
+ if (!showSearch || (collapsed && !isMobile)) return null
504
504
 
505
505
  return (
506
- <SearchInput
506
+ <MemoizedSearchInput
507
507
  searchInputRef={searchInputRef}
508
508
  searchPlaceholder={searchPlaceholder}
509
509
  value={searchQuery}
@@ -511,11 +511,6 @@ export function Sidebar({
511
511
  keyboardShortcuts={keyboardShortcuts}
512
512
  />
513
513
  )
514
- }, [showSearch, searchPlaceholder, searchQuery, handleSearch, keyboardShortcuts])
515
-
516
- // Search Component wrapper
517
- const SidebarSearch = React.memo(() => {
518
- return showSearch && (!collapsed || isMobile) ? searchElement : null
519
514
  })
520
515
 
521
516
  // Menu Content