Skip to content

feat(LIB-1918): FzTypeahead#272

Draft
sergioterrasifiscozen wants to merge 9 commits into
mainfrom
feat/LIB-1918
Draft

feat(LIB-1918): FzTypeahead#272
sergioterrasifiscozen wants to merge 9 commits into
mainfrom
feat/LIB-1918

Conversation

@sergioterrasifiscozen

@sergioterrasifiscozen sergioterrasifiscozen commented Dec 5, 2025

Copy link
Copy Markdown
Collaborator

Jira: LIB-1918

Va rilavorata completamente.

La Typeahead è stata sostituita da FzSelect con prop filterable.

La nuova Typeahead è da riprogettare e implementare. Andrebbe deprecata questa.


Note

Introduce a new FzTypeahead component (with docs, stories, and tests) and refactor FzSelect lazy-loading/UX; update Storybook with comprehensive demos.

  • Typeahead:
    • New Component: Implement FzTypeahead with Fuse.js/custom async filtering, lazy loading, grouped/disabled options, environment-aware sizing, icons, help/error slots, and full keyboard/a11y support.
    • Architecture: Split into internal components (FzTypeaheadButton, FzTypeaheadOptionsList, FzTypeaheadLabel, FzTypeaheadHelpError), shared common.ts, and utilities.
    • API: Supports options, filterFn, filtrable, optionsToShow, clearable, environment, position, teleport, etc.; deprecates legacy props.
  • Select:
    • Lazy Loading Refactor: Replace mutable visibleOptions array with computed based on loadedOptionsCount; adjust watchers and scroll handling; minor help/error rendering tweak.
    • Version: Bump @fiscozen/select to 1.0.0-next.1.
  • Docs/Storybook:
    • Add full MDX docs (apps/storybook/src/FzTypeahead.mdx) and overhaul stories with interactive play tests covering states, positioning, filtering, and lazy loading.
  • Tests:
    • Add comprehensive unit tests for FzTypeahead (a11y, keyboard nav, filtering, lazy loading, focus management).

Written by Cursor Bugbot for commit de673e4. This will update automatically on new commits. Configure here.

Comment thread packages/composables/src/composables/useCurrency.ts
Comment thread packages/action/src/FzAction.vue
Comment thread packages/select/src/FzSelect.vue
Comment thread packages/typeahead/src/FzTypeahead.vue Outdated
Comment thread packages/typeahead/src/FzTypeahead.vue Outdated
Comment thread packages/typeahead/src/FzTypeahead.vue
(option): option is FzTypeaheadOptionProps =>
isSelectableOption(option) && option.value === model.value
);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Selected option shows placeholder after filtering without selecting

The selectedOption computed property searches for the model value in internalFilteredOptions rather than props.options. When a user has a value selected, types to filter (resulting in options that don't include their selection), then closes the dropdown without selecting, the button incorrectly shows the placeholder instead of the selected option's label. This happens because the reset logic at lines 970-977 only resets searchValue when internalFilteredOptions is empty, not when it simply doesn't contain the selected option.

Additional Locations (1)

Fix in Cursor Fix in Web

if (focusedIndex.value >= 0 && focusedIndex.value < enabled.length) {
handleSelect(enabled[focusedIndex.value]);
}
break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Space key prevents typing spaces in search input

When the dropdown is open and filtrable is true, pressing the space key in the search input calls event.preventDefault() unconditionally before checking if there's a focused option to select. Since focusedIndex is set to -1 when the dropdown opens in filtrable mode (line 903), the selection condition fails but the space character is still prevented from being typed. Users cannot include spaces in their search queries, which breaks search functionality for multi-word terms.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant