-
Notifications
You must be signed in to change notification settings - Fork 40
refactor(atomic): migrate atomic-insight-search-box to Lit #6881
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
Merged
alexprudhomme
merged 12 commits into
main
from
copilot/migrate-atomic-insight-search-box
Jan 14, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
abd9f9b
Initial plan
Copilot 687bcef
Step 1 complete: Migrate atomic-insight-search-box component from Steβ¦
Copilot bd740ff
Step 2 progress: Add unit tests and fixtures for atomic-insight-searcβ¦
Copilot 3390de1
Merge branch 'main' into copilot/migrate-atomic-insight-search-box
alexprudhomme 9aabcd2
merge
alexprudhomme 1eddff3
done
alexprudhomme 235bef5
Add generated files
developer-experience-bot[bot] fd43bac
done
alexprudhomme 27f5d36
remove s
alexprudhomme 1b394d5
Merge branch 'main' into copilot/migrate-atomic-insight-search-box
alexprudhomme c937644
Update insight-panel.cypress.ts
alexprudhomme 6c8ea82
Merge branch 'main' into copilot/migrate-atomic-insight-search-box
alexprudhomme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,17 +28,24 @@ export interface RenderQuerySuggestionOptions { | |
| hasQuery: boolean; | ||
| suggestion: Suggestion; | ||
| hasMultipleKindOfSuggestions: boolean; | ||
| /** | ||
| * When true, the icon will always be displayed regardless of hasMultipleKindOfSuggestions. | ||
| * Used by the insight search box where icons should always be visible. | ||
| */ | ||
| alwaysShowIcon?: boolean; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's that exactly?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes exactly. For search we dont always show it |
||
| } | ||
|
|
||
| export const renderQuerySuggestion = ({ | ||
| icon, | ||
| hasQuery, | ||
| suggestion, | ||
| hasMultipleKindOfSuggestions, | ||
| alwaysShowIcon = false, | ||
| }: RenderQuerySuggestionOptions): HTMLElement => { | ||
| const shouldShowIcon = alwaysShowIcon || hasMultipleKindOfSuggestions; | ||
| const template = html` | ||
| <div part="query-suggestion-content" class="pointer-events-none flex items-center">${ | ||
| hasMultipleKindOfSuggestions | ||
| shouldShowIcon | ||
| ? html`<atomic-icon | ||
| part="query-suggestion-icon" | ||
| icon=${icon} | ||
|
|
||
25 changes: 25 additions & 0 deletions
25
.../src/components/insight/atomic-insight-search-box/atomic-insight-search-box.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { Meta } from '@storybook/addon-docs/blocks'; | ||
| import * as AtomicInsightSearchBoxStories from './atomic-insight-search-box.new.stories'; | ||
| import { AtomicDocTemplate } from '../../../../storybook-utils/documentation/atomic-doc-template'; | ||
|
|
||
| <Meta of={AtomicInsightSearchBoxStories} /> | ||
|
|
||
| <AtomicDocTemplate | ||
| stories={AtomicInsightSearchBoxStories} | ||
| githubPath="insight/atomic-insight-search-box/atomic-insight-search-box.ts" | ||
| tagName="atomic-insight-search-box" | ||
| className="AtomicInsightSearchBox" | ||
| > | ||
| This component is used within the Insight interface to allow users to enter and submit search queries. | ||
| It provides query suggestions as the user types. | ||
|
|
||
| ```html | ||
| <atomic-insight-interface> | ||
| <atomic-insight-layout> | ||
| <atomic-layout-section section="search"> | ||
| <atomic-insight-search-box></atomic-insight-search-box> | ||
| </atomic-layout-section> | ||
| </atomic-insight-layout> | ||
| </atomic-insight-interface> | ||
| ``` | ||
| </AtomicDocTemplate> |
53 changes: 53 additions & 0 deletions
53
...rc/components/insight/atomic-insight-search-box/atomic-insight-search-box.new.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import type { | ||
| Decorator, | ||
| Meta, | ||
| StoryObj as Story, | ||
| } from '@storybook/web-components-vite'; | ||
| import {getStorybookHelpers} from '@wc-toolkit/storybook-helpers'; | ||
| import {html} from 'lit'; | ||
| import {MockInsightApi} from '@/storybook-utils/api/insight/mock'; | ||
| import {parameters} from '@/storybook-utils/common/common-meta-parameters'; | ||
| import {wrapInInsightInterface} from '@/storybook-utils/insight/insight-interface-wrapper'; | ||
|
|
||
| const {events, args, argTypes, template} = getStorybookHelpers( | ||
| 'atomic-insight-search-box', | ||
| {excludeCategories: ['methods']} | ||
| ); | ||
| const {decorator, play} = wrapInInsightInterface({}, true); | ||
|
|
||
| const mockInsightApi = new MockInsightApi(); | ||
|
|
||
| const normalWidthDecorator: Decorator = (story) => | ||
| html`<div style="min-width: 400px;" id="code-root">${story()}</div>`; | ||
|
|
||
| const meta: Meta = { | ||
| component: 'atomic-insight-search-box', | ||
| title: 'Insight/Search Box', | ||
| id: 'atomic-insight-search-box', | ||
| render: (args) => template(args), | ||
| decorators: [normalWidthDecorator, decorator], | ||
| parameters: { | ||
| ...parameters, | ||
| actions: { | ||
| handles: events, | ||
| }, | ||
| msw: { | ||
| handlers: [...mockInsightApi.handlers], | ||
| }, | ||
| }, | ||
| args, | ||
| argTypes, | ||
|
|
||
| play, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Default: Story = {}; | ||
|
|
||
| export const WithDisabledSearch: Story = { | ||
| name: 'With disabled search', | ||
| args: { | ||
| 'disable-search': true, | ||
| }, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I'm clear on the relation between
hasMultipleKindOfSuggestionsand the optionalwaysShowIcon?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alwaysShowIconis an override that forces the icon to display even whenhasMultipleKindOfSuggestionsis false (which normally hides icons when there's only one suggestion type).