-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch solid-select to have two-stage creation
- Loading branch information
1 parent
58d02bc
commit b9cccb6
Showing
3 changed files
with
523 additions
and
469 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,8 @@ | |
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]" | ||
"[email protected]": "patches/[email protected]", | ||
"@thisbeyond/[email protected]": "patches/@[email protected]" | ||
}, | ||
"overrides": { | ||
"got@<11.8.5": ">=11.8.5", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
diff --git a/dist/source/create-options.jsx b/dist/source/create-options.jsx | ||
index 9ecaf9cd1d546794dd6dec8cca9dd2aca2db60f1..dc2fbf328430fea46ceefcaff5eab754780787c9 100644 | ||
--- a/dist/source/create-options.jsx | ||
+++ b/dist/source/create-options.jsx | ||
@@ -38,7 +38,7 @@ const createOptions = (values, userConfig) => { | ||
value, | ||
disabled: false, | ||
}; | ||
- createdOptions = [...createdOptions, option]; | ||
+ createdOptions = [option, ...createdOptions]; | ||
} | ||
} | ||
return createdOptions; | ||
diff --git a/dist/source/create-select.jsx b/dist/source/create-select.jsx | ||
index da8907d3b1b447bf06d7d2be1a78789198baebb2..94fcf186dc3149628433290e6c714f4af3c62c98 100644 | ||
--- a/dist/source/create-select.jsx | ||
+++ b/dist/source/create-select.jsx | ||
@@ -122,7 +122,11 @@ const createSelect = (props) => { | ||
break; | ||
case "Enter": | ||
if (isOpen() && focusedOption()) { | ||
- pickOption(focusedOption()); | ||
+ if (focusedOption().value === inputValue()) { | ||
+ pickOption(focusedOption()); | ||
+ break; | ||
+ } | ||
+ setInputValue(focusedOption().value); | ||
break; | ||
} | ||
return; | ||
@@ -160,7 +164,11 @@ const createSelect = (props) => { | ||
break; | ||
case "Tab": | ||
if (focusedOption() && isOpen()) { | ||
- pickOption(focusedOption()); | ||
+ if (focusedOption().value === inputValue()) { | ||
+ pickOption(focusedOption()); | ||
+ break; | ||
+ } | ||
+ setInputValue(focusedOption().value); | ||
break; | ||
} | ||
return; |
Oops, something went wrong.