widenarrow-ui 2.4.2 → 2.4.3

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/lib/index.d.ts CHANGED
@@ -772,19 +772,27 @@ interface ComboboxBaseProps {
772
772
  */
773
773
  selectedOptions?: Array<OptionItem>;
774
774
  /**
775
- * Text in the input, to control it, e.g. to fetch options for it. Without it the Combobox keeps the
776
- * text itself. When controlled, update it from `onInputChange`.
775
+ * Text in the input, to control it. Without it the Combobox keeps the text itself. When controlled,
776
+ * update it from `onInputChange`.
777
777
  */
778
778
  inputValue?: string;
779
779
  /**
780
- * Called when the text in the input changes. Fetch new options for reason `'input'` only: `'reset'`
781
- * and `'clear'` set the text to the selected option's label or empty it.
780
+ * Called when the text in the input changes, with the reason. To fetch options for what the user
781
+ * types, use `onSearchChange` instead: the text of a `'reset'` is the selected option's label, which
782
+ * isn't a search.
782
783
  */
783
784
  onInputChange?: (inputValue: string, reason: ComboboxInputChangeReason) => void;
785
+ /**
786
+ * Called with the text to search for: what the user types, and `''` when the search ends, which is when
787
+ * an option is picked, the value is cleared or the field is left. Use it to fetch options per search,
788
+ * together with `filterOptions={false}`. Going back to `''` brings back the initial options, so the list
789
+ * doesn't stay filtered by an old search the next time it opens.
790
+ */
791
+ onSearchChange?: (searchText: string) => void;
784
792
  /**
785
793
  * Filters the options by the typed text. By default an option is shown when its `text` contains the
786
794
  * typed text, ignoring case. Pass `false` when the options are already filtered, e.g. fetched for the
787
- * typed text from a server.
795
+ * typed text from a server, with `onSearchChange`.
788
796
  */
789
797
  filterOptions?: ((options: OptionItem[], inputValue: string) => OptionItem[]) | false;
790
798
  /** Visible label, associated with the input. Also its accessible name unless `ariaLabel` is set. */