Skip to content

Conversation

@renovate
Copy link

@renovate renovate bot commented Oct 19, 2021

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
react-select (source) ^3.0.0 -> ^5.0.0 age adoption passing confidence

Release Notes

JedWatson/react-select

v5.7.0

Compare Source

Minor Changes

v5.6.1

Compare Source

Patch Changes

v5.6.0

Compare Source

Minor Changes

v5.5.9

Compare Source

Patch Changes

v5.5.8

Compare 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.7

Compare Source

Patch Changes

v5.5.6

Compare Source

Patch Changes

v5.5.5

Compare Source

Patch Changes

v5.5.4

Compare Source

Patch Changes

v5.5.3

Compare Source

Patch Changes

v5.5.2

Compare Source

Patch Changes

v5.5.1

Compare Source

Patch Changes

v5.5.0

Compare Source

Minor Changes

v5.4.0

Compare Source

Minor Changes

v5.3.2

Compare Source

Patch Changes

v5.3.1

Compare Source

Patch Changes

v5.3.0

Compare Source

Minor Changes
Patch Changes

v5.2.2

Compare Source

Patch Changes

v5.2.1

Compare Source

Patch Changes

v5.2.0

Compare Source

Minor Changes
Patch Changes

v5.1.0

Compare Source

Minor Changes
Patch Changes

v5.0.0

Compare Source

Upgrade Guide

Summary

  • Convert to TypeScript (#​4489) - TypeScript types now come packaged with react-select so you no longer need to have @types/react-select installed; we no longer include Flow types
  • Drop IE11 support (#​4625, #​4720, #​4634) - this allows us to make changes to our CSS that we've wanted to make for a long time as well as remove unnecessary JS solutions (those changes are noted below)
  • Use forwardRef for all wrapped components (#​4489) - this means that if you were accessing anything on the Select instance using a ref, the ref will now reference the internal Select directly (see below for how to upgrade)
  • Replace HOCs with hooks (#​4489) - if you were using our HOCs to create custom Selects (i.e., makeCreatableSelect, mangeState, makeAsyncSelect) these have now been replaced by hooks (i.e., useCreatable, useStateManager, useAsync)
  • Remove dependency on AutosizeInput (#​4625) - our new solution uses CSS grid which IE11 does not fully support; also .prefix__input now targets the input and NOT the container
  • Improve screen reader experience (#​4676) - this isn't a breaking change in the API but it does change the screen reader announcements
  • Use CSS grid for single value layout (#​4720) - this also isn't a breaking change in the API but is it a change in the styles since it switches to using CSS grid (not fully supported by IE11) for single-value Selects
  • Remove readonly attribute on our DummyInput (#​4634) - this results in better accessibility but uses caret-color which is not available on IE11

Details

Convert to TypeScript

We've rewritten react-select in 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 to flow-typed.

Here are the most notable changes when replacing @types/react-select with our packaged types:

@​types/react-select react-select Notes
OptinTypeBase no replacement Options can be any type (if using getOptionValue and getOptionLabel) so there's no longer a base type for options
OptionsType Options
GroupTypeBase GroupBase
GroupedOptionsType no replacement This is equivalent to ReadonlyArray<Group>
ValueType OnChangeValue
InputActionTypes InputAction
NamedProps Props
Select (the ref type) SelectInstance See "Use forwardRef for all wrapped components" for more details
AsyncSelect (the ref type) SelectInstance See "Use forwardRef for all wrapped components" for more details
CreatableSelect (the ref type) SelectInstance See "Use forwardRef for all wrapped components" for more details
AsyncCreatableSelect (the ref type) SelectInstance See "Use forwardRef for all wrapped components" for more details

If you were previously importing a type from the src directory when using @types/react-select:

import { ... } from 'react-select/src/...';

These should now be imported from the dist/declarations/src directory:

import { ... } from 'react-select/dist/declarations/src/...';

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 Select component you can use module augmentation to add them to the Select prop types:

declare module 'react-select/dist/declarations/src/Select' {
  export interface Props<
    Option,
    IsMulti extends boolean,
    Group extends GroupBase<Option>
  > {
    myCustomProp: string;
  }
}
Drop IE11 support

This allows us to use modern CSS in order to improve the quality of react-select and remove excessive JavaScript code to work around not having the ability to use modern CSS. If you need IE11 support either:

  1. Stay on v4.
  2. Attempt to use our Styles API and/or Components API to override styles and/or components that don't support IE11. The only change that might be hard to override is "Remove readonly attribute on our DummyInput" since you can't override the DummyInput component with the Styles or Components API.
  3. If there are simple changes that make react-select compatible with IE11, open a PR. We are unlikely to provide official support for IE11 since supporting IE11 makes maintaining react-select a 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 forwardRef for all wrapped components

NOTE: Accessing any of the internals of the Select component using refs is not part of our public API. The internals of the Select component can change at any time (including in minor and patch releases). The only methods on the Select component that are part of the public API are the focus() and blur() methods.

react-select exports five components: BaseSelect, CreatableSelect, Select (the default export), AsyncSelect, AsyncCreatableSelect. The last four components are wrappers around the BaseSelect. Previously the ref for each of these components was pointing to itself, but now we use forwardRef which means that the refs for all five components now point to BaseSelect.

The focus() and blur() methods are untouched by this change. However if you were accessing the internals of the BaseSelect component, you will need to update how you were accessing the BaseSelect. Here is how to update access to the BaseSelect component:

Component v4 v5
BaseSelect ref ref
CreatableSelect ref.select.select ref
Select ref.select ref
AsyncSelect ref.select.select ref
AsyncCreatableSelect ref.select.select.select ref
Replace 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, or useAsync). As an example, here is how the state managed Select (the default export) used to be constructed with the mangeState HOC:

const Select = manageState(SelectBase);

With hooks it is now constructed like this:

const Select = (props) => {
  const baseSelectProps = useStateManager(props);
  return <SelectBase {...baseSelectProps} />;
}

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__input CSS 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:

  • NVDA now announces the context text when initially focused
  • Selected option(s) (single and multi) are now announced when initially focused
  • VoiceOver now announces the context text when re-focusing
  • The clear action is now announced
  • Placeholder text is now announced
  • Mobile VoiceOver is now able to remove selected multi options

Also we've added 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. 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.

before-after
Remove readonly attribute on our DummyInput

Previously we added the readonly attribute to the DummyInput (when isSearchable is set to false) in order to hide the flashing cursor and prevent devices from showing a virtual keyboard. However the readonly attribute causes the DummyInput to be removed from the tab order in iOS Safari. In order to solve this we're replacing the readonly attribute with setting the caret-color CSS prop (which IE11 does not support) to transparent and setting the inputMode attribute on the <input> to none.

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 for stateManager, async and creatable components, 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 option field to type of CreateOptionActionMeta

  • 9e82aadc #​4676 - The following improvements have been made for screen reader users:

    • NVDA now announces the context text when initially focused
    • Selected option/s (single and multi) are now announced when initially focused
    • VoiceOver now announces the context text when re-focusing
    • The clear action is now announced
    • Placeholder text is now announced
    • Mobile VoiceOver is now able to remove selected multi options
  • 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.1

Compare Source

Patch Changes
  • 2c915d10 #​4577 - Bump @​emotion/cache to v11.4.0 which fixes an issue where different versions of Emotion running at the same time causes styles to disappear in production.

v4.3.0

Compare Source

Minor Changes
Patch Changes
Documentation Updates

v4.2.1

Compare Source

Patch Changes

v4.2.0

Compare Source

Minor Changes
Patch Changes

v4.1.0

Compare Source

Minor Changes
Patch Changes

v4.0.2

Compare Source

Patch Changes

v4.0.1

Compare Source

Patch Changes

v4.0.0

Compare Source

Upgrade Guide

Summary

Details

Standardize value passed to onChange

This change makes it so that the first parameter passed to the onChange callback will now always be an array of options if isMulti is set to true and will always be a single option or null if isMulti is set to false. Previously the first parameter of onChange could be an array or null when isMulti was set to true.

That means if you were previously using nullish coalescing in order to handle null for isMulti:

<Select
  isMulti
  onChange={(newValues) =>  setValues(newValues ?? [])}
/>

You can now remove the nullish coalescing because onChange will always be an array when isMulti is set to true:

<Select
  isMulti
  onChange={(newValues) =>  setValues(newValues)}
/>
Emotion 11

The NonceProvider component now requires a cacheKey prop that corresponds to the newly required key prop for the Emotion cache. This won't affect you if you aren't using NonceProvider. 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
Patch Changes

v3.2.0

Compare Source

Minor Changes
  • c615e93d #​4084 Thanks @​JedWatson! - Changed the cx and getValue props that are passed to components into instance properties, which means they now pass a referential equality check on subsequent renders.

    This is helpful, for example, when you're optimising the performance of rendering custom Option components - see #​3055

  • 72f6036f #​4306 Thanks @​bladey! - Remove duplicate prop createOptionPosition

Patch Changes

v3.1.1

Compare Source

Patch Changes

v3.1.0

Compare Source

Minor Changes
Patch Changes

v3.0.8

Patch Changes

v3.0.6

Compare Source

v3.0.3: v3.0.3

Compare Source

The core motivation behind 3.0.0 is to set us up to leverage new tools to make react-select better. As such we've made the following changes:

Breaking Changes

  • Upgrade from Emotion 9 to Emotion 10
  • UMD builds deprecated
  • Multiple Entrypoints
  • React 16.8 required as peer dependencies
  • Normalized Values #​3416

What this means for you

Emotion 10

Moving to the latest major version of emotion affords us zero-config SSR and enabling easier CSP support. Unfortunately this will be a breaking change for consumers who are currently leveraging emotion to build custom components for react-select. For example, you'd previously create an custom Option component with emotion like so:

import { css } from 'emotion'

const customOption = ({ cx, className, getStyles, _ }) => 
  <div 
     classNames={cx(
       css(getStyles('option', props)), 
       {
         'option': true,
         'option--is-disabled': isDisabled,
         'option--is-focused': isFocused,
         'option--is-selected': isSelected,
        },
        className
     )}
     {...}
  >

With react-select 3.0.0, and emotion 10 it would be the following:

/** @&#8203;jsx jsx */
import { jsx } from '@&#8203;emotion/core';

const customOption = ({ cx, className, getStyles, _ }) => 
  <div 
    css={getStyles('option', props)}
    classNames={cx(
     {
       'option': true,
       'option--is-disabled': isDisabled,
       'option--is-focused': isFocused,
       'option--is-selected': isSelected,
      },
      className
    )} 
    {...}
  >

Multiple Entrypoints:

v3.0.0 separates removes the following components from the main entry point, and instead exports them as separate entrypoints:

  • Async (now exported from react-select/async)
  • Creatable (now exported from react-select/creatable)
  • Async Creatable (now exported from react-select/async-creatable)
  • makeAnimated and default animated components (now exported from react-select/animated)

Where you’d previously import them as such

	import { Async } from 'react-select'  

Or as:

	import Async from 'react-select/lib/Async'

Now imports look like this:

	import AsyncSelect from 'react-select/async'

This should have no bundle-size impact on react-select consumers currently leveraging tree-shaking. However for consumers who aren’t leveraging tree-shaking, this should help alleviate some of the bundle-weight.

UMD Builds

UMD builds have been removed as of react-select v3.

Peer dependency on React 16.8

We've decided on requiring 16.8 as a peer dependency for react-select 3.0.0. This is motivated by our commitment to leveraging the improvements in recent versions of React such as hooks to make react-select even better.

Normalized Values

At the moment, if no value is specified by the consumer, it's instantiated as a null value, regardless of whether the select isMulti or not.

When isMulti is false this is fine. On selection of an option, the value becomes an object, and on clearing of said value, it returns to being null. (null --> {} --> null)

However when isMulti is true, this becomes more inconsistent. On selection of options, the value becomes an array of options, removing values extricates them from this array, removing the last selected value results in an empty array, instead of the initial base state of null.
(null --> [{}] --> [])

We rectify this in 3.0.0, on removal of all selected values in an isMulti Select, the value passed to onChange is null and not [].
normalize-value

  • Remove base entrypoint to fix rollup dependency resolution issue in 3.0.3
  • See #​3585 for a detailed list of changes in 3.0.0

v3.0.2

Compare Source

v3.0.1

Compare Source


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), 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 this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate
Copy link
Author

renovate bot commented Mar 24, 2023

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@renovate renovate bot changed the title fix(deps): update dependency react-select to v5 fix(deps): update dependency react-select to v5 - abandoned Dec 8, 2024
@renovate
Copy link
Author

renovate bot commented Dec 8, 2024

Autoclosing Skipped

This PR has been flagged for autoclosing. However, it is being skipped due to the branch being already modified. Please close/delete it manually or report a bug if you think this is in error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants