Update dependency react-select to v5 #28
Open
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.
This PR contains the following updates:
^3.1.1→^5.0.0^3.0.28→^5.0.0Release Notes
JedWatson/react-select (react-select)
v5.10.2Compare Source
Patch Changes
bf0c8615#6051 Thanks @jnyholm-sc! - fix: hydration problem caused by isAppleDevicev5.10.1Compare Source
Patch Changes
c5706a0d#6013 Thanks @jonahShaf! - Distribute license filev5.10.0Compare Source
Minor Changes
6d28ed76#5993 Thanks @onihani! - Export theFilterOptionOptiontypev5.9.0Compare Source
Minor Changes
01206c33#5984 Thanks @Thris3n! - Add React 19 to peer dependency rangev5.8.3Compare Source
Patch Changes
111efad1#5974 Thanks @j2ghz! - Fix types compatibility with React 19v5.8.2Compare Source
Patch Changes
781284a9#5771 Thanks @tu4mo! - Fix for calling non-cancellable scroll eventsv5.8.1Compare Source
Patch Changes
dd740ced#5960 Thanks @leonaves! - No longer send pop-value action when multi-select is empty. This correctly resolves typings with that event, where removedValue cannot be undefined.v5.8.0Compare Source
Minor Changes
884f1c42#5758 Thanks @Ke1sy! - 1. Added 'aria-activedescendant' for input and functionality to calculate it;v5.7.7Compare Source
Patch Changes
224a8f0d#5666 Thanks @yhy-1! - Add aria-disabled to select's control component.v5.7.6Compare Source
Patch Changes
f6315cd5#5672 Thanks @tu4mo! - Fix for calling non-cancellable scroll eventsv5.7.5Compare Source
Patch Changes
9d1730ba#5347 Thanks @aszmyd! - Make scroll lock div work on a document context it belongs tov5.7.4Compare Source
Patch Changes
16414bb5#5689 Thanks @Rall3n! - ResolvedefaultPropsdeprecation warning for React v18+.v5.7.3Compare Source
Patch Changes
59513d00#5626 Thanks @emmatown! - Fix importingreact-selectin Node ESMv5.7.2Compare Source
Patch Changes
925cd4a2#5536 Thanks @Rall3n! -requiredprop accessibiltiy and functionality improvementsv5.7.1Compare Source
Patch Changes
597143ee#5559 Thanks @gdiazdelaserna! - Addexportsfield in package.jsonv5.7.0Compare Source
Minor Changes
0773095f#5457 Thanks @nderkim! - Add classNames API and unstyled propv5.6.1Compare Source
Patch Changes
cda16826#5482 Thanks @nderkim! - Fix unstable theme rerendering menuv5.6.0Compare Source
Minor Changes
c37e86d8#4882 Thanks @Rall3n! - Addrequiredpropv5.5.9Compare Source
Patch Changes
851ed2b8#5430 Thanks @Rall3n! - Fix focused option ifdefaultMenuIsOpenis setv5.5.8Compare Source
Patch Changes
1ad6de4e#5084 Thanks @kosciolek! - When focusing a dropdown option, the numbers included in the aria live region take filtering into consideration.v5.5.7Compare Source
Patch Changes
0ca2d5ba#5431 Thanks @nderkim! - Changeclasscomponents tofunctionalcomponentsv5.5.6Compare Source
Patch Changes
92398939#5409 Thanks @lukebennett88! - Move files around to as to be compatible with version 2 of@preconstruct/cliv5.5.5Compare Source
Patch Changes
0dd38029#5246 Thanks @Rall3n! - Fix re-focus of component in Firefox if being disabled while focusedv5.5.4Compare Source
Patch Changes
ebb0a17a#5404 Thanks @Methuselah96! - Use ResizeObserver to auto-update menu position if availablev5.5.3Compare Source
Patch Changes
07656aaa#5399 Thanks @dependabot! - Update memoize-onev5.5.2Compare Source
Patch Changes
00238f1a#5376 Thanks @lukebennett88! - Fix bug with animated multi-value select width being too widev5.5.1Compare Source
Patch Changes
0f6ef093#5381 Thanks @Methuselah96! - Disable use of ResizeObserver for menu position auto-updating to avoid potential breaking changes.v5.5.0Compare Source
Minor Changes
598f9ee0#5256 Thanks @Methuselah96! - Auto-update menu position when using menu portallingv5.4.0Compare Source
Minor Changes
5d49f70a#5249 Thanks @Methuselah96! - ExportformatOptionLabeltypes (i.e.,FormatOptionLabelMetaandFormatOptionLabelContext).v5.3.2Compare Source
Patch Changes
1f140e42#5177 Thanks @Methuselah96! - Fix view height used for menu positioning to be the scroll parent instead of the windowv5.3.1Compare Source
Patch Changes
03bf7351#5164 Thanks @Methuselah96! - Bump @emotion/react to ^11.8.1 to avoiduseInsertionEffectbugv5.3.0Compare Source
Minor Changes
c7d8d4b3#5133 Thanks @nil4! - UpdatepeerDependenciesto include React 18Patch Changes
0aaa9575#5134 Thanks @rkulinski! - Use defaultPrevented to skip duplicate event handler for clicking select.87e14431#5131 Thanks @pcorpet! - Avoid referencing an ID that is not in the DOM7184d538#5082 Thanks @Methuselah96! - Fix type inference for Async's loadOptions propbd4ee8ae#5057 Thanks @Rall3n! - Prevent transition props from being forwarded to<input>element inDummyInputcomponentv5.2.2Compare Source
Patch Changes
940a50b1#4928 Thanks @Methuselah96! - Fix usage with esModuleInterop disabled54f9538e#4941 Thanks @prichey! - Use React's AriaAttributes type directly rather than recreatinge97d45c0#4908 Thanks @vjee! - Make 3rd argument of CommonProps['setValue'] optional.v5.2.1Compare Source
Patch Changes
f172d7f9#4886 Thanks @Akridian! - Hooks for creation of custom Selects are now exported from main entryv5.2.0Compare Source
Minor Changes
6c7a3d1e#4785 Thanks @Rall3n! - AddprevInputValueto action metab522ac65#4860 Thanks @ebonow! - Fix animated MultiValue transitions when being removed and change method used to generate unqiue keys for Option components. Closes #4844 , closes #4602Patch Changes
417e7217#4842 Thanks @Methuselah96! - Remove src directory from published package480ea85b#4846 Thanks @Methuselah96! - Add missing index to MultiValue props typeb8e34472#4854 Thanks @mikunpham! - Make input container css re-compute whenever input value changes due to a bug from@emotion/reactin development env.v5.1.0Compare Source
Minor Changes
8b38d49b #4807 Thanks @hcharley! - Export AsyncCreatableProps from creatable entrypoint
46eeda1a #4801 Thanks @Methuselah96! - Export more types from main entry point
Patch Changes
fdd01e66 #4833 Thanks @ebonow! - Value container display property should be grid when isMulti and has no value so the Placeholder component is positioned correctly with the Input
0937604f #4823 Thanks @mikunpham! - Fix the issue where input contents are moved to the left due to multiple space characters.
ec80b577 #4803 Thanks @Methuselah96! - Import CSSObject from @emotion/react instead of @emotion/serialize
v5.0.0Compare Source
Upgrade Guide
Summary
react-selectso you no longer need to have@types/react-selectinstalled; we no longer include Flow typesforwardReffor all wrapped components (#4489) - this means that if you were accessing anything on theSelectinstance using aref, therefwill now reference the internalSelectdirectly (see below for how to upgrade)Selects (i.e.,makeCreatableSelect,mangeState,makeAsyncSelect) these have now been replaced by hooks (i.e.,useCreatable,useStateManager,useAsync).prefix__inputnow targets the input and NOT the containerSelectsreadonlyattribute on ourDummyInput(#4634) - this results in better accessibility but usescaret-colorwhich is not available on IE11Details
Convert to TypeScript
We've rewritten
react-selectin TypeScript which means you can remove any dependencies on@types/react-select. If you were using the Flow types than look into contributing types for v5 toflow-typed.Here are the most notable changes when replacing
@types/react-selectwith our packaged types:OptinTypeBasegetOptionValueandgetOptionLabel) so there's no longer a base type for optionsOptionsTypeOptionsGroupTypeBaseGroupBaseGroupedOptionsTypeReadonlyArray<Group>ValueTypeOnChangeValueInputActionTypesInputActionNamedPropsPropsSelect(thereftype)SelectInstanceforwardReffor all wrapped components" for more detailsAsyncSelect(thereftype)SelectInstanceforwardReffor all wrapped components" for more detailsCreatableSelect(thereftype)SelectInstanceforwardReffor all wrapped components" for more detailsAsyncCreatableSelect(thereftype)SelectInstanceforwardReffor all wrapped components" for more detailsIf you were previously importing a type from the
srcdirectory when using@types/react-select:These should now be imported from the
dist/declarations/srcdirectory:We export any types from the main entry point that we think might be useful to the user. If you are using a type that is not exported from the main entry point please open a PR or issue so that we can add it.
If you are using custom props for the
Selectcomponent you can use module augmentation to add them to theSelectprop types:Drop IE11 support
This allows us to use modern CSS in order to improve the quality of
react-selectand remove excessive JavaScript code to work around not having the ability to use modern CSS. If you need IE11 support either:readonlyattribute on ourDummyInput" since you can't override theDummyInputcomponent with the Styles or Components API.react-selectcompatible with IE11, open a PR. We are unlikely to provide official support for IE11 since supporting IE11 makes maintainingreact-selecta lot more difficult and holds us back from changes we want to make, but we also are glad to accept simple changes if they make your life easier.Use
forwardReffor all wrapped componentsNOTE: Accessing any of the internals of the
Selectcomponent usingrefs is not part of our public API. The internals of theSelectcomponent can change at any time (including in minor and patch releases). The only methods on theSelectcomponent that are part of the public API are thefocus()andblur()methods.react-selectexports five components:BaseSelect,CreatableSelect,Select(the default export),AsyncSelect,AsyncCreatableSelect. The last four components are wrappers around theBaseSelect. Previously thereffor each of these components was pointing to itself, but now we useforwardRefwhich means that therefs for all five components now point toBaseSelect.The
focus()andblur()methods are untouched by this change. However if you were accessing the internals of theBaseSelectcomponent, you will need to update how you were accessing theBaseSelect. Here is how to update access to theBaseSelectcomponent:BaseSelectrefrefCreatableSelectref.select.selectrefSelectref.selectrefAsyncSelectref.select.selectrefAsyncCreatableSelectref.select.select.selectrefReplace HOCs with hooks
The primary reason for this change is that hooks combined with generic components are easier to type in TypeScript than HOCs combined with generic components. These HOCs/hooks are considered advanced usage.
If you were using the HOCs, it shouldn't be too hard to replace them with its corresponding hook (i.e.,
useStateManager,useCreatable, oruseAsync). As an example, here is how the state managed Select (the default export) used to be constructed with themangeStateHOC:With hooks it is now constructed like this:
Consult the source code for how the other components are constructed.
Remove dependency on AutosizeInput
This is an exciting change because we get to drop our dependency on
react-input-autosize. We now use a pure CSS solution to auto-size the input, however this means that we have to drop support for IE11 since IE11 does not fully support CSS grid. As part of this refactor the.prefix__inputCSS class now targets the input itself and NOT the container. See #4625 for more details.Improve screen reader experience
The following improvements have been made for screen reader users:
Also we've added the role of combobox and the required ARIA attributes to the
InputandDummyInputcomponents to allow JAWS support and a better screen reader experience overall. See #4695 for more details.Use CSS grid for single value layout
Previously the absolution positioning of both the value and the placeholder pulled them out of the flow, and thus the component itself collapsed down when used as a flex child. To solve this we are now using CSS grid for the single value layout.
Remove
readonlyattribute on ourDummyInputPreviously we added the
readonlyattribute to theDummyInput(whenisSearchableis set tofalse) in order to hide the flashing cursor and prevent devices from showing a virtual keyboard. However thereadonlyattribute causes theDummyInputto be removed from the tab order in iOS Safari. In order to solve this we're replacing thereadonlyattribute with setting thecaret-colorCSS prop (which IE11 does not support) totransparentand setting theinputModeattribute on the<input>tonone.Changelog
Major Changes
ef87c3ac #4683 Thanks @Methuselah96! - React-Select has been converted from Flow to TypeScript.
Other changes for v5 include usage of
forwardRef, new hooks forstateManager,asyncandcreatablecomponents, and more reliable filtering implementaion with new options in the creatable variant.Patch Changes
10225290 #4720 - Updated the layout for the singleValue input/placeholder/container so that it works better when used in flex layouts.
53f1972b #4731 Thanks @JedWatson! - MultiValue key now includes a hyphen between the value and the index to prevent edge cases where you could get a duplicate key error
b41f4ceb #4704 Thanks @Rall3n! - Fix findDOMNode deprecation by adding refs to transition components
4b028829 #4634 - The readonly attribute has been removed from the DummyInput to improve accessibility
7fcec537 #4697 - Add the role of combobox and the required ARIA attributes to the Input and DummyInput components to allow JAWS support and a better screen reader experience overall.
ca2c0e5b #4756 Thanks @fdcds! - Add
optionfield to type ofCreateOptionActionMeta9e82aadc #4676 - The following improvements have been made for screen reader users:
638f5455 #4702 Thanks @Methuselah96! - The Option generic is no longer required to extend the OptionBase type
23cea0b5 #4782 Thanks @Methuselah96! - Fix type of loadingMessage prop to allow it to return any ReactNode
v4.3.1Compare Source
Patch Changes
v4.3.0Compare Source
Minor Changes
focusedOptionis now passed to the MenuList Component as a propPatch Changes
menuShouldScrollIntoView=falseDocumentation Updates
v4.2.1Compare Source
Patch Changes
v4.2.0Compare Source
Minor Changes
2ffed9c6 #4444 Thanks @Rall3n! - Use accessor props to get value and label in
compareOption2baf5a9d #4414 Thanks @ebonow! - Add
ariaLiveMessagesprop for internationalization and other customizations, addaria-liveprop, and other accessibility fixes. Inspired heavily from the work done by @Kashkovsky, @radegran, @Malgalad, and @TheHollidayInn - thanks to them, @bozdoz for the thorough testing and recommendations, and for everyone who contributed constructive feedback towards a better accessibility experience.7cdb8a6b #4391 Thanks @ebonow! - Pass and sanitize CommonProps passed to Group and Input components
Patch Changes
c955415c #4437 Thanks @ebonow! - Set event listeners to be non-passive to remove Chrome console warnings
3ca22b2f #3827 Thanks @mitchellhamilton! - Memoize stripDiacritics in createFilter for the input with memoize-one so that stripDiacritics is not called for the same string as many times as there are options every time the input changes
Inspired by https://blog.johnnyreilly.com/2019/04/react-select-with-less-typing-lag.html
dce3863f #4423 Thanks @Methuselah96! - Remove browser alias fields in order to fix SSR apps
ec7c0728 #4443 Thanks @ebonow! - Allow tabIndex prop Type to be number or string
v4.1.0Compare Source
Minor Changes
b5f9b0c5 #4342 Thanks @Methuselah96! - Standardized innerProps and className props on customizable components
19b76342 #3911 Thanks @eugenet8k! - Add
removedValuestoonChangeevent meta when the action isclear(when the user clears the value in the Select)Patch Changes
f600d13f #4422 Thanks @Methuselah96! - Fix finding focusable options for groups
a016c878 #4420 Thanks @Methuselah96! - Bump dependency on @babel/runtime in order to fix compatibility issues with Webpack 5
10b5f5a5 #4404 Thanks @Methuselah96! - Remove unnecessary dependency on @emotion/css
v4.0.2Compare Source
Patch Changes
v4.0.1Compare Source
Patch Changes
v4.0.0Compare Source
Upgrade Guide
Summary
onChange(#4339) - theonChangehandler is now always passed an array of options ifisMultiis set totrueNonceProvidercomponentDetails
Standardize value passed to
onChangeThis change makes it so that the first parameter passed to the
onChangecallback will now always be an array of options ifisMultiis set totrueand will always be a single option ornullifisMultiis set tofalse. Previously the first parameter ofonChangecould be an array ornullwhenisMultiwas set totrue.That means if you were previously using nullish coalescing in order to handle
nullforisMulti:You can now remove the nullish coalescing because
onChangewill always be an array whenisMultiis set totrue:Emotion 11
The
NonceProvidercomponent now requires acacheKeyprop that corresponds to the newly requiredkeyprop for the Emotion cache. This won't affect you if you aren't usingNonceProvider. See #4283 for more details.Remove usage of UNSAFE React methods
This isn't necessarily a breaking change, but it required a large refactor in order to accomplish so we released this in a major upgrade in case it has some unintended consequences.
Changelog
Major Changes
02050675 #4339 Thanks @Methuselah96! - Standardized value passed to onChange
26b6325c #4283 Thanks @majgaard! - Upgrades Emotion dependency to v11.0.0
BREAKING CHANGE: The NonceProvider component now requires a
cacheKeyprop that corresponds to thekeyfor the Emotion cache.b2488bb5 #4313 Thanks @Methuselah96! - Removed usages of UNSAFE React methods
Patch Changes
Configuration
📅 Schedule: Branch creation - "before 3am on the first day of the month" in timezone America/Sao_Paulo, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.