Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JedWatson/react-select into fix-s…
Browse files Browse the repository at this point in the history
…croll-issue
  • Loading branch information
vadimka123 committed Dec 28, 2020
2 parents 29c5743 + d1e660c commit ff36fb4
Show file tree
Hide file tree
Showing 28 changed files with 154 additions and 96 deletions.
5 changes: 0 additions & 5 deletions .changeset/chilly-eagles-arrive.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/flat-kings-applaud.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/great-actors-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-select": patch
---

Adds react ^17.0.0 to peer dependencies for React 17 support
5 changes: 5 additions & 0 deletions .changeset/lazy-singers-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-select": patch
---

Creatable: Fixed removing MultiValues that have identical values. See issue #4137 for details.
5 changes: 5 additions & 0 deletions .changeset/lemon-boats-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-select": patch
---

Added a guard to the `ScrollCaptor` component to check that `el` exists before calling `removeEventListener`, fixes intermittent errors
7 changes: 7 additions & 0 deletions .changeset/nasty-coats-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"react-select": minor
---

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](https://github.com/JedWatson/react-select/issues/3055)
5 changes: 5 additions & 0 deletions .changeset/silly-donkeys-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-select": patch
---

Updated react-input-autosize to v3.0.0
5 changes: 0 additions & 5 deletions .changeset/sixty-forks-fry.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/ten-apples-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-select': minor
---

Remove duplicate prop createOptionPosition
8 changes: 0 additions & 8 deletions .changeset/thick-eyes-walk.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/touches-fix.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/update-context-api.md

This file was deleted.

7 changes: 7 additions & 0 deletions .changeset/wicked-turkeys-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"react-select": patch
---

Added `innerProps` prop to the built-in `MenuList` component to reduce the need for additional DOM nodes or forking internal code when passing additional props to the DOM element the MenuList component is rendering.

See issue [#4265](https://github.com/JedWatson/react-select/issues/4265) for an explanation.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ jobs:
command: |
yarn global add cypress
yarn install --silent
cypress install
yarn cypress install
yarn e2e
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Jed Watson
Copyright (c) 2020 Jed Watson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ Shout out to [Joss Mackison](https://github.com/jossmac), [Charles Lee](https://

## License

MIT Licensed. Copyright (c) Jed Watson 2019.
MIT Licensed. Copyright (c) Jed Watson 2020.
16 changes: 16 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @react-select/docs

## 2.4.6

### Patch Changes

- [7af1aafb](https://github.com/JedWatson/react-select/commit/7af1aafb2314db02544b7970784b868e97ec4824) [#4295](https://github.com/JedWatson/react-select/pull/4295) Thanks [@JedWatson](https://github.com/JedWatson)! - Fix menuplacement context

- Updated dependencies [c8d74bd5]:
- Updated dependencies [c8447f48]:
- Updated dependencies [7af1aafb]:
- Updated dependencies [32ad5c04]:
- Updated dependencies [6af14fbb]:
- Updated dependencies [0eb1ef96]:
- Updated dependencies [ad608c8f]:
- react-select@undefined

## 2.4.5

- Updated dependencies [[9ad152b](https://github.com/JedWatson/react-select/commit/9ad152b)]:
- react-select@3.0.0
2 changes: 1 addition & 1 deletion docs/examples/CustomNoOptionsMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const CustomNoOptionsMessage = () => {
<Select
isClearable
components={{ NoOptionsMessage }}
styles={{ NoOptionsMessage: base => ({ ...base, ...msgStyles }) }}
styles={{ noOptionsMessage: base => ({ ...base, ...msgStyles }) }}
isSearchable
name="color"
options={[]}
Expand Down
1 change: 1 addition & 0 deletions docs/examples/MenuPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class MenuPortal extends Component<*, State> {
menuPosition={isFixed ? 'fixed' : 'absolute'}
menuPlacement={portalPlacement}
options={colourOptions}
menuShouldScrollIntoView={false}
/>
<Note Tag="label">
<select
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@react-select/docs",
"private": true,
"version": "2.4.5",
"version": "2.4.6",
"author": "Jed Watson",
"license": "MIT",
"dependencies": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"react-helmet": "^5.2.0",
"react-markings": "^1.3.0",
"react-router-dom": "^4.2.2",
"react-select": "^3.0.0",
"react-select": "^3.1.1",
"react-sortable-hoc": "^1.9.1",
"react-syntax-highlighter": "^7.0.1",
"style-loader": "^0.23.1",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"jest-in-case": "^1.0.2",
"memoize-one": "^5.0.0",
"moment": "^2.20.1",
"node-fetch": "^2.5.0",
"node-fetch": "^2.6.1",
"pretty-proptypes": "^0.5.0",
"prop-types": "^15.6.0",
"raf": "^3.4.0",
Expand All @@ -74,7 +74,7 @@
"react-codesandboxer": "^2.0.1",
"react-dom": "^16.13.0",
"react-helmet": "^5.2.0",
"react-input-autosize": "^2.2.2",
"react-input-autosize": "^3.0.0",
"react-markings": "^1.3.0",
"react-router-dom": "^4.2.2",
"react-sortable-hoc": "^1.9.1",
Expand Down
21 changes: 21 additions & 0 deletions packages/react-select/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# react-select

## 3.1.1

### Patch Changes

- [c8d74bd5](https://github.com/JedWatson/react-select/commit/c8d74bd5710b1db6736837fb4334a59e46614a27) [#3979](https://github.com/JedWatson/react-select/pull/3979) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - Fix repository field

- [c8447f48](https://github.com/JedWatson/react-select/commit/c8447f480f8b9ca04386bee08e8d3a6fbb4f07c8) [#4034](https://github.com/JedWatson/react-select/pull/4034) Thanks [@sophiebits](https://github.com/sophiebits)! - Improve performance of option filtering when ignoreAccents is enabled (the default)

- [7af1aafb](https://github.com/JedWatson/react-select/commit/7af1aafb2314db02544b7970784b868e97ec4824) [#4295](https://github.com/JedWatson/react-select/pull/4295) Thanks [@JedWatson](https://github.com/JedWatson)! - Fix menuplacement context

- [32ad5c04](https://github.com/JedWatson/react-select/commit/32ad5c040bdd96cd1ca71010c2558842d684629c) [#3892](https://github.com/JedWatson/react-select/pull/3892) Thanks [@flexdinesh](https://github.com/flexdinesh)! - Fix react-select ignoring HTML5 "form" attribute

- [6af14fbb](https://github.com/JedWatson/react-select/commit/6af14fbbc8ab42f2d17721732c9fe221d47c9e30) [#3897](https://github.com/JedWatson/react-select/pull/3897) Thanks [@lorisdev](https://github.com/lorisdev)! - Removes the call to `onMenuOpen` on every input change

If you were relying on this undesired behavior it may be a breaking change.
Please upgrade accordingly.

- [0eb1ef96](https://github.com/JedWatson/react-select/commit/0eb1ef9625de907fddaf29516cec3bd93bf9c5f7) Thanks [@JedWatson](https://github.com/JedWatson)! - Fixes touch issues in IE11

- [ad608c8f](https://github.com/JedWatson/react-select/commit/ad608c8f1f445e70a082bae755dd30bda5b5f205) [#3928](https://github.com/JedWatson/react-select/pull/3928) Thanks [@dpordomingo](https://github.com/dpordomingo)! - Update MenuPlacer context usage in order to the new React Context API

## 3.1.0

### Minor Changes
Expand Down
8 changes: 4 additions & 4 deletions packages/react-select/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-select",
"version": "3.1.0",
"version": "3.1.1",
"description": "A Select control built with and for ReactJS",
"main": "dist/react-select.cjs.js",
"module": "dist/react-select.esm.js",
Expand All @@ -15,7 +15,7 @@
"@emotion/css": "^10.0.9",
"memoize-one": "^5.0.0",
"prop-types": "^15.6.0",
"react-input-autosize": "^2.2.2",
"react-input-autosize": "^3.0.0",
"react-transition-group": "^4.3.0"
},
"devDependencies": {
Expand All @@ -26,8 +26,8 @@
"react-dom": "^16.13.0"
},
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0"
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
},
"files": [
"dist",
Expand Down
2 changes: 0 additions & 2 deletions packages/react-select/src/Creatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export type CreatableProps = {
created, and `onChange` will **not** be called. Use this when you need more
control over what happens when new options are created. */
onCreateOption?: string => void,
/* Sets the position of the createOption element in your options list. Defaults to 'last' */
createOptionPosition: 'first' | 'last',
/* Name of the HTML Input (optional - without this, no input will be rendered) */
name?: string,
options?: OptionsType,
Expand Down
13 changes: 7 additions & 6 deletions packages/react-select/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,14 +742,15 @@ export default class Select extends Component<Props, State> {
};
}

getValue = () => this.state.selectValue;

cx = (...args: any) => classNames(this.props.classNamePrefix, ...args);

getCommonProps() {
const { clearValue, getStyles, setValue, selectOption, props } = this;
const { classNamePrefix, isMulti, isRtl, options } = props;
const { selectValue } = this.state;
const { clearValue, cx, getStyles, getValue, setValue, selectOption, props } = this;
const { isMulti, isRtl, options } = props;
const hasValue = this.hasValue();
const getValue = () => selectValue;

const cx = classNames.bind(null, classNamePrefix);
return {
cx,
clearValue,
Expand Down Expand Up @@ -1520,7 +1521,7 @@ export default class Select extends Component<Props, State> {
}}
isFocused={isOptionFocused}
isDisabled={isDisabled}
key={this.getOptionValue(opt)}
key={`${this.getOptionValue(opt)}${index}`}
index={index}
removeProps={{
onClick: () => this.removeValue(opt),
Expand Down
15 changes: 11 additions & 4 deletions packages/react-select/src/components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ export const menuCSS = ({
zIndex: 1,
});

const PortalPlacementContext = createContext<() => void>(() => { });
const PortalPlacementContext = createContext<{
getPortalPlacement?: (() => void) | null,
}>({ getPortalPlacement: null });

// NOTE: internal only
export class MenuPlacer extends Component<MenuPlacerProps, MenuState> {
Expand All @@ -277,7 +279,6 @@ export class MenuPlacer extends Component<MenuPlacerProps, MenuState> {
menuShouldScrollIntoView,
theme,
} = this.props;
const { getPortalPlacement } = this.context;

if (!ref) return;

Expand All @@ -295,6 +296,7 @@ export class MenuPlacer extends Component<MenuPlacerProps, MenuState> {
theme,
});

const { getPortalPlacement } = this.context;
if (getPortalPlacement) getPortalPlacement(state);

this.setState(state);
Expand Down Expand Up @@ -348,6 +350,8 @@ export type MenuListProps = {
children: Node,
/** Inner ref to DOM Node */
innerRef: InnerRef,
/** Props to be passed to the menu-list wrapper. */
innerProps: {},
};
export type MenuListComponentProps = CommonProps &
MenuListProps &
Expand All @@ -366,7 +370,7 @@ export const menuListCSS = ({
WebkitOverflowScrolling: 'touch',
});
export const MenuList = (props: MenuListComponentProps) => {
const { children, className, cx, getStyles, isMulti, innerRef } = props;
const { children, className, cx, getStyles, isMulti, innerRef, innerProps } = props;
return (
<div
css={getStyles('menuList', props)}
Expand All @@ -378,6 +382,7 @@ export const MenuList = (props: MenuListComponentProps) => {
className
)}
ref={innerRef}
{...innerProps}
>
{children}
</div>
Expand Down Expand Up @@ -520,7 +525,9 @@ export class MenuPortal extends Component<MenuPortalProps, MenuPortalState> {
);

return (
<PortalPlacementContext.Provider value={this.getPortalPlacement}>
<PortalPlacementContext.Provider
value={{ getPortalPlacement: this.getPortalPlacement }}
>
{appendTo ? createPortal(menuWrapper, appendTo) : menuWrapper}
</PortalPlacementContext.Provider>
);
Expand Down
2 changes: 2 additions & 0 deletions packages/react-select/src/internal/ScrollCaptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ScrollCaptor extends Component<CaptorProps> {
this.isListened = true;
}
stopListening(el: HTMLElement) {
if (!el) return;

// all the if statements are to appease Flow 😢
if (typeof el.removeEventListener === 'function') {
el.removeEventListener('wheel', this.onWheel, false);
Expand Down
Loading

0 comments on commit ff36fb4

Please sign in to comment.