Skip to content
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

fix(deps): update dependency react-select to v5 #645

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 11, 2022

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
react-select (source) 3.2.0 -> 5.9.0 age adoption passing confidence

Release Notes

JedWatson/react-select (react-select)

v5.9.0

Compare Source

Minor Changes

v5.8.3

Compare Source

Patch Changes

v5.8.2

Compare Source

Patch Changes

v5.8.1

Compare Source

v5.8.0

Compare Source

Minor Changes
  • 884f1c42 #​5758 Thanks @​Ke1sy! - 1. Added 'aria-activedescendant' for input and functionality to calculate it;

    1. Added role 'option' and 'aria-selected' for option;
    2. Added role 'listbox' for menu;
    3. Added tests for 'aria-activedescendant';
    4. Changes in aria-live region:
    • the instructions how to use select will be announced only one time when user focuses the input for the first time.
    • instructions for menu or selected value will be announced only once after focusing them.
    • removed aria-live for focused option because currently with correct aria-attributes it will be announced by screenreader natively as well as the status of this option (active or disabled).
    • separated ariaContext into ariaFocused, ariaResults, ariaGuidance to avoid announcing redundant information and higlight only current change.

v5.7.7

Compare Source

Patch Changes

v5.7.6

Compare Source

Patch Changes

v5.7.5

Compare Source

Patch Changes

v5.7.4

Compare Source

Patch Changes

v5.7.3

Compare Source

Patch Changes

v5.7.2

Compare Source

Patch Changes

v5.7.1

Compare Source

Patch Changes

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

Configuration

📅 Schedule: Branch creation - "every weekday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, 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 was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/react-select-5.x branch 13 times, most recently from 7dc9f6a to fc59f95 Compare February 18, 2022 09:56
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 10 times, most recently from 2db9747 to b566cc0 Compare February 25, 2022 14:27
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 5 times, most recently from 6cd935c to 3b14319 Compare March 4, 2022 00:16
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 2 times, most recently from 66ae5e0 to 5233343 Compare March 8, 2022 18:22
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from 9d58bb7 to 86af641 Compare April 29, 2024 11:41
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from 86af641 to 7a77e16 Compare June 17, 2024 15:02
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from 7a77e16 to 88788de Compare June 25, 2024 08:31
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from 88788de to 382abde Compare July 25, 2024 12:09
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 7 times, most recently from a11a59f to 711af3f Compare August 2, 2024 21:46
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from 711af3f to 40c1953 Compare August 19, 2024 13:47
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 9 times, most recently from bb15445 to 3d061f7 Compare September 6, 2024 16:54
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 2 times, most recently from b759e90 to a264374 Compare September 19, 2024 16:48
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from a264374 to 2b9425a Compare October 14, 2024 01:24
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 2 times, most recently from 45cf3d6 to 6d93682 Compare October 31, 2024 18:53
@renovate renovate bot force-pushed the renovate/react-select-5.x branch 2 times, most recently from c9e40da to fc1c0df Compare November 14, 2024 18:34
@renovate renovate bot force-pushed the renovate/react-select-5.x branch from fc1c0df to 230208d Compare December 12, 2024 00:45
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.

0 participants