forked from carbon-design-system/carbon-for-ibm-dotcom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(search-with-typeahead/masthead): support initial search term (ca…
…rbon-design-system#11668) ### Related Ticket(s) Closes carbon-design-system#11617 ### Description I couldn't find definitive proof this property ever existed on either the Search with Typeahead or Masthead web components. Maybe it existed on react versions of these? In any case, I've added the requested attribute to `<c4d-search-with-typeahead>` and `<c4d-masthead-composite/container>`. It will set the `value` attribute of the search's text input when users open the search bar, unless the user has previously opened the search and modified the default value. In that case, we respect the user's changes and don't set the `value`. This brings up a potential improvement to cache the user's input and use that instead if they close & reopen the search bar, but I'll leave that for another issue 🙂 ### Changelog **New** - Adds `initial-search-term` attribute on both `<c4d-search-with-typeahead>` and `<c4d-masthead-composite/container>` elements that sets default query in search input. - Documents `initial-search-term` feature in Storybook. **Changed** - Adds Storybook knobs for `<c4d-search-with-typeahead>`'s "open on load" (`active`) and `should-remain-open` features. ### Testing Test the "initial search term" knob on both the [Search with Typeahead](https://ibmdotcom-webcomponents.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/11668/index.html?path=/story/components-search-with-typeahead--default) and [Masthead](https://ibmdotcom-webcomponents.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/11668/index.html?path=/story/components-masthead--default) deploy preview stories. <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
- Loading branch information
Showing
6 changed files
with
113 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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