Repository navigation
SearchableChipSelectControl: Add form control to @wordpress/ui #80980
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
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ff51b9b
Add SearchableChipSelectControl to @wordpress/ui
mirka 71f6065
Add changelog
mirka d085b27
Tweak changelog
mirka 40ab5bb
SearchableChipSelectControl: Add grouped subcomponents and story.
mirka a8dd424
Merge trunk into add-ui-searchable-chip-select-control
mirka 98e8750
SearchableChipSelectControl: Mark recommended and add to manifest.
mirka 84d3cc6
Remove redundant subcomponent JSDocs from SearchableChipSelect.
mirka 508ee57
Remove redundant subcomponent JSDocs from SearchableChipSelectControl.
mirka 7a0e47a
Add changelog
mirka 776f1e5
Allow SearchableChipSelect components in use-recommended-components.
mirka 04511fe
SearchableChipSelectControl: Add missing control-level stories.
mirka afb39ad
Merge trunk into add-ui-searchable-chip-select-control
mirka 74d0e9f
Update Storybook manifest snapshot.
mirka c788e99
Render SearchableChipSelect directly under Field.Root.
mirka 80d7b2d
Remove SearchableChipSelectControl subcomponent displayNames.
mirka 792adb1
Move creatable stories to SearchableChipSelectControl.
mirka f88d7cd
Merge branch 'trunk' into add-ui-searchable-chip-select-control
mirka e7272d9
Merge branch 'trunk' into add-ui-searchable-chip-select-control
mirka 2787468
SearchableChipSelectControl: Fix Grouped story defaultValue
mirka 6233fb4
SearchableChipSelect: Forward ref to search input
mirka 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
Some comments aren't visible on the classic Files Changed page.
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
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
21 changes: 21 additions & 0 deletions
21
packages/ui/src/form/searchable-chip-select-control/index.ts
|
Member
Author
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. We can't add |
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,21 @@ | ||
| import { SearchableChipSelectControl as _SearchableChipSelectControl } from './searchable-chip-select-control'; | ||
| import { Group } from '../primitives/combobox/group'; | ||
| import { GroupLabel } from '../primitives/combobox/group-label'; | ||
| import { Item } from '../primitives/combobox/item'; | ||
| import { ChipWithRemove } from '../primitives/combobox/chip-with-remove'; | ||
| import { Collection } from '../primitives/combobox/collection'; | ||
|
|
||
| /** | ||
| * A complete searchable multi-select field with chips, integrated label, | ||
| * and description. | ||
| */ | ||
| export const SearchableChipSelectControl = Object.assign( | ||
| _SearchableChipSelectControl, | ||
| { | ||
| Group, | ||
| GroupLabel, | ||
| Item, | ||
| ChipWithRemove, | ||
| Collection, | ||
| } | ||
| ); |
35 changes: 35 additions & 0 deletions
35
packages/ui/src/form/searchable-chip-select-control/searchable-chip-select-control.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,35 @@ | ||
| import { forwardRef } from '@wordpress/element'; | ||
| import { Field, SearchableChipSelect } from '../primitives'; | ||
| import type { SearchableChipSelectControlProps } from './types'; | ||
|
|
||
| /** | ||
| * A complete searchable multi-select field with chips, integrated label, | ||
| * and description. | ||
| */ | ||
| export const SearchableChipSelectControl = forwardRef< | ||
| HTMLInputElement, | ||
| SearchableChipSelectControlProps | ||
| >( function SearchableChipSelectControl( | ||
| { | ||
| className, | ||
| label, | ||
| description, | ||
| details, | ||
| hideLabelFromVision, | ||
| ...restProps | ||
| }, | ||
| ref | ||
| ) { | ||
| return ( | ||
| <Field.Root className={ className }> | ||
| <Field.Label hideFromVision={ hideLabelFromVision }> | ||
| { label } | ||
| </Field.Label> | ||
| <SearchableChipSelect ref={ ref } { ...restProps } /> | ||
| { description && ( | ||
| <Field.Description>{ description }</Field.Description> | ||
| ) } | ||
| { details && <Field.Details>{ details }</Field.Details> } | ||
| </Field.Root> | ||
| ); | ||
| } ); |
Oops, something went wrong.
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.
Removed these two stories on the lower-level component in favor of keeping them on the higher-level component, since a clean and simple sharing of the code cannot be done due to the
renderfunction.I think this is fine, I don't expect much need for the lower-level version here, unlike the underlying
Combobox.