@umituz/web-design-system 4.28.0 → 4.28.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-design-system",
3
- "version": "4.28.0",
3
+ "version": "4.28.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Web Design System - Tailwind v4 authored, precompiled CSS shipped. Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications.",
@@ -1,9 +1,3 @@
1
- /**
2
- * CommandPalette Component (Organism)
3
- * @description ⌘K-style command palette — filterable grouped actions with
4
- * full keyboard navigation, built on the Radix dialog primitives.
5
- */
6
-
7
1
  import * as React from 'react';
8
2
  import * as DialogPrimitive from '@radix-ui/react-dialog';
9
3
  import { Search } from 'lucide-react';
@@ -13,9 +7,7 @@ export interface CommandItem {
13
7
  id: string;
14
8
  label: string;
15
9
  icon?: React.ReactNode;
16
- /** Right-aligned hint (e.g. a navigation target). */
17
10
  hint?: string;
18
- /** Extra match targets beyond the label. */
19
11
  keywords?: string;
20
12
  danger?: boolean;
21
13
  disabled?: boolean;
@@ -30,13 +22,10 @@ export interface CommandGroup {
30
22
  export interface CommandPaletteProps {
31
23
  open: boolean;
32
24
  onOpenChange: (open: boolean) => void;
33
- /** Static entry groups; palettes driven purely by `search` may omit them. */
34
25
  groups?: CommandGroup[];
35
26
  placeholder?: string;
36
27
  emptyLabel?: string;
37
- /** Accessible name for the dialog. */
38
28
  label?: string;
39
- /** Notifies the host on every query change (typing and reset-on-open). */
40
29
  onQueryChange?: (q: string) => void;
41
30
  }
42
31
 
@@ -77,8 +66,6 @@ export const CommandPalette = ({
77
66
  [groups, query]
78
67
  );
79
68
 
80
- // Fresh query + selection every time the palette opens (render-time
81
- // adjustment — the React-endorsed replacement for a reset effect).
82
69
  const [prevOpen, setPrevOpen] = React.useState(open);
83
70
  if (open !== prevOpen) {
84
71
  setPrevOpen(open);
@@ -88,20 +75,22 @@ export const CommandPalette = ({
88
75
  }
89
76
  }
90
77
 
78
+ const onQueryChangeRef = React.useRef(onQueryChange);
79
+ React.useEffect(() => {
80
+ onQueryChangeRef.current = onQueryChange;
81
+ });
91
82
  React.useEffect(() => {
92
83
  if (open) {
93
- onQueryChange?.('');
84
+ onQueryChangeRef.current?.('');
94
85
  }
95
- }, [open, onQueryChange]);
86
+ }, [open]);
96
87
 
97
- // Keep the highlighted index inside the (possibly filtered) list.
98
88
  const [prevFlatLength, setPrevFlatLength] = React.useState(flat.length);
99
89
  if (flat.length !== prevFlatLength) {
100
90
  setPrevFlatLength(flat.length);
101
91
  setActiveIndex((i) => Math.min(i, Math.max(flat.length - 1, 0)));
102
92
  }
103
93
 
104
- // Keep the highlighted option in view while arrowing through the list.
105
94
  React.useEffect(() => {
106
95
  const active = flat[activeIndex];
107
96
  if (!active) return;