-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(select): add isClearable #3746
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
Closed
abhinav700
wants to merge
24
commits into
heroui-inc:beta/release-next
from
abhinav700:adding-isClearable-to-select
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
40579f1
feat(select): add core logic for isClearable
abhinav700 3954594
fix: fix alignment for clear button in select component
abhinav700 798ee73
docs: add docs for clear button, isClearable, onClear
abhinav700 16334a9
Merge branch 'nextui-org:canary' into adding-isClearable-to-select
abhinav700 6c0d2a3
chore: lint the code
abhinav700 c683694
chore: add changeset
abhinav700 179b530
chore: remove case for isClearable=false from docs and story
abhinav700 5635e4f
chore(select): code refactor
abhinav700 e7f481e
Merge branch 'nextui-org:canary' into adding-isClearable-to-select
abhinav700 961b942
Merge branch 'nextui-org:canary' into adding-isClearable-to-select
abhinav700 2d74e6d
chore(select): update logic for clear button and add docs
abhinav700 5d112ac
Merge branch 'canary' into adding-isClearable-to-select
abhinav700 450c77d
chore(select): implement wingkwong's suggestions
abhinav700 60ecd78
docs(select): pass onclear property to clear button
abhinav700 5f49a0d
chore(select): theme version update, docs update
abhinav700 4c7b06e
Merge branch 'nextui-org:canary' into adding-isClearable-to-select
abhinav700 50def02
fix(select): fix the focus behaviour of the clear button
abhinav700 3c07d24
Merge branch 'canary' into adding-isClearable-to-select
wingkwong 6ad9f33
Merge branch 'nextui-org:canary' into adding-isClearable-to-select
abhinav700 0684bff
fix(select): fix hover, remove endContent, remove onClear
abhinav700 1a52faf
Merge branch 'beta/release-next' into pr/3746
wingkwong 968df46
Merge branch 'beta/release-next' into pr/3746
wingkwong bf029ab
chore(changeset): change to patch
wingkwong c221d07
refactor(docs): apply new structure to docs
wingkwong 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@nextui-org/select": patch | ||
| "@nextui-org/theme": patch | ||
| --- | ||
|
|
||
| add `isClearable` and `onClear` prop to Select component (#2239) |
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 |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import {Select, SelectItem} from "@nextui-org/react"; | ||
|
|
||
| export const animals = [ | ||
| {key: "cat", label: "Cat"}, | ||
| {key: "dog", label: "Dog"}, | ||
| {key: "elephant", label: "Elephant"}, | ||
| {key: "lion", label: "Lion"}, | ||
| {key: "tiger", label: "Tiger"}, | ||
| {key: "giraffe", label: "Giraffe"}, | ||
| {key: "dolphin", label: "Dolphin"}, | ||
| {key: "penguin", label: "Penguin"}, | ||
| {key: "zebra", label: "Zebra"}, | ||
| {key: "shark", label: "Shark"}, | ||
| {key: "whale", label: "Whale"}, | ||
| {key: "otter", label: "Otter"}, | ||
| {key: "crocodile", label: "Crocodile"}, | ||
| ]; | ||
|
|
||
| export const PetBoldIcon = (props) => { | ||
| return ( | ||
| <svg | ||
| aria-hidden="true" | ||
| fill="none" | ||
| focusable="false" | ||
| height="1em" | ||
| role="presentation" | ||
| viewBox="0 0 24 24" | ||
| width="1em" | ||
| {...props} | ||
| > | ||
| <path | ||
| d="M19.0803 15.7203C18.4903 12.1903 15.1003 9.32031 11.5203 9.32031C7.63028 9.32031 4.21028 12.4703 3.88028 16.3503C3.75028 17.8503 4.23028 19.2703 5.22028 20.3403C6.20028 21.4103 7.58028 22.0003 9.08028 22.0003H13.7603C15.4503 22.0003 16.9303 21.3403 17.9403 20.1503C18.9503 18.9603 19.3503 17.3803 19.0803 15.7203Z" | ||
| fill="currentColor" | ||
| /> | ||
| <path | ||
| d="M10.2796 7.86C11.8978 7.86 13.2096 6.54819 13.2096 4.93C13.2096 3.31181 11.8978 2 10.2796 2C8.66141 2 7.34961 3.31181 7.34961 4.93C7.34961 6.54819 8.66141 7.86 10.2796 7.86Z" | ||
| fill="currentColor" | ||
| /> | ||
| <path | ||
| d="M16.94 9.02844C18.2876 9.02844 19.38 7.93601 19.38 6.58844C19.38 5.24086 18.2876 4.14844 16.94 4.14844C15.5924 4.14844 14.5 5.24086 14.5 6.58844C14.5 7.93601 15.5924 9.02844 16.94 9.02844Z" | ||
| fill="currentColor" | ||
| /> | ||
| <path | ||
| d="M20.5496 12.9313C21.6266 12.9313 22.4996 12.0582 22.4996 10.9812C22.4996 9.90429 21.6266 9.03125 20.5496 9.03125C19.4727 9.03125 18.5996 9.90429 18.5996 10.9812C18.5996 12.0582 19.4727 12.9313 20.5496 12.9313Z" | ||
| fill="currentColor" | ||
| /> | ||
| <path | ||
| d="M3.94 10.9816C5.28757 10.9816 6.38 9.88914 6.38 8.54156C6.38 7.19399 5.28757 6.10156 3.94 6.10156C2.59243 6.10156 1.5 7.19399 1.5 8.54156C1.5 9.88914 2.59243 10.9816 3.94 10.9816Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ); | ||
| }; | ||
|
|
||
| export default function App() { | ||
| return ( | ||
| <div className="flex w-screen justify-center items-center"> | ||
| <Select className="max-w-xs my-5" isClearable={true} label="Favorite Animal"> | ||
| {animals.map((animal) => ( | ||
| <SelectItem key={animal.key}>{animal.label}</SelectItem> | ||
| ))} | ||
| </Select> | ||
| </div> | ||
| ); | ||
| } |
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,9 @@ | ||
| import App from "./is-clearable.raw.jsx?raw"; | ||
|
|
||
| const react = { | ||
| "/App.jsx": App, | ||
| }; | ||
|
|
||
| export default { | ||
| ...react, | ||
| }; |
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
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.
Uh oh!
There was an error while loading. Please reload this page.