Skip to content

Commit 3b108d5

Browse files
tay1orjonesTannerSkodiakhq[bot]
authored
feat(react-v10): add input change callback to multiselect filterable (#11690)
* feat(react): added input change callback to multiselect filterable (#11415) * feat(react): added input change callback to multiselect filterable * chore(react): removed story changes for previous version * chore(project): update snaps * chore(react): updated handleOnInputValueChange to remove type param Co-authored-by: Taylor Jones <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * chore(project): update caniuse-lite, browserslist db Co-authored-by: Tanner Summers <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent ef6221d commit 3b108d5

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed
Binary file not shown.
Binary file not shown.

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,6 +3083,9 @@ Map {
30833083
"onChange": Object {
30843084
"type": "func",
30853085
},
3086+
"onInputValueChange": Object {
3087+
"type": "func",
3088+
},
30863089
"onMenuChange": Object {
30873090
"type": "func",
30883091
},
@@ -4160,6 +4163,9 @@ Map {
41604163
"onChange": Object {
41614164
"type": "func",
41624165
},
4166+
"onInputValueChange": Object {
4167+
"type": "func",
4168+
},
41634169
"onMenuChange": Object {
41644170
"type": "func",
41654171
},

packages/react/src/components/MultiSelect/FilterableMultiSelect.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ export default class FilterableMultiSelect extends React.Component {
111111
*/
112112
onChange: PropTypes.func,
113113

114+
/**
115+
* `onInputValueChange` is a utility for this controlled component to communicate to
116+
* the currently typed input.
117+
*/
118+
onInputValueChange: PropTypes.func,
119+
114120
/**
115121
* `onMenuChange` is a utility for this controlled component to communicate to a
116122
* consuming component that the menu was opened(`true`)/closed(`false`).
@@ -260,6 +266,10 @@ export default class FilterableMultiSelect extends React.Component {
260266
};
261267

262268
handleOnInputValueChange = (inputValue, { type }) => {
269+
if (this.props.onInputValueChange) {
270+
this.props.onInputValueChange(inputValue);
271+
}
272+
263273
if (type !== Downshift.stateChangeTypes.changeInput) {
264274
return;
265275
}

packages/react/src/components/MultiSelect/next/FilterableMultiSelect.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(
4545
itemToString,
4646
light,
4747
locale,
48+
onInputValueChange,
4849
open,
4950
onChange,
5051
onMenuChange,
@@ -166,6 +167,10 @@ const FilterableMultiSelect = React.forwardRef(function FilterableMultiSelect(
166167
}
167168

168169
function handleOnInputValueChange(inputValue, { type }) {
170+
if (onInputValueChange) {
171+
onInputValueChange(inputValue);
172+
}
173+
169174
if (type !== Downshift.stateChangeTypes.changeInput) {
170175
return;
171176
}
@@ -516,6 +521,12 @@ FilterableMultiSelect.propTypes = {
516521
*/
517522
onChange: PropTypes.func,
518523

524+
/**
525+
* `onInputValueChange` is a utility for this controlled component to communicate to
526+
* the currently typed input.
527+
*/
528+
onInputValueChange: PropTypes.func,
529+
519530
/**
520531
* `onMenuChange` is a utility for this controlled component to communicate to a
521532
* consuming component that the menu was opened(`true`)/closed(`false`).

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11591,9 +11591,9 @@ __metadata:
1159111591
linkType: hard
1159211592

1159311593
"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001125, caniuse-lite@npm:^1.0.30001179, caniuse-lite@npm:^1.0.30001202, caniuse-lite@npm:^1.0.30001219, caniuse-lite@npm:^1.0.30001228, caniuse-lite@npm:^1.0.30001272, caniuse-lite@npm:^1.0.30001286, caniuse-lite@npm:^1.0.30001287":
11594-
version: 1.0.30001287
11595-
resolution: "caniuse-lite@npm:1.0.30001287"
11596-
checksum: b53c26a3a267a2920394e4aa5d1f60a76f891943914068066700e5497dda512f096d8a77dfefda17306a9df06e16ce9c6b5179f8856cc0efbcd8873d13b2fbea
11594+
version: 1.0.30001359
11595+
resolution: "caniuse-lite@npm:1.0.30001359"
11596+
checksum: e15dbf4ea445367e998ad525c54620275ae382446d0bc289d14bf014a159074a2207881b46406b011a72676686f8a734457ea8e8d4856dc3f700c3391e89b43e
1159711597
languageName: node
1159811598
linkType: hard
1159911599

0 commit comments

Comments
 (0)