@papernote/ui 1.7.4 → 1.7.6

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.js CHANGED
@@ -5068,11 +5068,14 @@ const Autocomplete = React.forwardRef(({ value, onChange, options = [], onSearch
5068
5068
  const results = await onSearch(query);
5069
5069
  setFilteredOptions(results.slice(0, maxResults));
5070
5070
  setIsOpen(results.length > 0);
5071
+ // Auto-highlight first result for keyboard navigation
5072
+ setHighlightedIndex(results.length > 0 ? 0 : -1);
5071
5073
  }
5072
5074
  catch (err) {
5073
5075
  console.error('Autocomplete search error:', err);
5074
5076
  setFilteredOptions([]);
5075
5077
  setIsOpen(false);
5078
+ setHighlightedIndex(-1);
5076
5079
  }
5077
5080
  finally {
5078
5081
  setLoading(false);
@@ -5083,6 +5086,8 @@ const Autocomplete = React.forwardRef(({ value, onChange, options = [], onSearch
5083
5086
  const filtered = filterOptions(query);
5084
5087
  setFilteredOptions(filtered);
5085
5088
  setIsOpen(filtered.length > 0);
5089
+ // Auto-highlight first result for keyboard navigation
5090
+ setHighlightedIndex(filtered.length > 0 ? 0 : -1);
5086
5091
  }
5087
5092
  };
5088
5093
  // Debounced search
@@ -5119,7 +5124,16 @@ const Autocomplete = React.forwardRef(({ value, onChange, options = [], onSearch
5119
5124
  const handleKeyDown = (e) => {
5120
5125
  if (!isOpen) {
5121
5126
  if (e.key === 'ArrowDown') {
5122
- handleSearch(value);
5127
+ e.preventDefault();
5128
+ // If we have cached results from a previous search, show them
5129
+ if (filteredOptions.length > 0) {
5130
+ setIsOpen(true);
5131
+ setHighlightedIndex(0);
5132
+ }
5133
+ else if (value.length >= minChars) {
5134
+ // Otherwise trigger a new search
5135
+ handleSearch(value);
5136
+ }
5123
5137
  }
5124
5138
  return;
5125
5139
  }
@@ -5422,8 +5436,11 @@ function FormWizard({ steps, onComplete, onStepChange, showStepNumbers = true, a
5422
5436
  }
5423
5437
  }
5424
5438
  else {
5425
- // Go to next step
5426
- goToStep(currentStep + 1);
5439
+ // Advance to next step directly (don't use goToStep which checks completedSteps
5440
+ // before React has re-rendered with the updated state)
5441
+ const nextStepIndex = currentStep + 1;
5442
+ setCurrentStep(nextStepIndex);
5443
+ onStepChange?.(nextStepIndex);
5427
5444
  }
5428
5445
  };
5429
5446
  // Previous step