Skip to content

refactor(ui): replace custom file/folder controls with reusable SelectList#105

Open
RavenHogWarts wants to merge 2 commits into
vran-dev:masterfrom
RavenHogWarts:refactor/selectlist-file-folder-controls
Open

refactor(ui): replace custom file/folder controls with reusable SelectList#105
RavenHogWarts wants to merge 2 commits into
vran-dev:masterfrom
RavenHogWarts:refactor/selectlist-file-folder-controls

Conversation

@RavenHogWarts
Copy link
Copy Markdown
Collaborator

Summary

  • Replace FileListControl with a SelectList-backed implementation and simplify file option logic.
  • Replace FolderPathControl with a FolderListControl that uses SelectList (adds folder filtering and optional multi-select).
  • Rename and consolidate CSS selectors from FileListControl-specific names to generic SelectList selectors and adjust related styles.

What changed

  • Introduced reusable SelectList and SelectOption usage for file and folder selectors.
  • Added getOptions(searchText) helper for markdown file options (returns up to 100 filtered results) and a concise mapper producing {id, value, label}.
  • Added formatValue helper to centralize internal-link handling for select values.
  • Implemented FolderListControl component and swapped usages in CpsFormFieldControl; FolderPathControl removed/commented out.
  • Removed complex popover/keyboard/state handling and unused imports/hooks from FileListControl, delegating UI/interaction to SelectList.

Why

  • Simplifies control components by delegating UI and interaction to a reusable SelectList.
  • Reduces duplicate logic, improves clarity and testability of file/folder option generation.
  • Improves folder selection UX with searchable, optionally multi-selectable list.

SelectList component and simplify file options logic

- Rename CSS selector for the select trigger to match SelectList usage
  (button.form--SelectListTrigger).
- Remove complex popover, keyboard handling, open/active state and
  extensive value-formatting logic from FileListControl.
- Introduce SelectList and SelectOption imports and provide a
  getOptions(searchText) helper that returns up to 100 markdown file
  options filtered by the search text.
- Replace manual mapping/formatting code with a concise mapper that
  produces {id, value, label} entries for each file.
- Add a small formatValue helper to centralize internal-link handling
  (preparing for simplified value formatting when integrating with the
  SelectList).
- Remove unused imports and hooks (Popover, state refs, i18n local
  instance, icons) to reduce complexity and shift behavior into the
  reusable SelectList component.

The changes simplify FileListControl by delegating UI/interaction to the
SelectList component, reduce duplicate logic, and make file filtering
and option generation clearer and more testable.
Replace the folder path text-suggest control with a folder list selector
and update related imports and styles.

- Add FolderListControl component that provides a SelectList of vault
  folders (supports filtering and optional multiple selection).
- Remove FolderPathControl implementation and switch usages to
  FolderListControl in CpsFormFieldControl.
- Update SelectList CSS class names (rename FileListControl-specific
  selectors to generic SelectList selectors) and adjust styling for
  trigger arrow, placeholder, items and content input.
- Update import in CpsFormFieldControl from FolderPathControl to
  FolderListControl and comment out the old FolderPathControl JSX.

This change improves folder selection UX by offering a searchable list
with multi-select support and consolidates select-list styling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant