-
Notifications
You must be signed in to change notification settings - Fork 32
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
V6 (Chakra UI V3) #341
base: main
Are you sure you want to change the base?
V6 (Chakra UI V3) #341
Conversation
📊 Package size report -5.2%↓
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
Open in Stackblitz • chakra-react-select-demo
commit: |
@csandman Hello there. Do we have a timeline for migrating to ChakraUI v3? And how can we help? |
Hey, sorry for the delay in communication, I've been very busy recently and haven't had as much time to focus on this project as I'd like. Let me give a rundown of the current situation. So, for full transparency, my company isn't planning to upgrade to Chakra V3 in the near future due to the dramatic size of the refactor necessary. That means that I will most likely not be personally using this new version of Besides that, the biggest blocker really is updating the docs. With all of the changes to the core component APIs along with the theming API in Chakra v3, I will have to do a full refresh of the docs for this project to reflect those changes, and how this package utilizes them. Overall, it's not actually too complicated past the changes I mentioned above, I just wrote a giant wall of text for the docs over time, and it's going to take a while to comb through them haha. Now, all that being said, I think the changes in the And if there is any feedback around things genuinely not working properly, I will do my best to get things fixed in a timely manner to avoid slowing anyone's development down. If you post an issue on a weekday, I should have a fix ready by the next night, if not the same night (barring anything that involves major architectural changes). |
The EDIT: If others are blocked and are using npm, this block in
|
@b4stien Good call, I intended for that version EDIT: Ok I just pushed a new version that changes the peer dependency requirement of |
@csandman Hi, I just wanted to mention that I encountered runtime errors on my side if any of the Select components weren't enclosed within the Chakra's Field component. The error was "TypeError: Cannot read properties of undefined (reading 'readOnly')", meaning that inputProps.readOnly and similar properties were undefined. |
Ok thanks for letting me know, I'll take a look tonight! Can you provide an example of your implementation of it that I can go off of? EDIT: Nevermind @sblyvwx, I realized I just made a really stupid mistake. Somehow I totally missed handling the case where the Now that I think about it, the reason I hadn't thought anything of it is that the return typing on the |
I just implemented a pretty complex case with debouncing using // Async Listing select stuff
const [listingValue, setListingValue] = useState<any>(null);
const _loadListingOptions = (inputValue: string, callback: any) => {
autovisitaListingsList({ search: inputValue }).then((response) => {
const newOptions = response.map((listing) => ({
label: listing.title,
value: listing.pk
}));
callback(newOptions);
});
};
const loadListingOptions = useDebouncedCallback(_loadListingOptions, 500);
{/* ... */}
{/* Listing */}
<Field
label="Listing"
invalid={errors.listing ? true : false}
errorText={errors.listing?.message}
>
<AsyncSelect
name="listing"
placeholder="Select listing"
loadOptions={loadListingOptions}
noOptionsMessage={() => "Start typing to search"}
loadingMessage={() => "Loading..."}
onChange={(value: any) => {
setListingValue(value); // Set value to local state
setValue("listing", value?.value); // Send value to hook form
}}
value={listingValue}
/>
<Button
size={"xs"}
variant={"subtle"}
colorPalette="gray"
onClick={() => {
setValue("listing", null);
setListingValue(null);
}}
>
Clean
</Button>
</Field>
|
Things are working fine here using 6.0.0-next.5. |
@dontic @lovegehlin Thanks for the feedback! I'm working on the changes to the docs now, so I should have the first full release ready pretty soon! |
This is still very much a work in progress, I'm just going to leave this open in draft state while I work on it.
To test out the Chakra V3 compatible version, install it using the following.
npm i chakra-react-select@next # or yarn add chakra-react-select@next
Just to keep track, here are some loosely formatted notes on what changed:
select
component (except for the control which still uses input styles).colorScheme
is nowcolorPalette
tagColorScheme
->tagColorPalette
selectedOptionColorScheme
->selectedOptionColorPalette
colorScheme
->colorPalette
chakraComponents.LoadingIndicator
(they no longer exist on the ChakraSpinner
):emptyColor
speed
thickness
focusBorderColor
anderrorBorderColor
were removed as custom props, as they no long exist on the input/select.is
prefix removed:isRequired
is now therequired
attribute that's already built-in toreact-select
.isReadOnly
->readOnly
isInvalid
->invalid
disabled
, which will override theisDisabled
prop built-in toreact-select
menuPlacement
of"auto"
. This is to more closely match the default flipping behavior of the ChakraSelect
.