Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create search field component #2293

Closed
4 tasks
gfellerph opened this issue Nov 22, 2023 · 2 comments
Closed
4 tasks

Create search field component #2293

gfellerph opened this issue Nov 22, 2023 · 2 comments
Labels
📦 components Related to the @swisspost/design-system-components package 💭 draft Issue is not ready for development stale

Comments

@gfellerph
Copy link
Member

gfellerph commented Nov 22, 2023

Create a search field component.

Design

image

https://www.figma.com/file/xZ0IW0MJO0vnFicmrHiKaY/Components-Post?type=design&node-id=16739%3A53259&mode=design&t=i6IlqbsNcGrr8I6l-1

Features

  • Has a placeholder icon that disappears when a search query is entered
  • Has a clear button that will clear the current search query and focus the input field afterwards
  • Has an optional suggestion list (which is basically a styleable datalist)
    • Suggestions can either trigger the search directly (like a link) or just put the value into the input box (specific feature of the suggestionlist component that could also be used in a combobox where selecting a suggestion does not submit a search)
    • A maximum of 8 items are displayed at any given time (recommendation, use overflow scrolling if there are more)
    • If the list is empty, it should be hidden
    • While selecting suggestions, the focus should stay inside the text box in case the user continues to type
    • Number of characters to trigger the first suggestion get call should be configurable
    • Suggestion items can have any icon
    • Text input that matches a part of the suggestion will render this part in bold
    • Suggestion items can be categorized with headings
    • The suggestion list can either be rendered inline or as a popover (internet header uses inline rendering as the searchbox itself is already in a popover)

Structure proposal

Floating label

<post-search id="search" floating>
  <label for="search">Search</label>
  <post-suggestion-list slot="suggestions" popover>
    <post-suggestion>Se</suggestion>
  </post-suggestion-list>
</post-search>

Non floating label

<label for="search">Search</label>
<post-search id="search">
  <post-suggestion-list slot="suggestions">
    <post-suggestion>Se</suggestion>
  </post-suggestion-list>
</post-search>

This approach could use the <post-popovercontainer> internally.

<Host>
  <input />
  <post-popovercontainer>
    <slot name="suggestion-list"></slot>
  </post-popovercontainer>
</Host>

Alternative structure proposal (more generic, more complicated):

<post-textinput clearbutton type="search" floating id="search">
  <post-icon name="1000" slot="placeholder-icon"></post-icon>
  <label for="search">Search</label>
</post-textinput>

Tasks

Initial Design Ticket: #1960

@gfellerph gfellerph added 💭 draft Issue is not ready for development 📦 components Related to the @swisspost/design-system-components package labels Nov 22, 2023
@gfellerph
Copy link
Member Author

  • Split suggestion list into a separate ticket

@github-actions github-actions bot added the stale label Mar 5, 2024
@gfellerph gfellerph added this to the Web Components milestone Mar 6, 2024
@gfellerph
Copy link
Member Author

Closing because definition and requirements are outdated. Components that will make a suggestion box possible need to be implemented separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 components Related to the @swisspost/design-system-components package 💭 draft Issue is not ready for development stale
Projects
Development

No branches or pull requests

1 participant